Approximating the Metric TSP in Linear Time Davide Bil`o∗
Luca Forlizzi†
Guido Proietti‡
Abstract Given a metric graph G = (V, E) of n vertices, i.e., a complete graph with an edge cost function c : V × V 7→ R≥0 satisfying the triangle inequality, the metricity degree © c(x,y) ª £ 1 ¤ of G is defined as β = maxx,y,z∈V c(x,z)+c(y,z) ∈ 2 , 1 . This value is instrumental to establish the approximability of several NP-hard optimization problems definable on G, like for instance the prominent traveling salesman problem, which asks for finding a Hamiltonian cycle of G of minimum total cost. In fact, this problem can be approximated quite accurately depending on the metricity degree of G, namely by a 2 2−β 2 2 ratio of either 3(1−β) or 3β 2 3β −2β+1 , for β < 3 or β ≥ 3 , respectively. Nevertheless,
these approximation algorithms have O(n3 ) and O(n2.5 log1.5 n) running time, respectively, and therefore they are superlinear in the Θ(n2 ) input size. Thus, since many real-world problems are modeled by graphs of huge size, their use might turn out to be unfeasible in the practice, and alternative approaches requiring only linear time are sought. With this restriction, the currently most efficient available solution is given by the classic double-tree shortcutting algorithm, which in O(n2 ) time returns a solution 2 within a factor 2β 2 2β −2β+1 from the optimum. In this paper, we develop an enhanced but still linear-time version of this latter algorithm, which returns a 2β-approximate solution, and thus always outperforms its counterpart. Computational experiments suggest that our algorithm computes solutions of comparable quality to those produced by the Christofides algorithm, while requiring a significantly smaller running time. Keywords: Traveling Salesman Problem, Metric Graphs, NP-hardness, Linear-time Approximation Algorithms.
1
Introduction
The Traveling Salesman Problem (TSP, for short) is one of the most prominent and studied combinatorial optimization problems. It is defined as follows: Given a complete, undirected graph G = (V, E) of n vertices, with an edge cost function c : V × V 7→ R≥0 , find a Hamiltonian cycle H = (V, E(H)) P of G (i.e., a simple cycle that spans all the vertices of G) of minimum total cost c(H) = e∈E(H) c(e). The TSP is intractable and does not admit any polynomial-time constant-ratio approximation algorithm, unless P = NP. On the other hand, when the edge cost function induces a metric on G (i.e., for any x, y, z ∈ V, c(x, z) ≤ c(x, y) + c(y, z)), things improve sensibly. ∗
Institut f¨ ur Theoretische Informatik, ETH, Z¨ urich, Switzerland. E-mail:
[email protected]. Dipartimento di Informatica, Universit` a di L’Aquila, Italy. E-mail:
[email protected]. ‡ Dipartimento di Informatica, Universit` a di L’Aquila, Italy, and Istituto di Analisi dei Sistemi ed Informatica “A. Ruberti”, CNR, Roma, Italy. E-mail:
[email protected]. †
1
More specifically, in such a case the problem is known as the metric TSP, and it can be approximated by the Christofides algorithm [4] within an approximation factor of 3/2, but still it remains NP-hard to find an approximate solution for it within a factor better than 220/219 [9]. In some special metric cases, however, the approximability of the problem becomes really effective. For instance, when vertices of G are actually points in a fixeddimension Euclidean space, and the edge cost function is their Euclidean distance, then the problem (also known as geometric TSP) admits a polynomial-time approximation scheme [1]. Getting back to the general metric case, it is interesting to notice that one can define suitable approximation on the metricity degree of G, which is defined n algorithms o depending £1 ¤ c(x,y) as β = maxx,y,z∈V c(x,z)+c(y,z) ∈ 2 , 1 . More precisely, for 21 ≤ β ≤ 23 , there exists a 2−β 3(1−β) -approximation
2 3 < β ≤ 1, the best approximation algorithm 3β 2 . In the following, we will therefore as3β 2 −2β+1
algorithm [2],1 while for
is still the Christofides’ one, with a ratio of sume that the input graph is β-metric (i.e., its metricity degree is equal to β), and the metric TSP with this additional parameter will be correspondingly named the β-metric traveling salesman problem (β-MTSP for shortness, also known as strengthened-metric TSP). Both the aforementioned best-known approximation algorithms for the β-MTSP have a shortcoming, however: their time complexity is superlinear in the input size. Indeed, the former runs in O(n3 ) time,2 while the latter runs in O(n2.5 log1.5 n) time [8]. From a practical point of view, this might result in a severe drawback, since often the input graph is massive. For instance, the well-known benchmark TSPLIB of TSP instances [10] contains several input graphs with order of 105 vertices (most of them coming from roadmaps, and then most likely metric), for which these algorithms become computationally expensive. In such a case, a linear-time approximation algorithm would be desirable, even if a (possibly small) price in terms of performance ratio had to be paid. In this paper, we exactly aim at this goal. We emphasize that insisting on this trade-off is not completely novel, and linear-time constrained approximation algorithms have been already developed in the past, but as far as we know, this was done only for high-degree polynomial-time solvable problems (e.g., the weighted matching problem [6] and the watchman route problem [12]). Actually, designing a linear-time approximation algorithm for the β-MTSP by starting from the efficient implementation given in [8] of the Christofides algorithm sounds prohibitive, since this uses the very efficient O(n2.5 log1.5 n) time approximate minimum-cost perfect matching algorithm as a brick for constructing a feasible solution (and in the worst case such an algorithm runs on a graph having Θ(n) vertices). The same holds for the algorithm of B¨ockenhauer et al. [2], which makes use of the long-standing O(n3 ) time procedure for computing a maximum-cost perfect 2-matching. Thus, a different approach needs to be used. A basic approximation algorithm for the metric TSP is the well-known double-tree shortcutting algorithm, which works as follows: first, construct a Minimum Spanning Tree (MST, 1
Notice that for β = 1/2, all the graph edges have the same cost, and the problem becomes trivial. This bound can be obtained after conditioning the costs of the input graph G in such a way that the problem of determining a minimum-cost cycle cover of G, which represents the core procedure of the algorithm in [2], reduces to that of finding a maximum-cost simple 2-matching in the transformed graph, which can be solved in O(n3 ) time [7]. 2
2
for short) T of G; after, construct a Eulerian tour D on the multigraph G0 = T ∪ T , and finally return a Hamiltonian tour H from D by shortcutting in G repeated vertices in the Eulerian tour. This algorithm (which we will call Double-MST in the rest of the paper) is easily seen to guarantee a 2-approximation ratio, and then it turns out to be a 2β 2 -approximation algorithm for the β-MTSP [2].3 As a matter of fact, it is then 2β 2 −2β+1 always outperformed by its super-linear counterparts. In an effort of improving this gap, by maintaining the linear-time constraint, we therefore develop an easy modification of such an algorithm, which allows us to obtain, by means of an accurate analysis, a 2β-approximate solution, thus beating the Double-MST for any 1/2 < β < 1. This improvement is effective, since as a side result, we show that for any 1/2 < β < 1, the performance ratio of the Double-MST is strictly larger than 2β. As a matter of fact, the reduction of the theoretical gap with respect to the superlinear approximation algorithm is significant: for instance, for all 1/2 < β ≤ 3/4, our algorithm is only about 5% away from it in the worst case, while for the Double-MST this gap raises to about 26%. Moreover, preliminary experimental results suggest that our algorithm computes solutions of comparable quality to those produced by the Christofides algorithm, while requiring a significantly smaller running time. It is worth noticing that the Double-MST approach is at the basis of one of the bestperforming heuristics available for the TSP [3, 5]. This heuristic computes in O(4d n2 ) time (where d denotes the maximum node-degree in T ) the Hamiltonian cycle obtained by performing a minimum-weight shortcutting of the Eulerian cycle D. Extensive computational experiments show that this strategy allows very good approximations, often better that those obtained with heuristics derived by the Christofides algorithm, although it requires a running time which might be exponential. However, despite its high performances registered in practice, no theoretical approximation guarantee better than that of the basic Double-MST was exhibited in [5]. Our analysis immediately shows that the algorithm given in [5] has an actually approximation ratio strictly smaller than 2, for any β < 1. Due to the practical relevance heuristics based on the minimum-weight shortcutting of D, we see this as a noteworthy consequence of our results. The paper is organized as follows: in Section 2 we recall and prove some useful properties of β-metric graphs; in Section 3 we present our algorithm and we give a tight analysis for its guaranteed approximation ratio; in Section 4, we provide a graphical comparison (in terms of approximation ratio) between our algorithm and its counterparts as well as preliminary experimental results, which emphasize the the approximation quality obtained by our approach; finally in Appendix A, we show that the performance ratio of the Double-MST algorithm is strictly larger than 2β.
2
Preliminaries
We prove a useful property about the cost of an edge subtended by a path in a metric graph. From now on, we will assume that the input graph G = (V, E) is an instance of the β-MTSP. Thus, we will say that G satisfies the β-triangle inequality. Moreover, paths and cycles will be expressed explicitly throughout the sequence of constituting vertices. 3
This ratio results from the fact that if A is an α-approximation algorithm for the metric TSP, then A α·β 2 is an β 2 +(α−1)(1−β) 2 -approximation algorithm for the β-MTSP (see [2] for further details).
3
Lemma 1. Let P = v0 v1 . . . vk be a simple path in G of length k ≥ 3. Then c(v0 , vk ) ≤ β c(P ) − (1 − β)
k−2 X
à β
j
j=1
k−1−j X
! c(vi , vi+1 ) .
i=0
Proof. The proof is by induction on k. For the case k = 3, we have that ¡ ¢ c(v0 , v3 ) ≤ β c(v0 , v2 ) + c(v2 , v3 ) ¡ ¢ ≤ β 2 c(v0 , v1 ) + c(v1 , v2 ) + β c(v2 , v3 ) ¡ ¢ = β c(P ) − β(1 − β) c(v0 , v1 ) + c(v1 , v2 ) and the claim follows. Now, assume that for every 3 ≤ k 0 < k the claim is true, that is 0 −2 k0X −1−j kX β j c(v0 , vk0 ) ≤ β c(P 0 ) − (1 − β) c(vi , vi+1 ) , j=1
i=0
where P 0 = v0 v1 . . . vk0 . Because of the β-triangle inequality and by induction, we have that ¡ ¢ c(v0 , vk ) ≤ β c(v0 , vk−1 ) + c(vk−1 , vk ) ≤β
2
k−2 X
c(vi , vi+1 ) − (1 − β)
i=0
k−3 X
à β
j+1
k−2−j X
j=1
= β c(P ) − β(1 − β)
k−2 X
c(vi , vi+1 ) − (1 − β)
= β c(P ) − (1 − β)
j=1
3
à βj
c(vi , vi+1 )
i=0
i=0 k−2 X
!
k−3 X j=1
k−1−j X
!
à β
j+1
+ β c(vk−1 , vk )
k−2−j X
! c(vi , vi+1 )
i=0
c(vi , vi+1 ) .
i=0
The 2β-approximation algorithm
In this section we provide a refinement of Double-MST which returns a 2β-approximate solution for the β-MTSP (its pseudo-code is given in Algorithm 2). In the following, given a vertex v of the considered rooted tree T , we denote by Tv the subgraph of T induced by v and by its children in T . We call closest children of v in T the set of vertices v 0 ∈ Tv such that c(v, v 0 ) is minimum in Tv .
3.1
Algorithm analysis
In the following, we will denote by A the set of edges of T belonging to H, and by B = E(H) \ A the remaining edges in H. Observe that since the root v0 has degree 1, then edges 4
Algorithm 1 The Refined Double-MST algorithm. Input: A β-metric graph G = (V, E). 1: [Step 1.] Construct an MST T of G. 2: [Step 2.] Root T at any arbitrary vertex of degree 1. Starting from the root, do a careful depth-first search of T , i.e., a depth-first search where at each visited vertex, the next vertex to be visited is selected among its closest children in T . Let v0 , v1 , . . . , vn−1 be the sequence of vertices in the order they are visited. Output: Return the cycle H = v0 v1 . . . vn−1 v0 of G.
(v0 , v1 ), (v1 , v2 ) always belong to A. Notice also that the restriction of having a vertex of degree 1 as the root of T is only for the purpose of avoiding technicalities. All the results contained in this section can be extended to the general case in which T is rooted at any arbitrary vertex. We start by proving the following Lemma 2. For every non-leaf vertex vj of T , we have that |A ∩ E(Tvj )| = 1. Proof. Clearly, the lemma holds for j = 0. Hence, assume that j > 0. There are exactly two edges in E(H) incident to vj . One of them connects vj to vj−1 , so it does not belong to Tvj (indeed, for the depth-first search properties, vj−1 cannot be a descendent of vj ). If vj is not a leaf, one of its children is visited immediately after vj , hence (vj , vj+1 ) ∈ E(Tvj ). We now give some more definitions in view of the following developments. For any edge e ∈ E(H), let Pe denote the unique path in T joining the two endpoints of e (notice that if e ∈ A, then Pe consists of e). Because of the depth-first search properties, it is not hard to see that, for any e ∈ E(T ), there are exactly two edges of H, say e1 , e2 , that cover e, i.e., e ∈ E(Pe1 ) and e ∈ E(Pe2 ). For any e ∈ E(H), S with Pe = x0 x1 . . . xk , we define Ve as the set of vertices {x1 , x2 , . . . , xk−2 }, and V 0 = e∈E(H),|E(Pe )|≥3 Ve . The following holds: Lemma 3. Let e = (vj , vj+1 ) ∈ E(H) be such that Pe = x0 x1 . . . xk , with x0 = vj , xk = vj+1 , and assume that k ≥ 3. Then, for 1 ≤ i ≤ k − 1, xi is the parent in T of xi−1 . Proof. Since Pe is a simple path in T , all the vertices in Pe but one, say xh , have their parent in T contained in Pe . Suppose by contradiction that h < k − 1. Then xk is a descendent of xh+1 in T . It follows that xh+1 is visited after x0 and before xk . But this is not possible since (x0 , xk ) ∈ E(H) implies that xk is visited immediately after x0 . Therefore, it must be either h = k − 1 or h = k. In both cases, this implies that xk−1 is the parent of xk−2 in T , which in its turn is the parent of xk−3 in T , and so on. From this, the claim follows. Let L denote the set of leaves of T . We now prove the following Lemma 4. V 0 = V \ (L ∪ {v0 , v1 }). Proof. Lemma 3 implies that V 0 cannot contain any of the vertices in L ∪ {v0 , v1 }. Hence, in order to prove the claim, it is enough to show that any internal vertex vj of T but v0 and v1 belongs to Ve , for some e ∈ E(H). As vj is an internal vertex and because of the depth-first search properties, there is an edge in H, say e = (vh−1 , vh mod n ), with h − 1 > j, such that vh−1 is a proper descendent of vj while vh mod n is not a descendent of vj . Then, in order to conclude that vj ∈ Ve , it suffices to observe that from the depth-first search properties, vh mod n cannot be the parent of vj in T . 5
From now on, we will denote by A0 the set of edges in A but (v0 , v1 ), (v1 , v2 ). Moreover, we define a function σ : A0 → V 0 which maps each edge e ∈ A0 into the endpoint of e which is the parent in T of the other endpoint. From the above lemma and from Lemma 2, it is easy to derive that σ is a bijective function. We can now prove the following Lemma 5. For every e ∈ B such that Pe = x0 x1 . . . xk contains k ≥ 3 edges, we have that à k−1−j ! k−2 X X X j β c(xi , xi+1 ) ≥ c(σ −1 (x)). (1) j=1
i=0
x∈Ve
Proof. Grouping together terms with respect to the edge costs, the left-hand side of (1) becomes k−2 k−2 k−1−i X X X β j c(x0 , x1 ) + β j c(xi , xi+1 ). (2) j=1
i=1 j=1
By suitably rearranging its terms, (2) can be rewritten as k−2 k−1−i X X β j c(xi−1 , xi ) + β k−1−i c(xi , xi+1 ) . i=1
(3)
j=1
Now we bound the i-th term of the external summation in (3) with respect to the cost of edge σ −1 (xi ). Recall that (see [2]) for any two adjacent edges e1 , e2 of G, it is β β c(e2 ). Then, for each xi ∈ Ve it is c(σ −1 (xi )) ≤ 1−β c(xi , xi+1 ). Moreover, c(e1 ) ≤ 1−β −1 −1 c(σ (xi )) ≤ c(xi−1 , xi ), since σ (xi ) and (xi−1 , xi ) are both edges of Txi . Then we have k−2 k−1−i X X (3) ≥ β j c(σ −1 (xi )) + β k−2−i (1 − β) c(σ −1 (xi )) i=1
=
k−2 X i=1
≥
k−2 X i=1
j=1 k−2−i X j=1 k−2−i X j=1
β j + β k−2−i c(σ −1 (xi ))
k−2 X X 1 1 −1 −1 c(σ −1 (x)) + c(σ (x )) = c(σ (x )) = i i 2j 2k−2−i i=1
x∈Ve
where the last inequality holds because β ≥ 21 . We are now ready to give our main result: Theorem 1. The Refined Double-MST algorithm is a 2β-approximation algorithm for the β-MTSP.
6
S Proof. Let us start by setting B = 2≤i≤n Bi , where Bi = {e ∈ B s.t. |E(Pe )| = i}. For any e ∈ E(H), let Pe = xe0 xe1 . . . xek . We can bound the total cost of H with c(H) =
X
c(e) +
e∈A
≤
≤
X
X
c(e) +
e∈B2
c(e) + β
X
c(Pe ) +
e∈B2
X
n X X
e∈A
c(e)
k=3 e∈Bk
e∈A
c(e) + β
n X X
n X X
β c(Pe ) − (1 − β)
k−2 X
à βj
j=1
k=3 e∈Bk
c(Pe ) − (1 − β)
k=2 e∈Bk
n X X X
k−1−j X
! c(xei , xei+1 )
i=0
c(σ −1 (x))
k=3 e∈Bk x∈Ve
where the first inequality holds from the β-metricity of G and from Lemma 1, while the last inequality holds from Lemma 5. Since each edge of T is covered by exactly two edges of H, then n X X X X c(Pe ) = c(e) + 2 c(e). k=2 e∈Bk
e∈A
e∈E(T )\A
By definition, observe that each e ∈ E(H) for which Ve ⊆ V 0 is in Bj for some j ≥ 3. From this fact and because σ is bijective we can derive n X X X
c(σ −1 (x)) ≥
X
c(σ −1 (x)) =
x∈V 0
k=3 e∈Bk x∈Ve
X
c(f )
f ∈A0
(in fact, here we could prove that equality holds, since e 6= e0 ⇒ Ve ∩ Ve0 = ∅). To conclude the proof, let e∗ be a maximum-cost edge of any optimal solution H ∗ . Observe that, c(e) ≤ c(e∗ ) for every e ∈ E(T ). Indeed, let us consider the cut induced by the removal of e from T , and let e0 ∈ E(H) be an edge traversing that cut. Then, since T is an MST, we have c(e) ≤ c(e0 ) ≤ c(e∗ ). Using previous observations we have X c(H) ≤ c(v0 , v1 ) + c(v1 , v2 ) + c(e) e∈A0
+ β c(v0 , v1 ) + c(v1 , v2 ) +
≤ 2β
c(e) + 2
e∈A0
= 2β
X
c(e) +
X
e∈A0
e∈E(T )\A
X
X
e∈A0
c(e) +
X
c(e) − (1 − β)
e∈E(T )\A
X
X
c(e)
e∈A0
³ ´ c(e) + (1 + β) c(v0 , v1 ) + c(v1 , v2 ) c(e) + c(v0 , v1 ) + c(v1 , v2 ) + 2β c(e∗ )
e∈E(T )\A
≤ 2β c(T ) + 2β c(e∗ ) ≤ 2β c(H ∗ ) where the last but two inequality holds because c(e∗ ) ≥ c(e), ∀e ∈ E(T ), the last but one inequality holds because β ≥ 12 , and the last inequality follows from the fact that by removing e∗ from H ∗ , one obtains a spanning tree. 7
approximation ratio 2
3/2 4/3
1 1/2
2/3
1
β
Figure 1: The approximation ratio of our algorithm (solid line), as compared to that provided by the Double-MST (dotted) and the currently best-known approximation algorithm (dashed).
3.2
Tightness of the bound
We now show that the bound provided by Theorem 1 is tight. Let G = (V, E) be a complete graph with n = 2k + 1 vertices, such that V = {v0 , v1 , v2 , . . . , v2k−1 , v2k }. Consider the edge-cost function defined as follows: c(v0 , vi ) = 1, ∀i ≤ 2k, c(vi , vi+1 ) = 2β, ∀1 ≤ i < 2k, c(vi , vi+2 ) = 1, ∀1 ≤ i ≤ 2k − 2, c(v1 , v2k ) = 1, and all other edges have cost 2β. Since the only values of the edge costs are 1 and 2β, G satisfies the β-triangle inequality. An MST of G is the star centered in v0 . Suppose that the depth-first search visits v0 ’s children in order of increasing index. Then, the algorithm returns the solution H = v0 v1 . . . v2k−1 v2k v0 , having cost c(H) = 2 + 2β(n − 2). However, there is an optimal solution formed only by edges having cost 1: H ∗ = v1 v3 . . . v2k−1 v0 v2 v4 . . . v2k v1 . It follows that the approximation , which tends to 2β for increasing values of n. ratio is 2+2β(n−2) n
4
Discussion
In Figure 1, we provide a comparison between the three approximation algorithms for the β-MTSP discussed in this paper, namely the Double-MST, that obtained by composing the algorithms given in [4, 2], and finally our one. It is worth noticing that our algorithm induces a significant improvement in the gap with respect to the superlinear approximation algorithm: for instance, for all 1/2 < β ≤ 3/4, our algorithm is only about 5% away from it in the worst case, while for the Double-MST this gap raises to about 26%. Thus, especially for this range of values of β, from a practical point of view one can make use of our very simple linear-time algorithm—instead of pursuing a very complicate implementation of the superlinear algorithm—by only paying a little bit more in terms of approximation ratio. We started a series of computational experiments in order to check how the theoretical appeal of the Refined Double-MST translates into practice. In first place, our interest focused on discovering how the performances of our algorithm are affected by different values of β. For this reason, we used β-metric test instances with a controlled value of β, instead of more common test instances as those provided by the DIMACS Implementation Challenge. 8
β .55 .6 .65 .7 .75 .8 .85 .9 .95 1
Average approximation ratio Refined Double-MST Christofides 1.036525 1.01887 1.077623 1.041335 1.118549 1.061255 1.167194 1.085147 1.2174 1.108869 1.277498 1.131933 1.350438 1.160631 1.43198 1.188212 1.539945 1.214483 1.65324 1.25125
Table 1: Average performance ratios of the Christofides algorithm, as opposed to our proposed one.
The preliminary experiments conducted so far, were aimed to compare our algorithm against the Christofides algorithm, chosen as a reference since its theoretical and experimental properties are well studied, and provided that it enjoys an approximation ratio dependent 1 , i = 1, . . . , 10, we randomly generated 10 input βon β. More precisely, for each β = 12 +i 20 metric graphs with 1000 vertices, on which we computed the approximate solutions returned by the two algorithms. In Table 1 we report the average approximation ratios achieved on the given input instances.4 The practical appealing of our approach is confirmed by these preliminary experiments, which show that our algorithm maintains a real performance ratio significantly better than the expected one, and which in the worst case (namely for β = 1) raises approximately to only 3/2. Christofides algorithm, as expected, computes better solution, but the performances of the Refined Double-MST are rather close, especially for values of β less than 0.85. Thus, the Refined Double-MST offers approximation of similar quality than those provided by the Christofides algorithm, while requiring a significantly lower running time; on the other hand it enjoys over the standard Double-MST a provably better approximation guarantee. We plan in a near future to continue experimentation on the Refined Double-MST, testing it with bigger instances and comparing its performances with those of other TSP heuristics.
References [1] S. Arora. Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems. J. ACM, 45(5):753–782, 1998. [2] H.-J. B¨ockenhauer, J. Hromkoviˇc, R. Klasing, S. Seibert, and W. Unger. Approximation algorithms for the TSP with sharpened triangle inequality. Information Processing Letters, 75:133– 138, 2000. 4 To compute the optimal solution of a given β-MTSP instance, we made use of the well-known Concorde library [11].
9
[3] R.E. Burkard, V.G. Deineko, and G.J. Woeginger. The travelling salesman and the pq-tree. Mathematics of Operations Research, 23(3):613–623, 1998. [4] N. Christofides. Worst-case analysis of a new heuristic for the traveling salesman problem. Technical report, Graduate School of Industrial Administration, Carnegy–Mellon University, 1976. [5] V.G. Deineko and A. Tiskin. Fast minimum-weight double-tree shortcutting for metric TSP. In Proc. of the 6th Workshop on Experimental Algorithms (WEA), volume 4525 of Lecture Notes in Computer Science, pages 136–149, 2007. [6] D.E. Drake Vinkemeier and S. Hougardy. A linear-time approximation algorithm for weighted matchings in graphs. ACM Transactions on Algorithms, 1(1):107–122, 2005. [7] H.N. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. In Proc. of the 15th Annual ACM Symp. on Theory of Computing (STOC), pages 448–456, 1983. [8] H.N. Gabow and R.E. Tarjan. Faster scaling algorithms for general graph-matching problems. J. ACM, 38(4):815–853, 1991. [9] C.H. Papadimitriou and S. Vempala. On the approximability of the traveling salesman problem. Combinatorica, 26(1):101–120, 2006. [10] G. Reinelt. TSPLIB library, University heidelberg.de/groups/comopt/software/tsplib95/.
of
Heidelberg,
http://www.iwr.uni-
[11] TSP site. Concorde TSP solver, http://www.tsp.gatech.edu/concorde/. [12] X. Tan. Approximation algorithms for the watchman route and zookeeper’s problems. Discrete Applied Mathematics, 136(2-3):363–376, 2004.
10
A A.1
Double-MST is not a 2β-approximation algorithm Triangles in β-metric graphs
We begin with two easy-to-check properties which will be helpful to prove that a certain graph is β-metric. Let then G = (V, E) be a complete weighted graph whose edge cost function c has range R ⊂ R≥0 . We say that the subgraph of G induced by x, y, z ∈ V , with x, y, z pairwise disjoint, is a triangle, or the triangle formed by x, y, z. It is immediate to see that, for any fixed β ≥ 12 , G satisfies the β-triangle inequality if and only if all of its triangles satisfy the β-triangle inequality. Whether a triangle satisfies the β-triangle inequality or not, depends only on the costs of its edges. Given r1 , r2 , r3 ∈ R, with r1 ≤ r2 ≤ r3 , we say that a triangle in G has type ∆(r1 , r2 , r3 ) if there exists a permutation he1 , e2 , e3 i of its edges such that c(e1 ) = r1 , c(e2 ) = r2 , and c(e3 ) = r3 . The triangle type characterizes whether the triangle satisfies the β-triangle inequality or not. Hence, we say that the type ∆(r1 , r2 , r3 ) satisfies the β-triangle inequality iff triangles having type ∆(r1 , r2 , r3 ) satisfy the β-triangle inequality. Lemma 6. Type ∆(r1 , r2 , r3 ) satisfies the β-triangle inequality iff r3 ≤ β(r1 + r2 ). Proof. Let hc1 , c2 , c3 i be a permutation of the edge costs r1 , r2 , r3 . Then c1 ≤ r3 and r1 + r2 ≤ c2 + c3 . Hence, r3 ≤ β(r1 + r2 ) implies c1 ≤ β(c2 + c3 ). The other direction follows by definition. Lemma 7. Let us consider ∆(r1 , r2 , r3 ) and ∆(r10 , r20 , r30 ), with r1 ≤ r10 , r2 ≤ r20 , and r3 ≥ r30 . If ∆(r1 , r2 , r3 ) satisfies the β-triangle inequality, then ∆(r10 , r20 , r30 ) satisfies the β-triangle inequality. Proof. If ∆(r1 , r2 , r3 ) satisfies the β-triangle inequality, then r30 ≤ r3 ≤ β(r1 + r2 ) ≤ β(r10 + r20 ).
A.2
Analysis of Double-MST
The Double-MST does not prescribe how to shortcut repeated vertices in the Eulerian cycle obtained by merging the two copies of the MST. An easy to state and widely used rule, is to perform shortcut according to the visiting order of vertices in a DFS of the MST. Applying this rule, the Double-MST algorithm can be stated as follows: Algorithm 2 The Double-MST algorithm. Input: A β-metric graph G = (V, E). 1: [Step 1.] Construct an MST T of G. 2: [Step 2.] Perform a depth-first search on T starting from an arbitrary vertex v0 . v0 , v1 , . . . , vn−1 be the sequence of vertices in the order they are visited. Output: Return the cycle H = v0 v1 . . . vn−1 v0 of G. 2
Let
As said before, this algorithm turns out to be a 2β 2 2β -approximation algorithm for the −2β+1 β-MTSP. Although this ratio has not been proven to be tight, in the following we provide an input instance showing that the cost of the Hamiltonian cycle computed by Double-MST can be strictly larger than 2β times the optimal one. 11
For a given 12 < β < 1, let G = (V, E) be a β-metric graph with vertex set V = {v0 , x1 , y1 , z1 , . . . , xh , yh , zh }, and such that the edge costs are defined as follows: • c(v0 , xi ) = 1, c(v0 , yi ) = • c(yi , v) =
β 1−β ,
β 1−β , c(v0 , zi )
= 2β, ∀1 ≤ i ≤ h;
∀1 ≤ i ≤ h and ∀v ∈ V \ {yi };
• c(xi , xj ) = 2β, ∀1 ≤ i, j ≤ h; • c(zi , zj ) = 2β, ∀1 ≤ i, j ≤ h; • c(xi , zj ) = 1, ∀1 ≤ i ≤ j ≤ h; • c(xi , zj ) = 2β 2 + β, ∀1 ≤ j < i ≤ h. © β ª Notice that the edge cost function has range R = 1, 2β, 2β 2 + β, 1−β . In order to verify that G satisfies the β-triangle inequality, we make use of the results presented in Section A.1. β Let us first consider triangle types not having edges with cost 1−β . Then, it is easy to see 2 that ∆(1, 1, 2β) and ∆(1, 2β, 2β +β) satisfy the β-triangle inequality, while ∆(1, 1, 2β 2 +β) does not. From this, using Lemma 7, it follows that, among the triangles not having β , all but those of type ∆(1, 1, 2β 2 + β) satisfy the β-triangle inequality. edges with cost 1−β However, no triangles of type ∆(1, 1, 2β 2 + β) are contained in G. Indeed, if e ∈ E has cost 2β 2 + β, then e = (xi , zj ), with j < i. But the only edges of cost 1 incident to xi connect it either with v0 or with zk , for some k ≥ i, and all of these vertices are connected to zj by an edge of cost 2β. Analogously, the only edges of cost 1 incident to zj connect it with xk , for some k ≤ j, and all of these vertices are connected to xi by an edge of cost 2β. β Let us now consider triangle types having at least one edge of cost 1−β . Then, it turns β β β , 1−β ) satisfies the β-triangle inequality, while ∆(2β 2 +β, 2β 2 +β, 1−β ) does out that ∆(1, 1−β not. From this, by using Lemma 7, if follows that, among the triangles under consideration, β only those having at least two edges of cost 1−β satisfy the β-triangle inequality. However,
observe that in G all and only edges incident to vertices yi , with 1 ≤ i ≤ h, have cost β 1−β β 1−β .
Then, any triangle having one edge of cost
β 1−β .
contains a vertex yi , with 1 ≤ i ≤ h, and
consequently has at least two edges of cost Therefore, we conclude that G satisfies the β-triangle inequality. An MST T of G is formed by edges (v0 , xi ), (xi , yi ), (xi , zi ), for each 1 ≤ i ≤ h. In Figure 2 the MST for the case h = 3 is depicted. Assume now that the Double-MST algorithm takes v0 as root of T , and performs a depthfirst search visiting, for all 1 ≤ i ≤ h, yi before zi . Then, the algorithm builds the solution H = v0 x1 y1 z1 x2 y2 z2 . . . xh yh zh v0 , having cost (see Figure 3 for the case h = 3) µ ¶ β β β c(H) = 1 + (h − 1) 2 + 2β 2 + β + + + 2β 1−β 1−β 1−β ¢ 1 ¡ = 1 − β + 2hβ + (h − 1)(2β 2 + β − 2β 3 − β 2 ) + 2β − 2β 2 1−β ¢ 1 ¡ = h(3β + β 2 − 2β 3 ) + 1 − 3β 2 + 2β 3 . 1−β 12
v0
1
1
1
x1 β 1−β
x2 β 1−β
1
y1
z1
y2
x3
1
β 1−β
z2
y3
1
z3
Figure 2: An MST of G
1
β 1−β
β 1−β
β 1−β
2β
2β 2 + β
2β 2 + β
β 1−β
β 1−β
β 1−β
Figure 3: The solution H constructed by the Double-MST algorithm Consider now the solution H ∗ = y1 y2 . . . yh v0 xh zh xh−1 zh−1 . . . x1 z1 y1 which has cost c(H ∗ ) = (h − 1)
β β β β + + 1 + (h − 1)(1 + 1) + 1 + = (h + 1) + 2h 1−β 1−β 1−β 1−β 1 1 = (h(β + 2(1 − β)) + β) = (h(2 − β) + β) . 1−β 1−β
To prove that H ∗ is an optimal solution, observe that since T contains one edge having cost β β β 1−β , an optimal solution has at least one edge of cost 1−β . This implies that c(T ) + 1−β is a lower bound for the cost of a solution of the TSP, but it is c(H ∗ ) = c(T ) + shows H ∗ when h = 3. 13
β 1−β .
Figure 4
β 1−β
1 1 1
1 1
1
β 1−β β 1−β
β 1−β
Figure 4: The optimal solution H ∗ Therefore, we have h(3β + β 2 − 2β 3 ) + 1 − 3β 2 + 2β 3 c(H) = , c(H ∗ ) h(2 − β) + β c(H) and after some calculation it can be shown that c(H ∗ ) > 2β as soon as » ¼ −2β 3 + 5β 2 − 1 h> , −β + 3β 2 − 2β 3
where the right-hand side term is increasing in β and for β → 1/2+ is equal to 7.
14