From 0945959b4496e6a640637bad5be81d3078724991 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 7 Apr 2006 21:57:28 +0000 Subject: [PATCH] Correct the estimates from last commit; unfortunately, they were overly pessimistic. --- tsp/tsp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tsp/tsp.cpp b/tsp/tsp.cpp index 469cede..9768257 100644 --- a/tsp/tsp.cpp +++ b/tsp/tsp.cpp @@ -132,10 +132,10 @@ int distance(int row_from, int switch_from, int side_from, int row_to, int switc /* can we just switch sides? */ if (row_from + 1 == row_to && side_from == 1 && side_to == 0) { - return pessimistic_distance(switch_from, row_from, switch_to, row_to) - 31; + return distance_switch(switch_from, switch_to) + distance_row(row_from, row_to) - 31; } if (row_from == row_to + 1 && side_from == 0 && side_to == 1) { - return pessimistic_distance(switch_from, row_from, switch_to, row_to) - 31; + return distance_switch(switch_from, switch_to) + distance_row(row_from, row_to) - 31; } return pessimistic_distance(row_from, switch_from, row_to, switch_to); @@ -146,7 +146,7 @@ int optimistic_distance(int row_from, int switch_from, int row_to, int switch_to if (row_from == row_to) return distance_switch(switch_from, switch_to); else if (abs(row_from - row_to) == 1) - return pessimistic_distance(row_from, switch_from, row_to, switch_to) - 31; + return distance_switch(switch_from, switch_to) + distance_row(row_from, row_to) - 31; else return pessimistic_distance(row_from, switch_from, row_to, switch_to); } -- 2.39.2