In the previous chapters, we have seen that:
Many classic optimization problems (such as Vertex Cover, TSP, Independent Set) are NP-hard.
This means that finding an exact optimal solution in a reasonable time is almost impossible.
Therefore, we take a step back and ask a practical question:
If I don't pursue the optimal solution, can I quickly find an "approximately" good solution?
This is where approximation algorithms come in. ## What is an Approximation Algorithm?
Definition (informal):
An approximation algorithm is a polynomial-time algorithm that does not necessarily output the optimal solution, but guarantees an upper bound on the "gap" between its solution and the optimal solution.
We usually use the approximation ratio to measure the quality of the algorithm.
For a minimization problem:
If an algorithm guarantees:
Then it is called a ρ-approximation algorithm.
This was the first example used to introduce approximation algorithms in Lecture 13 of the 570 course.
Problem Description:
There are
There are
Each job cannot be split.
Goal: Minimize the maximum machine load.
Algorithm:
Process the jobs in the given order.
Assign the current job to the machine with the minimum current load.
This is a very simple greedy approach.
Approximation Ratio Analysis (Core Idea)
Let:
Conclusion:
Therefore, this greedy algorithm is a 2-approximation algorithm.
Intuitively:
The last job placed on the "heaviest machine" has a size ≤
Before placing it, the machine's load was ≤
So the final load is ≤
Improved approach:
Sort the jobs by processing time from largest to smallest, then use the same greedy strategy.
This is the famous LPT (Longest Processing Time First). Conclusion
Lecture 13 provides the proof:
Therefore: This is a 1.5-approximation algorithm.
This shows that simple sorting + greedy approach can significantly improve the approximation quality.
Let's return to the familiar Vertex Cover problem.
Algorithm (very important)
S = ∅while S is not a vertex cover:Select an uncovered edge (u, v)Add both u and v to S
This algorithm is a 2-approximation. Why?
Each time we select an edge (u, v)
The optimal solution must select at least one of u or v
We select both
Therefore:
This is a classic 2-approximation algorithm.
Although:
Independent Set ↔ Vertex Cover
Approximation does not preserve structure.
Conclusion: Reduction ≠ Approximation Transitivity
Vertex Cover ≤ₚ Set Cover
Approximation can be transferred from Set Cover back to Vertex Cover
Reason:
Vertex Cover is a special case of Set Cover
The size of the solution is exactly the same
Conclusion: ρ-approx for Set Cover ⇒ ρ-approx for Vertex Cover
Problem: Given a set of clauses of length 3, maximize the number of satisfied clauses.
This is an extremely simple 1/2-Approximation
Algorithm:
Set all variables to TRUE
If ≥ 50% of clauses are satisfied, terminate
Otherwise, set all to FALSE
Conclusion: This is a 1/2-approximation
The course also mentioned that more complex methods can achieve an 8/9-approximation, but this will not be discussed in detail. ## Designing Approximation Algorithms using Linear Programming (LP)
Define variables:
Objective function:
Constraints:
This is an Integer Linear Program (ILP).
Relax:
to:
This yields a Linear Program (LP), which can be solved in polynomial time.
Define:
Correctness:
For any edge
It's impossible for both to be
Therefore,
Approximation Ratio Analysis:
LP Relaxation + Rounding yields a 2-Approximation.
The summary diagram in Lecture 13 is crucial:
LP was once considered NP-intermediate
In 1979, it was proven that LP can be solved in polynomial time
Simplex algorithm has exponential worst-case complexity
But in practice, it usually performs very well