Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

S9-Slide9-Approximation-Algorithms

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

S9-Slide9-Approximation-Algorithms

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CSCE 423/823

Approximation Algorithms
Dr. Qiuming Yao
Fall 2024

*adapted from Cormen et al. 2022, Chapter 35.1,35.2,35.3


*adapted from Cormen et al. 2009, Chapter 35.1,35.2,35.3 1
NP-complete or NP-hard problems
• They are very hard problems, as hard as any NP
problems.
• Don’t yet know if polynomial algorithm exists.
• Compromised Solution:
- (1) Superpolynomial solution may be acceptable
when input is small size.
- (2) Special cases of the problem may have a
polynomial solution.
- (3) Find near optimal solutions in polynomial time.
(approximation algorithm)

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

We can guess this is a 2-


approximation algorithm (𝜌=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).

• Input of the TSP is a complete graph with pair-wise


distances/cost/weight.
• Find a Hamiltonian cycle for lowest weight/cost.
• C=W is a full symmetric matrix
Get all cycles are expensive.

9
TSP problem

c(T) c(T*) c(T)/c(T*) = 19.074/14.715 =1.296

This algorithm is O(V2)

10
TSP problem
Assume best tour is T*, the tour from the algorithm is T, we need to calculate
c(T)/c(T*)

c(MST) ≤c(T*) c(T) =2*c(MST)

c(T) ≤ 2*c(MST) ≤2*c(T*)


c(T)/c(T*) ≤ 2
𝜌=2

c(T) ≤ 2*c(MST) c(T*)


11
TSP problem

Assume there is a polynomial and 𝜌 -approximation algorithm, we will get


some contradiction.
We can always construct a graph from HAM-CYCLE(G) to TSP(G’)

The optimal solution for TSP(G’) is |V|.


If we substitute one edge in optimal solution with an edge having larger weights.

This is “next-optimal solution” is not the output of 𝜌 -approximation algorithm


since it’s larger than 𝜌|V|.
𝜌 -approximation algorithm will output exact |V| if HAM-CYCLE(G) is true
and will output larger than 𝜌|V| if HAM-CYCLE(G) is false.
which means we can use a polynomial method to determine HAM-CYCLE.
This is impossible unless P=NP since HAM-CYCLE is known to be NP-complete.
12
Set covering problem
• Given a set X, and a sub-set group F={S1,S2,…Sn}
where Si⊆ X are sub-sets of X.
• Find a minimum group C={Si} to cover X.
• This is to say, each element in X should be in at
least one of the sub-set Si
• Optimal solution
C*={S3, S4, S5}
|C*|=3
Enumerate S is expensive.
But why set covering is an NP-complete problem?
13
Set covering problem
# of loops from line3-6: min(|X|,|F|)
O(|X||F|min(|X||F|))

Each iteration, select the S that


can cover most of the uncovered
elements.

In this specific example,


C={S1,S4,S5,S3}
C*={S3,S4,S5}
|C|/|C*|=4/3

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

This needs more work!!!

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

You might also like