We have added some cities to your interview trip. Instead of drawing a graph, we have listed the cost between pairs of cities in a table. Again, you will start at Philadelphia, visit all the cities, and then return home. Recall that the original cities in this problem were (P)hiladelphia, (N)ew York, (A)tlanta, (M)emphis, and (C)leveland.
Finding the cheapest route. Assume that (R)aleigh and (B)oston are to be added to the trip.
| P | N | A | M | C | R | B |
P | 0 | 210 | 230 | 280 | 420 | 240 | 430 |
N | 210 | 0 | 250 | 310 | 350 | 320 | 180 |
A | 230 | 250 | 0 | 170 | 290 | 90 | 510 |
M | 280 | 310 | 170 | 0 | 240 | 120 | 500 |
C | 420 | 350 | 290 | 240 | 0 | 270 | 380 |
R | 240 | 320 | 90 | 120 | 270 | 0 | 290 |
B | 430 | 180 | 510 | 500 | 380 | 290 | 0 |
a. If you were to draw a graph as we did in Example 5 and then use the brute force algorithm, how many Hamilton circuits would you have to consider?
b. If you could examine one Hamilton circuit per minute, how many hours would it take you to solve this TSP using the brute force algorithm?
c. Use the nearest neighbor algorithm to find a Hamilton circuit beginning at Philadelphia.
d. Use the best edge algorithm to find a Hamilton circuit beginning at Philadelphia.
Solving a TSP Using Brute Force
Use Figure to find the sequence of cities for you to visit that will minimize your total travel cost.
Graph model of your possible trips. Weights on edges denote the cost of travel between cities.
SOLUTION:
Another way to state this problem is that we want to find the Hamilton circuit that has the smallest weight. For example, if you choose the circuit PMACNP, the cost of your trip will be
Our plan for a solution is simple but tedious. We will calculate the weight of each Hamilton circuit in the graph. The circuit with the smallest weight will be our solution. Because this graph has five vertices there will be 4! = 24 Hamilton circuits. However, in Table we have listed only 12 of these circuits because clearly each circuit has the same weight as its reverse.
From Table, we see that the smallest weight is $1,200, which corresponds to the circuit PAMCNP. Thus, you should start at Philadelphia and then travel to Atlanta, Memphis, Cleveland, and New York City in that order and then return home.
Hamilton circuits and their weights.
Hamilton Circuit | Weight ($) |
PACMNP | 1,280 |
PACNMP | 1,460 |
PAMCNP | 1,200 |
PAMNCP | 1,480 |
PANCMP | 1,350 |
PANMCP | 1,450 |
PCAMNP | 1,400 |
PCANMP | 1,550 |
PCMANP | 1,290 |
PCNAMP | 1,470 |
PMACNP | 1,300 |
PMCANP | 1,270 |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.