The Traveling Salesman Problem

Irina Bryan April 18, 2009
Abstract The traveling salesman problem (TSP) seeks to minimize the cost of the route for a salesman to visit all the cities exactly once and return home. TSP is easy to describe, but difficult to solve because it requires finding a Hamiltonian cycle of minimum cost. There are several sufficient conditions for Hamiltonicity, but no necessary conditions. Some sufficient conditions are demonstrated in Dirac’s and Ore’s Theorems. Two approaches to solving the TSP are presented. The approaches use trees but in different ways. Although the first approach is systematically considering all possible ways to build Hamilton cycles, it is also searching for the cheapest way to build the cycles. It uses a “branch and bound” method to limit the number of different vertices in the search tree that must be inspected in search of minimal solution. The second approach is a quicker approximate algorithm for obtaining good (near-minimal) tours. It is followed by a theorem stating that at worst the approximate algorithm’s tour is always less than twice the cost of a true minimal tour. This algorithm uses a successive nearest-neighbor strategy.


A weighted graph G = (V. the task is to find a shortest possible tour that visits each city exactly once [13]. the weight of an edge is the corresponding connections distance. the drilling of printed circuits boards. the sequencing of jobs on a single machine and the assignment of routes for planes of a specified fleet. Problems having the TSP structure occur in the analysis of the structure of crystals. b(a = b). it appears as a sub-problem in many areas. in cutting stock problems. a large number of heuristics and exact methods allows us to solve some instances with tens of thousands of cities can be solved [1] [13]. or TSP for short. Definition 2. There are many important cases of practical problems that can be formulated as TSP problems and many other problems are generalizations of this problem. Most importantly. TSP can be modelled as a weighted graph (see Figure 1). b) joins two different vertices a. such as genome sequencing (a genome map has for each chromosome a sequence of markers–segments of DNA that appear exactly once–with some estimate of the distance between adjacent markers). Each edge e = (a. E) consists of a finite set V of vertices and a finite set E of edges. and an optimal TSP tour is a shortest Hamiltonian cycle. the best known and important one of which is the vehicle routing problem. A graph G = (V. the clustering of data arrays. Definition 3. Definition 1. has captured much attention of mathematicians and computer scientists because it is so easy to describe and so difficult to solve. it was not until 1930’s when TSP was first formulated as a mathematical problem. Weights are usually real numbers [10]. Although one of the first appearences of tours and circuits in the mathematical literature is in a 1757 paper by the great Leonhard Euler. the problem of determining for a fleet of vehicles which customers should be served by each vehicle and in what order each vehicle should visit the customers assigned to it [1] [5]. w) associates a label w (weight) with every edge in the graph. The graph’s vertices correspond to cities and the graph’s edges correspond to connections between cities.1 Introduction The traveling salesman problem. Today it is one of the most intensively studied problems in optimization and is used as a benchmark for many optimization methods. that is. 2 . in material handling in a warehouse. [8]. Even though the problem is computationally difficult. the traveling salesman problem often comes up as a sub-problem in more complex combinatorial problems. An edge may be directed or undirected. Otherr elated variations on the traveling salesman problem include the resource constrained traveling salesman problem which has applications in scheduling with an aggregate deadline. the overhauling of gas turbine engines. Slightly modified. E. A TSP tour is now a Hamiltonian cycle (Figure 2). Traveling Salesman Problem: given a list of cities and their pairwise distances.

In the asymmetric TSP.Figure 1: A weighted graph (the wheel. then the underlying graph is said to be complete (see Figure 3). in general. When the salesman can get from every city to every other city directly. This is a useful simplifying step. Figure 2: Two different Hamiltonian cycles In the symmetric TSP. Thus. W6 ) Definition 4. the distance from one city to the other does not necessary equal the distance in the other direction. For example. because a complete graph with more than two vertices 3 . there may not even be a connection in the other direction. A path or cycle is Hamiltonian (or spanning) if it uses all vertices exactly once. This symmetry halves the number of feasible solutions. the distance between two cities is the same in each direction. the asymmetric case models one-way streets or air-fares that depend on the direction of travel [13]. the underlying structure is a directed graph. Thus. A graph that contains a Hamiltonian cycle is a Hamiltonian graph. [10]. the underlying structure is an undirected graph.

the problem of finding a sequence of knight’s moves that will take the piece from a starting square on a chessboard. Figure 4: Knight’s tour 4 . The paper concerns a solution of the knight’s tour problem in chess. through every other square exactly once and returning to the start. Instances where not all cities are connected can be transformed into complete graphs by adding very long edges between these cities. that is. It appears to have been discussed informally among mathematicians for many years. where the order of moves is indicated by the numbers on the squares [1].is Hamiltonian. Euler’s solution is depicted in Figure 4. Figure 3: A complete graph with six vertices (K6 ) 2 History of TSP The origin of the TSP and its name is somewhat obscure. One of the first appearances of tours and circuits in the mathematical literature is in a 1757 paper by the great Leonard Euler. edges that will not appear in the optimal tour [13]. Suprisingly little in the way of results has appeared in the mathematical literature.

The objective is to go around the world by passing through each city once and only once. Sir Hamilton got into serious financial difficulties trying to market his game [3].A handbook for travelling salesmen from 1832 mentions the problem and includes example tours through Germany and Switzerland. A dodecahedron is a polyhedron with twelve pentagonal faces. The twenty vertices of a regular solid dodecahedron (see Figure 5) are labeled as twenty famous cities of the world. but contains no mathematical treatment. It has twenty vertices (each of degree three) and thirty edges [9]. Figure 5: The Icosian Game Figure 6: Dodecahedron Definition 5. In 1859 Sir William Hamilton contributed to the growth of graph theory by inventing the Icosian game (or Hamilton’s around the world problem) (see Figure 5). considers the obvious brute-force algorithm.R. notably by Karl Menger. The general form of the TSP appears to have been first studied by mathematicians during the 1930s in Vienna and at Harvard. who defines the problem. Mathematical problems related to the travelling salesman problem were treated in the 1800s by the Irish mathematician W. 5 . Hamilton and by the British mathematician Thomas Kirkman [13]. The solution is called a “Hamilton cycle” (see Figure 2). and observes the non-optimality of the nearest neighbour heuristic.

In the 1950s and 1960s. a graph G is Hamiltonian if it has a spanning cycle. For many other instances with millions of cities.810-city instance given by a microchip layout problem. Tucker (Princeton University) recall that they first heard about the problem in a seminar talk by Hassler Whitney at Princeton in 1934. computer science. chemistry. In the following decades. Cook and others computed an optimal tour through a 33. Johnson. which has been used by many research groups for comparing results. which implies the NP-hardness of TSP. solutions can be found that are provably within 1% of optimal tour[1] [13]. therefore it is notoriously difficult to find a solution to this problem for a given 6 . A heuristic method is particularly used to rapidly come to a solution that is reasonably close to the best possible answer.W. currently the largest solved TSPLIB instance. In 1972 Richard M. Applegate. This supplied a scientific explanation for the apparent computational difficulty of finding optimal tours. a collection of benchmark instances of varying difficulty. Using these new methods they took up the computational challenge of TSP. educated guesses. A heuristic is an adjective for methods that help in problem solving. These methods in most cases employ experimentation and trial-and-error techniques. Along the way they set the stage for the study of integer programming. solving a 49-city instance by hand to optimality by constructing a tour and proving that no other tour could be shorter. In the late 1970s and 1980 Grtschel. physics. in turn leading to learning and discovery. California experts.Definition 6. Heuristics are “rules of thumb”. Merrill Flood (Columbia University). The design of Concorde is focused on the solution of larger. and Cook developed the program Concorde that has been used in many recent record solutions. In the 1990s. using cutting planes and branch-and-bound methods. Delbert Ray Fulkerson and Selmer M. more difficult. and other sciences. The problem of determining whether a graph is Hamiltonian is well known to be NP-complete. Rinaldi and others managed to exactly solve instances with up to 2392 cities. were part of an exceptionally strong and influential center for the new field of mathematical programming. They expressed TSP as an integer linear program and developed the cutting plane method for its solution. who is credited with naming the travelling salesman problem. Karp showed that the problem of finding a Hamiltonian cycle was NP-complete. the problem was studied by many researchers from mathematics. George Dantzig. housed at the RAND Corporation in Santa Monica. Padberg. Bixby. Gerhard Reinelt published the TSPLIB in 1991. In 2005. tried to obtain near optimal solutions in reference to routing of school buses. rather than concentrating on the fastest solution of small examples. intuitive judgments or simply common sense [13]. the problem became increasingly popular in scientific circles in Europe and the USA. Chvtal. or ’optimal solution’. Both Flood and A. 3 The Existence of the Hamiltonian Cycle Restated. as early as 1937. instances of the problem.

then G has a Hamiltonian cycle. we embed G in a saturated non-Hamiltonian graph G as follows: Clearly not all possible edges occur in G or else it would be Hamiltonian already. the more likely it is that a Hamiltonian cycle will exist [4]. then so can every problem in NP [11].graph of even moderate size [4]. 2 We now proceed to a contradiction. • Dirac’s Theorem (1952) Theorem 1. In this graph. Consider. If this insertion does not complete a Hamiltonian circuit. Traversing the vertices in numerical order 1 − 6 and back to 1 yields a Hamilton cycle. Definition 8. the number of computation steps a computer or an abstract machine requires to evaluate the algorithm [12]. Firstly. W6 (Figure 1). Definition 9. In computational complexity theory. Proof. then leave the edge in the graph. the insertion of an edge which is missing from G. take the edge back out. consider the wheel on six vertices. A degree. • If the problem can be solved quickly (in polynomial time). polynomial time refers to the running time of an algorithm. of a vertex is the total number of edges incident with that vertex (loops are incident twice) [3]. If G is a simple graph with n vertices with n ≥ 3 such that the degree of every vertex in G is at least n/2. If it does complete a Hamiltonian circuit. The following two early theorems provide some sufficient conditions for Hamiltonicity. Go around G doing this at each missing edge. the search for necessary conditions continues. As an illustration of Dirac’s Theorem. then. the set of problems with this property is called NP. Both are based on the intuitive fact that the more edges a graph has. Definition 10. In computer science. It is generally believed that no polynomial algorithm will ever be found for an NP-complete problem [8]. the complexity class NPcomplete (NP standing for Nondeterministic Polynomial time) is a class of problems having two properties: • Any given solution to the problem can be verified quickly (in polynomial time). A simple graph is a graph with no loops of parallel edges [3]. so it is Hamil2 tonian. Suppose the given graph G which has n vertices and every degree is at least n is non-Hamiltonian (does not contain a Hamiltonian cycle). Definition 7. minimum degree δ = 3 ≥ 6 . d(v). that is. While there are several sufficient conditions for Hamiltonicity. The order in which one tries the missing edges is 7 .

If G is a simple graph with n vertices with n ≥ 3 such that deg(x) + deg(y) ≥ n for every pair of nonadjacent vertices x and y in G. vn cannot be joined to itself. Altogether. The sum of the degrees of nonadjacent vertices (i. Adding edges certainly does not diminish the degree of any vertex. Now if the vertex v1 happens to be joined to the vertex vi .... where i − 1 ranges from 1 to n − 2. so that the addition of any edge to G produces a Hamiltonian graph. etc. and yet it will be saturated in the sense that the addition now of any missing edge will have to complete a Hamiltonian cycle (otherwise we would have left the edge in the graph when it was tried during our rounds). Hence every vertex of G has degree at least n . we ask whether the vertex vn could possibly be joined to vi−1 ? The answer is “no. Since G is non-Hamiltonian. Consequently. While v1 is not joined to vn . then. Thus v1 is joined to at least n 2 2 vertices vi where i runs from 2 to n − 1. the graph 8 . Suppose the edge between vertices v1 and vn is missing. But we will not know when G is maximal unless we can test all the graphs obtained by adding an extra edge and show that they are Hamiltonian!) Now G is certainly not complete. even without the edge v1 vn . vn−1 . v3 . to which vn cannot possibly be joined.. we suppose that G is a graph which satisfies the hypothesis of Ore’s Theorem but is not Hamiltonian. We also may suppose that G is maximal with these properties. or deg(1) + deg(5). then G would contain the Hamiltonian cycle v1 vi vi+1 . vn . deg(2) + deg(6). if vn were joined to vi−1 .. W6 . either. v2 . it 2 cannot contain all possible edges. . the resulting graph G will still be non-Hamiltonian since no Hamiltonian circuit is ever allowed to remain intact.) is always 6.. 2 • Ore’s Theorem (1960) Theorem vi−1 vi−2 . Putting in this edge would complete a Hamiltonian circuit because G is saturated.. The wheel. which is the order of the graph. At the end of this tour. so it has a non-adjacent pair of vertices x and y.unimportant.v2 v1 . (We add new edges joining previously non-adjacent vertices as long as G remains non-Hamiltonian. there are at least n 2 vertices vi−1 . the graph G must contain a Hamiltonian path from v1 to vn (inserting the edge v1 vn merely completes this path into a cycle). Arguing by contradiction.” For. This is impossible since G is non-Hamiltonian. Proof. then G has a Hamiltonian cycle. Since loops are not permitted. contradicting the given fact that its degree is at least n [6]. Adding a new edge does not decrease the degree of any vertex. Thus. This leaves fewer than n vertices to which vn can be 2 joined. so the degree condition remains true. Let us denote the order of the n vertices in this path by v1 . we do know that v1 has degree at least n .e. also satisfies Ore’s Theorem. Since G is maximal non-Hamiltonian.. and does not create any new non-adjacent pair of vertices. there are more than n vertices to which 2 vn cannot be joined.

9 .. But the vertex v1 = x does not belong to either A or B. this set is well-defined. . and a Hamiltonian cycle in this graph must contain e. . yj }. y} is Hamiltonian. Then we follow the path backwards through vn−1 . . Consider the graph with 2m + 1 vertices x1 . ym+1 . vn = y).. It follows that |A ∩ B| ≥ 1. Exact approaches to solving such problems require algorithms that generate both a lower bound and an upper bound on the true minimum value of the problem instance. .. and the sum of their degrees is 2m + 2 = n + 1 or 2m − n − 1 respectively [2]. one needs both upper and lower bounding techniques to find optimal solutions to hard combinatorial problems or even to obtain solutions meeting a quality guarantee [5]. y1 .. . we follow the path v2 . a proof of optimality is achieved.. These solution strategies produce answers but without any quality guarantee as to how far off they may be from the optimal answer.. and having as edges all pairs {xi . xm . Algorithms that construct feasible solutions... Now we obtain a contradiction by constructing a Hamiltonian cycle in G... Now vi−1 is adjacent to y (since vi ∈ B). for any edge crosses between the sets A = {a1 . In order to know about the closeness of the upper bound to the optimum value. Now let A be the set of vertices adjacent to x.obtained by adding the edge e = {x. .) It is not Hamiltonian.. and thus upper bounds for the optimum value. Any round-trip tour that goes through every city exactly once is a feasible solution with a given cost which cannot be smaller than the minimum cost tour.. If not. a conservative estimate of the true relative error of the upper bound is provided by the difference of the upper and the lower bound divided by the lower bound. So G itself contains a Hamiltonian path (x = v1 . one must also know a lower bound on the optimum value. am } and B = {b1 . and let B = {vi : vi−1 is adjacent to y} . 4 Methods of Solving TSP Metods of solving TSP could be split into two categories: exact algorithms and heuristic (approximation) algorithms. (Since y is not adjacent to vn = y. If the upper and lower bound coincide. (This is a complete bipartite graph. v3 . Thus. as far as vi−1 . v2 . and so there is a vertex vi lying in both A and B.) By assumption. are called heuristics. |A| + |B| ≥ n.. Starting at x = v1 ... and then home to v1 (this edge exists because vi ∈ A) [2]. bm }... and so a path of odd lengh starting in A or both in B.. e2 .. The result is best possible in some sense. as far as vi . . so we go to y = vn at the next step. so |A ∪ B| ≤ n − 1.

the problem can be solved in time within a polynomial factor of 2n and polynomial space. Several categories of heuristics are recognized: • Constructive heuristics The nearest neighbour (NN) algorithm (or so-called greedy algorithm) lets the salesman choose the nearest unvisited city as his next move. Progressive improvement algorithms which use techniques reminiscent of linear programming. it is an open problem if there exists an exact algorithm for TSP that runs in time O(1. solving an instance with 85. For N cities randomly distributed on a plane. In May 2004. The computations were performed on a network of 110 processors located at Rice University and Princeton University. the algorithm averagely yields length = 1. An exact solution for 15. This algorithm quickly yields an effectively short route. which quickly yield good solutions have been devised. this is the method of choice for solving large instances. Modern methods can find solutions for extremely large problems (millions of cities) within a reasonable time which are with a high probability just 2-3% away from the optimal solution.900 cities [1]. Implementations of branch-and-bound and problem-specific cut generation. which can be used to process TSPs containing 40-60 cities. This approach holds the current record. the travelling salesman problem of visiting all 24.048. the travelling salesman problem of visiting all 33. The computation took approximately 15.500 kilometers was found and it was proven that no shorter tour exists.25× exact 10 .7 CPU years.945 units was found and it was proven that no shorter tour exists. Ray Fulkerson. The total computation time was equivalent to 22. the factorial of the number of cities.900 points was solved using Concorde TSP Solver. Improving these time bounds seems to be difficult. and Selmer Johnson in 1954. Using inclusionexclusion method.In March 2005.978 towns in Sweden was solved: a tour of length approximately 72.810 points in a circuit board was solved using Concorde TSP Solver: a tour of length 66.112 German towns from TSPLIB was found in 2001 using the cutting-plane method proposed by George Dantzig. so this solution becomes impractical even for only 20 cities.• Exact algorithms The most direct solution would be to try all permutations (ordered combinations) and see which one is cheapest (using brute force search). In April 2006 an instance with 85.9999n ) [13]. • Other approaches include: Various branch-and-bound algorithms.6 years on a single 500 MHz Alpha processor. Works well for up to 200 cities. For example. • Heuristic and approximation algorithms Various heuristics and approximation algorithms. based on linear programming. taking over 136 CPU years [1]. The running time for this approach lies within a factor of O(n!).

Rosenkrantz showed that the NN algorithm has the approximation factor Θ(log |V |) for instances satisfying the triangle inequality. choose four nearby points. The cycles are then stitched to produce the final tour. Recently a new constructive heuristic. simulated annealing. • V’-opt heuristic The variable-opt method is related to. • Randomised improvement Optimised Markov chain algorithms which use local searching heuristic sub-algorithms can find a route extremely close to the optimal route for 700 to 800 cities. swap their ways to create a new random path. “Branch and bound” and the nearest neighbour algorithms are discribed below. Tabu search. and a generalization of the k-opt method. ant colony optimization. Random path change algorithms are currently the stateof-the-art search algorithms and work up to 100. MTS performs two sequential matchings. This is true for both asymmetric and symmetric TSPs. to yield a set of cycles.000 cities. there exist many specially arranged city distributions which make the NN algorithm to produce the worst route. MTS has been shown to empirically outperform all existing tour construction heuristics. Instead they grow the set as the search process continues.1 “Branch and Bound” Method TSP seeks a minimal-cost Hamilton circuit in a complete graph having associated cost matrix C. The concept is quite simple: Choose a random path. Match Twice and Stitch (MTS). where the second matching is executed after deleting all the edges of the first matching. the variable-opt methods do not fix the size of the edge set to remove. • Iterative improvement Pairwise exchange. 4. has been proposed. or Lin-Kernighan heuristics.shortest length. TSP is a touchstone for many general heuristics devised for combinatorial optimization such as genetic algorithms. The first approach is to systematically consider all 11 . and the cross entropy method [13]. Whereas the k-opt methods remove a fixed number (k) of edges from the original tour. while in parallel decreasing the upper bound of the path length. The pairwise exchange or “2-opt” technique involves iteratively removing two edges and replacing these with two different edges that reconnect the fragments created by edge removal into a new and shorter tour. Entry cij in C is the cost of using the edge from the ith vertex to the jth vertex. However.

a 50-city (vertex) problem has 49! ≈ 6 × 1062 possible circuits. This latter constraint means that if we choose. we can subtract a constant from any column without changing the set of edges of a minimal tour. All rows in Table 2 now contain a 0 entry. x3 . Still the edges of a minimal tour for the altered problem are the same edges that form a minimal tour for the original problem. let’s consider a small traveling salesman problem with four vertices x1 . Entry cij is the cost of going from vertex (city) i to vertex j. the edges of a minimal tour will not change if we subtract a constant value from each entry in the first row of the cost matrix (of course. then c12 cannot be used. one in each row and in each column. An undirected tree is characterized as a connected graph with no circuits [8]. and each leaf – a complete Hamilton circuit. for example. Let the cost matrix for this problem be the matrix in Table 1. x4 . Do this for the other three rows also. a minimal tour using the cost data in Table 3 will cost 15 less than a minimal tour using original cost data in Table 2. In a similar fashion. Since we will want to avoid making 12 . Definition 11. say. namely 3. To 1 2 3 4 1 ∞ 3 5 9 2 3 ∞ 6 7 3 9 6 ∞ 4 4 7 5 6 ∞ From Table 1: TSP with four vertices We first show how to obtain a lower bound for the cost of this traveling salesman problem. there is a unique path from the root to x. Since every solution must contain an entry in the first row. we subract the value of the smallest entry in row 1. (Note we do not require cij = cji . Note that a complete graph on n vertices has (n − 1)! different Hamilton circuits.) The infinite costs on the main diagonal indicate that we cannot use these entries. Each vertex in the tree will represent a partial Hamilton circuit. A Hamilton circuit will use four entries in the cost matrix C. then we cannot also use c32 . We subtract as large a number as possible from the first row without making any antry in the row negative. x2 . that is. the cost of a minimal tour will change by this constant). A tree is a graph with a special vertex called a root and for each vertex x. if entries c23 and c31 are used. After subtracting a total of 3 + 3 + 5 + 4 = 15 from the different rows. entry c23 . other than the root.possible ways to build Hamilton circuits in search of the cheapest one. It uses a “branch and bound” method to limit the number of different vertices in the search tree that must be inspected in search of a minimal solution. for these two entries form a subcircuit of lenght 2. such that no proper subset of entries (edges) forms a subcircuit. To demonstrate “branch and bound” approach. We display the altered cost matrix in Table 2. Similarly.

also entry c21 must be set to ∞ (to avoid subcircuit x1 − x2 − x1 ). The lower bound for a tour in Table 5 using c12 is now 16 + 1 = 17.From To 1 2 3 4 1 ∞ 0 0 5 2 0 ∞ 1 3 3 6 3 ∞ 0 4 4 2 1 ∞ Table 2: TSP with four vertices (continued) any entries negative. and hence a minimal tour using Table 1 must cost at least 16. The smallest value in row 1 of the altered Table 3 is now c14 = 3. Either we use c12 or we do not use c12 . So we subtract 1 from the last column in Table 2 to get the matrix in Table 3. We look at an entry in Table 3 that is equal to 0. and so we subtract 1 from row 2 to obtain the cost matrix in Table 5. In the case that we do not use c12 . then the rest of the tour cannot use another entry in row 1 or column 2. The new smallest value of the reduced matrix in row 2 is 1. Similarly. In general. We “branch” on this choice. whose smallest value is 1. The only such column in Table 2 is column 4. we represent the no-c12 choice by setting c12 = ∞. we obtain the new cost matrix in Table 4. Every row and column in Table 3 now contains a 0 entry. Hence. Now we are ready for the branching part of the “branch and bound” method. To 1 2 3 4 1 ∞ 0 0 5 2 0 ∞ 1 3 3 6 3 ∞ 0 4 3 1 0 ∞ From Table 3: TSP with four vertices (continued) The cost of a minimal tour using Table 3 has been reduced by a total of 15 + 1 = 16 from the original cost using Table 1. Say c12 . If we use c12 to built a tour for Table 3. we consider subtracting a constant only from columns with all current entries positive. we can subtract 1 from from column 2. the lower bound for the traveling salesman problem equals the sum of the constants subtracted from the rows and columns of the original cost matrix to obtain a new cost matrix with a 0 entry in each row and column. and so we can subtract this amount from row 1. We can use this reduction of cost to obtain a lower bound on the cost of a minimal tour: A minimal tour using the cost in Table 3 must trivially cost at least 0. Since our lower bound of 17 is less than the lower bound of 20 when we do 13 . If we do not use entry c12 . any tour for the original problem (Table 1) that does not use c12 must cost at least 16 + (3 + 1) = 20.

The only 0 entry in row 2 of Table 5 is c24 . Since c43=c31 =0 . Using c24 will not increase the lower bound. Table 6 shows the new remaining cost matrix (all rows and columns still have a 0 entry). we have c12 +c24 +c43 +c31 = 3 + 5 + 4 + 5 = 17. From To 2 3 4 1 ∞ 0 5 3 2 ∞ 0 4 0 0 ∞ Table 5: TSP with four vertices (continued) Again we have the choice of using c24 or not using c24 .then we would have to go back and consider partil tours not using c12 . this tour has a cost equal to the lower bound of 17 in Table 6. This next 0 entry need not connect with c12 . If the lower bound were to exceed 20. Our tree of choices is a binary tree whose internal vertices represent choices of the form: use entry cij or do not use cij . we do not need to look at the subtree of possible tours not using cij . At any stage. this tour must be minimal since its cost equals our lower bound. and so we further extend the partial tour using c24 along with c12 . Now the way to finish the tour is clear: use entries c43 and c31 for a complete tour x1 − x2 − x4 − x3 − x1 . we continue our consideration of tours using c12 by determining bounds associated with whether or not to use a second entry with value 0. Not using c24 will increase the lower bound by 2 (the smallest entry in row 2 of Table 5 after we set c24 = ∞. Again we delete row 2 and column 4 in Table 5 and set c41 = ∞ (to block the subcircuit x1 − x2 − x4 − x1 ). Futher. One general point should be made about how to take best advantage of the 14 . as long as the lower bounds for partial tours using cij are less than the lower bound for tours not using cij .From To 1 2 3 4 1 ∞ 0 0 5 2 ∞ ∞ 0 2 3 3 3 ∞ 0 4 0 1 0 ∞ Table 4: TSP with four vertices (continued) not use c12 . that is. We extend a tour using c12 by considering another entry with value 0. but for simplicity we shall pick an entry in row 2. We will continue to extend these partial tours using c12 as long as the lower bound is ≤ 20. column 4 still has a 0. We actually have no choice since not using either of c43 or c31 forces us to use an ∞ (which represents a forbidden edge). need not be of the form ci1 or c2j . Rechecking the tour’s cost with the original cost matrix in Table 1.

Given the k-vertex circuit Ck . the 0 entry whose maximizes the increase in the lower bound.22. we will prove that at worst the approximate algorithm’s tour is always less than twice the cost of a true minimal tour. 2. Vertex x3 is the vertex not in C2 closest to a vertex in C2 . k ≥ 1. x3 .2 Approximate Algorithm: Nearest-Neighbor Strategy The second approach is a quicker algorithm for obtaining good (near-minimal) tours. In Table 3. Repeat steps 2 and 3 until a Hamilton circuit (containing all vertices) is formed. in practice our approximate algorithm finds a tour that is close to the true minimum. Approximate Traveling Salesman Tour Construction 1. Pick any vertex as a starting circuit C1 consisting of 1 vertex. Example: Approximate Traveling Salesman Tour Let us apply the proceding algorithm to the 6-vertex TSP whose cost matrix is given in Figure 3.e. when the costs are symmetric (i. x2 . namely. cij = cji) and the costs satisfy the triangle inequality — cik ≤ cij + cjk . call it yk . x6 . on Ck . such a bound is quite acceptable. 4. we should pick as the next entry on which to branch (use or do not use the entry). A bound of twice the true minimum may sound bad. find the vertex zk not on Ck that is closest to a vertex. a check of all 0 entries reveals that not using entry c43 will raise the lower bound by 3 + 3 = 6 (3 is the new smallest value in row 4 and in column 3). Futhermore.From To 3 4 1 0 ∞ 3 ∞ 0 Table 6: TSP with four vertices (continued) branch-and-bound technique. 4. thus 15 . This algorithm uses a successive nearest-neighbor strategy. Let Ck+1 be the k+1-vertex circuit obtained by inserting zk immediately in front of yk in Ck . We will start with x1 as C1 . Name the vertices x1 . 3.. At each stage. These two assumptions are satisfied in most TSP. After describing the algorithm and giving an example of its use. x5 . Vertex x4 is closest to x1 . So c43 would theoretically have been a better entry than c12 to use for the first branching. x4 . and so C2 is x1 –x4 –x1 . since the greater lower bound for the subtree of tours not using c43 makes it less likely that we would ever have to check possible tours in that subtree [8]. but in many cases where a “ballpark” figure is needed (and the exact minimal tour can be computed later if needed). closest to x4 .

. 16 . x5 is within 4 units of x3 and x6 . Inserting x5 before x6 . obtaining C5 =x1 –x2 –x3 –x4 –x6 –x1 . a large number of heuristics and exact methods allows us to solve some instances with tens of thousands of cities can be solved. To date. The length of the approximate tour was not that close to an optimal length. It is inserted before x3 to obtain C4 =x1 –x2 –x3 – x4 –x1 . To 1 2 3 4 5 6 1 ∞ 3 3 2 7 3 2 3 ∞ 3 4 5 5 3 3 3 ∞ 1 4 4 4 2 4 1 ∞ 5 5 5 7 5 4 5 ∞ 4 6 3 5 4 5 4 ∞ From Table 7: Approximate Traveling Salesman Tour In this case. the length of this tour obtained with the Approximation Tour Construction algorithm is quite close to the minimum (which happens to be 18). Even though the problem is computationally difficult. then by trying other vertices as the starting vertex (that forms C1 ) and applying the algorithm. if one can find an efficient algorithm (i. Suppose we pick x2 . that as our understanding of the underlying mathematical structure of the TSP problem improves. we will get other near-minimal tours. however. then efficient algorithms could be found for all other problems in the NP-complete class. we obtain our near-minimal tour C6 =x1 –x2 –x3 –x4 –x5 –x6 –x1 . 3 units from vertices in C3 . Finally. x2 and x6 . Theorem 3. Specifically. The TSP problem belongs in the class of combinatorial optimization problems known as NPcomplete. So. we will be able to tackle this problem in the nearest future. Vertex x6 is still 3 units from x1 . let us hope. The cost of the tour generated by the approximate tour construction is less than twice the cost of the minimal traveling salesman tour. no one has found a polynomial-time algorithm for the TSP. There are now two vertices.C3 =x1 –x3 –x4 –x1 .e. so we insert x6 before x1 . an algorithm that will be guaranteed to find the optimal solution in a polynomial number of steps) for the traveling salesman problem. Taking the shortest of this set of tours generated by the Approximate Tour Construction would give us an improved estimate for the true minimal tour [8]. and with the continuing advancement in computer technology. whose cost we compute to be 19. Conclusion The importance of the TSP is that it is a representative of a larger class of problems known as combinatorial optimization problems.

html. Ltd. [5] K.Padberg. [9] http://en.wikipedia. Applications of Graph Theory Algorithms. Tucker.K. http://iris.Chv´tal. Cambridge University Press. [2] P. Princeton and Oxford. o ca/navigation/ideas/articles/honsberger/index. Applied Combinatorics. Inc.L. Elsevier North Holland. [11] John Wiley & Sons. Traveling Salesman Problem.. Rinnooy Kan. Moore.E. Lawler. J. algorithms.PDF.B. 1979. 2007. Princeton University Press.wikipedia. J.J. John Wiley & Sons. [8] A.shtml. R. The Traveling Salesa man Problem.M.wikipedia. Cook.L. The Story of Louis P´sa. Combinatorics: topics. D.gmu. Cameron.References [1] D. http://www. 17 . A Study of Sufficient Conditions for Hamilton Cycles. [3] paper4/v1n1-4pd. [7] E. 2006. Ghare. [4] M. V. A Computational Study. The Traveling Salesman Problem. [10] http://en. edu/~khoffman/papers/trav_salesman. Applegate. 1985. Hoffman. P. M.wikipedia. Lenstra. http://www.G. [6] R. Inc.H. [13] http://en.J. 1994.uwaterloo. techniques. Honsberger. W.. Bixby. [12] http://en. DeLeon.