Graph Theory Traveling Salesman Problems Brute Force Method
Graph Theory Traveling Salesman Problems Brute Force Method
Hamilton Paths & Circuits Using the Brute Force Method to solve a traveling salesman problem.
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).
Hamilton Paths & Circuits Steps: 1. escribe the traveling salesman problem with a complete weighted graph. 2. rite every possible Hamilton circuit leaving spaces between each pair of vertices. (Stay organized!) 3. rite the cost of each edge between corresponding vertices. 4. ind the total cost (distance) of each circuit. 5. he lowest cost circuit is the optimal route.
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?
Hamilton Paths & Circuits This is the complete weighted graph for this problem.
Hamilton Paths & Circuits For the next circuit, simply switch the Cvisits and Next, there are two possible circuits where These To stay are organized, the only try two topossible keep the circuits With four vertices, there will be sixremaining unique last two circuits, the salesman Since the salesman lives in Bakersville, each D Centertown is hisstop first stop after. B. leaving where vertices the as salesman’s close to alphabetical first stop after order leaving as Hamilton circuits for us to with list. Dover is his first after leaving Bakersville. circuit must start and end Bakersville possible. is Adams. B A CRemember: D B there are DWith n vertices, C B B A B C (n-1)! unique Hamiton in a complete Acircuits D B graph. B C D A B B D A C B B D C A B
Hamilton Paths & Circuits Now, fill in the spaces with the appropriate The distance between B and C is 45. D 35. distances. The distance between A and C is 25. The distance between A and D is 50. C 40. The distance between A and B is 20. B 20 A 25 C 40 D 35 B B 20 A 50 D 40 C 45 B B 45 C 25 A 50 D 35 B B 45 C 40 D 50 A 20 B B 35 D 50 A 25 C 45 B B 35 D 40 C 25 A 20 B
Hamilton Paths & Circuits Next add up the total distance of each circuit. B 20 A 25 C 40 D 35 B = 120 B 20 A 50 D 40 C 45 B = 155 B 45 C 25 A 50 D 35 B = 155 B 45 C 40 D 50 A 20 B = 155 B 35 D 50 A 25 C 45 B = 155 B 35 D 40 C 25 A 20 B = 120
Hamilton Paths & Circuits Now it is easy to see that the optimal cost is 120. B 20 A 25 C 40 D 35 B = 120 B 20 A 50 D 40 C 45 B = 155 There are two different optimal circuits. 45 25 50 35 B C one is. Athe reverse D order. Bof the = 155 Notice that other. The optimal circuits will always 45 40 50 20 B A B = 155 happen in. Cpairs. D B 35 D 50 A 25 C 45 B = 155 B 35 D 40 C 25 A 20 B = 120
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) epresent this traveling salesman problem with a complete, eighted graph showing the prices of the flights on the ppropriate edges. b) se the brute force method to determine the least expensive oute for Veronica to travel to each city and return home to oston. c) hat is the minimum cost she can pay?
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) epresent this traveling salesman problem with a complete, eighted graph showing the prices of the flights on the ppropriate edges.
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) epresent this traveling salesman problem with a complete, weighted raph showing the prices of the flights on the ppropriate edges. : n o i t B M 450 u l ) o y Do NOT go on until you have S r 590 a 575 e l v b view s completed i s This may help, but do not n the graph! 425 s o L 160 Po luti 575 have competed go on until you o S ( the graph on your own R
Hamilton Paths & Circuits b) Use the brute force method to determine the least expensive oute for Veronica to travel to each city and return home to oston. c) What is the minimum cost she can pay? B List all sixcost circuits leaving Add the total of each circuit. There are 4 vertices. Put the appropriate L spaces between theset How many unique costs between each letters. State the optimal circuits and the are there? ofcircuits letters. optimal cost. 450 590 575 160 575 R Follow nothave go on Do NOTthe go steps. on until. Do you until you have the completed thecompeted table and found a solution! 425 M
Hamilton Paths & Circuits Your table should look something like this.
Hamilton Paths & Circuits Solution: The optimal circuit is either BRMLB or BLMRB The optimal cost is $1750
- Slides: 17