S9-Slide9-Approximation-Algorithms
S9-Slide9-Approximation-Algorithms
Approximation Algorithms
Dr. Qiuming Yao
Fall 2024
2
Approximation Algorithms
• These algorithms reach near-optimal solution at
polynomial time.
• Approximation ratio 𝜌 is used to define how close
this solution (C) from the optimal solution (C*).
• 1≤
• If 𝜌(n) is a constant, this is called 𝜌-approximation
algorithm. 𝜌=1, this is the exact optimal algorithm.
For approximation algorithm, 𝜌 >1.
• For minimization problem C/C* = 𝜌
• For maximization problem C*/C = 𝜌
3
Approximation Algorithms
• Approximation ratio 𝜌(n) can be also a function of input
data size n.
• Since 𝜌(n) is usually larger than one
𝜌(n)-approximation algorithm can be represent as (1+𝜀)-
approximation algorithm, where 𝜀 is a variable and 𝜀>0
• There can be a trade-off between 𝜀 and running time.
For example, O(𝑛!/# ) and O((1/ 𝜀)2n3)
• The Polynomial Time Approximation Scheme (PTAS) are
the algorithms run at polynomial time for input size n.
• The Fully Polynomial Time Approximation Scheme
(FPTAS) are the algorithms run at polynomial time both
for input size n and the 1/ 𝜀.
4
NP-complete optimization
problems
• Vertex cover problem: APPROX-VERTEX-COVER
runs at O(V+E), 𝜌=2
• TSP (travelling salesman problem):
- Under triangular inequity (Euclidean space),
APPROX-TSP-TOUR runs at O(V2), 𝜌=2
- In general case, polynomial approximation
algorithm doesn’t exist unless P=NP.
• Set covering problem: GREEDY-SET-COVER runs at
O(|X||F|min(|X||F|)), 𝜌=ln(|X|)+1
5
Vertex cover problem
• Given a graph, what is the smallest number of
nodes that can cover all edges on the graph?
• This is a small graph, so we know the best result is
{b,e,d}
• Enumerate node sets
• But there is no known
polynomial algorithm
can resolve this optimally.
• Need heuristic method
6
Vertex cover problem
Pick an edge
Delete edges sharing nodes
Iterate
C={b,c,d,e,f,g}
C*={b,d,e}
|C|/|C*| =6/3=2
7
Vertex cover problem
Proof:
Assume A is a set of picked edges, they are disjoint edges.
Optimal number of nodes at least should cover the edges in A.
|C*|≥ |A|
In this algorithm, we add both nodes for each edge:
|C|=2|A|
So |C*| ≥ |C|/2
|C|/|C*| ≤ 2 (approximation solution is bounded)
𝜌=2
In worst case, this algorithm produces twice number of vertices as the optimal
solution. This algorithm is polynomial O(V+E).
8
TSP problem
• Triangle inequity is a property in Euclidean space
(eg. 2D map).
9
TSP problem
10
TSP problem
Assume best tour is T*, the tour from the algorithm is T, we need to calculate
c(T)/c(T*)
Generally 𝜌=???
14
Set covering problem
Proof on page 1120. Cx is the cost assigned to element x when x is first added in round i
15
Set covering problem
≤ |C*| (ln|X|+1)
16
summary
• Vertex cover problem: APPROX-VERTEX-COVER
runs at O(V+E), 𝜌=2
• TSP (travelling salesman problem):
- Under triangular inequity (Euclidean space),
APPROX-TSP-TOUR runs at O(V2), 𝜌=2
- In general case, polynomial approximation
algorithm doesn’t exist unless P=NP.
• Set covering problem: GREEDY-SET-COVER runs at
O(|X||F|min(|X||F|)), 𝜌=ln(|X|)+1
17