changeset 93:8b33cb568b10 refactors

Fix inconsistency (with Finder) in choice of preference where two costs come out equal
author Chris Cannam
date Thu, 27 Nov 2014 15:56:12 +0000
parents c665173b3a33
children 13be4158251d
files src/Matcher.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/Matcher.cpp	Thu Nov 27 15:29:43 2014 +0000
+++ b/src/Matcher.cpp	Thu Nov 27 15:56:12 2014 +0000
@@ -337,8 +337,13 @@
             double cost1 = min1 + distance;
             double cost2 = min2 + distance;
             double cost3 = min3 + diagDistance;
+
+            // Choosing is easy if there is a strict cheapest of the
+            // three. If two or more share the lowest cost, we choose
+            // in order of preference: cost3 (AdvanceBoth), cost2
+            // (AdvanceThis), cost1 (AdvanceOther).
             
-            if (cost1 <= cost2) {
+            if (cost1 < cost2) {
                 if (cost3 <= cost1) {
                     updateValue(m_frameCount, index, AdvanceBoth,
                                 min3, distance);