Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

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 dicult to solve because it requires nding a Hamiltonian cycle of minimum cost. There are several sucient conditions for Hamiltonicity, but no necessary conditions. Some sucient conditions are demonstrated in Diracs and Ores Theorems. Two approaches to solving the TSP are presented. The approaches use trees but in dierent ways. Although the rst 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 dierent 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 algorithms tour is always less than twice the cost of a true minimal tour. This algorithm uses a successive nearest-neighbor strategy.

Introduction

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

Figure 1: A weighted graph (the wheel, W6 ) Denition 4. A path or cycle is Hamiltonian (or spanning) if it uses all vertices exactly once. A graph that contains a Hamiltonian cycle is a Hamiltonian graph. [10].

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

is Hamiltonian. Instances where not all cities are connected can be transformed into complete graphs by adding very long edges between these cities, edges that will not appear in the optimal tour [13].

Figure 3: A complete graph with six vertices (K6 )

History of TSP

The origin of the TSP and its name is somewhat obscure. It appears to have been discussed informally among mathematicians for many years. Suprisingly little in the way of results has appeared in the mathematical literature. One of the rst appearances of tours and circuits in the mathematical literature is in a 1757 paper by the great Leonard Euler. The paper concerns a solution of the knights tour problem in chess, that is, the problem of nding a sequence of knights moves that will take the piece from a starting square on a chessboard, through every other square exactly once and returning to the start. Eulers solution is depicted in Figure 4, where the order of moves is indicated by the numbers on the squares [1].

Figure 4: Knights tour

A handbook for travelling salesmen from 1832 mentions the problem and includes example tours through Germany and Switzerland, but contains no mathematical treatment. Mathematical problems related to the travelling salesman problem were treated in the 1800s by the Irish mathematician W.R. Hamilton and by the British mathematician Thomas Kirkman [13]. In 1859 Sir William Hamilton contributed to the growth of graph theory by inventing the Icosian game (or Hamiltons around the world problem) (see Figure 5). The twenty vertices of a regular solid dodecahedron (see Figure 5) are labeled as twenty famous cities of the world. The objective is to go around the world by passing through each city once and only once. The solution is called a Hamilton cycle (see Figure 2). Sir Hamilton got into serious nancial diculties trying to market his game [3].

Figure 5: The Icosian Game

Figure 6: Dodecahedron Denition 5. A dodecahedron is a polyhedron with twelve pentagonal faces. It has twenty vertices (each of degree three) and thirty edges [9]. The general form of the TSP appears to have been rst studied by mathematicians during the 1930s in Vienna and at Harvard, notably by Karl Menger, who denes the problem, considers the obvious brute-force algorithm, and observes the non-optimality of the nearest neighbour heuristic. 5

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

The Existence of the Hamiltonian Cycle

Restated, a graph G is Hamiltonian if it has a spanning cycle. The problem of determining whether a graph is Hamiltonian is well known to be NP-complete, therefore it is notoriously dicult to nd a solution to this problem for a given 6

graph of even moderate size [4]. It is generally believed that no polynomial algorithm will ever be found for an NP-complete problem [8]. Denition 7. In computer science, polynomial time refers to the running time of an algorithm, that is, the number of computation steps a computer or an abstract machine requires to evaluate the algorithm [12]. Denition 8. In computational complexity theory, 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 veried quickly (in polynomial time); the set of problems with this property is called NP. If the problem can be solved quickly (in polynomial time), then so can every problem in NP [11]. While there are several sucient conditions for Hamiltonicity, the search for necessary conditions continues. The following two early theorems provide some sucient conditions for Hamiltonicity. Both are based on the intuitive fact that the more edges a graph has, the more likely it is that a Hamiltonian cycle will exist [4]. Diracs Theorem (1952) Theorem 1. 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, then G has a Hamiltonian cycle. Denition 9. A simple graph is a graph with no loops of parallel edges [3]. Denition 10. A degree, d(v), of a vertex is the total number of edges incident with that vertex (loops are incident twice) [3]. As an illustration of Diracs Theorem, consider the wheel on six vertices, W6 (Figure 1). In this graph, minimum degree = 3 6 , so it is Hamil2 tonian. Traversing the vertices in numerical order 1 6 and back to 1 yields a Hamilton cycle. Proof. 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). 2 We now proceed to a contradiction. Firstly, 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. Consider, then, the insertion of an edge which is missing from G. If this insertion does not complete a Hamiltonian circuit, then leave the edge in the graph. If it does complete a Hamiltonian circuit, take the edge back out. Go around G doing this at each missing edge. The order in which one tries the missing edges is 7

unimportant. At the end of this tour, the resulting graph G will still be non-Hamiltonian since no Hamiltonian circuit is ever allowed to remain intact, 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). Adding edges certainly does not diminish the degree of any vertex. Hence every vertex of G has degree at least n . Since G is non-Hamiltonian, it 2 cannot contain all possible edges. Suppose the edge between vertices v1 and vn is missing. Putting in this edge would complete a Hamiltonian circuit because G is saturated. Thus, even without the edge v1 vn , the graph G must contain a Hamiltonian path from v1 to vn (inserting the edge v1 vn merely completes this path into a cycle). Let us denote the order of the n vertices in this path by v1 , v2 , v3 , ..., vn1 , vn . Now if the vertex v1 happens to be joined to the vertex vi , we ask whether the vertex vn could possibly be joined to vi1 ? The answer is no. For, if vn were joined to vi1 , then G would contain the Hamiltonian cycle v1 vi vi+1 ...vn vi1 vi2 ...v2 v1 . This is impossible since G is non-Hamiltonian. While v1 is not joined to vn , we do know that v1 has degree at least n . Thus v1 is joined to at least n 2 2 vertices vi where i runs from 2 to n 1. Consequently, there are at least n 2 vertices vi1 , where i 1 ranges from 1 to n 2, to which vn cannot possibly be joined. Since loops are not permitted, vn cannot be joined to itself, either. Altogether, then, there are more than n vertices to which 2 vn cannot be joined. This leaves fewer than n vertices to which vn can be 2 joined, contradicting the given fact that its degree is at least n [6]. 2 Ores Theorem (1960) Theorem 2. 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, then G has a Hamiltonian cycle. The wheel, W6 , also satises Ores Theorem. The sum of the degrees of nonadjacent vertices (i.e., deg(2) + deg(6), or deg(1) + deg(5), etc.) is always 6, which is the order of the graph. Proof. Arguing by contradiction, we suppose that G is a graph which satises the hypothesis of Ores Theorem but is not Hamiltonian. We also may suppose that G is maximal with these properties, so that the addition of any edge to G produces a Hamiltonian graph. (We add new edges joining previously non-adjacent vertices as long as G remains non-Hamiltonian. Adding a new edge does not decrease the degree of any vertex, and does not create any new non-adjacent pair of vertices, so the degree condition remains true. 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, so it has a non-adjacent pair of vertices x and y. Since G is maximal non-Hamiltonian, the graph

obtained by adding the edge e = {x, y} is Hamiltonian; and a Hamiltonian cycle in this graph must contain e. So G itself contains a Hamiltonian path (x = v1 , e2 , v2 , ..., vn = y). Now let A be the set of vertices adjacent to x; and let B = {vi : vi1 is adjacent to y} . (Since y is not adjacent to vn = y, this set is well-dened.) By assumption, |A| + |B| n. But the vertex v1 = x does not belong to either A or B; so |A B| n 1. It follows that |A B| 1, and so there is a vertex vi lying in both A and B. Now we obtain a contradiction by constructing a Hamiltonian cycle in G. Starting at x = v1 , we follow the path v2 , v3 , ... as far as vi1 . Now vi1 is adjacent to y (since vi B), so we go to y = vn at the next step. Then we follow the path backwards through vn1 , ... as far as vi , and then home to v1 (this edge exists because vi A) [2]. The result is best possible in some sense. Consider the graph with 2m + 1 vertices x1 , ..., xm , y1 , ..., ym+1 , and having as edges all pairs {xi , yj }. (This is a complete bipartite graph.) It is not Hamiltonian; for any edge crosses between the sets A = {a1 , ..., am } and B = {b1 , ..., bm }, and so a path of odd lengh starting in A or both in B, and the sum of their degrees is 2m + 2 = n + 1 or 2m n 1 respectively [2].

Methods of Solving TSP

Metods of solving TSP could be split into two categories: exact algorithms and heuristic (approximation) algorithms. 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. 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. Algorithms that construct feasible solutions, and thus upper bounds for the optimum value, are called heuristics. These solution strategies produce answers but without any quality guarantee as to how far o they may be from the optimal answer. In order to know about the closeness of the upper bound to the optimum value, one must also know a lower bound on the optimum value. If the upper and lower bound coincide, a proof of optimality is achieved. If not, a conservative estimate of the true relative error of the upper bound is provided by the dierence of the upper and the lower bound divided by the lower bound. Thus, one needs both upper and lower bounding techniques to nd optimal solutions to hard combinatorial problems or even to obtain solutions meeting a quality guarantee [5]. 9

Exact algorithms The most direct solution would be to try all permutations (ordered combinations) and see which one is cheapest (using brute force search). The running time for this approach lies within a factor of O(n!), the factorial of the number of cities, so this solution becomes impractical even for only 20 cities. Using inclusionexclusion method, the problem can be solved in time within a polynomial factor of 2n and polynomial space. Improving these time bounds seems to be dicult. For example, it is an open problem if there exists an exact algorithm for TSP that runs in time O(1.9999n ) [13]. Other approaches include: Various branch-and-bound algorithms, which can be used to process TSPs containing 40-60 cities. Progressive improvement algorithms which use techniques reminiscent of linear programming. Works well for up to 200 cities. Implementations of branch-and-bound and problem-specic cut generation; this is the method of choice for solving large instances. This approach holds the current record, solving an instance with 85,900 cities [1]. An exact solution for 15,112 German towns from TSPLIB was found in 2001 using the cutting-plane method proposed by George Dantzig, Ray Fulkerson, and Selmer Johnson in 1954, based on linear programming. The computations were performed on a network of 110 processors located at Rice University and Princeton University. The total computation time was equivalent to 22.6 years on a single 500 MHz Alpha processor. In May 2004, the travelling salesman problem of visiting all 24,978 towns in Sweden was solved: a tour of length approximately 72,500 kilometers was found and it was proven that no shorter tour exists.In March 2005, the travelling salesman problem of visiting all 33,810 points in a circuit board was solved using Concorde TSP Solver: a tour of length 66,048,945 units was found and it was proven that no shorter tour exists. The computation took approximately 15.7 CPU years. In April 2006 an instance with 85,900 points was solved using Concorde TSP Solver, taking over 136 CPU years [1]. Heuristic and approximation algorithms Various heuristics and approximation algorithms, which quickly yield good solutions have been devised. Modern methods can nd 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. 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. This algorithm quickly yields an eectively short route. For N cities randomly distributed on a plane, the algorithm averagely yields length = 1.25 exact 10

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

4.1

Branch and Bound Method

TSP seeks a minimal-cost Hamilton circuit in a complete graph having associated cost matrix C. Entry cij in C is the cost of using the edge from the ith vertex to the jth vertex. The rst approach is to systematically consider all 11

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

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, we consider subtracting a constant only from columns with all current entries positive. The only such column in Table 2 is column 4, whose smallest value is 1. So we subtract 1 from the last column in Table 2 to get the matrix in Table 3. Every row and column in Table 3 now contains a 0 entry. 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. 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, and hence a minimal tour using Table 1 must cost at least 16. In general, 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. Now we are ready for the branching part of the branch and bound method. We look at an entry in Table 3 that is equal to 0. Say c12 . Either we use c12 or we do not use c12 . We branch on this choice. In the case that we do not use c12 , we represent the no-c12 choice by setting c12 = . The smallest value in row 1 of the altered Table 3 is now c14 = 3, and so we can subtract this amount from row 1. Similarly, we can subtract 1 from from column 2. If we do not use entry c12 , we obtain the new cost matrix in Table 4. Hence, any tour for the original problem (Table 1) that does not use c12 must cost at least 16 + (3 + 1) = 20. If we use c12 to built a tour for Table 3, then the rest of the tour cannot use another entry in row 1 or column 2; also entry c21 must be set to (to avoid subcircuit x1 x2 x1 ). The new smallest value of the reduced matrix in row 2 is 1, and so we subtract 1 from row 2 to obtain the cost matrix in Table 5. The lower bound for a tour in Table 5 using c12 is now 16 + 1 = 17. Since our lower bound of 17 is less than the lower bound of 20 when we do 13

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

From

To 3 4

1 0

3 0

Table 6: TSP with four vertices (continued)

branch-and-bound technique. At each stage, we should pick as the next entry on which to branch (use or do not use the entry), the 0 entry whose maximizes the increase in the lower bound. In Table 3, 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). So c43 would theoretically have been a better entry than c12 to use for the rst branching, 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].

4.2

Approximate Algorithm: Nearest-Neighbor Strategy

The second approach is a quicker algorithm for obtaining good (near-minimal) tours, when the costs are symmetric (i.e., cij = cji) and the costs satisfy the triangle inequality cik cij + cjk . These two assumptions are satised in most TSP. After describing the algorithm and giving an example of its use, we will prove that at worst the approximate algorithms tour is always less than twice the cost of a true minimal tour. A bound of twice the true minimum may sound bad, but in many cases where a ballpark gure is needed (and the exact minimal tour can be computed later if needed), such a bound is quite acceptable. Futhermore, in practice our approximate algorithm nds a tour that is close to the true minimum. This algorithm uses a successive nearest-neighbor strategy. Approximate Traveling Salesman Tour Construction 1. Pick any vertex as a starting circuit C1 consisting of 1 vertex. 2. Given the k-vertex circuit Ck , k 1, nd the vertex zk not on Ck that is closest to a vertex, call it yk , on Ck . 3. Let Ck+1 be the k+1-vertex circuit obtained by inserting zk immediately in front of yk in Ck . 4. Repeat steps 2 and 3 until a Hamilton circuit (containing all vertices) is formed. Example: Approximate Traveling Salesman Tour Let us apply the proceding algorithm to the 6-vertex TSP whose cost matrix is given in Figure 3.22. Name the vertices x1 , x2 , x3 , x4 , x5 , x6 . We will start with x1 as C1 . Vertex x4 is closest to x1 , and so C2 is x1 x4 x1 . Vertex x3 is the vertex not in C2 closest to a vertex in C2 , namely, closest to x4 , thus 15

C3 =x1 x3 x4 x1 . There are now two vertices, x2 and x6 , 3 units from vertices in C3 . Suppose we pick x2 . It is inserted before x3 to obtain C4 =x1 x2 x3 x4 x1 . Vertex x6 is still 3 units from x1 , so we insert x6 before x1 , obtaining C5 =x1 x2 x3 x4 x6 x1 . Finally, x5 is within 4 units of x3 and x6 . Inserting x5 before x6 , we obtain our near-minimal tour C6 =x1 x2 x3 x4 x5 x6 x1 , whose cost we compute to be 19. 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). The length of the approximate tour was not that close to an optimal length, then by trying other vertices as the starting vertex (that forms C1 ) and applying the algorithm, we will get other near-minimal tours. 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]. Theorem 3. The cost of the tour generated by the approximate tour construction is less than twice the cost of the minimal traveling salesman tour. Conclusion The importance of the TSP is that it is a representative of a larger class of problems known as combinatorial optimization problems. The TSP problem belongs in the class of combinatorial optimization problems known as NPcomplete. Specically, if one can nd an ecient algorithm (i.e., an algorithm that will be guaranteed to nd the optimal solution in a polynomial number of steps) for the traveling salesman problem, then ecient algorithms could be found for all other problems in the NP-complete class. To date, however, no one has found a polynomial-time algorithm for the TSP. Even though the problem is computationally dicult, a large number of heuristics and exact methods allows us to solve some instances with tens of thousands of cities can be solved. So, let us hope, that as our understanding of the underlying mathematical structure of the TSP problem improves, and with the continuing advancement in computer technology, we will be able to tackle this problem in the nearest future.

16

References
[1] D.L. Applegate, R.E. Bixby, V.Chvtal, W.J. Cook, The Traveling Salesa man Problem, A Computational Study, Princeton University Press, Princeton and Oxford, 2006. [2] P.J. Cameron, Combinatorics: topics, techniques, algorithms, Cambridge University Press, 1994. [3] V. Chachra, P.M. Ghare, J.M. Moore, Applications of Graph Theory Algorithms, Elsevier North Holland, Inc., 1979. [4] M. DeLeon, A Study of Sucient Conditions for Hamilton Cycles, http://www.rose-hulman.edu/mathjournal/archives/2000/vol1-n1/ paper4/v1n1-4pd.PDF. [5] K. Homan, M.Padberg, Traveling Salesman Problem, http://iris.gmu. edu/~khoffman/papers/trav_salesman.html. [6] R. Honsberger, The Story of Louis Psa, http://www.math.uwaterloo. o ca/navigation/ideas/articles/honsberger/index.shtml. [7] E.L. Lawler, J.K. Lenstra, A.H.G. Rinnooy Kan, D.B. Shnoys, The Traveling Salesman Problem, John Wiley & Sons, Ltd., 1985. [8] A. Tucker, Applied Combinatorics, John Wiley & Sons, Inc., 2007. [9] http://en.wikipedia.org/wiki/Dodecahedron. [10] http://en.wikipedia.org/wiki/Glossary_of_graph_theory. [11] http://en.wikipedia.org/wiki/NP-complete. [12] http://en.wikipedia.org/wiki/Polynomial_time. [13] http://en.wikipedia.org/wiki/Travelling_salesman_problem.

17

You might also like