Branch and Cut for the Travelling Salesman Problem CS 581 Neil Lindquist, Nigel Tan 1
Neil Lindquist • 1st year CS PhD student • Numerical linear algebra • B.A. in CS and Math • Saint John’s University • Originally from New Ulm 2
Neil Lindquist • Rowing • Board games • Sci Fi movies/TV shows 3
Nigel Tan • Originally from San Diego • Enrolled in 4 colleges • B.S. in CS and Applied Math at UC Merced • MS in Computational and Applied Math at Rice • PhD in CS at UTK • My family comes from the Philippines 4
Nigel Tan • May be the only student in UTK collaborating with Los Alamos National Lab • Fan of Thai and Japanese food • Had Koi fish for pets 5
Questions 1. How do we ensure integer values in the solution? 2. How many subtour elimination constraints are there? 3. How do we detect violations of the subtour elimination constraints? 6
Travelling Salesman Problem • Given a list of cities and distances between them, compute the shortest path that visits each city exactly once and returns to the origin city. • NP-Hard • Richard Karp showed finding a Hamiltonian cycle is NP-Complete • A Hamiltonian cycle is a path that visits each vertex only once • Millennium problem • Important for applications requiring routing • Delivery, drilling machines, space travel 7
UK49687 Pub Crawl 63,739,687 meters Examples http://www.math.uwaterloo.ca /tsp/uk/uk49_run720.mp4 Tour of 2,008 Pokestops in Houston TX. 100,000 city TSP representing the Mona Lisa as a 2,121,499 meters or 1,318 miles continuous-line drawing. $1000 Prize 8
History • Exact origins are unclear • Formulated in 1800s by Sir William Rowan Hamilton and Thomas Penyngton Kirkman • The Icosian Game: Find a Hamiltonian cycle on the edges of a dodecahedron • Mathematically defined by Karl Menger in the 1930s • Nicos Christofides published approximate algorithm in 1976 • Finds an approximate solution within 1.5x the optimal path • Still the best approximation algorithm in general 9
Linear Programming Formulation denotes whether edge e is in the path Minimum weight tour Integer constraints 10
Linear Programming Formulation denotes whether edge e is in the path Minimum weight tour Each vertex has 2 edges Integer constraints 11
Subtour Elimination Constraints (SEC) 2 subtours that satisfy (2) and (4) but are not a valid solution to the TSP. We need to add constraints to prevent subtours 12
Subtour Elimination Constraints (SEC) Let S be a subset of V (in red). We can prevent subtours by requiring the following 13
Linear Programming Formulation denotes whether edge e is in the path Minimum weight tour Each vertex has 2 edges Subtour elimination constraints Integer constraints 14
Linear Programming Formulation denotes whether edge e is in the path 2 |V| constraints! 15
Solve a relaxed problem instead denotes whether edge e is in the path 16
Branch and Cut • Check solution of relaxed problem against original constraints • Fix non-integral values with branch and bound • Fix violations of SEC by re-adding the specific constraint • Add a “cutting plane” 17
Branch and Bound • Given an LP solution with a non-integral variable x i , solve two variations of the LP problem • One with x i = 1 • One with x i = 0 • For non-integral solutions, branch again • Unless the objective value is worse than the best integral solution found ( bound) • For integral solutions, record the best 18
Branch and Bound Example z = 4 Minimizing Non-int Upper Bound: ∞ x i = 1 Lower Bound: 4 x i = 0 z = ? z = ? 19
Branch and Bound Example z = 4 Minimizing Non-int Upper Bound: 6 x i = 1 Lower Bound: 4 x i = 0 z = ? z = 6 int Record as best solution found 20
Branch and Bound Example z = 4 Minimizing Non-int Upper Bound: 6 Lower Bound: 5.5 x i = 1 x i = 0 z = 5.5 z = 6 Smallest z of open nodes is 5.5. We cannot do better than that non-int int x j = 0 x j = 1 z = ? z = ? 21
Branch and Bound Example z = 4 Minimizing Non-int Upper Bound: 6 Lower Bound: 5.5 x i = 1 x i = 0 z = 5.5 z = 6 non-int int x j = 0 x j = 1 All children will have z ≥ 6.1 Thus, they cannot be optimal z = 6.1 z = ? Bounded. Don’t recurse further non-int 22
Branch and Bound Example z = 4 Minimizing Non-int Upper Bound: 6 Lower Bound: 5.5 x i = 1 x i = 0 z = 5.5 z = 6 non-int int x j = 0 x j = 1 Integral, but not an z = 6.1 z = 6.4 improvement non-int int No remaining open nodes. 6 is the optimal objective value. 23
Min-Cut • How to detect SEC violations? • Use the min-cut algorithm • If the cut crosses < 2 edges the solution contains a subtour Wc = 0 24
Min-Cut • Stoer-Wagner Algorithm • O(|V||E|+|V|²log|V|), (O(|E|+|V|log|V|) with Fibonacci heap) Stoer, Mechthild, and Frank Wagner. "A simple min-cut algorithm." Journal of the ACM (JACM) 44.4 (1997): 585-591. 25
Stoer-Wagner Min-Cut Algorithm 2 3 4 1 2 3 4 3 2 2 2 2 2 5 6 7 8 3 1 3 26
Stoer-Wagner Min-Cut Algorithm Start 2 2 3 3 4 4 1 1 2 2 3 3 4 4 3 3 2 2 2 2 2 2 2 2 2 2 5 5 6 6 7 7 8 8 3 3 1 1 3 3 w = 5, Best Cut = 5 27
Stoer-Wagner Min-Cut Algorithm Start 3 4 2 3 4 4 2 2 2 2 1,5 6 7 8 3 1 3 w = 5, Best Cut = 5 28
Stoer-Wagner Min-Cut Algorithm Start 3 4 2 3 4 4 2 2 4 1,5 6 7,8 3 1 w = 7, Best Cut = 5 29
Stoer-Wagner Min-Cut Algorithm Start 3 2 3 4 2 6 4 1,5 6 7,8 3 1 w = 7, Best Cut = 5 30
Stoer-Wagner Min-Cut Algorithm Start 3 3,4 2 7,8 4 2 1 1,5 6 3 w = 4, Best Cut = 4 31
Stoer-Wagner Min-Cut Algorithm Start 2 4 5 3,4 1,5 6,7, 8 3 w = 7, Best Cut = 4 32
Stoer-Wagner Min-Cut Algorithm Start 2 9 V \ 2 w = 9, Best Cut = 4 33
Stoer-Wagner Min-Cut Algorithm 2 3 4 1 2 3 4 3 2 2 2 2 2 5 6 7 8 3 1 3 Minimum cut 34
TSP Test Examples • att48 • 48 capitals of U.S., 1128 edges • berlin52 • 52 locations in Berlin, 1326 edges • gr21 • 21 city problem by Martin Groetschel, 210 edges • hk48 • 48 city problem by Michael Held and Richard Karp, 1128 edges • pr76 • 76 city problem by Manfred Padberg and Giovanni Rinaldi, 2850 edges • st70 • 70 city problem by T.H.C. Smith Gerald Thompson, 2415 edges • ulysses22 • Odyssey of Ulysses by Martin Groetschel and Manfred Padberg, 231 edges 35
TSP Examples • Implemented with Gurobi • Only used for solving relaxed LPs • Ryzen 5 2600, 3.4 - 3.9 GHz • Single threaded • Using the nearest neighbor algorithm for the initial bound 36
Results Graph Avg. Time (s) # of branch # of subtours nodes att48 0.862226057 13 20 berlin52 0.166384503 1 3 gr21 0.001985988 1 0 hk48 0.550707614 7 11 st70 14.51977184 97 41 ulysses22 0.015799748 1 8 pr76 2904.12748115 23467 391 37
Other Cuts & Inequalities • Chvatal-Gomory cuts • 2-matching inequalities • • Where 𝜀 is the set of edges with only 1 vertex in S • Comb inequalities • http://homepages.rpi.edu/~mitchj/handouts/gomorycuts/gomorycuts.html 38
Questions 1. How do we ensure integer values in the solution? 2. How many subtour elimination constraints are there? 3. How do we detect violations of the subtour elimination constraints? 39
Recommend
More recommend