1 / 48

The Traveling Salesman Problem in Theory & Practice

The Traveling Salesman Problem in Theory & Practice. Lecture 6: Exploiting Geometry 25 February 2014 David S. Johnson dstiflerj@gmail.com http:// davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays. Outline. The k-d tree data structure

ronda
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 6: Exploiting Geometry 25 February 2014 David S. Johnson dstiflerj@gmail.com http://davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays

  2. Outline • The k-d tree data structure • Exploiting k-d trees to speed up geometric tour construction heuristics

  3. K-d trees and the TSPReferences • J.L. Bentley, “Multidimensional binary search trees used for associative searching,’’ Comm. ACM9 (1973), 509-517. • J.H. Friedman, J.L. Bentley, R.A. Finkel, “An algorithm for finding best matches in logarithmic expected time,” ACM Trans. Math. Software3 (1977), 209-226. • J.L. Bentley, B.W. Weide, A.C. Yao, “Optimal expected-time algorithms for closest point problems,” ACM Trans. Math. Software6(1980), 563-580. • J.L. Bentley, “K-d trees for semidynamic point sets,” Proc. 6th Ann. ACM Sympon Computational Geometry, ACM, 1990, 187-197. • J.L. Bentley, “Experiments on traveling salesman heuristics,” Proc. of 1st Ann. ACM-SIAM Symp. on Discrete Algorithms, 1990, 91-99. • J.L. Bentley, “Fast algorithms for geometric traveling salesman problems,” ORSA J. Comput.4 (1992), 387-411.

  4. K-d trees [Bentley, 1975](Based on hierarchical partitioning, splitting at medians) Stop partitioning is box contains k or fewer cities (typical k might be 5 or 8)

  5. Data Elements Array T:Permutation of Points derived from the partitioning Array D: Array of Tree Vertices Array H: H[i] = index of tree leaf vertex containing Point i Point Structure: Tree Vertex Structure: Index U in Array T of Last Point Index L in Array T of First Point Index of Point X-coord Deleted? Y-coord Median Value in Widest Dimension Widest Dimension • Implicit for Tree Vertex D[k]: • Index of Median =⎣(L+U)/2⎦ • Index of Parent =⎣k/2⎦ • Index of Lower Child = 2k • Index of Higher Child = 2k+1 Leaf?

  6. 0.71 0.60 Tree Vertex D[3]: Tree Vertex D[2]: Tree Vertex D[1]: 0.48 (mth vertex from left) L= 1 L= m+1 L= 1 U= N U= N U= m [L,U] is reordered so the city with median widest-dimension coordinate is in position ⎣(L+U)/2⎦and all cities to the left have widest dimension coords. ≤ the median. vertical vertical horizontal 0.60 0.71 0.48 T contains all the cities, in arbitrary order. Non-Leaf Non-Leaf Non-Leaf

  7. Operations • Construct k-d Tree: O(NlogN) • Delete or Undelete Points(without rebalancing): O(1) • Nearest Neighbor Search: Find undeleted point nearest to a specified member of the point set: “Typically”O(logN) • Fixed Radius Search: Return all undeleted points that are within the specified distance to a specified member of the point set:“Typically”O(logN) • “Ball Search” – will be described later when we need it.

  8. Finding nearest neighbor of point v • Let the coordinates for v by (x,y). • Use array H to find the index k of the tree vertex structure for the leaf containing v. • Find the nearest neighbor u of v among the cities in the the interval of T specified by the tree vertex D[k]. • Let Δ = d(u,v). Any point (x’,y’) closer to v than u must have x-Δ≤ x’ ≤ x+Δ andy-Δ ≤ y’ ≤ y+Δ, so we only need consider cities in leaves whose regions intersect this corresponding square, which we can discover by going up the tree.

  9. u v

  10. Finding nearest neighbor of point v:The recursive search: Going up. Initially, all four directions (up,down,left,right) are live. Set k to be the index of the leaf that contains v. Repeat until done: • If k = 1or all four directions are dead, we are done. • Let D[k] be the current Tree Vertex. • Consider the parent Tree Vertex D(⎣k/2⎦), and let D[k’] be the sibling of D[k]. If D[k’] has already been explored,set k ←⎣k/2⎦and continue. • If the parent’s other child is in a dead direction, set k ⎣k/2⎦and continue. • Test whether the parent’s median (in its specified direction) is contained in the current square. • If yes, call “ExploreDown(k’)”. • Otherwise, declare this direction dead. • Set k ←⎣k/2⎦and continue.

  11. Finding nearest neighbor of point v:ExploreDown(k) • If D[k] is a leaf, let w be the closest point to v in the list of points for D[k]. • If d(v,w) < Δ, declare w to be the new nearest neighbor and set Δ = d(v,w), thus shrinking the current square. • Return. • Otherwise, D[k] is an internal vertex, with at least one of its two children potentially intersecting the current square. Let k’ be the index of the child that lies to the “inside” direction of the median,and let k’’ be the index of the other child. • Call ExploreDown(k’). • If the median lies entirely outside the current square, declare the relevant direction dead and return. • Otherwise, call ExploreDown(k’’) and then return.

  12. Fixed Radius Search Implemented just like Nearest Neighbor Search, except that Δis fixed and part of the query,and we return all vertices in the encountered leaf nodes that satisfy the distance criterion.

  13. Nearest Neighbor in “O(NlogN)” • Construct a k-d tree on cities. • Pick a starting city cπ(1) and delete it from the kd-tree. • While there remains an unvisited city, let the current last city be cπ(i). • Delete cπ(i) from the kd-tree, and use a Nearest Neighbor Search to find the nearest unvisited (undeleted) city to cπ(i). Call that city cπ(i+1) and declare it the new “current last city”. • Add an edge from cπ(N) tocπ(i).

  14. Greedy (Lazily) in “O(NlogN)”Initialization • Construct a k-d tree on the set C of cities. Let Gbe a graph with vertex set C and (initially) no edges. We will maintain the property that the kd-tree contains only vertices with degree 0 or 1 in G. We will also maintain, for each degree-1 city c, the identity tail(c) of the other end of the path containing c. • For each city c, perform a Nearest Neighbor Search to identify its nearest neighbor c’ and add the triple 〈c,c’,dist(c,c’)〉 to a priority queue, sorted by increasing value of the third component. In what follows, we shall say that an edge {c,c’}is “legal” if adding it to the current graph Gdoes not create • A vertex of degree 3 or • A cycle of length less than N.

  15. Greedy (Lazily) in“O(NlogN)”Choosing the next edge to add While not yet a Hamilton Path: • While we haven’t yet selected a champion edge, • Extract the minimum 〈c,c’,d(c,c’)〉triple from the priority queue and let Δ = d(c,c’). • While, {c,c’} is not legal, • If c’ = tail(c), we temporarily delete c’ from the kd-tree and do a Nearest Neighbor Search to find a new nearest neighbor c’ for c. • Once the we have obtained a legal {c,c’}, undelete all the cities deleted during the interior while loop. • If d(c,c’) ≤ Δ, declare {c,c’} to be the champion; otherwise, insert the triple 〈c,c’d(c,c’)〉 into the priority queue -- there is no champion yet.

  16. Greedy (Lazily) in “O(NlogN)”Handling the Chosen Legal Edge • Add {c,c’} to G. • If either c or c’now has degree 2, delete it (permanently) from the k-d-tree. We also have to update some tail( ) values: • If both c and c’had degree-0 previously, set tail(c) = c’ and tail(c’) = c. • If c was previously degree-1 and c’ was degree 0, set tail(c’) = tail(c)and tail(tail(c)) = c’. • If c’ was previously degree-1 and c was degree 0, set tail(c) = tail(c’) and tail(tail(c’)) = c. • If both c and c’ were degree-1, set tail (tail(c)) = tail(c’) and tail(tail(c’)) = tail (c). tail(c) c c’ tail(c’) Once we have constructed a Hamilton path, we get a tour by adding an edge between and the two endpoints of the path.

  17. Savings Heuristic in “O(NlogN)” c’ c • Our implementation mimics our lazy approach to Greedy, except that the triples in the priority queue will be 〈c,c’,s(c,c’)〉, the third component being the savings from the shortcut, not the distance between c and c’. (Also, the hub city c1does not take part in any triple.) • The key difference is in computing the greatest savings for a given pair of cities c and c’, which equals d(c1,c) + d(c1,c’) – d(c,c’). • Nominally, we want to find, for each c, that c’ which yields the biggest savings, and insert the corresponding triple into the priority queue. However, this is not strictly necessary. • Call a city c’ “good” for c if d(c1,c’) ≤ d(c1,c) and otherwise call it “bad” • CLAIM: For a given c, it is not harmful to ignore bad candidates for c’. • PROOF: Suppose c’ is not good for c, in which case d(c1,c’) > d(c1,c). If the edge {c,c’} provides the biggest savings overall, then it will also provides the biggest savings for c’, and since c is good for c’ in this case, the triple involving the edge{c,c’}will still be in the priority queue, as part of the triple 〈c’,c,s(c’,c)〉, even under the restriction to only good candidates c1

  18. Savings Heuristic in “O(NlogN)” • Construct a standard k-d tree as we did for Greedy. • For each city c, perform a modified Nearest Neighbor search to identify a good neighbor c’ for c (if any exist)that yields the maximum savings, and add the triple 〈c,c’,s(c,c’)〉 to the priority queue. The search proceeds as follows. • If there are any good cities in the leaf bucket containing c, let S be the maximum savings for any such city, and let c’ be that city. Otherwise, let c’ be c and set S to -∞. • CLAIM: If a good city c’’ for c yields savings S’’ >S, then we must have d(c,c’’) ≤ 2d(c1,c) – S. • PROOF: By definition we have S’’ = d(c1,c’’) + d(c1,c)– d(c,c’’). Hence d(c,c’’) = d(c1,c’’) + d(c1,c) – S’’ < 2d(c1,c) – S, since the fact that c’’ is good for c implies d(c1,c’’) ≤ d(c1,c) . • So, from now on mimic Nearest Neighbor Search with d(c,c’) < 2d(c1,c) – S playing the role of d(c,c’) <Δ,. • The rest of the implementation closely mimics that for Greedy, with our modified Nearest Neighbor Search replacing the original.

  19. Nearest Addition in “O(NlogN)” Initialization • Construct a standard k-d tree as we did for Greedy. • Perform Nearest Neighbor Searches for each city c to find its nearest neighbor n(c). • Use linear search to find a city c with minimum d(c,n(c)). Let c’ = n(c). • Let our initial tour consist of the two cities c and c’, delete c and c’ from the k-d tree, compute the new nearest neighbors n(c) and n(c’) for c and c’, and add the triples 〈c,n(c),d(c,n(c))〉 and 〈c’,n(c’),d(c,n(c’))〉 to a new priority queue. • Inductively, we shall assume that the cities in the tour are deleted from the k-d tree, while the non-tour cities remain undeleted. In addition, the priority queue contains entries for every city in the current tour (and only those), with the triples satisfying the property that, for each triple 〈c,c’,d(c,c’)〉, if c’ is not in the current tour, then it is the nearest non-tour city to c. Finally, we store the tour in a doubly-linked list, with each city linked to its two tour neighbors, so that the two edges involving a given vertex can be found in constant time.

  20. Nearest Addition in “O(NlogN)” Doing the Insertions While we have not yet constructed a tour on all the cities, • While we have not yet found a valid candidate for the next city to be inserted, • Extract the minimum 〈c,c’,d(c,c’)〉from the priority queue. • If city c’ is currently in the tour, perform a Nearest Neighbor Search to identify the nearest non-tour city c’’ to c, and insert the triple 〈c,c’’,d(c,c’’)〉 into the priority queue. • Let {c,c1} an {c,c2} be the two tour edges involving c. • Determine into which of the two edges c’ can be more cheaply inserted and perform that insertion. • Delete c’ from the k-d tree, compute its nearest non-tour neighbor c’’, and insert 〈c’,c’’,d(c’,c’’)〉 into the priority queue. Note: A simplified variant on this implementation will construct MSTs in time “O(Nlog(N))”.

  21. Nearest Insertion in “O(NlogN)” • The choice of how to start and which city to insert next is the same as for Nearest Addition. • The new complexity is that, instead of just two choices of where to insert the new city, now ALL tour edges are potential insertion candidates. • That is going to be complicated, so let’s start with something a bit simpler and almost as good, an algorithm due to [Bentley, 1992] that is intermediate between Nearest Addition and Nearest Insertion: • Nearest Augmented Addition (NA+): Choose the city c to be inserted as in Nearest Addition, and let c’ be the nearest tour city to it. As candidate insertion edges, consider all tour edges having an endpoint c’’ with d(c,c’’)≤ 2d(c,c’).

  22. Nearest Augmented Addition in “O(NlogN)” Finding the Best Insertion • We maintain an additional k-dtree, this one containing all the cities, but with all the cities initially marked “deleted” and only undeleted when they are added to the tour. • To find the candidate edges for city c with nearest tour neighbor c’, we do a fixed radius search in our second kd-tree for c with radius 2d(c,c’). • For each city c’’ found in this search, we determine the cost of inserting c into each of the tour edges with endpoint c’’, and insert c into the best edge found, over all c’’ returned by the fixed radius search.

  23. Nearest Insertion in “O(NlogN)” Finding the Best Insertion • We exploit a theorem from [Bentley, 1992]: • Best Insertion Theorem: Let c’ be the nearest tour neighbor of non-tour city c, and for any tour city b, let longer(b) be the length of the longer tour edge incident on b. The best tour edge into which to insert c must have an endpoint e satisfying one of the two following restrictions: • d(c,e) ≤ 1.5d(c,c’), or • d(c,e) ≤ 1.5longer(e). • To exploit this, we need to use the “Ball search” operation mentioned earlier, which we will now explain. We will prove the theorem later.

  24. Nearest Insertion in “O(NlogN)” Finding the Best Insertion Ball Search • Suppose we have a positive distance rad(c’) associated with each undeleted city c’. Given a city c, return all those undeleted c’ such that d(c,c’) ≤ rad(c’). [We wish to implement this in an environment where cities can be undeleted and the values of rad(c’) can change dynamically.] • The basic idea is to store, with each leaf vertex, a list of all the undeleted cities c’ that are within distance rad(c’) of some city in the leaf vertex. • To construct these lists, perform Fixed-Radius searches for each undeleted c’, with radius set to rad(c’). • We can update the value of rad(c’) for a given c’ by performing a Fixed-Radius search for c’ with the larger of the before and after values for rad(c’), and either adding or removing c’ from the leaf lists, as appropriate.

  25. Nearest Insertion in “O(NlogN)” Finding the Best Insertion To set up our method for finding the best insertion, we maintain the property that the undeleted cities in our k-d tree are precisely the tour cities, and that for each such city c’’, we have rad(c’’) =1.5longer(c’’). This involves at most three Fixed Radius searches after each insertion: one for the inserted vertex and one for each of its new tour neighbors. By the Best Insertion Theorem, we can then find all potential candidates for the best place to insert c by • Doing a Fixed Radius search for c with radius 1.5d(c,c’), where c’ is (already identified) city in the tour that is nearest to c. • Doing a Ball Search for c. The best edge will be a tour edge incident on one of our candidates, by the Theorem. With luck, this will yield far fewer candidates than there are cities in the current tour, at least when the latter number number is large.

  26. Proof of Best Insertion Theorem Recall: c is the city to be inserted and c’ is the nearest tour city to c. We need to show the the best place to insert c into the tour is next to a city e satisfying one of • d(c,e) ≤ 1.5d(c,c’), or • d(c,e) ≤ 1.5longer(e). Observation: Denote the cost of inserting a vertex c into a tour edge {x,y}, which by definition is d(c,x) + d(c,y) - d(x,y), as cost(c,x-y). Then cost(c,x-y) ≤ 2d(c,x). Proof: The triangle inequality implies d(c,y) ≤ d(c,x) + d(x,y). Thus we have cost(c,x-y) ≤ d(c,x) + (d(c,x) + d(x,y)) –d (x,y) = 2d(c,x). We exploit this to prove the Best Insertion Theorem by contradiction. Assume that {f,g} yields the minimum value of cost(c,x-y) for {x,y} a tour edge and c the city we wish to insert, but neither (a) nor (b) holds when e is either f or g.

  27. Case 1 [Long {f,g}]:d(f,g) > d(c,c’). Let c’’ be either tour neighbor of c’. Assume without loss of generality that d(f,g) = 1, and hence both longer(f) and longer(g) are at least 1. Since this is the “Long” case, this means that d(c,c’) < 1. By assumption we have thus have both d(c,f) > 1.5 and d(c,g) > 1.5. By our observation, cost(c,c’-c’’) ≤ 2d(c,c’) < 2. By definition, cost(c,f-g) = d(c,f) + d(c,g) – d(f,g) > 1.5 + 1.5 – 1 = 2. So cost(c,f-g) > cost(c,c’-c’’), a contradiction. c’’ c’ < 1 c > 1.5 > 1.5 g f 1.5 1.5 1

  28. Case 2 [Short {f,g}]: d(f,g) ≤ d(c,c’). Assume without loss of generality that d(c,c’) = 1. Then, since this is the “Short” case, we must have that d(f,g) ≤ 1. By assumption we have thus have both d(c,f) > 1.5 and d(c,g) > 1.5. By our observation, cost(c,c’-c’’) ≤ 2d(c,c’) = 2. By definition, cost(c,f-g) = d(c,f) + d(c,g) – d(f,g) > 1.5 + 1.5 – 1 = 2. So cost(c,f-g) > cost(c,c’-c’’), a contradiction. c’’ c’ 1 c 1.5 > 1.5 > 1.5 g f ≤ 1

  29. Cheapest Insertion in “O(NlogN)” • Construct a standard k-d tree as we did for Greedy. • The intitial 2-city tour is constructed just as in Nearest Addition. • For subsequent insertions, we will maintain a (lazily evalutated) priority queue whose entries are triples 〈{a,b},c,d(a,c)+d(b,c)〉 for {a,b} a tour edge and c a non-tour city that yields the minimum value for Δ = d(a,c) + d(b,c). • We determine the next insertion by repeatedly extracting the triple 〈{a,b},c,Δ〉 with the minimum Δ from the priority queue, discarding it if {a,b} is not a tour edge, updating and reinserting it if {a,b}remains a tour edge but c is now in the tour, and otherwise stopping. Once we have stopped we know that the current triple denotes the cheapest insertion, and we perform it. • To compute the currently correct triple for a tour edge {a,b}, we proceed as described on the next slide. (This computation is needed when {a,b}first becomes a tour edge, or when a triple for {a,b} is extracted from the priority queue and, although {a,b} remains a tour edge, c is now in the tour.)

  30. Cheapest Insertion in “O(NlogN)” Finding the cheapest c for {a,b} • First, use a Nearest Neighbor search to find a nearest neighbor c of a, with ties broken in favor of the nearest neighbor that minimizes d(a,c) + d(b,c). • Next, do a fixed-radius search from b with radius d(b,c), and among the returned cities (which must include c itself) find a city e that yields the minimum value for d(b,e) + d(a,e). Claim: The city e thus found yields the cheapest possible insertion for {a,b}. Proof: Suppose not, and some city f yields a cheaper insertion. We thus must have d(a,f) + d(b,f) < d(b,e) + d(a,e) ≤ d(a,c) + d(b,c). By step (1), we must have d(a,f) ≥ d(a,c), which implies we must have d(b,f) < d(b,c). But this means that f would have been considered in step (2), and so we cannot have d(b,f) + d(a,f) < d(b,e) + d(a,e), a contradiction.

  31. Convex Hull Cheapest Insertion in “O(NlogN)” The same as Cheapest Insertion, except for the choice of starting tour. Convex Hull Greatest Angle Insertion in “O(NlogN)” A bit more complicated… Figure from [JBMR94]

  32. RI, RA, RA+ “O(NlogN)” • Build k-d tree on cities, with all cities marked deleted (no priority queue needed). • Pick two random cities c and c’ to start the tree, and mark them undeleted. • While not yet done • Pick a random non-tour city c. • Do a Nearest Neighbor search from c to find its nearest tour neighbor c’. • We then use the method for choosing the place to insert that is used by NI, NA, or NA+, respectively. • Insert c’ into the chosen edge and mark it as undeleted.

  33. FI, FA, and FA+ in “O(NlogN)” As usual, we start by constructing a k-d tree on all the cities, with all cities deleted except those in the initial tour. Then, for each city c not in our initial tour, we compute its nearest tour neighbor c’, and enter the triple 〈c,c’,d(c,c’)〉 into a priority queue, sorted by decreasing (rather than increasing) order of the third component. To find the next city to insert: • Extract the maximum element 〈c,c’,d(c,c’)〉 in the priority queue. • Perform a Nearest Neighbor Search on c, and if it finds a tour city c’’ other than c’, insert 〈c,c’’,d(c,c’’)〉 and go back to extracting. • Otherwise, we choose to insert vertex c. We then use the method for choosing the place to insert as used by NI, NA, or NA+, respectively.

  34. FI, FA, and FA+ in “O(NlogN)” Hidden Challenge: Constructing the initial 2-city tour. How do we identify the two most distant cities in O(NlogN) time? Answer: It can be done. Suppose C is the minimum-diameter circle that contains all our cities. (This can be constructed in linear time [N. Megiddo, “Linear-time algorithms for linear programming in R3 and related problems,” SIAM J. Comput.12 (1983) 759-756] .) Claim: There is a pair {a,b} of most-distant cities, both of which lie on circle C. Proof by Picture: [On succeeding slides]

  35. Slide C as far right as possible, until it hits a city c → Circle of radius d(a,b) with center b. There are no cities inside this region: Any such city x would have d(x,b) > d(a,b), contradicting the maximality of d(a,b). c C a b {c,b} is also a maximum distance pair, and c is on the circle. So we may assume there is a maximum distance pair {a,b} with city a on the minimum-diameter circle containing all the cities.

  36. Assume there is a maximum-distance pair {a,b} with one, but not both, endpoints on circle C. Case 1. The intersections of A and C are in the half of C containing a. There are no cities in this closed region: Any such city x would have d(x,a) ≥ d(a,b), contradicting either the maximality of d(a,b) or the assumption that no max distance pair has both endpoints on C. A C a b Circle A of radius d(a,b) with center a. Then we can slide C left by a small ε and it will still contain all cities, but now none will be on its border. Thus, we can shrink C and still enclose all the cities – a contradiction.

  37. Case 2. The intersections of A and C are in the half of C not containing a. There are no cities in this closed region: Any such city x would have d(x,a) ≥ d(a,b), contradicting either the maximality of d(a,b) or the assumption that no max distance pair has both endpoints on C. A x C a b Circle A of radius d(a,b) with center a. All cities must lie in this region Let x be the city on C that is closest to b, and let X be a circle of radius d(a,b) centered at X.

  38. All cities must lie in the darkest region (or on its boundaries). A x C a b Split C by a diameter that intersects A between b and the intersection of A and C closest to x. Note that both a and x must lie on the same side of this diameter, and somewhat distant from it. Now we can slide Cby a small ε in the direction indicated, and all cities will remain inside, but now none will be on the boundary and we can shrink C and still enclose them all.

  39. Finding the farthest pair in time O(NlogN) So now we know we can restrict attention to cities on the minimum-diameter enclosing circle C. Sort these cities in order around the circle in time O(NlogN). For a given boundary city a, we can now find the boundary city b that is most distant from a in constant time: Construct the diameter of C that has c as an endpoint, and let x be the intersection of that diameter with the other side of the circle. City bis the boundary city closest to x. x C b a Thus the total time for finding a farthest pair is O(N) to find the smallest enclosing circle, O(NlogN) to sort the cities on the circle, and O(N) to find the farthest city for each boundary city and then determine the farthest over all. Total time is hence O(NlogN), as hoped.

  40. Farthest Insertion in “O(NlogN)” • Dirty Little Secret: • We don’t do what I just told you. • In Jon Bentley’s Farthest Insertion code (which is used for our results) the Initial Tour actually consists of the first city in the input plus the city most distant from it. • Similarly, his implementations of Nearest Addition, etc., all start with a tour consisting of the first city in the input plus its nearest neighbor. • Advantages: Simpler programming. • Disadvantages: Results depend on the order in which the input cities are presented.

  41. Double MST in “O(NlogN)” • Create k-d tree: O(NlogN) • Build MST using a priority queue and choosing cities to add (and where) in the same way we chose vertices to add in Nearest Addition. • Duplicate the spanning tree: O(N) • Find Euler Tour: O(N) • Perform “smart shortcuts”: O(N) Approximate Christofides in “O(NlogN)” • Create k-d tree: O(NlogN) • Build MST using a priority queue and choosing cities it add (and where) inthe same way we chose vertices to add in Nearest Addition. • Add a “greedy” matching on the odd-degree vertices using Nearest Neighbor searches. • Find Euler Tour: O(N) • Perform “smart shortcuts”: O(N)

  42. Random Euclidean Performance for N = 1,000,000(% Excess over HK Bound)

  43. Implementation Breakdown

  44. Running Times, Random Euclidean Instance with N = 1,000,000Normalized to a 500Mhz DEC Alpha Processor in a Compaq ES40 with 2 Gb RAM

More Related