Approximation Algorithms
Algorithms · Advanced Placement
Approximation Algorithms: the big picture
When a problem is NP-hard, an approximation algorithm runs in polynomial time and returns a solution whose cost is provably within a bounded factor of optimal. The approximation ratio is defined so that it exceeds one for minimisation and lies below one for maximisation, and an algorithm with a constant ratio is far more valuable than a heuristic with no guarantee, because the bound holds for every instance. Vertex cover admits a simple factor-two approximation: repeatedly take both endpoints of any uncovered edge, since any cover must include at least one of them. The travelling salesman problem with distances satisfying the triangle inequality admits a factor-two approximation by doubling a minimum spanning tree and shortcutting, improved to one and a half by Christofides's construction adding a minimum matching on the odd-degree vertices; without the triangle inequality no constant-factor approximation exists unless P equals NP. Set cover admits a greedy algorithm with a logarithmic ratio, which is essentially the best possible. The subset sum problem admits a fully polynomial-time approximation scheme, achieving any desired accuracy with running time polynomial in both the input size and the inverse of the error tolerance. Some problems admit no constant-factor approximation at all.
Approximation Ratios, Vertex Cover & Set Cover
An approximation algorithm runs in polynomial time and comes with a proof that its answer is within a stated factor of optimal — which is categorically different from a heuristic that usually works. Vertex cover's factor-two algorithm is almost trivially simple: take both endpoints of any uncovered edge, since the optimum must take at least one. Set cover's greedy algorithm achieves a logarithmic ratio, and that is provably the best possible, which is itself a striking result.
{{illustration:algos-l20-f1}}
{{illustration:algos-l20-f2}}
Key relations
- Approximation ratio definitions. ρ = C_alg/(Cₒₚₜ) (minimisation) ; FPTAS: ρ ≤ 1 + ε in time poly(n, 1/ε)
Parameterised Complexity, Heuristics & Tractable Special Cases
NP-hardness measures difficulty against input size alone, which often misses the structure that makes real instances easy. Parameterised complexity measures against a second parameter: vertex cover is solvable in time exponential in the cover size but linear in the graph, which is excellent when the cover is small. Tree decomposition generalises this, making many hard problems tractable on graphs that are nearly trees. And some special cases are outright polynomial — 2-colouring, planar graph colouring, interval scheduling — so checking whether your instances fall into one is always worth doing.
{{illustration:algos-l20-f3}}
{{illustration:algos-l20-f4}}
Key relations
- Parameterised running time. T(n, k) = f(k)· poly(n) ; vertex cover: O(2^kn)