Lesson 5.2 The Traveling alesperson Problem In Lesson 4.5, you explored circuits that visited each vertex of your graph exactly once (Hamiltonian circuits). In this lesson, you will extend your thinking on this original problem and examine a type of problem known as a traveling salesperson problem (TP). These TPs involve finding a Hamiltonian circuit of minimum value such as time, distance, or cost. Optimization problems of this type are becoming increasingly important in the world of communications, warehousing, airlines networking, delivery truck routing, and building wiring. Explore This uppose you are a salesperson who lives in t. Louis. Once a week you have to travel to Minneapolis, hicago, and New Orleans and then return home to t. Louis. The graph in Figure 5.7 represents the trips that are available to you. The edges of the graph are labeled with the cost of each possible trip. For instance, the cost of making a trip from hicago to New Orleans is $910. When each edge of a graph is assigned a number (weight), the graph is called a weighted graph. The numbers associated with the edges often represent such things as distance, cost, or time. Minneapolis 400 hicago t. Louis 550 1,260 270 670 Figure 5.7. Graph of four cities with the costs of traveling between them. 910 New Orleans
242 hapter 5 More Graphs, ubgraphs, and Trees ince you own your own business, it is important that you minimize travel costs. To help save money, find the least expensive route that begins in t. Louis, visits each of the other cities exactly once, and returns to t. Louis. One way to solve the problem of finding the least expensive route in Figure 5.7 is to use the brute force method of listing every possible circuit, along with its cost. A tree diagram like the one in Figure 5.8 can help you list the possible routes. Inspection of the tree diagram shows that the optimal solution is the circuit, M,, N, or the circuit in reverse order, N,, M,. 400 1,260 550 270 400 910 670 M N N M N 1,260 910 M 910 910 1,260 1,260 400 400 N N M M 670 270 670 550 270 550 2,5 2,990 2,600 2,990 2,600 2,5 Figure 5.8. Tree diagram of every possible circuit from t. Louis to each of the other cities and back to t. Louis. olving the TP for four vertices is not too difficult or time-consuming because only six possibilities need to be considered. But as the number of vertices increases, so does the number of possible circuits. Hence, checking all possibilities soon becomes impractical, if not impossible. Even with the help of a computer that can do computations at the rate of 1 billion per second, it would take more than 19 million years for the computer to find the weights of every circuit for a graph with 25 vertices!
Lesson 5.2 The Traveling alesperson Problem 243 More Efficient Algorithms Is it possible that a faster, more efficient algorithm exists? You might try, for example, to begin at a vertex, look for the vertex nearest to your starting vertex, move to it, and continue until you complete the circuit. To explore this method for the graph in Figure 5.7 on page 241, begin at t. Louis, move to the nearest neighboring vertex (hicago), then to the nearest vertex not yet visited, and return to t. Louis when you have visited all of the other cities (270 + 400 + 1,260 + 670 = 2,600). This procedure is known as the nearest-neighbor algorithm. Although the solution was reached quickly, notice that in this case, it is not the best possible one. A method such as this, which produces a quick and reasonably close-to-optimal solution, is known as a heuristic method. The choice of method now becomes a trade-off. The brute force method of inspecting every possible path guarantees the best route but is prohibitively slow. The nearest-neighbor method is quick but does not necessarily produce the optimal solution. There is no known computationally efficient method of solving all traveling salesperson problems. But with the discovery of more and more efficient algorithms, hope has increased that better solutions will be forthcoming. These solutions to TPs are of great interest because they translate into savings of millions of dollars for certain areas of the economy. Point of Interest The current record-setting solution for a TP was set in 2006 when an optimal 85,900-city tour was found. In this problem, the cities represented locations on a customized computer chip, and finding the shortest possible movement of the laser equated to minimizing the cost production cost of the chip. The table below shows several TP milestones. TP MILETONE Year Number of ities 1954 49 1971 64 1975 80 1977 318 1987 2,392 1992 3,038 1998 13,509 2004 24,978 2006 85,900 According to William J. ook, the ultimate travel challenge is currently a 1,904,771-city problem that consists of every town, city, and village in the world.
244 hapter 5 More Graphs, ubgraphs, and Trees Exercises In Exercises 1 through 4, a. onstruct a tree diagram showing all possible circuits that begin at, visit each vertex of the graph exactly once, and end at. b. Find the total weight of each route. c. Identify the shortest circuit. d. Use the nearest-neighbor algorithm to find the shortest circuit. e. Does the nearest-neighbor algorithm produce the optimal solution? 1. 2. 10 D 20 20 B 61 B 10 3. 4. 10 52 133 D 75 68 10 5 10 B 5 D B 20 5 6 5 58 D 6 11 E 5. In a graph with 10 vertices, 9!, or 9 8 7 6 5 4 3 2 1, possible Hamiltonian circuits exist if the beginning vertex is known. a. Assume that a computer can perform calculations at the rate of 1 million per second. About how long will it take the computer to check 9! possibilities? What if the graph had 15 vertices (14! possible circuits)? b. According to a eptember 29, 2004 news report, the IBM BlueGene/L computer system can sustain speeds of 36 teraflops 36 trillion computations per second! How long will it take this new system to check a graph with 9! possible circuits? With 14! possible circuits? With 20! possible circuits?
Lesson 5.2 The Traveling alesperson Problem 245 6. Give two examples of a situation in which a solution to the traveling salesperson problem would be beneficial. 7. The following figure shows a circuit board and the distances in millimeters between holes that must be drilled by a drilling machine. ince it is advantageous in terms of time to minimize the distance traveled, find the shortest possible circuit for the machine to travel and the total distance for that circuit. (Assume the machine has to begin and end at point.) 3.75 5.25 4.75 4.5 4.25 B 8.0 A Point of Interest Mathematicians in IBM s Tokyo Research Laboratory have developed a drill route optimization system that has a TP approximation algorithm as its core. The new system reduces the drill route length on a circuit board by an average of 80% and the operation time by 15% on the average. 8. A delivery person must visit each of his warehouses daily. His delivery route begins and ends at his garage (G). The table below shows the approximate travel time (in minutes) between stops. G A B D G 25.0 16.5 18.0 43.0 A 25.0 21.0 17.5 15.0 B 16.5 21.0 23.5 19.5 18.0 17.5 23.5 21.0 D 43.0 15.0 19.5 21.0 a. Draw a weighted complete graph with 5 vertices to represent the information in the table. b. Use the nearest-neighbor algorithm to find the quickest route starting at G, visiting each of the vertices of the graph exactly once, and ending at G. c. What is the travel time of the route in part b?
246 hapter 5 More Graphs, ubgraphs, and Trees Projects 9. An algorithm, known by such names as the sorted-edges algorithm and the cheapest-link algorithm, provides another quick and simple way to find an approximate solution to the TP. Investigate this algorithm. Write a brief report on the algorithm and give an example to show how it works. 10. reate a TP poster that illustrates the use of the nearest-neighbor algorithm. At a minimum, your poster should include the following elements. A map of your neighborhood, town, or state with five or six selected locations highlighted. A table that shows the distances between each pair of selected locations. A weighted graph that models the situation. An explanation of how the algorithm is used to find the minimum distance from one selected starting location to each of the others and to return to the original starting point. 11. elect five colleges or universities that you might be interested in attending. After researching the schools of choice, write a paper that incorporates the following. A short paragraph on each school explaining your interest. A weighted, complete graph that shows the five schools and your home. An optimal route based on the shortest path that starts at your home, visits each of the five schools, and returns to your home.