180 likes | 305 Views
§ 6.3-6.4 Traveling-Salesman Problems; Simple Strategies to Solve TSPs.
E N D
§ 6.3-6.4 Traveling-Salesman Problems; Simple Strategies to Solve TSPs
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.
We might represent this dilemma with the following graph: D 8 A 17 12 15 20 B C 20
We might represent this dilemma with the following graph: D 8 A 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. 17 12 15 27 B C 20
One solution might begin as follows: D 8 A 17 12 15 20 B C 20
. . . And continue like so. . . D 8 A 17 12 15 20 B C 20
. . . And so on . . . D 8 A 17 12 15 20 B C 20
. . . Continuing until he arrives back at home. D 8 A 17 12 15 20 B C 20
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?
`Method 1` Make a list of all possible Hamiltonian circuits. Calculate the `cost` for each one. Select the circuit with the least cost.
`Method 1` Make a list of all possible Hamiltonian circuits. Calculate the `cost` for each one. Select the circuit with the least cost.
`Method 1` Make a list of all possible Hamiltonian circuits. Calculate the `cost` for each one. Select the circuit with the least cost. 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!
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.
Again, we can model this situation using a graph like the one on the screen to the right. B • 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. . . 75 30 60 65 50 A C 28 28 48 22 35 40 35 50 29 G D 30 15 32 20 13 80 40 F E
THE FOLLOWING TABLE TELLS US HOW MANY TONS OF TYLIUM IT TAKES TO TRAVEL FROM ONE PLANET TO ANOTHER:
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!=720POSSIBLE HAMILTONIAN CIRCUITS!) SO WHAT CAN WE DO IN THIS CASE?
THE FOLLOWING TABLE TELLS US HOW MANY TONS OF TYLIUM IT TAKES TO TRAVEL FROM ONE PLANET TO ANOTHER: LET’S TRY THE FOLLOWING: METHOD 2START 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.
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. . .