2.2 Traveling Salesman Problem The problem of finding the minimumcost has applications not only for vacation planning, but also in operations research, the branch of mathematics concerned with getting governments and businesses to operate more efficiently. This problem is usually called the traveling salesman problem (TSP). The traveling salesman problem (TSP) involves finding the trip of minimum cost that a salesman can make to visit the cities in a sales territory once and only once (represented by a complete graph with weights on the edges), starting and ending the trip in the same city. Other situations that require the solution of a TSP are as follows: 1) a lobster fisherman checking his traps 2) a telephone company checking its pay phones (kind of an outdated example) 3) gas or electric company meter reader 4) rural school bus driver 5) shuttle service from different hotels to the airport 6) pizza delivery 7) armored car picking up money from stores or banks 1 TSP problems are also solved in the design of computer chips. The component must be located so that the machines involved in the assembly can insert them on the chips as efficiently as possible. The meaning of cost can vary from problem to problem. It can be measured in terms of distance, time, airplane ticket prices, or any other factor that is to be optimized. Some problems may involve multiple TSP's within one larger situation, such as multiple trucks servicing a large number of stores or multiple school buses serving a large city. 2 2.3 Helping Traveling Salesmen Because the TSP problem arises often in situations where the number of vertices is large, we need other methods which are faster than the bruteforce method to find our minimum cost Hamiltonian circuit. One intuitive idea is to try to visit nearby locations sooner. This gives rise to the NearestNeighbor Algorithm. Starting from the home city, first visit the nearest city, then visit the nearest city that has not already been visited. We return to the start city when no other choice is available. This approach is called the nearestneighbor algorithm. Consider the example from before. 3) You are traveling from Chicago (C) to Minneapolis (M), Cleveland (L), and St. Louis (S) and back to Chicago. You can visit the cities in any order and want to minimize your cost. Using the nearestneighbor algorithm, find a minimum cost Hamiltonian circuit that starts at Chicago. 3 4 Using the nearest neighbor algorithm, find a minimum cost Hamiltonian circuit for the graph below, starting at vertex A. 5 6 The nearestneighbor algorithm is an example of a greedy algorithm because at each stage a best (greedy) choice, based on an appropriate criterion, is made. Unfortunately, this is not always the optimal tour. Making the best choice at each stage may not yield the best "global" solution. However, even for a large TSP, one can always find a nearestneighbor route quickly. Another approach to the TSP that finds a good solution quickly is the SortedEdges Algorithm. Start by sorting or arranging the edges of the complete graph in order of increasing cost (or, equivalently, arranging the intercity distances in order of increasing distance). Then at each stage select an edge that has not been previously chosen of least cost that (1) never requires that three used edges meet at a vertex (because a Hamiltonian circuit uses up exactly two edges at each vertex) and that (2) never closes up a circular tour that doesn't include all the vertices. This algorithm is called the sortededges algorithm. Try using this algorithm for the previous example. 7 8 Using the sortededges algorithm, find a minimum cost Hamiltonian circuit for the graph below. 9 10
© Copyright 2026 Paperzz