1 / 19

Approximate Algorithms & Repetitive Nearest Neighbor

Approximate Algorithms & Repetitive Nearest Neighbor. Notes 28 - Sections 6.6 & 6.7. Essential Learnings. Students will understand and be able to use approximate algorithms and the repetitive nearest neighbor algorithm to solve TSP problems. Approximate Algorithms.

ianthe
Télécharger la présentation

Approximate Algorithms & Repetitive Nearest Neighbor

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. Approximate Algorithms &Repetitive Nearest Neighbor Notes 28 - Sections 6.6 & 6.7

  2. Essential Learnings • Students will understand and be able to use approximate algorithms and the repetitive nearest neighbor algorithm to solve TSP problems.

  3. Approximate Algorithms A really good algorithm for solving TSPs in general would have to be both: • efficient(nearest-neighbor algorithm) • optimal(brute-forcealgorithm).

  4. Approximate Algorithms So far, no one has beenable to come up with an efficient and optimal algorithm for solving TSPs or, alternatively, to prove that such an algorithm does not exist. Because this question hasprofound implications in an area of computer science called complexity theory, ithas become one of the most famous unsolved problems in modern mathematics.

  5. Approximate Algorithms We will use the term approximate algorithm to describe any algorithm thatproduces solutions that are, most of the time, reasonably close to the optimal solution.

  6. Example – A Tour of 10 Cities: Part 2 When we left Willy back in Example 6.8, we had (1) decided not totry the brute-force algorithm (way too much work for just a $200 reward) and(2) used the nearest-neighbor algorithm to find the tour A, C, E, D, B, J, G, K, F,H, A, with a total cost of $2153 (it took about 10 minutes). Is this an optimal tour?If not, how close is it to the optimal tour? To answer these questions we would have to know the cost of the optimaltour.

  7. Example – A Tour of 10 Cities: Part 2 It turns out that this cost is $1914. (This value was found using a computerprogram in just a few seconds, but this is deceptive. Somebody had to spend a lotof time writing the program, and someone – the author – had to spend a fair amount oftime entering the city-to-city costs. Even with a computer, it’s a hassle.) We canconclude, with hindsight, that the nearest-neighbor tour is off by a relative errorof about [12153 – 1914]/1914≈ 0.1249 = 12.49%.

  8. Key Point The key point of Example 6.9 is that choosing an approximate but efficient algorithm over an optimal but inefficient algorithm is often a good tradeoff. As theysay, “time is money.”(This is a big departure from the conventional wisdom thatmath problems have either “right” or “wrong” answers. When dealing with algorithmic problems we need to consider not only the quality of the answer but alsothe amount of effort it takes to find it.)

  9. Repetitive Nearest Neighbor Algorithm

  10. Repetitive Nearest-Neighbor Algorithm As one might guess, the repetitive nearest-neighbor algorithm is a variation of thenearest-neighbor algorithm in which we repeat several times the entire nearest-neighbor circuit-building process. Why would we want to do this? The reason isthat the nearest-neighbor tour depends on the choice of the starting vertex. If wechange the starting vertex, the nearest-neighbor tour is likely to be different, and,if we are lucky, better.

  11. Repetitive Nearest-Neighbor Algorithm Since finding a nearest-neighbor tour is an efficientprocess, it is not unreasonable to repeat the process several times, each time starting at a different vertex of the graph. In this way, we can obtain several different“nearest-neighbor solutions,” from which we can then pick the best.

  12. Repetitive Nearest-Neighbor Algorithm But what do we do with a tour that starts somewhere other than the vertexwe really want to start at? That’s not a problem. Remember that once we have acircuit, we can start the circuit anywhere we want. In fact, in an abstract sense, acircuit has no starting or ending point.

  13. Example – A Tour of Five Cities: Part 3 In Example 6.7, we computed the nearest-neighbor tour with A as the starting vertex, and we got A, C, E, D, B, A with a total cost of $773.

  14. Example – A Tour of Five Cities: Part 3 Butif we use B as the starting vertex, the nearest-neighbor tour takes us from B to C,then to A, E, D, and back to B, with a total cost of $722. Well, that is certainly an improvement! As for Willy–who must start and end histrip at A–this very same tour would take the form A, E, D, B, C, A.

  15. Example – A Tour of Five Cities: Part 3 The process is once again repeated using C, D, and E as the starting vertices.When the starting point is C, we get the nearest-neighbor tour C,A,E,D,B,C(total cost is $722); when the starting point is D, we get the nearest-neighbor tourD, B, C, A, E, D (total cost is $722); and when the starting point is E, we get thenearest-neighbor tour E, C, A, D, B, E (total cost is $741).

  16. Example – A Tour of Five Cities: Part 3 Among all the nearest-neighbor tours we pick the cheapest one – A, E, D, B, C, A – with a cost of $722.

  17. ALGORITM 3: THE REPETITIVE NEAREST NEIGHBOR ALGORITHM ■Let X be any vertex. Find the nearest-neighbor tour with X as the startingvertex, and calculate the cost of this tour. ■Repeat the process with each of the other vertices of the graph as the starting vertex. ■Of the nearest-neighbor tours thus obtained, choose one with least cost. Ifnecessary, rewrite the tour so that it starts at the designated starting vertex.We will call this tour the repetitive nearest-neighbor tour.

  18. PLEASE NOTE: ALL Late/Absent Work Due by Monday (12/10) at 3:00 p.m.

  19. Assignment p. 232: 37 – 39, 41, 71

More Related