Approximation Algorithms and LP Rounding
Learning Objectives
- Define the approximation ratio of an algorithm for a minimization problem and explain why proving it requires a lower bound on the unknown optimum.
- Formulate weighted vertex cover as an integer linear program, relax it to an LP, and prove that threshold rounding at 1/2 gives a 2-approximation.
- Define the integrality gap of a relaxation and show the vertex cover LP's gap approaches 2.
- Analyze the greedy algorithm for set cover and state its guarantee and the matching hardness result.
Context & Motivation
algorithms-software/computability-complexity showed that problems such as vertex cover and set cover are NP-complete, so no polynomial-time algorithm is expected to solve them exactly. That is not the end of the story in practice: a delivery company still needs to place depots, and a network operator still needs to monitor every link. An approximation algorithm runs in polynomial time and returns a solution provably within a fixed factor of the optimum, on every input.
The difficulty is that the optimum is unknown; proving "within a factor 2 of OPT" requires a lower bound on OPT that can be computed. algorithms-software/linear-programming-optimization provides one: relax the integrality constraints of an integer program to obtain a linear program, which is solvable in polynomial time and whose value can only be better than the integer optimum. Rounding the fractional LP solution back to an integer one, while tracking how much the rounding costs, is one of the main techniques in Williamson and Shmoys's textbook and MIT's 6.854.
Core Theory
Approximation ratio
For a minimization problem, an algorithm is an -approximation () if on every instance it returns a feasible solution of cost . Every proof has the same skeleton: find a quantity with that can be computed, then show . The LP relaxation is the most versatile choice of .
Vertex cover as an integer program
Given a graph with vertex weights , choose a minimum-weight set of vertices touching every edge. With meaning " is chosen":
The LP relaxation replaces with . Every integer solution is also an LP solution, so .
Threshold rounding
Solve the LP to get , and pick .
- Feasible: for each edge, , so at least one of them is at least and is chosen.
- Cost: each chosen vertex has , so .
That is a complete 2-approximation proof. (For unweighted vertex cover, taking both endpoints of a maximal matching also gives a factor of 2 with no LP at all.)
Integrality gap
The integrality gap is the worst ratio over all instances. It limits any rounding argument that compares only to the LP: no rounding of this LP can prove a factor better than the gap. On the complete graph , setting every is feasible with value , while any vertex cover must include all but one vertex, so . The gap is , so threshold rounding is as good as this relaxation allows. Improving on 2 for vertex cover is a major open problem: it is NP-hard to approximate within about 1.36, and within under the Unique Games Conjecture.
Greedy set cover
Given a universe of elements and a family of sets with costs, cover every element at minimum total cost. Greedy: repeatedly pick the set minimizing cost per newly covered element, until everything is covered.
Analysis by charging: when greedy picks a set, spread its cost equally over the elements it newly covers. When elements remain uncovered, the optimal solution covers them with total cost , so some set covers them at an average cost of at most per element; greedy's choice is at least that good. Ordering elements by when they get covered, the -th element from the end is charged at most . Summing:
This is essentially tight: Feige (1998) and later Dinur and Steurer (2014) showed that approximating set cover within is NP-hard. A simple greedy rule matches the best possible polynomial-time guarantee.
Worked Examples
Example 1: rounding on a triangle
Problem: Unweighted vertex cover on a triangle (vertices , all three edges). Solve the LP, round, and compare with OPT.
Trace: Setting satisfies every edge constraint with equality and has value . No feasible fractional solution does better: summing the three constraints gives , so the LP optimum is exactly . Threshold rounding picks all three vertices, cost 3. The true optimum is 2 (any two vertices). The ratio is within the guaranteed factor of 2, and shows the analysis is tight against the LP even when the actual solution is not that bad.
Example 2: greedy set cover by hand
Problem: Universe , unit-cost sets , , , . Run greedy.
Trace: All costs are 1, so greedy maximizes newly covered elements. Step 1: covers 4, the most; pick , remaining . Step 2: covers , covers , covers ; pick . Done with cost 2, which is optimal here. Change to and add , keeping , , : greedy picks (5 new), then any set containing 6, cost 2, still optimal. Instances where greedy is off by a factor exist and are built carefully so that each greedy choice covers slightly more than any optimal set while the optimum uses only two large sets; the bound guarantees that, however adversarial the instance, the loss never exceeds .
Common Misconceptions & Pitfalls
- "An approximation ratio of 2 means the answer is usually twice the optimum." It is a worst-case guarantee; on typical instances LP rounding and greedy are often within a few percent of optimal. Ratio and typical quality answer different questions.
- "Rounding an LP solution always works." Naive rounding can be infeasible or arbitrarily bad; each problem needs a rounding scheme whose feasibility and cost are both proved. Randomized rounding (choose with probability ) is another standard tool, analyzed with the concentration bounds of an earlier concept.
- "NP-hard means nothing can be guaranteed." NP-hard problems differ enormously in approximability: knapsack admits a -approximation for any , set cover only , and general TSP no constant factor at all unless P = NP.
Summary
An approximation algorithm returns, in polynomial time, a solution within a proven factor of the optimum, which requires a computable lower bound on the optimum. Relaxing an integer program to a linear program provides that bound. For vertex cover, rounding every variable at least up is feasible and costs at most twice the LP value, a 2-approximation, and the integrality gap of 2 on complete graphs shows the relaxation cannot prove more. Greedy set cover, charging each set's cost to the elements it newly covers, achieves , matching the hardness of approximation. The next concept keeps the idea of comparing against an optimum that cannot be computed, but now because the input arrives one piece at a time.