# § 6.3-6.4 traveling-salesman problems; simple strategies to solve tsps

Post on 14-Dec-2015

212 views

Category:

## Documents

Tags:

• #### efficient route

Embed Size (px)

TRANSCRIPT

• Slide 1

6.3-6.4 Traveling-Salesman Problems; Simple Strategies to Solve TSPs Slide 2 Example (D`oh!): We all know that Homer is lazy. However, he has to run errands at the Kwik-E-Mart, the Retirement Home and Moe`s. Assuming that he wants to begin and end his day at home find the route that will allow him to get back to napping as soon as possible. Slide 3 We might represent this dilemma with the following graph: We might represent this dilemma with the following graph: 12 8 20 17 15 20 A B C D Slide 4 We might represent this dilemma with the following graph: We might represent this dilemma with the following graph: 12 8 20 17 15 27 A B C D These numbers will represent the number of blocks between each destination. When we place values like this on the edges of a graph we refer to them as the weights of the edges. Slide 5 One solution might begin as follows: One solution might begin as follows:12 8 20 17 15 20 A B C D Slide 6 ... And continue like so...... And continue like so...12 8 20 17 15 20 A B C D Slide 7 ... And so on...... And so on...12 8 20 17 15 20 A B C D Slide 8 ... Continuing until he arrives back at home.... Continuing until he arrives back at home.12 8 20 17 15 20 A B C D Slide 9 Following this circuit, we find that Homer has to travel 12 + 8 + 20 + 17 = 57 blocks to finish his errands and get back to napping. But is this the most efficient route he can take? How might we find this best route? Slide 10 `Method 1` Make a list of all possible Hamiltonian circuits. Calculate the `cost` for each one. Select the circuit with the least cost. Slide 11 CircuitMirror Image Weight A, B, C, D, AA, D, C, B, A12 + 8 + 20 + 17 = 57 A, B, D, C, AA, C, D, B, A12 + 20 + 17 + 15 = 74 A, C, B, D, AA, D, B, C, A15 + 20 + 20 + 8 = 63 Slide 12 `Method 1` Make a list of all possible Hamiltonian circuits. Calculate the `cost` for each one. Select the circuit with the least cost. CircuitMirror Image Weight A, B, C, D, AA, D, C, B, A12 + 8 + 20 + 17 = 57 A, B, D, C, AA, C, D, B, A12 + 20 + 17 + 15 = 74 A, C, B, D, AA, D, B, C, A15 + 20 + 20 + 8 = 63 We can see that the first route was indeed the most efficient--Homer can get back to his nap after traveling only 57 blocks. Woo Hoo! Slide 13 Example: The Galactica needs to survey a set of planets (A, B, C, D, E, F, G) in order to find water for the Fleet. the Commander has asked the helm to chart the course that will use the lowest amount of tylium fuel. Slide 14 Again, we can model this situation using a graph like the one on the screen to the right. this time, however, it is incredibly difficult to list all the possible paths, so the homer method (I.e. Method I( is not a good choice here. in fact, even listing the weight of each edge on the graph is hard given the number of vertices. so, the first thing we will do is list the weights in a table... A B C G F E D 75 22 50 13 40 20 40 30 65 50 80 35 29 15 48 35 60 28 30 32 28 Slide 15 ABCDEFG A755028351522 B753060806550 C 3040483528 D 6040203029 E358048204032 F156535304013 G225028293213 THE FOLLOWING TABLE TELLS US HOW MANY TONS OF TYLIUM IT TAKES TO TRAVEL FROM ONE PLANET TO ANOTHER: Slide 16 ABCDEFG A755028351522 B753060806550 C 3040483528 D 6040203029 E358048204032 F156535304013 G225028293213 THE FOLLOWING TABLE TELLS US HOW MANY TONS OF TYLIUM IT TAKES TO TRAVEL FROM ONE PLANET TO ANOTHER: METHOD I IS IMPRACTICAL HERE (WE HAVE (7-1)!=6!=720 POSSIBLE HAMILTONIAN CIRCUITS!) SO WHAT CAN WE DO IN THIS CASE? Slide 17 ABCDEFG A755028351522 B753060806550 C 3040483528 D 6040203029 E358048204032 F156535304013 G225028293213 THE FOLLOWING TABLE TELLS US HOW MANY TONS OF TYLIUM IT TAKES TO TRAVEL FROM ONE PLANET TO ANOTHER: LETS TRY THE FOLLOWING: METHOD 2 START AT VERTEX A. FROM THERE, GO TO THE VERTEX WHICH COSTS THE LEAST TO GET TO. KEEP GOING TO THE CHEAPEST VERTEX UNTIL YOU GET BACK TO A. Slide 18 THIS METHOD MAY NOT GIVE US THE MOST EFFICIENT ROUTE, BUT IN GENERAL IT GETS US CLOSE. THEREFORE, WE USE IT WHEN COMPUTING THE COST OF ALL THE POSSIBLE CIRCUITS IS IMPRACTICAL. WE WILL FORMALIZE THESE METHODS AND A VARIATION ON THE SECOND ONE TOMORROW...

Recommended