1 / 34

The Traveling Salesman Problem in Theory & Practice

The Traveling Salesman Problem in Theory & Practice. Lecture 13: The Maximum TSP Problem 22 April 2014 David S. Johnson dstiflerj@gmail.com http:// davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays. Outline. The Maximum Traveling Salesman Problem

fadhila
Télécharger la présentation

The Traveling Salesman Problem in Theory & Practice

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Traveling Salesman Problem in Theory & Practice Lecture 13: The Maximum TSP Problem 22 April 2014 David S. Johnson dstiflerj@gmail.com http://davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays

  2. Outline • The Maximum Traveling Salesman Problem • Heuristics for the symmetric case • Polynomial-time solvable symmetric special cases • The Asymmetric Maximum TSP • Student Presentation by Jeffrey Scholz on “The Traveling Salesman Problem with Distances 1 and 2,” by Papadimitriou and Yannakakis.

  3. The MaximumTravelingSalesman Problem (MaxTSP) Given: Set of cities {c1,c2,…,cN}. For each pair of cities {ci,cj}, a distance d(ci,cj). Find: Permutation that maximizes

  4. Applications • The “Taxicab Ripoff Problem” • The “Frequent Flyer Miles Accumulation Problem” • The “Shortest Superstring Problem” • Given: Finite set of S strings over some alphabet. • Find: Shortest string that contains all strings in S as substrings. • Cities: Strings in S. • Distances: d(x,y) = |y| - maximum overlap between a suffix of x and a prefix of y. X = “alphabet”, y =“ betrayal” d(x,y) = 5 alphabet betrayal d(y,x) = 6 betrayal alphabet

  5. First Observations, Symmetric Case NP-hard in general. But we do not need the triangle inequality to get good approximation bounds. • To guarantee a solution or weight at least (1/2)Optimal, simply construct a maximum weight matching and connect the resulting N/2 edges into a tour arbitrarily. • To guarantee a solution of weight at least (2/3)Optimal, construct a maximum weight cycle cover, delete the shortest edge from each cycle (each must contain at least three edges), and connect the resulting paths into a tour arbitrarily. • In a 1984 paper (in Russian), Serdyukov presented an algorithm that uses both a maximum weight matching and a maximum weight cycle cover, and guarantees a solution of weight at least (3/4)Optimal. • Current record [Paluch, Mucha, Madry, 2009] is an O(N3) algorithm that guarantees a solution of weight at least (7/9)Optimal. History: 0.5 ➟ 0.6666... ➟ 0.71428 ➟ 0.75 ➟ 0.75308... ➟ 0.7777...

  6. Sketch of the ¾ Algorithm Suppose N is even (odd case is a bit more complicated). • Construct a maximum weight matching M (Length ≥ OPT/2). • Construct a maximum weight cycle cover C (Length ≥ OPT). • Note that every vertex has degree 3 in the combined graph M∪C. • We will move edges from C to M so as to turn each into a union of paths. • Process the cycles of C in order. For each, • Pick an arbitrary vertex v in the cycle. • Vertex v has degree 2 in C and so is the end of a path in M. At least one of the two edges incident on v in C does not create a cycle in M. Transfer it to M. • Turn the collections of paths in M and C into tours (TMand TC) by connecting the paths arbitrarily. • The longer tour must have weight at least (3/4)OPT.

  7. Geometry: Norms LpNorm:

  8. Polyhedral Norms Defined in terms a “unit ball” which is a centrally symmetric polyhedron P with the origin as its center.

  9. Polyhedral Norms Defined in terms a “unit ball” which is a centrally symmetric polyhedron P with the origin as its center.

  10. Polyhedral Norms Defined in terms a “unit ball” which is a centrally symmetric polyhedron P with the origin as its center. x x y y To compute the distance from x to y, Transpose x and y so that one is at the origin, Then expand or contract the unit square so that the other point is on the border of the unit square. The distance is the factor by which the unit square was expanded/contracted.

  11. x (0,1) Sup Norm y (1,0) (0,1) x Rectilinear Metric y (1,0) x Very Approximate Euclidean y

  12. Alternate Definition Note that a centally symmetric polytopeP with 2f facets (the number of facets must be even since P is symmetric) can be specified by a set HP = {h1, h2, …, hf} of points in Rd such that P is the intersection of the following collection of 2f half-spaces: For the Sup Norm we can take Hp = {(1,0),(0,1)}. For the Rectilinear Norm we can take Hp= {(1,1),(-1,1)}. Then we have d(x,y) = max {|(x-y)•hi|: 1 ≤ i ≤ f}.

  13. All Polyhedral Norms are Metrics We clearly have, for all polyhedral norms and all points x,y in the relevant space Rd, that d(x,y) ≥ 0, d(x,y) = 0 if and only if y = x, and d(x,y) = d(y,x). To complete the proof, we need to show that the triangle inequality holds. Suppose we are given a polynomial norm for Rd specified by the set of points HP = {h1, h2, …, hf}, and any three points x, y, z in Rd. We must show d(x,y) ≤ d(x,z) + d(z,y). Choose i such that d(x,y) =|(x-y)•hi|. Then d(x,z) + d(z,y) ≥ |(x-z)•hi| + |(z-y)•hi| ≥ |(x-z)•hi+ (z-y)•hi| = |(x-y)•hi| = d(x,y)

  14. Theorem[Barvinok, Fekete, Johnson, Tamir, Woeginger, and Woodroofe, “The Geometric Maximum Traveling Salesman Problem,” J.ACM30 (2003), 641-664.] For any fixed polyhedral norm whose “unit ball” has 2f faces, the MaxTSP problem can be solved in time O(N2f-2logN) time in the real number RAM model. (If all the numbers in the input are integers with maximum absolute value U, the running time under the standard logarithmic cost RAM model increases only by a factor of log(NU). Proof: We convert the problem to a non-geometric special case of MaxTSP, the “Tunneling TSP”, and design an algorithm for that.

  15. The Tunneling TSP • We are given a set C of cities and a set T = {t1, t2, …, tk}, k ≥ 2, of “tunnels”. • Each tunnel is viewed as a bidirectional passage with a front and back end. • For each pair (c,t) of a city and a tunnel, we are given real-valued “access distances” F(c,t) and B(c,t) from city c to the front and back ends of the tunnel t, respectively. • Each tour edge (c,c’) must pass through some tunnel, either be entering through the front and leaving through the back • cost = F(c,t) + B(c’,t), • or be entering through the back and leaving through the front. • cost = B(c,t) + F(c’,t). • Since we are concerned with the maximum tour length, we thus can take the distance between c and c’ to be • d(c,c’) = max {F(c,ti) + B(c’,ti),B(c,ti) + F(c’,ti): 1 ≤ i≤ k}. • Note that this is symmetric, like the distance under a polyhedral norm.

  16. The Tunneling TSP c F(c,t1) B(c,t1) • We are given a set C of cities and a set T = {t1, t2, …, tk}, k ≥ 2, of “tunnels”. • Each tunnel is viewed as a bidirectional passage with a front and back end. • For each pair (c,t) of a city and a tunnel, we are given real-valued “access distances” F(c,t) and B(c,t) from city c to the front and back ends of the tunnel t, respectively. t1 F(c,t2) B(c,t2) t2 F(c,t3) B(c,t3) t3 t4 F(c,t4) B(c,t4)

  17. The Tunneling TSP c F(c,t1) B(c,t1) • Each tour edge (c,c’) must pass through some tunnel, either be entering through the front and leaving through the back • cost = F(c,t) + B(c’,t), • or by entering through the back and leaving through the front. • cost = B(c,t) + F(c’,t). t1 F(c,t2) B(c,t2) B(c’,t1) F(c’,t1) t2 F(c,t3) B(c,t3) F(c’,t2) B(c’,t2) t3 t4 F(c,t4) B(c,t4) F(c’,t3) B(c’,t3) c’ F(c’,t4) B(c’,t4)

  18. Polyhedral Norm TSP ➟ The Tunneling TSP Lemma: Suppose we are given a dimension-d polyhedral norm ||•||determined by the set HP = {h1, h2, …, hf}. Then for any set C of points in d-dimensional space, we can, in time O(df|C|), construct a tunnel system T with k tunnels that yields d(c,c’) = ||c-c’|| for all c,c’ ∈ C. Proof:By definition, we have ||c-c’|| = max {|(c-c’)•hi|: 1 ≤ i ≤ k} = max {(c-c’)•hi, (c’-c)•hi: 1 ≤ i ≤ k}. If we set T = HP, with F(c,h) = c•h and B(c,h) = -c•h for all cities c and tunnels h, we get d(c,c’) = max {F(c,hi) + B(c’,hi), B(c,hi) + F(c’,hi): 1 ≤ i≤ k = max {c•hi – c’•hi, -c•hi + c’•hi: 1 ≤ i ≤ k} = max {(c-c’)•hi, (c’-c)•hi: 1 ≤ i ≤ k} = max {|(c-c’)•hi|: 1 ≤ i ≤ k} = ||c-c’||. QED.

  19. Tours vs. Sets for Tunnel Systems • Consider a multigraphG = (C∪T,E), with four weighted edges between each (city,tunnel) pair: • e1,F(c,t), w(e1,F(c,t))= F(c,t) • e2,F(c,t), w(e2,F(c,t))= F(c,t) • e1,B(c,t), w(e1,B(c,t))= B(c,t) • e2,B(c,t), w(e2,B(c,t))= B(c,t) • For notational convenience, let • E[t,F] = {ei,F(c,t): c ∈ C, i ∈ {1,2}}, for all t ∈ T. • E[t,B] = {ei,B(c,t): c ∈ C, i ∈ {1,2}}, for all t ∈ T.

  20. Tours vs. Sets for Tunnel Systems Lemma:Every tour of a tunnel system corresponds to a subset E’ ⊆ E that has ∑e∈E’ w(e) equal to the tour length, and satisfies: • Every city is incident on exactly two edges in E’. • For each tunnel t ∈ T, |E’ ∩ E[t,F]| = |E’ ∩ E[t,B]|. • The set E’ is connected. Example: Suppose we have a 4-city instance with tour (c1,c2,c3,c4). c3 c1 e2,F(c1,t1) e1,B(c4,t1) e1,F(c1,t1) t1 e1,B(c4,t2) e1,B(c2,t1) t2 e1,F(c3,t1) e1,B(c2,t1) e1,F(c3,t2) c2 c4

  21. New Goal Find a maximum-weight subset E’ ⊆ E satisfying (1) – (3). Approach: Divide into cases: • Pick a degree sequence deg(t1), …, deg(tk), for the tunnels. • Choices are even numbers between 0 and 2N. • Total number of possiblities is O(Nk-1). • Pick a spanning tree for the p ≤ k tunnels with nonzero degree in (a). • Total number of possibilities is pp-2 [Cayley, 1889]. • Pick the cities c that will be used to realize each of the (p-1) spanning tree edges from (b), replacing {t,t’} by the pair of edges {t,c} and {c,t’}. • Total number of possibilities over all p-1 edges is O(Np-1) = O(Nk-1). • For each triple (t,c,t’) generated in (c), choose one of the four edges linking c to t and one of the four edges linking c to t’. • Total number of possibilities per triple is 16. Total number of cases is O(16kk-2N2k-2), which for fixed k is O(N2k-2). Each can be handled by a bipartite b-matching computation.

  22. The b-matching problem • Left side vertices: The cities in C. • Right side vertices: Two representatives tF and tB for each tunnel t ∈ T with positive degree from (a). • For each vertex c in a triple (t,c,t’) from (c): • The chosen edge from c totFor tB, with the appropriate label from {ei,F(c,t), ei,B(c,t): i∈ {1,2}}, and the corresponding weight, F(c,t)or B(c,t). • The chosen edge from c tot’For t’B, with the appropriate label from {ei,F(c,t’), ei,B(c,t’): i ∈ {1,2}}, and the corresponding weight,F(c,t’)or B(c,t’). • For each vertex cnot in a triple from (c), and each tunnel t with positive degree: • Two edges from c totF, with labels ei,F(c,t), i ∈ {1,2}, and weight F(c,t). • Two edges from c totB, with labels ei,B(c,t), i ∈ {1,2}, and weight B(c,t). • Target degrees: 2 for each city c, deg(t)/2 for each tunnel t.

  23. Total Running Time t1,F The remaining cities each have two edges to each of the ti,F and ti,B tunnel vertices. A choice of spanning tree t1 c1 t1,B c2 c3 c2 t2,F t2 t3 c3 t2,B An assignment of cities to spanning tree edges c4 t3,F c5 t3,B Constructing tunnel system: O(N2k). Constructing the tunnel graph: O(Nk). Number of cases generated and time to construct them: O(N2k-2). Constructing a maximum b-matching for a single case: O(N3). TOTAL TIME = O(N2k+1). (To reduce this to the claimed O(N2k-2logN) = O(N2f-2logN) requires a bit more work and results from [Megiddo & Tamir (1996] about fast solutions for the duals of transportation problems.)

  24. Is this practical? • Rectilinear and Sup Norms have 2d faces in Rd, hence running times O(N2d-2logN). • O(N2logN) for R2 • O(N4logN) for R3 • etc. • Practical at least for planar instances. • But unnecessary: Theorem [Fekete, 1999]: The maximum TSP for points in the plane can be solved in linear time for any 4-face polyhedral norm.

  25. What about the Euclidean Metric? Theorem [Fekete, 1999]: The Maximum TSP for points in Rd under the Euclidean metric is NP-hard for all d ≥ 3. This results extends to all Lp norms except for p = 1 and p = ∞. The problems remain open for all such p’s when the points are in R2. Note that we get Polynomial Time Approximation Schemes (PTAS’s) for the MaxTSP under the Euclidean metric in Rd for all d ≥ 2, by using polyhedral norms whose Unit Balls have more and more faces, so as to better approximate a circle (sphere).

  26. Asymptotic Optimality, Much Quicker An algorithm is “asymptotically optimal” if limit|C|→∞ALG(C)/OPT(C) → 1. If we are willing to settle for this, we can, for a d-dimensional polyhedral metric with 2f faces, find asymptotically optimal maximum TSP solutions in time O(N3+dfN) [Serdyukov, 1995]. Proof:Start by constructing a maximum-cost cycle cover in time O(N3). We then proceed in two steps. • We post-process the cycle cover in time O(dfN) to obtain one that contains at most f cycles. • Given this cover, we construct in time O(N2) a Hamilton Cycle with length at least (1-(1/N))fOPT(C).

  27. 1. Post-Processing the Cycle Cover • In time O(dfN), construct the tunnel system corresponding to our norm. • While there are more than f cycles in our cover, • Pick two cycles that contain edges using the same tunnel. (That is, their weight is determined by F(c,t) + B(c’,t) for the same tunnel t.) • Let {x,y} be the edge using tunnel t in the first cycle, and {u,v} be the edge using tunnel t in the second cycle, with the vertices named so that c(x,y) = F(x,t) + B(y,t) and c(u,v) = F(u,t) + B(v,t). • Replace these two edges by {x,v} and {u,y}. This will connect the two cycles, and the weight of the replacement edges will be at least c(x,v) + c(u,y) ≥ F(x,t) + B(v,t) + F(u,t) + B(y,t) = c(x,y) + c(u,v). F(x,t) x B(y,t) y t v u B(v,t) F(u,t)

  28. 2. Constructing the Hamilton Cycle • Suppose we have a maximum weight cycle cover containing at most k ≤ f cycles. We will merge them, one by one, until there is a single cycle. • Here’s how: • While there is more than one cycle, do the following: • Let C0 be the cycle with minimum average edge weight. • Let C1 be another cycle. • Let c(C0) and c(C1)be the total weights of edges in C0and C1, respectively. • Let the edges in C0be {a1,a2}, {a2,a3}, …, {am,a1}. • Note that we have must have m < N since there is at least one other cycle.

  29. 2. Constructing the Hamilton Cycle a5 x a1 a4 C0 C1 • Choose an edge {x,y} to delete from C1. • Consider the m ways of merging the two cycles, in which we delete {x,y} from C1and {ai,ai+1(mod m)} from C0, and add the edges {x,ai} and {y,ai+1(mod m)}. • Perform the swap of this type that results in the smallest decrease in overall weight. • The average, over these m swaps, of the amount by which the total edge weight decreases, is c(x,y) + (c(C0) - ∑c(ai,x) - ∑c(ai,y))/m. • By the Δ-Inequality, we have c(x,y) ≤ c(ai,x) + c(ai,y), for 1 ≤ i ≤ m. • Therefore, (∑c(ai,x) + ∑c(ai,y))/m ≥ (mc(x,y))/m = c(x,y). • So the average decrease is no more than c(C0)/m and the decrease for our choice must be at least the small. y a3 a2

  30. 2. Constructing the Hamilton Cycle • But c(C0)/m is the average edge weight of C0, and all the other cycles have average edge weight at least as large. • Thus, c(C0)/m can be no more than the average edge weight over all, which is OPT/N. • Thus the weight of the new cycle cover is at least (1 – 1/N)OPT. • Repeating this k ≤ f times, we get a Hamilton Cycle of weight at most (1 – 1/N)fOPT(C), • as claimed.

  31. Euclidean Metric, Revisited • Maximum error for a polyhedral norm based on a regular polygon with K vertices, all on the circle, is h, from the Wolfram Figure, with • Θ = 2π/k • R = 1 • % Error = 100h = 100(1 – cos(π/k)) • Polyhedral length of Maximum tour is at least the Euclidean length, since its unit ball is contained in the Euclidean unit ball. • So Maximum polyhedral norm tour has polyhedral length at least OPT, and Euclidean length at least (1-h)OPT. • Asymptotic Opt Error = 1 - r(1-1/N)f r = Rcos(Θ/2) h = R - r From

  32. What about “in practice”? Why not use Concorde? • Let M = max{d(x,y): x,y in C}. • Set d’(x,y) = M – d(x,y) and minimize. • OptMax= NM - OptMin. Quick Test (this morning): • N = 100. • Points uniform in the 1,000,000 x 1,000,000 square. • 1,415,000 as a surrogate for M. • Running time: 3515.60 seconds (2.4 Ghz Core i5 iMac) • Versus an average of about 20 seconds for standard Euclidean instances with N = 500.

  33. What about non-symmetric unit balls? These yield “quasi-norms” (triangle inequality but no symmetry) and our results carry over, although now the faces do not pair up and we need a tunnel for each face. So we have Theorem [BFJTWW, 2003]: Suppose we are given a polyhedral quasi-norm for Rd, d ≥ 2, whose unit ball has f faces. Then the Maximum TSP for a set of N points in Rd can be solved in time O(N2f-2logN) on a real number RAM. (A polynomial-time algorithm for the special case of R2with a triangle for the unit ball was presented in [Serdyukov, 1995].) A modified version of Serdukov’s “asymptotically optimal” algorithm may still apply. More on this and related problems next time.

More Related