TSP, set cover & the general techniques
◈ 7 cardsMetric-TSP 2-approximation via MST + preorder shortcut, the inapproximability of general TSP, greedy set cover’s H(n) ratio, and LP rounding.
Metric TSP: a 2-approximation from an MST
In the traveling-salesperson problem (TSP) you are given a complete undirected graph with edge costs , and you want a minimum-cost Hamiltonian cycle (a tour visiting every vertex once). General TSP is NP-hard. But when the costs satisfy the triangle inequality — true for any distances in a metric space, e.g. points on a plane — there is a clean 2-approximation:
APPROX-TSP-TOUR(G, c)
pick a root r
T = MST-PRIM(G, c, r) // minimum spanning tree
H = preorder walk of T from r // vertices in first-visit order
return the cycle H
Why it is a 2-approximation. Three inequalities chain together. Let be an optimal tour and the MST.
- — deleting any one edge from the optimal tour leaves a spanning tree, so the minimum spanning tree is no costlier than the tour. The MST is the lower bound.
- A full walk of (down and back up every branch) traverses each tree edge exactly twice: .
- The preorder walk is with repeated vertices skipped. Each skip replaces a path by the direct edge ; by the triangle inequality this never increases cost: .
Chaining: .
Worked example. Five points: , , , , with Euclidean distance. Prim from builds an MST of cost . Its preorder walk is , a tour of cost . The guarantee holds comfortably (and since ).
General TSP has no constant-ratio approximation
Drop the triangle inequality and the picture collapses. Theorem 35.3: if , then for no constant does a polynomial-time -approximation for general TSP exist.
Sketch (gap amplification). Reduce HAM-CYCLE: given , build a complete graph with if , else . If has a Hamiltonian cycle, the optimal tour costs ; if not, every tour uses a heavy edge and costs . A -approximation would distinguish the two cases, solving HAM-CYCLE in polynomial time — so . The trick is to manufacture a gap of factor that any -approximation must respect.
Greedy set cover: an -approximation
Set cover: given a universe of elements and a family of subsets whose union is , find the smallest subfamily covering . GREEDY-SET-COVER repeatedly takes the set covering the most still-uncovered elements.
Theorem 35.4: greedy is an -approximation (where ). Why: if the optimum uses sets, then at any moment sets cover all uncovered elements, so by averaging some set covers . Greedy takes at least that many, so . This drops below once , giving . The ratio is logarithmic, not a constant — and that is essentially unavoidable for set cover.
LP rounding: weighted vertex cover, 2-approximation
For weighted vertex cover the matching trick breaks (a heavy vertex may anchor a light edge). Instead, write the integer program — minimize subject to per edge, — then relax to a linear program (solvable in polynomial time). Solve the LP for fractional , then round: put in the cover iff .
This is a 2-approximation (Theorem 35.6). Feasibility: each edge has , so at least one endpoint has and is taken. Cost: for every chosen , , so — the LP optimum is a lower bound on the integer optimum. Rounding up to is exactly where the factor 2 comes from.
And when would not even help: the FPTAS for subset sum
Subset sum (NP-complete) admits an FPTAS: keep a list of achievable subset sums, but trim values within a factor of each other, with . Trimming keeps the list polynomial, , while the compounded error stays . So you get a -approximation in time polynomial in and — the best you can hope for short of solving it exactly.