Presentation is loading. Please wait.

Presentation is loading. Please wait.

Traveling Salesman Problems

Similar presentations


Presentation on theme: "Traveling Salesman Problems"— Presentation transcript:

1 Traveling Salesman Problems
Graph Theory Traveling Salesman Problems Brute Force Method

2 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Using the Brute Force Method to solve a traveling salesman problem.

3 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits The Brute Force Method considers every possible Hamilton circuit of a traveling salesman problem. The Brute Force Method is guaranteed to find the optimal solution (the lowest cost route).

4 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Steps: 1. Describe the traveling salesman problem with a   complete weighted graph. 2. Write every possible Hamilton circuit leaving spaces   between each pair of vertices. (Stay organized!) 3. Write the cost of each edge between corresponding   vertices. 4. Find the total cost (distance) of each circuit. 5. The lowest cost circuit is the optimal route.

5 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Example: A salesman from Bakersville must make visits to clients in Dover, Centertown, and Adams before returning home. To save on mileage, he would like to take the shortest route on these sales visits. The distances between cities are given in the table below. What is the shortest route he can take?

6 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits This is the complete weighted graph for this problem.

7 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits These are the only two possible circuits where the salesman’s first stop after leaving Bakersville is Adams. For the last two circuits, the salesman visits Dover is his first stop after leaving Bakersville. Next, there are two possible circuits where Centertown is his first stop after leaving Bakersville. To stay organized, try to keep the remaining vertices as close to alphabetical order as possible. For the next circuit, simply switch the C and D Since the salesman lives in Bakersville, each circuit must start and end with B. With four vertices, there will be six unique Hamilton circuits for us to list. Remember: With n vertices, there are (n-1)! unique Hamiton circuits in a complete graph. B C A D B C A D B C A D B C A D B C A D B C A D B

8 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Now, fill in the spaces with the appropriate distances. The distance between B and D is 35. The distance between B and C is 45. The distance between A and C is 25. The distance between A and D is 50. The distance between C and D is 40. The distance between A and B is 20. 20 35 25 40 B C A D B 45 50 C A D B C A D B C A D B C A D B C A D B

9 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Next add up the total distance of each circuit. 35 20 40 25 B C A D B = 120 45 50 C A D B = 155 C A D B = 155 C A D B = 155 C A D B = 155 C A D B = 120

10 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Now it is easy to see that the optimal cost is 120. 35 25 20 40 B A C D B = 120 45 50 35 25 20 40 = 155 C A D B There are two different optimal circuits. Notice that one is the reverse order of the other. The optimal circuits will always happen in pairs. B D C A B = 120

11 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Try this. Job Interviews: Veronica Marquez is searching for a new job. She lives in Boston, MA and has interviews in Miami, FL; Los Angles, CA; and Rochester, NY. the costs of one-way flights between these four cities are as follows: Boston to Miami costs $450, Boston to Los Angeles costs $575, Boston to Rochester costs $160, Miami to Los Angeles costs $590, Miami to Rochester costs $425, and Los Angles to Rochester costs $575. a) Represent this traveling salesman problem with a complete,  weighted graph showing the prices of the flights on the  appropriate edges. b) Use the brute force method to determine the least expensive  route for Veronica to travel to each city and return home to  Boston. c)  What is the minimum cost she can pay?

12 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Job Interviews: Veronica Marquez is searching for a new job. She lives in Boston, MA and has interviews in Miami, FL; Los Angles, CA; and Rochester, NY. the costs of one-way flights between these four cities are as follows: Boston to Miami costs $450, Boston to Los Angeles costs $575, Boston to Rochester costs $160, Miami to Los Angeles costs $590, Miami to Rochester costs $425, and Los Angles to Rochester costs $575. a) Represent this traveling salesman problem with a complete,  weighted graph showing the prices of the flights on the  appropriate edges.

13 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Job Interviews: Veronica Marquez is searching for a new job. She lives in Boston, MA and has interviews in Miami, FL; Los Angles, CA; and Rochester, NY. the costs of one-way flights between these four cities are as follows: Boston to Miami costs $450, Boston to Los Angeles costs $575, Boston to Rochester costs $160, Miami to Los Angeles costs $590, Miami to Rochester costs $425, and Los Angles to Rochester costs $575. a) Represent this traveling salesman problem with a complete, weighted  graph showing the prices of the flights on the  appropriate edges. L B R M 590 160 575 450 425 Possible Solution: (Solutions vary) Do NOT go on until you have completed the graph! This view may help, but do not go on until you have competed the graph on your own

14 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits b) Use the brute force method to determine the least expensive  route for Veronica to travel to each city and return home to  Boston. c)   What is the minimum cost she can pay? L B R M 590 160 575 450 425 Add the total cost of each circuit. State the optimal circuits and the optimal cost. Put the appropriate costs between each set of letters. There are 4 vertices. How many unique circuits are there? List all six circuits leaving spaces between the letters. Follow the steps. Do not go on until you have competed the table and found a solution. Do NOT go on until you have completed the table and found a solution!

15 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Your table should look something like this.

16 Hamilton Paths & Circuits
T. Serino Hamilton Paths & Circuits Solution: The optimal circuit is either BRMLB or BLMRB The optimal cost is $1750

17 athematical M D ecision aking


Download ppt "Traveling Salesman Problems"

Similar presentations


Ads by Google