The Traveling Salesperson Problem Algorithms and Networks.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Great Theoretical Ideas in Computer Science for Some.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Approximation Algorithms for TSP
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
Combinatorial Algorithms
Complexity 16-1 Complexity Andrei Bulatov Non-Approximability.
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Approximation Algorithms: Combinatorial Approaches Lecture 13: March 2.
Approximation Algorithms: Concepts Approximation algorithm: An algorithm that returns near-optimal solutions (i.e. is "provably good“) is called an approximation.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
Great Theoretical Ideas in Computer Science.
Exponential time algorithms Algorithms and networks.
Steiner trees Algorithms and Networks. Steiner Trees2 Today Steiner trees: what and why? NP-completeness Approximation algorithms Preprocessing.
The Traveling Salesperson Problem
Network Optimization Problems: Models and Algorithms
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
Approximation Algorithms
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
1 Traveling Salesman Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Algorithms for Network Optimization Problems This handout: Minimum Spanning Tree Problem Approximation Algorithms Traveling Salesman Problem.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Traveling Salesman Problem Approximation
University of Texas at Arlington Srikanth Vadada Kishan Kumar B P Fall CSE 5311 Solving Travelling Salesman Problem for Metric Graphs using MST.
1 The TSP : NP-Completeness Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Advanced Algorithm Design and Analysis (Lecture 13) SW5 fall 2004 Simonas Šaltenis E1-215b
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
The Traveling Salesman Problem Over Seventy Years of Research, and a Million in Cash Presented by Vladimir Coxall.
Thursday, May 9 Heuristic Search: methods for solving difficult optimization problems Handouts: Lecture Notes See the introduction to the paper.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Projects Network Theory VLSI PSM 1. Network 1. Steiner trees
Approximation Algorithms for TSP Tsvi Kopelowitz 1.
1 Travelling Salesman Problem Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij.
Exponential time algorithms Algorithms and networks.
Algorithms for hard problems Introduction Juris Viksna, 2015.
Approximation Algorithms Guo QI, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
Approximation Algorithms
Management Science 461 Lecture 7 – Routing (TSP) October 28, 2008.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Traveling Salesman Problem DongChul Kim HwangRyol Ryu.
1 Minimum Spanning Tree: Solving TSP for Metric Graphs using MST Heuristic Soheil Shafiee Shabnam Aboughadareh.
Approximation Algorithms
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Steiner trees: Approximation Algorithms
Optimization problems such as
Routing Through Networks - 1
Shortest Paths and Minimum Spanning Trees
Approximation Algorithms
Hamiltonian Cycle and TSP
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Algorithms for hard problems
Great Theoretical Ideas in Computer Science
Approximation Algorithms
Computability and Complexity
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Approximation Algorithms for TSP
Discrete Mathematics for Computer Science
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Shortest Paths and Minimum Spanning Trees
The Traveling Salesperson Problem
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Approximation Algorithms
Lecture 24 Vertex Cover and Hamiltonian Cycle
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

The Traveling Salesperson Problem Algorithms and Networks

A&N: TSP2 Contents TSP and its applications Heuristics and approximation algorithms –Construction heuristics, a.o.: Christofides, insertion heuristics –Improvement heuristics, a.o.: 2-opt, 3-opt, Lin- Kernighan

1 Problem definition Applications

A&N: TSP4 Problem Instance: n vertices (cities), distance between every pair of vertices Question: Find shortest (simple) cycle that visits every city

A&N: TSP5 Applications Collection and delivery problems Robotics Board drilling

A&N: TSP6 NP-complete Instance: cities, distances, K Question: is there a TSP-tour of length at most K? –Is an NP-complete problem –Relation with Hamiltonian Circuit problem

A&N: TSP7 Assumptions Lengths are non-negative (or positive) Symmetric: w(u,v) = w(v,u) –Not always: painting machine application Triangle inequality: for all x, y, z: w(x,y) + w(y,z)  w(x,z) Always valid?

A&N: TSP8 If triangle inequality does not hold Theorem: If P  NP, then there is no polynomial time algorithm for TSP without triangle inequality that approximates within a ratio c, for any constant c. Proof: Suppose there is such an algorithm A. We build a polynomial time algorithm for Hamiltonian Circuit (giving a contradiction): –Take instance G=(V,E) of HC –Build instance of TSP: A city for each v  V If (v,w)  E, then d(v,w) = 1, otherwise d(v,w) = nc+1 –A finds a tour with distance at most nc, if and only if G has a Hamiltonian circuit

A&N: TSP9 Heuristics and approximations Two types –Construction heuristics A tour is built from nothing –Improvement heuristics Start with `some’ tour, and continue to change it into a better one as long as possible

2 Construction heuristics

A&N: TSP11 1 st Construction heuristic: Nearest neighbor Start at some vertex s; v=s; While not all vertices visited –Select closest unvisited neighbor w of v –Go from v to w; –v=w Go from v to s. Can have performance ratio O(log n) Can have performance ratio O(log n)

A&N: TSP12 Heuristic with ratio 2 Find a minimum spanning tree Report vertices of tree in preorder

A&N: TSP13 Christofides 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: TSP14 Ratio 1.5 Total length edges in T: at most OPT Total length edges in matching M: at most OPT/2. T+M has length at most 3/2 OPT. Use  -inequality.

A&N: TSP15 Closest insertion heuristic Build tour by starting with one vertex, and inserting vertices one by one. Always insert vertex that is closest to a vertex already in tour.

A&N: TSP16 Closest insertion heuristic has performance ratio 2 Build tree T: if v is added to tour, add to T edge from v to closest vertex on tour. T is a Minimum Spanning Tree (Prim’s algorithm) Total length of T  OPT Length of tour  2* length of T

A&N: TSP17 Many variants Closest insertion: insert vertex closest to vertex in the tour Farthest insertion: insert vertex whose minimum distance to a node on the cycle is maximum Cheapest insertion: insert the node that can be inserted with minimum increase in cost –Gives also ratio 2 –Computationally expensive Random insertion: randomly select a vertex Each time: insert vertex at position that gives minimum increase of tour length

A&N: TSP18 Cycle merging heuristic Start with n cycles of length 1 Repeat: –Find two cycles with minimum distance –Merge them into one cycle Until 1 cycle with n vertices This has ratio 2: compare with algorithm of Kruskal for MST.

A&N: TSP19 Savings Cycle merging heuristic where we merge tours that provide the largest “savings”: can be merged with the smallest additional cost / largest savings

A&N: TSP20 Some test results In an overview paper, Junger et al report on tests on set of instances (105 – 2392 vertices; city-generated TSP benchmarks) Nearest neighbor: 24% away from optimal in average Closest insertion: 20%; Farthest insertion: 10%; Cheapest insertion: 17%; Random Insertion: 11% Preorder of min spanning tress: 38% Christofides: 19% with improvement 11% / 10% Savings method: 10% (and fast)

3 Improvement heuristics

A&N: TSP22 Improvement heuristics Start with a tour (e.g., from heuristic) and improve it stepwise –2-Opt –3-Opt –K-Opt –Lin-Kernighan –Iterated LK –Simulated annealing, … Iterative improvement Local search

A&N: TSP23 Scheme Rule that modifies solution to different solution While there is a Rule(sol, sol’) with sol’ a better solution than sol –Take sol’ instead of sol Cost decrease Stuck in `local minimum’ Can use exponential time in theory…

A&N: TSP24 Very simple Node insertion –Take a vertex v and put it in a different spot in the tour Edge insertion –Take two successive vertices v, w and put these as edge somewhere else in the tour

A&N: TSP25 2-opt Take two edges (v,w) and (x,y) and replace them by (v,x) and (w,y) OR (v,y) and (w,x) to get a tour again. Costly: part of tour should be turned around

A&N: TSP26 2-Opt improvements Reversing shorter part of the tour Clever search to improving moves Look only to subset of candidate improvements Postpone correcting tour Combine with node insertion On R 2 : get rid of crossings of tour

A&N: TSP27 3-opt Choose three edges from tour Remove them, and combine the three parts to a tour in the cheapest way to link them

A&N: TSP28 3-opt Costly to find 3-opt improvements: O(n 3 ) candidates k-opt: generalizes 3-opt

A&N: TSP29 Lin-Kernighan Idea: modifications that are bad can lead to enable something good Tour modification: –Collection of simple changes –Some increase length –Total set of changes decreases length

A&N: TSP30 LK One LK step: –Make sets of edges X = {x 1, …, x r }, Y = {y 1,…,y r } If we replace X by Y in tour then we have another tour –Sets are built stepwise Repeated until … Variants on scheme possible

A&N: TSP31 One LK step Choose vertex t 1, and edge x 1 = (t 1,t 2 ) from tour. i=1 Choose edge y 1 =(t 2, t 3 ) not in tour with g 1 = w(x 1 ) – w(y 1 ) > 0 (or, as large as possible) Repeat a number of times, or until … –i++; –Choose edge x i = (t 2i-1,t 2i ) from tour, such that x i not one of the edges y j oldtour – X + (t 2i,t 1 ) +Y is also a tour –if oldtour – X + (t 2i,t 1 ) +Y has shorter length than oldtour, then take this tour: done –Choose edge y i = (t 2i, t 2i+1 ) such that g i = w(x i ) – w(y i ) > 0 y i is not one of the edges x j. y i not in the tour

A&N: TSP32 Iterated LK Construct a start tour Repeat the following r times: –Improve the tour with Lin-Kernighan until not possible –Do a random 4-opt move that does not increase the length with more than 10 percent Report the best tour seen Cost much time Gives excellent results Cost much time Gives excellent results

A&N: TSP33 Other methods Simulated annealing and similar methods Problem specific approaches, special cases Iterated LK combined with treewidth/branchwidth approach: –Run ILK a few times (e.g., 5) –Take graph formed by union of the 5 tours –Find minimum length Hamiltonian circuit in graph with clever dynamic programming algorithm

4 A dynamic programming algorithm

A&N: TSP35 Held-Karp algorithm for TSP O(n 2 2 n ) 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: TSP36 TSP: Recursive formulation B({s},s) = 0 If |S| > 1, then –B(S,w) = min v  S – {x} B(S-{x}, v}) + w(v,x) If we have all B(V,v) then we can solve TSP. Gives requested algorithm using DP- techniques.

A&N: TSP37 Conclusions TSP has many applications Also many applications for variants of TSP Heuristics: construction and improvement Further reading: –M. Jünger, G. Reinelt, G. Rinaldi, The Traveling Salesman Problem, in: Handbooks in Operations Research and Management Science, volume 7: Network Models, North-Holland Elsevier, 1995.