Presentation is loading. Please wait.

Presentation is loading. Please wait.

Traveling Salesman Problem Continued. Heuristic 1 Ideas? –Go from depot to nearest delivery –Then to delivery closest to that –And so on until we are.

Similar presentations


Presentation on theme: "Traveling Salesman Problem Continued. Heuristic 1 Ideas? –Go from depot to nearest delivery –Then to delivery closest to that –And so on until we are."— Presentation transcript:

1 Traveling Salesman Problem Continued

2 Heuristic 1 Ideas? –Go from depot to nearest delivery –Then to delivery closest to that –And so on until we are done with deliveries –Then go to closest depot

3 Heuristic 1 Much better than just using given/random order Optimal?

4 Heuristic 1 is “Greedy” Makes the next decision “greedily” –Best decision you can make now –Without considering future consequences –And never go back to change a decision Greedy algorithms –Generally fast –But often don’t get the best solution

5 How Could We Get More Quality? By spending more CPU time Heuristic 2: take best of many results –“Multi-start” –E.g.try our greedy algorithm multiple times How to make it get a different answer? 1.Force it to start at a different depot 2.Start with the 2 nd smallest travel time from depot to a delivery 3.Have a 10% chance of taking the second smallest travel time when choosing each next delivery 4....

6 Heuristic 2: Multi-start Different Might be better travel time, even though first hop is longer

7 Heuristic 3 Improve an existing solution?

8 Heuristic 3 Improve an existing solution? –How? –Local perturbation 5 4 8 5 4 2 20 15 18 Travel time for this connection (edge) Total travel time = 81

9 Heuristic 3: Local Perturbation E.g. 2-edge operation (2-opt) –Delete two connections in path

10 Heuristic 3: Local Perturbation E.g. 2-edge operation (2-opt) –Reconnect total path differently –But have to make legal!

11 Heuristic 3: Local Perturbation Must form a depot  all delivery  depot path –Swap endpoints of blue & yellow connections 15 4 8 5 2 20 15 18 9

12 Heuristic 3: Local Perturbation Must form a depot  all delivery  depot path –Swap endpoints of blue & yellow connections (edges) –Then reverse some edge directions to legalize path –This can affect edge travel times! 15 4 7 4 2 20 15 18 9 Total travel time = 94

13 Heuristic 3: Local Perturbation Calculate new total travel time –Update current best solution if it is an improvement –Otherwise go back to prior solution 15 4 7 4 2 20 15 18 9 Total travel time = 94

14 Heuristic 3: Local Perturbation Try another 2-opt –Swap end-points of pink & green connections 5 4 8 5 4 2 20 15 18 Total travel time = 81

15 Heuristic 3: Local Perturbation Try another 2-opt –Swap end-points of pink & green connections –Compute new connection travel times 5 4 8 5 4 2 23 14 18

16 Heuristic 3: Local Perturbation Try another 2-opt –Swap end-points of pink & green connections –Compute new connection travel times –Legalize path (have to go to depot from last delivery) 5 4 8 5 4 2 23 14 7

17 Heuristic 3: Local Perturbation Try another 2-opt –Compute new travel time: 72 –Improvement: save in current best solution 5 4 8 5 4 2 23 14 7

18 Heuristic 3 Local perturbation or iterative improvement N-1 edges/connections between delivery locations How many different 2-opts? –(N-1) choose 2 choices between delivery locations –N = 40  39 * 38 / 2 = 741 options –Somewhat more if we also change the depot edges –Reasonable number, but fast code can check them all If you find an improvement, can try all 2-opts again –Path has changed  a 2-opt that didn’t work before now might

19 Iterative Improvement Can still get stuck in local minima Not at the optimum (global minimum) But your local perturbations all result in a worse solution Larger perturbations can explore a bigger space E.g 3-opts –Delete 3 connections at a time –Then reconnect in various ways –Bigger change  can explore more of space –But more combinations: N-1 choose 3: ~10,000 Times 4 ways to reconnect each: ~40,000

20 Heuristic 4: Hill Climbing One way to get out of a rut –Change something! –Even if it looks like a bad idea at first Hill climbing


Download ppt "Traveling Salesman Problem Continued. Heuristic 1 Ideas? –Go from depot to nearest delivery –Then to delivery closest to that –And so on until we are."

Similar presentations


Ads by Google