Tolerance based Greedy Heuristics for the Asymmetric TSP Gerold Jäger Martin Luther University Halle-Wittenberg Cooperation with Boris Goldengorin DFG Project: Paul Molitor December 21, 200
Overview 1 Introduction Definitions Known Results Historical Development by the Data Base TSPLIB 2 Tolerances Definition of Tolerance Tolerances for the TSP 3 Greedy Algorithm Algorithm Worst Case Example
Overview 4 Tolerance Based Greedy Heuristics Idea Relaxed Assignment Problem R-RTBG Algorithm Linear Assignment Problem L-R 1 TBG Algorithm L-R 2 TBG Algorithm Experimental Results Problem Classes Comparison of Execution Time and Quality 6 Conclusions and Future Work
Introduction Definitions TSP Input: Directed complete graph G = (V, E), V = n with weight function g : E R. Output: Shortest closed path visiting each vertex exactly once. ATSP g((i, j)) g((j, i)) for at least one edge (i, j), 1 i < j n. STSP g((i, j)) = g((j, i)) for all edges (i, j), i.e. the graph is undirected.
Introduction Known Results Theoretical Results Christofides: Approximation factor 1, for STSP with triangle inequality. Arora: Approximation scheme for Euclidean STSP. Practical Results Trivial method: (n 1)! steps (with is too large already for n 20 ). Data base (TSPLIB) with problems from 14 up to 1.904.711 vertices (the most are real city problems).
Introduction Historical Development by the Data Base TSPLIB Year Research team Number Vertices/Cities 194 Dantzig, Fulkerson, Johnson 49 1971 Held, Karp 64 197 Camerini, Fratta, Maffioli 100 1977 Grötschel 120 1980 Crowder, Padberg 318 1987 Padberg, Rinaldi 32 1987 Grötschel, Holland 666 1987 Padberg, Rinaldi 2.392 1994 Applegate, Bixby, Chvátal, Cook 7.397 1998 Ap., Bi., Ch., Co. 13.09 (USA tour) 2001 Ap., Bi., Ch., Co. 1.112 (Germany tour) 2004 Ap., Bi., Ch., Co., Helsgaun 24.978 (Sweden tour)
Tolerances Definition of Tolerance Input: Directed graph G = (V, E), V = n with g : E R. Problem with set of solutions L(g) E. Let e E be arbitrary and g constant except for e. Upper tolerance: If g(e) is sufficiently small, e L(g). If g(e) is sufficiently small, e / L(g). Let e L(g). The upper tolerance ot(e) is the number, g(e) needs to be increased for reaching e / L(g). Lower tolerance: Let e / L(g). The lower tolerance ut(e) is the number, g(e) needs to be decreased for reaching e L(g).
Tolerances Tolerances for the TSP Let an edge e be in the minimum tour. The upper tolerance ot(e) is the number e needs to be decreased so that e is not in the minimum tour any more. Let an edge e be not in the minimum tour. The lower tolerance ut(e) is the number e needs to be decreased, so that e is in the minimum tour. The tolerance computation is more difficult than the whole TSP. Not reasonable. Using of polynomial time problems, related to the TSP.
Greedy Algorithm Algorithm Consider an ATSP (and as special case a STSP). 1. Determine the smallest edge in the graph. 2. Contract both vertices of this edge to a new vertex. 3. Repeat 1. and 2., until we have only two vertices. 4. Connect these two vertices to one cycle.. Replace all vertices by the contracted paths. The received tour is the ATSP tour.
Greedy Algorithm Worst Case Example 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 6 6 1 2 4 3 (1,2) 3 4 6 (1,2) 12 13 13 13 3 3 18 19 19 4 3 19 24 2 3 19 2 30 6 216 19 2 31 6 1 2 4 12 3
Greedy Algorithm Worst Case Example (1,2,3) 4 6 (1,2,3) 18 19 19 4 3 24 2 3 2 30 6 216 2 31 6 1 2 3 4 18 (1,2,3,4) 6 (1,2,3,4) 24 2 3 30 6 216 31 (1,2,3,4,) 6 (1,2,3,4,) 30 6 216 6 216 6 1 2 3 1 2 3 4 30 Solution: 306 (worst tour of all possible tours) 4 24
Tolerance Based Greedy Heuristics Idea Choose the contracted edge not by the smallest weight, but by the largest upper tolerance to a problem related to the ATSP.
Tolerance Based Greedy Heuristics Relaxed Assignment Problem Input: Directed graph G = (V, E), V = n with weight function g : E R. Output: Assignment function f : V V with f(v) v for all v V. The sum of weights of the assignment function is minimum.
Tolerance Based Greedy Heuristics Relaxed Assignment Problem Worst Case Example 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 6 13 (6) 6 (1) 1 2 13 (6) 13 (6) 4 13 () 12 (1) 3 The relaxed assignment problem can be solved in O(n 2 ). The computation of all tolerances is also in O(n 2 ). A minimum ATSP tour is a relaxed assignment! The length of a minimum relaxed assignment is a lower bound for the minimum ATSP tour.
Tolerance Based Greedy Heuristics R-RTBG Algorithm Choose from a solution to the RAP the edge with the largest upper tolerance to the RAP (R-RTBG). 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 6 13 (6) 6 (1) 1 2 13 (6) 13 (6) 4 13 () 12 (1) 3 1 3 (4,2) 6 1 7 7 7 7 3 3 18 19 19 (4,2) 3 12 13 13 3 19 2 30 6 216 19 2 31 6 1 7 (0) 4 19 (6) 2 18 (1) 19 (6) 12 (1) 3
Tolerance Based Greedy Heuristics R-RTBG Algorithm 1 (4,2) (,3) 6 1 7 7 7 (4,2) 3 13 13 (,3) 3 18 19 6 216 2 31 6 7 (0) 1 4 2 (6) 18 (1) 2 13 (0) 3 1 (,3) (6,4,2) 1 7 7 (,3) 3 19 (6,4,2) 3 13 1 7 (0) 6 4 13 (22) 2 19 (16) 3 1 (6,4,2,,3) 1 7 (6,4,2,,3) 3 Solution: 112 7 1 6 4 2 3 3
Tolerance Based Greedy Heuristics Linear Assignment Problem Input: Directed graph G = (V, E), V = n with weight function g : E R. Output: Assignment function f : V V with f(v) v for all v V. The sum of the weights of assignment edges is minimum. The assignment function is bijective.
Tolerance Based Greedy Heuristics Linear Assignment Problem Linear assignment problem can be solved in O(n 3 ) (Hungarian method). 13 2 6 13 18 3 4 19 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 7 1 13 2 6 1 3 13 19 7 Solution: 10 (non-unique optimal solution) 4 18 3 3
Tolerance Based Greedy Heuristics Linear Assignment Problem Minimum ATSP-Tour is a linear assignment! The length of a minimum linear assignment is a lower bound for the minimum ATSP tour. The lower bound weight of a minimum linear assignment is better than the lower bound weight of a minimum relaxed assignment, but more difficult to compute (O(n 3 ) instead of O(n 2 ) ). The same (O(n 3 ) in comparison to O(n 2 ) ) holds for the computation of all tolerances. Observation: The lower bound weight of a minimum linear assignment is considerably better for the ATSP than for the STSP. For the STSP the so-called Held Karp bound is better.
Tolerance Based Greedy Heuristics L-R 1 TBG Algorithm Choose an edge from a solution to the LAP. The tolerance computation for the LAP is too expensive. Computation of the largest upper tolerance similar to that of the RAP. Algorithm L-RTBG.
Tolerance Based Greedy Heuristics L-R 1 TBG Algorithm Version 1: Choose as tolerance the difference of an edge from the LAP to the edge with next large weight, starting from the same vertex ( is possible). 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 13 (6) 2 6 13 (0) 18 (1) 3 4 19 () 7 (0) 1 3 ( )
Tolerance Based Greedy Heuristics L-R 1 TBG Algorithm 2 3 4 (,1) 6 2 12 13 13 13 3 13 18 19 19 4 13 19 24 2 (,1) 6 7 7 7 6 13 19 2 31 13 (0) 1 7 (0) 2 6 13 (6) 18 (1) 19 (6) 4 3 Solution: 10 (optimum solution)
Tolerance Based Greedy Heuristics L-R 2 TBG Algorithm Version 2: Choose as tolerance the negative difference of an edge from the LAP to the smallest edge, starting from the same edge. (lower tolerance). Is this edge the smallest edge, choose the positive difference to the second smallest edge of this vertex (upper tolerance). 1 2 3 4 6 1 6 7 7 7 7 2 3 12 13 13 13 3 3 13 18 19 19 4 3 13 19 24 2 3 13 19 2 30 6 216 13 19 2 31 13 (-1) 2 6 1 13 (6) 19 (-6) 7 (-1) 3 (-22) 18 (-) 4 3
Tolerance Based Greedy Heuristics L-R 2 TBG Algorithm 1 3 (4,2) 6 1 7 7 7 7 3 3 18 19 19 (4,2) 3 12 13 13 3 19 2 30 6 216 19 2 31 18 (1) 3 4 2 1 13 (-1) 7(0) 3 (-16) 19 (6) 6
Tolerance Based Greedy Heuristics L-R 2 TBG Algorithm 1 (4,2) (6,3) 1 7 7 7 (4,2) 3 13 13 3 2 30 (6,3) 3 18 19 6 3 18 (1) 13 (0) 4 2 1 7 (0) 3 (-10) 1 (6,3,4,2) 1 7 7 3 30 (6,3,4,2) 3 13 1 7 (0) 6 3 4 3 (-) 13 (22) 2 Solution: 10 (optimum solution)
Experimental Results Problem Classes 1 All asymmetric problems from TSPLIB (26 problems). 2 All symmetric problems from TSPLIB with dimension smaller than 3000 (99 problems). 3 Asymmetric problems with c(i, j) chosen randomly and uniformly distributed in {0, 1,, 100000} for i j, 10 for each dimension 100, 200,, 1000 and 3 for each dimension 1100, 1200,, 3000 (160 problems). 4 Asymmetric problems with c(i, j) chosen randomly and uniformly distributed in {0, 1,, i j} for i j, 10 for each dimension 100, 200,, 1000 and 3 for each dimension 1100, 1200,, 3000 (160 problems).
Experimental Results Problem Classes Symmetric problems with c(i, j) chosen randomly and uniformly distributed in {0, 1,, 100000} for i < j, 10 for each dimension 100, 200,, 1000 and 3 for each dimension 1100, 1200,, 3000 (160 problems). 6 Symmetric problems with c(i, j) chosen randomly and uniformly distributed in {0, 1,, i j} for i < j, 10 for each dimension 100, 200,, 1000 and 3 for each dimension 1100, 1200,, 3000 (160 problems).
Experimental Results Problem Classes 7 Sloped Plane problems: For randomly chosen x i, x j, y i, y j for i j in {0, 1,, i j} let c(i, j) = (x i x j ) 2 + (y i y j ) 2 max{0, y i y j } + 2 max{0, y j y i } for i j, 10 for each dimension 100, 200,, 1000 and 3 for each dimension 1100, 1200,, 3000 (160 problems). 8 Worst case example: c(i, j) = n 3 for i = n, j = 1 in for j = i + 1 n 2 1 for i = 2, 3,, n 1, j = 1 n min{i, j} + 1 otherwise for each dimension, 10,, 1000 (200 problems).
Experimental Results Comparison of Execution Time and Quality Average Excess over Optimum, LAP bound or Held Karp bound, Average Time Classes 1-4 Class 1 (26) Class 2 (99) Class 3 (160) Class 4 (160) Opt. Time Opt. Time LAP Time LAP Time (%) (s) (%) (s) (%) (s) (%) (s) GR 30.4 0.04 118.20 4.14 287.31 21.27 113.64 17.84 R-R 23.28 0.04 107.31 2.3 8.7 12.81 22.00 11.80 L-R 1 7.17 0.31 96.64 27.03 22.29 149.01 2.60 228.48 L-R 2 10.9 0.3 7.42 29.68 2.67 179.88 1.86 246.28
Experimental Results Comparison of Execution Time and Quality Average Excess over Optimum, LAP bound or Held Karp bound, Average Time Classes -8 Class (160) Class 6 (160) Class 7 (160) Class 8 (200) HK Time HK Time LAP Time LAP Time (%) (s) (%) (s) (%) (s) (%) (s) GR 233.12 19.61 924.3 18.66 2439.86 18.67 481.97 1.07 R-R 84.28 12.6 27.90 12.12 119.49 11.6 93.64 1.28 L-R 1 38.69 16.0 14.77 271.94 61.12 901.74 0.79 L-R 2 28.89 201.99 11.42 294.86 0.10 909.37 0 6.14
Conclusions and Future Work For greedy heuristics: Using of tolerances leads to substantial improvements. Further aims: Create a theoretical basis for the tolerances Improvement of more general TSP heuristics using tolerances Improvement of exact TSP algorithms, e.g. b-n-b algorithms using tolerances The leading TSP heuristic of Helsgaun is implicitly based on the tolerance of the minimum spanning tree. Test different tolerances in this algorithm.