Traveling salesman problems
Author: Jessica Yu (ChE 345 Spring 2014)
Steward: Dajun Yue, Fengqi You
The traveling salesman problem (TSP) is a widely studied combinatorial optimization problem, which, given a set of cities and a cost to travel from one city to another, seeks to identify the tour that will allow a salesman to visit each city only once, starting and ending in the same city, at the minimum cost.1
The origins of the traveling salesman problem are obscure; it is mentioned in an 1832 manual for traveling salesman, which included example tours of 45 German cities but gave no mathematical consideration.2 W. R. Hamilton and Thomas Kirkman devised mathematical formulations of the problem in the 1800s.2
It is believed that the general form was first studied by Karl Menger in Vienna and Harvard in the 1930s.2,3
Hassler Whitney, who was working on his Ph.D. research at Harvard when Menger was a visiting lecturer, is believed to have posed the problem of finding the shortest route between the 48 states of the United States during either his 1931-1932 or 1934 seminar talks.2 There is also uncertainty surrounding the individual who coined the name “traveling salesman problem” for Whitney’s problem.2
The problem became increasingly popular in the 1950s and 1960s. Notably, George Dantzig, Delber R. Fulkerson, and Selmer M. Johnson at the RAND Corporation in Santa Monica, California solved the 48 state problem by formulating it as a linear programming problem.2 The methods described in the paper set the foundation for future work in combinatorial optimization, especially highlighting the importance of cutting planes.2,4
In the early 1970s, the concept of P vs. NP problems created buzz in the theoretical computer science community. In 1972, Richard Karp demonstrated that the Hamiltonian cycle problem was NP-complete, implying that the traveling salesman problem was NP-hard.4
Increasingly sophisticated codes led to rapid increases in the sizes of the traveling salesman problems solved. Dantzig, Fulkerson, and Johnson had solved a 48 city instance of the problem in 1954.5 Martin Grötechel more than doubled this 23 years later, solving a 120 city instance in 1977.5 Enoch Crowder and Manfred W. Padberg again more than doubled this in just 3 years, with a 318 city solution.5
In 1987, rapid improvements were made, culminating in a 2,392 city solution by Padberg and Giovanni Rinaldi. In the following two decades, David L. Appelgate, Robert E. Bixby, Vasek Chvátal, & William J. Cook led the cutting edge, solving a 7,397 city instance in 1994 up to the current largest solved problem of 24,978 cities in 2004.5
Let be a directed or undirected graph with set of vertices and set of edges .3,6 Each edge is assigned a cost . Let be the set of all Hamiltonian cycles, a cycle that visits each vertex exactly once, in .6 The traveling salesman problem is to find the tour such that the sum of the costs in the tour is minimized.
Suppose graph is a complete graph, where every pair of distinct vertices is connected by a unique edge.6 Let the set of vertices be . The cost matrix is given by where the cost of the edge joining node to node , denoted , is given in entry .
In the context of the traveling salesman problem, the verticies correspond to cities and the edges correspond to the path between those cities. When modeled as a complete graph, paths that do not exist between cities can be modeled as edges of very large cost without loss of generality.6 Minimizing the sum of the costs for Hamiltonian cycle is equivalent to identifying the shortest path in which each city is visiting only once.
Classifications of the TSP
The TRP can be divided into two classes depending on the nature of the cost matrix.3,6
- Symmetric traveling salesman problem (sTSP) - is symmetric ()
- is undirected
- Applies when the distance between cities is the same in both directions
- Asymmetric traveling salesman problem (aTSP) - is asymmetric ()
- is directed
- Applies when there are differences in distances (e.g. one-way streets)
An ATSP can be formulated as an STSP by doubling the number of nodes.6
Variations of the TSP
- MAX TSP
- Rather than minimizing the tour cost, the MAX TSP seeks to identify a tour in which the total cost of edges is maximimum.6 The MAX TSP can be refomulated as a TSP by replacing each edge cost with its addivitive inverse.6
- Bottleneck TSP
- Objective is to locate a tour with the minimum cost for the edge with the largest cost, which can be reformulated as a TSP with exponentially large edge costs.6
- TSP with mutiple visits (TSPM)
- A relaxation of the TSP problem, the TSPM attempts to route a salesman such that each node is visited at least once and the total travel distance is minimized.6 Reformulations into a TSP involves replacing edge costs with the shortest path distance.6
- Messenger problem
- Also known as the wandering salesman problem, this problem seeeks to find the Hamiltonian path of least cost from specified node to node in .6 The TSP reformulations incorporates a large negative cost for the edge .
- Clustered TSP
- The set of vertices in are parititioned into clusters .6 The objective is to identify the least cost tour such that cities within the same cluster must all be visited before moving to the next cluster.6 This can be reformualted by adding a large cost to each edge between clusters.6
- Generalized TSP (GTSP)
- Given a set of clusters , the GTSP seeks to find the shortest cycle that passes through exactly one node in each cluster .6 The GTSP reduces to a TSP if .6 The GTSP can be solved as a TSP by modifying the cost matrix.6
- -salesmen TSP
- Given salesmen located at a node , minimize the total distance traveled by each salesman where each visits every node in a subset of exactly once before returning to node .6
Given a set of cities enumerated to be visited with the distance between each pair of cities and is given by .1 Introduce decision variables for each such that
The objective function is then given by
To ensure that the result is a valid tour, several contraints must be added.1,3
- Go-to constraints
- After visiting a city , the salesman must visit only one city next:
- Come-from constraints
- When visiting a city, the salesman must have come from only one city:
- Subtour elimination
- Ensure that a tour is fully connected, i.e. no subtours
- where is the set of all tours of
There are several other formulations for the subtour elimnation contraint, including circuit packing contraints, MTZ constraints, and network flow constraints.
aTSP ILP Formulation
The integer linear programming formulation for an aTSP is given by
sTSP ILP Formulation
The symmetric case is a special case of the asymmetric case and the above formulation is valid.3, 6 The integer linear programming formulation for an sTSP is given by
The most direct solution algorithm is a complete enumeration of all possible path to determine the path of least cost. However, for cities, the problem is time, and this method is practical only for extremely small values of .
Branch-and-bound algorithms are commonly used to find solutions for TSPs.7 The ILP is first relaxed and solved as an LP using the Simplex method, then feasibility is regained by enumeration of the integer variables.7
Other exact solution methods include the cutting plane method and branch-and-cut.8
Given that the TSP is an NP-hard problem, heuristic algorithms are commonly used to give a approximate solutions that are good, though not necessarily optimal. The algorithms do not guarantee an optimal solution, but gives near-optimal solutions in reasonable computational time.3 The Held-Karp lower bound can be calculated and used to judge the performance of a heuristic algorithm.3
There are two general heuristic classifications7:
- Tour construction procedures where a solution is gradually built by adding a new vertex at each step
- Tour improvement procedures where a feasbile solution is improved upon by performing various exchanges
The best methods tend to be composite algorithms that combine these features.7
Tour construction procedures
- Nearest neighbor
- The nearest neighbor algorithm follows a simple greedy procedure where the next city on a tour is simply the nearest city that has not yet been visited.8 This approach generally gives a tour within 25% of the Held-Karp lower bound.3
- A tour is constructed by repeatedly selecting the shortest edge that does not create a subtour, resulting in tours within 15-20% of the Held-Harp lower bound.3
- Insertion algorithms start with an arbitrary subset of cities and then select a new city that is not yet on the tour.3, 8 This city is inserted into the tour between two consecutive cities and such that the increase to the length of the tour (insertion cost) given by is minimized.8
Tour improvement procedures
- 2-opt and 3-opt
- Either two (2-opt) or three (3-opt) edges are randomly removed from a tour and reconnected in such a way that the tour is still feasible.3 This continues until no further improvements can be made. The 2-opt and 3-opt moves usually result in tours that are about 5% and 3% above the Held-Karp bound, respectively.3
- The k-opt move is the generalized case of the 2-opt and 3-opt methods that requires more computatinal time.3 A local optimum called the k-optimal is found by moving a tour to its best neighbor until no further improvements can be made, where a neighbor of a tour is one that can be obtained by deleting edges in and replacing them with another set of feasible edges.8
- Tabu search
- A 2-opt exchange mechanism that keeps a tabu list in order to prevent cycling and getting stuck in local minima.3,7
- Simulated annealing
- Analogous to material annealing, where at high temperature many possible states are reached by the system but as the system cools, the number of possibilities decreases.7 In the beginning, a high value of allows for a large number of moves. The number of moves decreasess with until a local minima is reached.
The importance of the traveling salesman problem is two fold. First its ubiquity as a platform for the study of general methods than can then be applied to a variety of other discrete optimization problems.5 Second is its diverse range of applications, in fields including mathematics, computer science, genetics, and engineering.5,6
- Drilling of printed circuit boards
- Consider a printed circuit board, where holes must be drilled in order to connect a conductor on one layer to that on another layer.3 These holes may be different sizes and, in order to drill two holes of different sizes consecutively, the head of the machine must perform a time-consuming drill equipment change.3 The process is then select a diameter, drill all the holes of that diameter, change to a different diameter, and repeat until complete.3 This problem can be seen as a series of TSPs, one for each diameter, where the nodes are the locations of the holes, the edges are the time required to move the drill head from one hole to the next, and the objective is to minimize machine head travel time.3
- Job sequencing
- Consider jobs that must be completed in order on a single machine and a setup time for executing job immediately after job .7 This problem can be formulated as a TSP where the nodes are jobs, the edges are the setup times, and the objective is to minimize the time required to complete all the jobs.7
- Computer wiring
- Consider a computer board on which a set of pins must be connected such that no more than two wires are attached to each pin.3 This simplifies to solving the TSP with the pins as nodes, the distance between the pins as edges, and the minimum length of wire as the objective.3
- Consider an experiment in which a large number of X-ray crystallography measurements must be taken, where each requires the sample to be mounted and the detector to be positioned approprirately.7 Describing the time it takes to move the detector to a certain position as the cost, solving a TSP with the positions as nodes can identify the order to measurements needed to complete the experiment in the shortest time.7
- Vanderbei, R. J. (2001). Linear programming: Foundations and extensions (2nd ed.). Boston: Kluwer Academic.
- Schrijver, A. (n.d.). On the history of combinatorial optimization (till 1960).
- Matai, R., Singh, S., & Lal, M. (2010). Traveling salesman problem: An overview of applications, formulations, and solution approaches. In D. Davendra (Ed.), Traveling Salesman Problem, Theory and Applications. InTech.
- Junger, M., Liebling, T., Naddef, D., Nemhauser, G., Pulleyblank, W., Reinelt, G., Rinaldi, G., & Wolsey, L. (Eds.). (2009). 50 years of integer programming, 1958-2008: The early years and state-of-the-art surveys. Heidelberg: Springer.
- Cook, W. (2007). History of the TSP. The Traveling Salesman Problem. Retrieved from http://www.math.uwaterloo.ca/tsp/history/index.htm
- Punnen, A. P. (2002). The traveling salesman problem: Applications, formulations and variations. In G. Gutin & A. P. Punnen (Eds.), The Traveling Salesman Problem and its Variations. Netherlands: Kluwer Academic Publishers.
- Laporte, G. (1992). The traveling salesman problem: An overview of exact and approximate algorithms. European Journal of Operational Research, 59(2), 231–247.
- Goyal, S. (n.d.). A suvey on travlling salesman problem.