0% found this document useful (0 votes)
56 views

The Travelling Salesman Problem

The travelling salesman problem involves finding the shortest route for a salesman to visit each city once and return home. It can be modeled as finding a minimum weight Hamilton cycle in a weighted complete graph. While no efficient algorithm solves it exactly, Christofides' approximation algorithm finds a route within a known bound of the optimal solution. It works by computing a minimum spanning tree, finding odd-degree vertices, adding a perfect matching between them, and tracing the resulting Eulerian multigraph. The travelling salesman problem is NP-hard, so approximation algorithms are useful for finding reasonably good solutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

The Travelling Salesman Problem

The travelling salesman problem involves finding the shortest route for a salesman to visit each city once and return home. It can be modeled as finding a minimum weight Hamilton cycle in a weighted complete graph. While no efficient algorithm solves it exactly, Christofides' approximation algorithm finds a route within a known bound of the optimal solution. It works by computing a minimum spanning tree, finding odd-degree vertices, adding a perfect matching between them, and tracing the resulting Eulerian multigraph. The travelling salesman problem is NP-hard, so approximation algorithms are useful for finding reasonably good solutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

202 Matchings and Independent Sets

5.5 The Travelling Salesman Problem

The Travelling Salesman Problem

A travelling salesman, starting in his own town, has to visit each of towns where

he should go to precisely or at least once and return his home by the shortest route.
This is known as the travelling salesman problem.

Contrast with the Chinese Postman Problem


At first glance, this problem is extremely similar to the Chinese postman problem.
However, in contrast with the Chinese postman problem, no efficient algorithm for
solving the travelling salesman problem is known as far. We will here describe an
algorithm of Christofides (1976) for approximately solving the travelling salesman
problem, following a comprehensive treatment of Gibbons (1985).

Graphic Models-Two Definitions


Use a connected undirected weighted graph (G, w) to model the traffic system
that the travelling salesman has to visit. We call a closed walk that contains each
vertex of G at least once to be a salesman route. In the graph theoretic language,
the travelling salesman problem can be stated as finding a minimum
weight Hamilton cycle or a minimum weight salesman route in (G, w).
Such a Hamilton cycle, if exists, is called an optimal cycle; such a salesman route,
which exists certainly, is called an optimal route.

In general, the two definitions of the travelling salesman problem may


have two different solutions even if optimal cycles exist. For example, for the
weighted graph (G, w) in Figure 5.15, it clearly contains an optimal cycle (x, y, z, x)
of weight 5 and an optimal route (x, z, x, y, x) of weight 4. As his travelling route,
any wise salesman would choose the latter rather than the former.

x x

1 1 1 1

y z y z
3 2(y, x, z)

Figure 5.15: (a) An optimal cycle; (b) an optimal route


5.5. THE TRAVELLING SALESMAN PROBLEM 203

Generally speaking, a connected weighted graph contains no optimal cy-


cle perhaps, but contains an optimal route certainly. In the following discus-
sion of the travelling salesman problem, we always adopt the second definition,
that is, to find an optimal route in a given weighted graph.

Let (G, w) be a connected undirected weighted graph. If for any two distinct
vertices x and y of G, the weighted distance w(x,y), the minimum-weight of any
xy-path in (G, w), satisfies

w(x, y) ≤ w(x, z) + w(z, y), ∀ z ∈ V (G) \ {x, y},

then we will say that the triangle inequality is satisfied in (G, w).

Weighted Complete Graphs

For an undirected graph G, we can construct a weighted complete graph (Kv , w′ )


with vertex-set as the same as G, where the weight w′ (xy) of the edge xy of Kv is
the weighted distance w(x, y) between x and y in (G, w). It is clear that the triangle
inequality is satisfied in (Kv , w′ ), and each edge xy of Kv corresponds to an xy-path
P in G with w(P ) = w′ (xy) or an edge xy in G with w(xy) = w′ (xy).

For example, see Figure 5.15, (K3 , w′ ) in (b) is constructed from (G, w) in (a)
by the above way.

x x

1 1 1 1

y z y z
3 2(y, x, z)
204 Matchings and Independent Sets

Basic Theory-Relationships

Lemma 5.12 (i) For any Hamilton cycle C in (Kv , w′ ), there exists a
salesman route R in (G, w) with w(R) = w′ (C).
(ii) For any optimal route R in (G, w), there exists a Hamilton cycle C

in (Kv , w′ ) with w′ (C) = w(R).

Proof: (i) A required salesman route R in (G, w) can be constructed as follows.


For xy ∈ E(C),
if xy ∈ E(G), then w(xy) = w′ (xy), and set xy ∈ R;
/ E(G), then G contains an xy-path P with w(P ) = w′ (xy), and set
if xy ∈
P ⊆ R.
(ii) A required Hamilton cycle in Kv can be constructed as follows. Trace R,
starting at a vertex x, and delete the vertex that has visited before in turn. Then re-
maining vertices, in the original order in R, institute a Hamilton cycle C in (Kv , w′ ),
which satisfies w′ (C) = w(R).

Theorem 5.12 An optimal route R in (G, w) corresponds to an optimal


cycle C in (Kv , w′ ) with w′ (C) = w(R), and vice versa.

Proof: Suppose that R is an optimal route in (G, w). By Lemma 5.12(ii), there
exists a Hamilton cycle C in (Kv , w′ ) with w′ (C) = w(R). If C is not optimal, let
C ∗ be an optimal cycle in (Kv , w′ ), then w′ (C ∗ ) < w′ (C). Thus, by Lemma 5.12(i),
there exists a salesman route R′ in (G, w) such that w(R′ ) = w′ (C ∗ ). Thus,

w(R) ≤ w(R′ ) = w′ (C ∗ ) < w′ (C) = w(R).

This contradiction implies that C is an optimal cycle in (Kv , w′ ).


Conversely, suppose that C is an optimal cycle in (Kv , w′ ). Then, by Lemma
5.12(i), there exists a salesman route R in (G, w) with w(R) = w′ (C). If R is not

optimal, and let R′ be an optimal route in (G, w). Then w(R′ ) < w(R). By Lemma
5.12(ii), there is a Hamilton cycle C ′ in (Kv , w′ ) with w′ (C ′ ) = w(R′ ). Thus,

w′ (C ′ ) = w(R′ ) < w(R) = w′ (C) ≤ w′ (C ′ ).

This contradiction implies that R be an optimal route in (G, w).


5.5. THE TRAVELLING SALESMAN PROBLEM 205

Transform of Problem

By Theorem 5.12, finding an optimal route in (G, w) can be referred to


finding an optimal cycle in (Kv , w′ ) within which the triangle inequality
is satisfied.

If the triangle inequality is satisfied in (G, w), then G is a spanning subgraph of


Kv , and w = w′ |E(G).
Thus, if C is an optimal cycle in (G, w), then C is certainly a Hamilton cycle
in (Kv , w′ ), and w(C) = w′ (C). Conversely, suppose that C is an optimal cycle

in (Kv , w′ ). If C ⊆ G, then C is an optimal cycle in (G, w); if C 6⊆ G, then, by


Theorem 5.12, there is an optimal route R in (G, w) such that w(R) = w′ (C).
This shows that if the triangle inequality is satisfied in (G, w), then an
optimal cycle in (Kv , w′ ) corresponds to either an optimal cycle or an
optimal route in (G, w).
However, if the triangle inequality is not satisfied in (G, w), then an
optimal cycle in (Kv , w′ ) would correspond to an optimal route rather
than an optimal cycle in (G, w).

Thus, we only need to find an optimal cycle in (Kv , w′ ) within which


the triangle inequality is satisfied.

Intractability: NP-completeness

An immediately obvious method is to enumerate all Hamilton cycles and then by


comparison to find the minimum. This approach, although straightforward, presents
us with an unacceptably large amount of computation. For a complete undirected
1
graph Kv , there are 2 (v − 1) ! essentially different Hamilton cycles. Unfortunately,
as far no efficient algorithm is known for finding an optimal cycle in a weighted
complete graph. In fact, it has been proved to be an N P -hard problem (see,
for example, Garey and Johnson (1979)), even if weight of every edge is restricted
to one and two, see Papadimitriou and Yannakakis (1993).
206 Matchings and Independent Sets

Necessarity of Approximation Algorithms

For the travelling salesman problem, as indeed for any other intractable problem,
it is useful to have a polynomial-time algorithm which will produce, within known
bound, an approximation to the required result. Such algorithms are called approx-
imation algorithms. We now describe the best one in these known algorithms for
solving the travelling salesman problem, discovered by Christofides in 1976.

Christofides’ Approximation Algorithm

1. Find the weighted distance matrix W′ of (G, w) and construct (Kv , w′ ).

2. Find a minimum tree T in (Kv , w′ ).

3. Find the set V ′ of vertices of odd degree in T and a minimum weight perfect
matching M in G′ = Kv [V ′ ].

4. Find an Euler circuit C0 = (x, y, z, · · · , x) in G∗ = T ⊕ M .

5. Starting at vertex x, we trace C0 and delete the vertex that has visited before
in turn. Then remaining vertices, in the original order in C0 , determine a
Hamilton cycle C in Kv , which is a required approximation optimal cycle.

In the algorithm,
the Dijsktra’s (see Section 2.5) algorithm can be used in Step 1;
the Prim’s algorithm (see Section 2.4) can be used in Step 2.
In Step 3, V ′ is nonempty certainly, and |V ′ | is even by Corollary 1.1. Since
G′ = Kv [V ′ ] is a complete graphs of even order, it must contain a perfect matching
M by Corollary 5.2.1. Edmonds and Johnson (1970) have presented an efficient
algorithm for finding minimum weight perfect in any weighted graph.
In Step 4, every vertex of G∗ is even degree and, hence, G∗ is eulerian by Corollary
1.7.2. Using the Edmonds and Johnson’s algorithm can find an Euler circuit C0 in
G∗ .
All of the above-mentioned algorithms are efficient, thus, Christofides’
approximation algorithm is efficient.
5.5. THE TRAVELLING SALESMAN PROBLEM 207

Example 5.5.1 Consider the weighted graph (G, w) in Figure 5.16 (a), within
which the triangle inequality is satisfied. (b) shows its weighted distance ma-
trix W′ ; (c) shows (K6 , w′ ) and a minimum tree T . V ′ = {x2 , x3 , x4 , x6 } is
the set of vertices of odd degree in T , M = {x2 x3 , x4 x6 } is a minimum weight

perfect matching of K6 [V ′ ]. G∗ = T ⊕ M , shown in (d), has an Euler circuit


C0 = (x1 , x5 , x2 , x3 , x2 , x4 , x6 , x1 ). Deleting a repeated vertex x2 from C0 results
in a Hamilton cycle C = (x1 , x5 , x2 , x3 , x4 , x6 , x1 ) in (K6 , w′ ) with w′ (C) = 12.
Because the edge x3 x4 of C is not in G, C corresponds a salesman route P =
(x1 , x5 , x2 , x3 , x2 , x4 , x6 , x1 ) with w(P ) = 12 which visits each vertex of G at least
once.
Notice that G contains only one Hamilton cycle C shown in (a), and so is optimal.
However, w(C) = 13 > 12 = w(P ).

x5

4
x6 3 x4 0 1
BB CC
0 2 2 4 1 1
2 2 0 1 4 2 3
1
=B
B 2 1 0 4 3 3 CC
1 3 W′
B 4 3 4 0 4 3 CA
1 2 3 4 0 2
2 1 3 3 3 2 0
x1 x3

2 1
x2

(a) (G, w) and an optimal cycle C (b) the weighted distance matrix of (G, w)

x5 x5

2 4
3 3
x6 3 x4 x6 x4
2
1 1
2
1 4 3 4 1 3
3
x1 2 x3 x1 x3
3 1
2 1
1
x2 x2

(c) (K6 , w′ ) and a minimum tree (d) G∗ = T ⊕ M

Figure 5.16: An application of Christofides’ algorithm


208 Matchings and Independent Sets

Performance Ratio of Approximation Algorithms


A quality measurement of an approximation algorithm is the performance ra-
tio. Let L be a value obtained by an approximation algorithm and L0 be an exact
value. We require a quality guarantee for the approximation algorithm which could,

for a minimization (resp. maximization) problem, be stated in the form:


L L0
1≤ ≤ α (resp. 1 ≤ ≤ α). (5.10)
L0 L
We would, of course, like α to be as close to one as possible. For an approximation
algorithm, if there exists a constant α such that (5.10) holds, then the approximation
algorithm is called an α-approximation algorithm.

Theorem 5.13 Christofides’ algorithm is a 32 -approximation algorithm.

Proof: Suppose that the triangle inequality is satisfied in a weighted complete


graph (Kv , w), C0 and C are an Euler circuit and a Hamilton cycle, respectively,
obtained by Christofides’ approximation algorithm. Then

w(C) ≤ w(C0 ) = w(T ) + w(M ), (5.11)

where T is a minimum spanning tree of (Kv , w), M is a minimum weight perfect


matching in G′ = Kv [V ′ ], and V ′ is the set of vertices of odd degree in T .
Let C ∗ be an optimal cycle in (Kv , w) and T ′ be a spanning tree of Kv obtained
by deleting any one edge from C ∗ . Then

w(T ) ≤ w(T ′ ) < w(C ∗ ) (5.12)

Let C ′ be a Hamilton cycle in G′ = Kv [V ′ ] obtained by following C ∗ . Because


the triangle inequality is satisfied in (Kv , w), w(C ′ ) ≤ w(C ∗ ). Since C ′ is an even
cycle, the set of edges of C ′ can be divided into two edge-disjoint perfect matchings
M1 and M2 . Without loss of generality, suppose w(M1 ) ≤ w(M2 ). Thus, M1 is a
perfect matching in G′ and
1 1
w(M ) ≤ w(M1 ) ≤ w(C ′ ) ≤ w(C ∗ ). (5.13)
2 2
By (5.11), (5.12) and (5.13), we have
1 3
w(C) < w(C ∗ ) + w(C ∗ ) = w(C ∗ ),
2 2
that is,
L0 w(C) 3
= <
L w(C ∗ ) 2
as desired.
5.5. THE TRAVELLING SALESMAN PROBLEM 209

Remarks

No such an approximation algorithm for the travelling salesman problem is as


far found whose performance ratio is smaller than one of Christofides’ algorithm.
Although this algorithm can efficiently solve one class of travelling salesman problem,
Sahni and Gonzalez (1976) have proved that unless the N P -complete problems have
solutions in polynomial-time, there is no algorithm with a constant of performance
ratio for the optimal cycle problem in (Kv , w) within which the triangle inequality
is not satisfied.
There is a great volume of literature associated with the travelling salesman
problem. See, for example, Bellmore and Nemhauser (1968) for a survey of earlier
works and Lawler et al. (1985) for more.

Exercise 5.5.4: Solve the travelling salesman problem in the following traffic system
(the minimum weight is 8117)(cited from Mathematics Today, 1978).

618 623 427 252


510 726 413 500
486 211
189
389

467
485 699 415
161

246
445
252
348
348 436
101

489
459

168

504
548 195
523 610 636
426
574
386

294

535
540

355

702 653
338
593

522
399
731

137
445 374
769 985 477

(Exercise 5.5.5)

Thank You !

You might also like