Advanced Topics, Frontiers & Applications

an approximation algorithm

Suppose the exact problem you face is NP-hard, so no efficient algorithm is known to nail the perfect answer. You do not always have the luxury of giving up. A natural compromise is to ask for an answer that is provably close to optimal, computed quickly. An approximation algorithm is exactly that: a fast (polynomial-time) algorithm that does not promise the best solution, but promises one within a guaranteed factor of the best.

The key idea is the approximation ratio. For a minimization problem, an algorithm is a c-approximation if, on every input, the cost of its output is at most c times the true optimum (so c is a number like 2, meaning 'never more than twice as expensive as the best possible'). For maximization, it guarantees at least 1/c of the optimum. Crucially the guarantee holds even though the algorithm never computes the true optimum and may not even know it — the ratio is proved by clever reasoning, often by comparing the output against a lower bound you can compute. Some problems even admit a PTAS (polynomial-time approximation scheme): for any desired accuracy 1+epsilon you want, there is a polynomial-time algorithm achieving it, trading more time for a tighter guarantee.

Approximation is one of the main honest responses to NP-hardness — a way to cope rather than to conquer (see coping with NP-completeness). It matters enormously in practice: package routing, scheduling, network design, and clustering all rely on approximations with proven guarantees rather than gambling on heuristics. But the guarantees vary wildly by problem. Vertex cover has a simple 2-approximation; metric TSP has a 1.5-approximation; and, as the next entry explains, some problems are provably hard even to approximate beyond a certain ratio, so 'just approximate it' is not always a way out.

For vertex cover, a tiny greedy rule gives a 2-approximation: repeatedly pick any uncovered edge and add BOTH its endpoints to the cover. Every chosen edge needs at least one of its endpoints in the optimal cover, and those chosen edges share no vertices, so the optimum has at least half as many vertices as you took — your cover is at most twice optimal, guaranteed, with no idea what the true optimum is.

A 2-approximation never exceeds twice the optimum, proved by comparing against a computable bound.

An approximation ratio is a WORST-CASE guarantee, not the typical behaviour; a 2-approximation often does far better in practice. And the guarantee is a proof, not a hope — a heuristic that 'usually looks good' but has no proven bound is not an approximation algorithm in this technical sense.

Also called
approximation ratioapproximation schemePTAS近似比近似比率