The Travelling Salesman Problem (TSP) H.P. Williams Professor
35 Slides1.08 MB
The Travelling Salesman Problem (TSP) H.P. Williams Professor of Operational Research London School of Economics 1
A Salesman wishes to travel around a given set of cities, and return to the beginning, covering the smallest total distance Easy to State Difficult to Solve 2
If there is no condition to return to the beginning. It can still be regarded as a TSP. Suppose we wish to go from A to B visiting all cities. A B 3
If there is no condition to return to the beginning. It can still be regarded as a TSP. Connect A and B to a ‘dummy’ city at zero distance (If no stipulation of start and finish cities connect all to dummy at zero distance) A B 4
If there is no condition to return to the beginning. It can still be regarded as a TSP. Create a TSP Tour around all cities A B 5
A route returning to the beginning is known as a Hamiltonian Circuit A route not returning to the beginning is known as a Hamiltonian Path Essentially the same class of problem 6
Applications of the TSP Routing around Cities Computer Wiring - connecting together computer components using minimum wire length Archaeological Seriation - ordering sites in time Genome Sequencing - arranging DNA fragments in sequence Job Sequencing - sequencing jobs in order to minimise total set-up time between jobs Wallpapering to Minimise Waste NB: First three applications generally symmetric 7
Major Practical Extension of the TSP Vehicle Routing - Meet customers demands within given time windows using lorries of limited capacity 10am-1pm 7am-8am 3am-5am 4pm-7pm 6pm-7pm Depot 8am-10am 6am-9am 2pm-3pm Much more difficult than TSP 8
History of TSP 1800’s Irish Mathematician, Sir William Rowan Hamilton 1930’s Studied by Mathematicians Menger, Whitney, Flood etc. 1954 Dantzig, Fulkerson, Johnson, 49 cities (capitals of USA states) problem solved 1971 1975 64 Cities 100 Cities 1977 120 Cities 1980 318 Cities 1987 666 Cities 1987 2392 Cities (Electronic Wiring Example) 1994 7397 Cities 1998 13509 Cities (all towns in the USA with population 500) 2001 15112 Cities (towns in Germany) 2004 24978 Cities (places in Sweden) But many smaller instances not yet solved (to proven optimality) 9
Recent TSP Problems and Optimal Solutions from Web Page of William Cook, Georgia Tech, USA with Thanks 10
1954 1962 1977 1987 1994 1998 n 1512 n 13509 n 2392 n 7397 n 120 n 532 n 666 n 49 n 33 Printed Circuit Board 2392 cities 1987 Padberg and Rinaldi 11
USA Towns of 500 or more population 13509 cities 1998 Applegate, Bixby, Chvátal and Cook 12
Towns in Germany 15112 Cities 2001Applegate, Bixby, Chvátal and Cook 13
Sweden 24978 Cities 2004 Applegate, Bixby, Chvátal, Cook and Helsgaun 14
Solution Methods I. Try every possibility faster (n-1)! possibilities – grows than exponentially If it took 1 microsecond to calculate each possibility takes 10140 centuries to calculate all possibilities when n 100 II. Optimising Methods optimal can take a very, long time III. Heuristic Methods ‘quickly’ obtain guaranteed solution, but very, obtain ‘good’ solutions by intuitive methods. No guarantee of optimality (Place problem in newspaper with cash prize) 15
The Nearest Neighbour Method (Heuristic) – A ‘Greedy’ Method 1. Start Anywhere 2. Go to Nearest Unvisited City 3. Continue until all Cities visited 4. Return to Beginning 16
A 42-City Problem The Nearest Neighbour Method (Starting at City 1) 5 8 25 37 31 24 41 26 14 15 28 6 36 32 30 27 11 7 23 40 9 33 22 29 12 13 2 19 34 42 35 20 16 17 38 4 21 3 1 18 10 39 17
The Nearest Neighbour Method (Starting at City 1) 5 8 25 37 31 24 41 26 14 15 28 6 36 32 30 27 11 7 23 40 9 33 22 29 12 13 2 19 34 42 35 20 16 17 38 4 21 3 1 18 10 39 18
The Nearest Neighbour Method (Starting at City 1) Length 1498 5 8 25 37 31 24 41 26 14 15 28 6 36 32 30 27 11 7 23 40 9 33 22 29 12 13 2 19 34 42 35 20 16 17 38 4 21 3 1 18 10 39 19
Remove Crossovers 5 8 25 37 31 24 41 6 26 14 15 28 32 36 30 27 11 7 23 33 40 22 9 29 12 13 19 2 34 42 20 16 3 35 17 38 4 21 1 18 10 39 20
Remove Crossovers 5 8 25 37 31 24 41 6 26 14 15 28 32 36 30 27 11 7 23 33 40 22 9 29 12 13 19 2 34 42 20 16 3 35 17 38 4 21 1 18 10 39 21
Remove Crossovers Length 1453 5 8 25 37 31 24 41 6 26 14 15 28 32 36 30 27 11 7 23 33 40 22 9 29 12 13 19 2 34 42 20 16 3 35 17 38 4 21 1 18 10 39 22
Christofides Method (Heuristic) 1. Create Minimum Cost Spanning Tree (Greedy Algorithm) 2. ‘Match’ Odd Degree Nodes 3. Create an Eulerian Tour - Short circuit cities revisited 23
Christofides Method 42 – City Problem 5 Minimum Cost Spanning Tree 8 Length 1124 25 31 37 24 6 28 30 26 36 32 27 41 11 14 23 7 33 22 15 9 29 40 13 12 2 35 19 42 34 38 20 16 17 4 21 3 10 39 18 1 24
Minimum Cost Spanning Tree by Greedy Algorithm Match Odd Degree Nodes 25
Match Odd Degree Nodes in Cheapest Way – Matching Problem 5 8 25 31 37 24 6 28 30 26 36 32 27 41 11 14 23 7 33 22 15 9 29 40 13 12 2 35 19 42 34 38 20 16 17 4 21 3 10 39 18 1 26
1. Create Minimum Cost Spanning Tree (Greedy Algorithm) 2. ‘Match’ Odd Degree Nodes 3. Create an Eulerian Tour - Short circuit cities revisited 27
Create a Eulerian Tour – Short Circuiting Cities revisited Length 1436 5 8 25 37 31 24 41 26 14 15 28 6 32 36 30 27 11 7 23 33 40 22 9 29 12 13 2 19 34 42 35 20 16 17 3 38 4 21 1 18 10 39 28
Optimising Method 1.Make sure every city visited once and left once – in cheapest way (Easy) -The Assignment Problem - Results in subtours 5 8 25 31 24 41 Length 1098 15 28 6 26 14 37 32 36 30 27 11 7 23 33 40 22 9 29 12 13 2 19 34 42 35 20 16 17 4 21 3 1 18 38 10 39 29
Put in extra constraints to remove subtours (More Difficult) Results in new subtours Length 1154 5 8 25 37 31 24 41 6 26 14 15 28 30 27 36 32 11 7 23 33 40 22 13 2 29 12 19 34 42 35 20 16 3 9 17 38 4 21 1 18 10 39 30
Remove new subtours Results in further subtours Length 1179 5 8 25 37 31 24 41 26 14 15 28 6 32 36 30 27 11 7 23 33 40 22 9 29 12 13 2 19 34 42 20 16 3 35 17 38 4 21 1 18 10 39 31
Further subtours Length 1189 5 8 25 37 31 24 41 26 14 15 28 6 32 36 30 27 11 7 23 33 40 22 9 29 12 13 2 19 34 42 20 16 3 35 17 38 4 21 1 18 10 39 32
Further subtours 1192 Length 5 8 25 37 31 24 41 6 26 14 15 28 32 36 30 27 11 7 23 9 33 40 22 29 12 13 2 19 34 42 20 16 3 35 17 38 4 21 1 18 10 39 33
Further subtours Length 1193 5 8 25 37 31 24 41 26 14 28 6 32 36 30 27 11 7 15 23 33 40 22 9 29 12 13 2 19 34 42 35 20 16 17 3 38 4 21 1 18 10 39 34
Length 1194 Optimal Solution 5 8 25 37 31 24 41 6 26 14 15 28 32 30 27 11 7 23 33 40 22 9 29 12 13 2 19 34 42 35 20 16 3 36 17 4 21 1 18 38 10 39 35