Presentation is loading. Please wait.

Presentation is loading. Please wait.

A computational study & tool for the Travelling Salesman Problem (TSP)

Similar presentations


Presentation on theme: "A computational study & tool for the Travelling Salesman Problem (TSP)"— Presentation transcript:

1 A computational study & tool for the Travelling Salesman Problem (TSP)
Mangesh Gharote, Dilys Thomas and Sachin Lodha Tata Consultancy Service – Innovations Lab Note: A general presentation for research and study purpose. Original Article found on Cite as: Mangesh Gharote, Dilys Thomas, Sachin Lodha: Excel Solvers for the Traveling Salesman Problem. COMAD 2012:

2 Talk outline Problem statement Applications Computational Complexity
Top Awards Combinatorial algorithm nearest neighbour greedy Geometric repair heuristics intersection removal hinge and crest optimization Benchmark datasets cities, PCB layout etc. comparison of algorithms to state of art

3 Problem Statement, Complexity
Given n cities, Distances or costs between pair or a metric on the space Find Permutation such that tour length is minimized Problem There are n! different permutations An actual tour on the globe with the lines indicating tour paths n=30 beyond reach of all computers on earth combined 100’s of mathematicians and computer scientist have tried to solve this problem

4 Applications BPO Vehicle Routing Bus Scheduling
Development of flight schedules Crew Scheduling Order-picking problem in warehouses Printing press scheduling problem Network cabling in a country Computer wiring Query workload ordering for optimization VLSI chip design connectivity layout Drilling of printed circuit boards

5 Applications Hot rolling scheduling problem in Iron & Steel Industry
Overhauling gas turbine engines (Ordering nozzle guides) X-Ray crystallography (Ordering positions for measurement) Global navigation satellite system Ordering test cases in regression suite to re-use components

6 Popular Appeal TSP in 1960 achieved national prominence in the United States of America Procter & Gamble offered prizes up to $10,000 for identifying the most correct links in a particular 33-city problem.

7 Awards Proved to be NP complete in 1972 by Richard Karp
Richard Karp won the Turing Award 1985 For contribution to the theory of algorithms and NP completeness including this result He showed a reduction from a result on logic satisfiability of conjunctive normal form clauses that have 3 literals each (3SAT) The most recent 2010 Gödel Prize Awarded to Sanjeev Arora and Joseph S B Mitchell for polynomial time approximation scheme for Euclidian TSP

8 Objective of our work Develop our own algorithms on top of reasonable in practice TSP algorithms Near optimal in practice Reduce run time for medium to large instances Scalable in memory for medium to large instances Ease of using the tool, handle different distance metrics including longitude and latitude Easy to visualize tours Improve state of art TSP solvers available in Excel

9 Different Approaches for Solving TSP
Exact Enumeration Linear Programming - Miller–Tucker–Zemlin (1960) Dynamic Programming Approximation Algorithms Nearest Neighbour Greedy K-Opt, Kernighan Lin (70’s) Christofides (1965) Heuristics Simulated Annealing Genetic Algorithm Ant Colony Optimization Electromagnetism like Algorithm Lower Bound Held -Karp

10 Approximation Algorithms I) Nearest Neighbour II) Greedy Algorithm

11 Nearest Neighbour (NN) Algorithm for TSP (Pseudo code)
1. Select an arbitrary vertex as current vertex. 2. Find out the shortest edge connecting current vertex and an unvisited vertex V. 3. Set current vertex to V. 4. Mark V as visited. 5. If all the vertices in domain are visited, then terminate; otherwise, go to step 2. Time Complexity: O(n2)

12 Greedy Algorithm for TSP (Pseudo code)
1. Sort all edges in increasing order of weigths. 2. Select the shortest edge and add it to our tour if it doesn’t violate any of the below constraints: if it is not yet in the tour if adding it would not create a degree-3 vertex or If does not create a cycle of size less than N. 3. Do we have N edges in our tour? If no, repeat step 2. Time Complexity O( n2 log (n)) Sub Cycle Degree of Vertex < 3

13 Numerical Example Using NN & Greedy
1 2 3 4 Input Graph 4 4 1 2 1 2 3 2 4 2 3 4 3 4 2 2 Starting Node 12 11 Greedy Nearest Neighbour

14 Nearest Neighbour with different starting vertex 16 Cities Benchmark Problem
Difference from Optimal 5 % Start Start Difference from Optimal 32 %

15 16 Cities Benchmark Problem
Greedy Difference from Optimal 16 %

16 51 Cities Benchmark Problem
Nearest Neighbour Greedy Difference from Optimal 18.7 % Difference from Optimal 13 %

17 Results on Benchmark Problems Using Nearest Neighbour (NN) and Greedy

18 Observation about NN and Greedy
For ‘N’ node graph, theoretically can guarantee only upto O(log N) multiplicative factor away from optimal towards the end more expensive edges could be forced Start point makes a difference for nearest neighbour In practice gives 25% away from optimal for moderately large sized instances They can be improved further with geometric constructions 2-opt, intersection removal, hinge-crest optimization

19 Types of Distances 2D – Euclidean ND – Euclidean (L1 , L2, Linfty)
Geographical (Longitude – Latitude) Symmetric - Asymmetric Triangular Inequality

20 Geographical Distance Code - Longitude & Latitude
PI = For computing the geographical distance; RRR = ; /* Radius of earth in kms */ deg = (int) X[i]; min = X[i] – deg; rad = PI * (deg * min/3.0)/180.0; q1 = cos (longitude[i] – longitude[j]); q2 = cos (latitude[i] – latitude[j]); q3 = cos (latitude[i] + latitude[j]); Dij = (int) (RRR * acos(0.5*((1.0 + q1)*q2 – (1.0 – q1)*q3))+1.0);

21 World Tour Airports NN – 2 Opt 19% Away from Optimal

22 World Tour - 535 Airports 10 % Greedy 2 Opt Difference from Optimal
Alaska North America Europe Hawai Guam Asia Africa Fiji South America Australia Santiago Trans Pacific Flights

23 USA 48 Mainland Capitals

24 Africa and Islands Optimal Tour Sahara Senegal St. Helenas Mauritius
Tristan de cunha South Africa

25 PCB- Drilling Problem (Nodes-2103)
Optimal Solution Actually our algorithm ensures it is not a criss-cross Referred as one of the Nasty TSP NN 2 Opt 6.5 %

26 State-of-the-art problem sizes
From: Book: Travelling Salesman Problem: A computational study David L. Applegate, Robert E. Bixby, Vasek Chvatal, William J. Cook

27 State-of-the-art optimal solutions
From: Book: Travelling Salesman Problem: A computational study David L. Applegate, Robert E. Bixby, Vasek Chvatal, William J. Cook

28 State-of-the-art Concorde Solver
From: Book: Travelling Salesman Problem: A computational study David L. Applegate, Robert E. Bixby, Vasek Chvatal, William J. Cook

29 Largest TSP instances solved optimally till date
Ref:

30 Motivating Our Work: Need for Approximate Solutions
Year – 2001 15,112 German towns solved using 110 processors at Rice University and Princeton University ~ 22.6 years on 500MHz Alpha processor. Year – 2005 33,810 Circuit board using state-of-the-art Concorde TSP Solver took 15.7 CPU - years Year -2006 85,900 points was solved using Concorde TSP Solver took over 136 CPU-years.

31 Our Benchmark Results

32 Well Known Approximation Algorithms
Lin-Kernighan heuristic works well in practice Linear Programming Formulation for TSP basis for using CPEX, Gurobi, Xpress solvers Held-Karp Dynamic Programming (n2 2n) 40 year open problem if there is an exact algorithm for TSP with time (cn) for c < 2. Christofides 1.5 Approximation 30 year open problem if there is an approximation algorithm with factor < 1.5

33 Lin-Kernighan Costly to find 3-opt improvements: O(n3) candidates
k-opt: generalizes 3-opt O(nk) Tour modification: Collection of simple changes Some increase length Total set of changes decreases length

34 Linear Programming Formulation for TSP
Degree of Vertex is 2 Subtour elimination

35 Held-Karp Dynamic Programming
O(n22n) algorithm for TSP Uses Dynamic programming Take some starting vertex s For set of vertices R (s Î R), vertex w Î R, let B(R,w) = minimum length of a path, that Starts in s Visits all vertices in R (and no other vertices) Ends in w A&N: TSP

36 TSP: Recursive Dynamic Programming formulation
B({s},s) = 0 If |S| > 1, then B(S,w) = minv Î S – {w}B(S-{w}, v}) + weight(v,w) If we have all B(V,v) then we can solve TSP. Gives requested algorithm using DP-techniques. A&N: TSP

37 Christofides 1.5 Approximation
Make a Minimum Spanning Tree T Set W = {v | v has odd degree in tree T} Compute a minimum weight matching M in the graph G[W]. Look at the graph T+M. (Note: Eulerian!) Compute an Euler tour C’ in T+M. Add shortcuts to C’ to get a TSP-tour A&N: TSP

38 Work done by students (2010-11)
Metaheuristics: Simulated Annealing Ant Colony Optimization Electromagnetism-like Algorithm Project Title: “Excelling with Metaheuristics” B.E. Project Done By: Prem Nathan, Prashant Kumar and Sani Kumbhar

39 Simulated Annealing (Kirkpatrick, 1985)
SA is a variant of local (neighborhood) search Traditional local search always moves in a direction of improvement SA allows non-improving moves to avoid getting stuck at a local optimum Analogy is from Material Science Slowly cool down a heated solid, so that all particles arrange in the ground energy state At each temperature wait until the solid reaches its thermal equilibrium Probability of being in a state with energy ‘E’ given by Boltzmann

40 Ant Colony Optimization (Dorigo et al 1996)
Ants secrete pheromone while traveling, in order to communicate with one another to find the shortest path The more ants follow a trail, the more attractive that trail becomes for being followed. Even when the tracks are equal the behavior will encourage one over the other—convergence

41 Electromagnetism Like Algorithm (Birbil & Fang, 2003)
Initialization Force Calculation F Movement Neighborhood Search Idea is based on the attraction repulsion mechanism of electromagnetism theory (Coulomb’s law) force exerted on a point via other points is inversely proportional to the distance between the points and directly proportional to the product of their charges The charge of each particle relates to the value of objective function the better the objective function value, the higher the magnitude of attraction.

42 Results – Metaheuristics
Nodes EM (%) ANT(%) SA (%) 14 5.3 3.0 7.6 52 7.1 6.4 18.2 96 9.9 6.0 15.2 159 15.4 14.3 20.5 226 15.9 13.1 11.8 299 22.9 18.5 24.7 654 24.2 24.9 25.3 Nodes EM Time (min) SA 1291 14.6% 3.1 18.0% 18.2 2103 6.3% 12.1 8.7% 34.3 3795 13.1% 20.1 19.0% 24.3 4461 20.0% 6.1 26.2% 31.1 5934 18.7% 23.8% 68.1 14051 21.4% 16.5 22.9% 44.6

43 Summary TSP - Geometric NP hard problem
Exact solution expensive (time, space) Implemented combinatorial algorithms NN, Greedy, intersection removal, hinge-crest optimization Provide approximations in practice Can solve and visualize tours of medium to large size (e.g. 14,000 cities – two orders of magnitude larger than Elsevier paper) Multiple applications to PCB layout, X-ray crystallography, other engineering and scientific domains Future Plans – To improve on solving even larger size problems by optimizing algorithm implementations Privacy Preserving TSP

44 Demonstration – TSP Using Excel
48 US Mainland Capitals NN, NN 2-Opt, Greedy, Greedy 2-Opt Demo 2 Printed Circuit Board Drilling Problem 280 Locations on 2D plane NN and NN-2 Opt All intersections removed

45 Thank You ! Reference Robert Bosch, February 2009 mona-lisa100K.tsp
$1000 Prize Offered [Can convert pictures into tours using Voronoi diagrams]


Download ppt "A computational study & tool for the Travelling Salesman Problem (TSP)"

Similar presentations


Ads by Google