Approximation Algorithms

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 16

Approximation Algorithm

1
Approximation Algorithm
 Up to now, the best algorithm for solving an
NP-complete problem requires exponential
time in the worst case. It is too time-
consuming.
 To reduce the time required for solving a
problem, we can relax the problem, and
obtain a feasible solution “close” to an
optimal solution
2
Approximation Algorithm
 One compromise is to use heuristic solutions.

 The word “heuristic” may be interpreted as


“educated guess.”

3
Approximation Algorithm
An algorithm that returns near-optimal solutions is called
an approximation algorithm.

We need to find an approximation ratio bound for an


approximation algorithm.

4
Approximation ratio bound
We say an approximation algorithm for the problem has a ratio
bound of  (n) if for any input size n, the cost C of the solution

produced by the approximation algorithm is within a factor of


 (n) of the C* of the optimal solution:

C C*
max{ , }   (n)
C* C
This definition applies for both minimization and maximization

problems.
5
-approximation algorithm
 An approximation algorithm with an
approximation ratio bound of  is called a -
approximation algorithm or a (1+)-
approximation algorithm.

 Note that  is always larger than 1 and =-


1.
 
6
Vertex Cover Problem
 Let G=(V, E). The subset S of V that
meets every edge of E is called the
vertex cover.
 The Vertex Cover problem is to find a
vertex cover of the minimum size. It is
NP-hard or the optimization version of
an NP-Complete decision problem.

7
Examples of vertex cover

8
APPROX_VERTEX_COVER(G)
1 C 
2 E'  E( G )
3 while E'  
4 do let ( u, v ) be an arbitrary edge of E'
5 C  C  {u , v}
6 remove from E' every edge incident on either u or v
7 return C
9
b c d b c d

a e f g a e f g

b c d b c d

a e f g a e f g

b c d b c d

a e f g a e f g

Complexity: O(E) 10
Theorem 35.1 APPROX_VERTEX_COVER has ratio
bound of 2. C*: optimal solution
C: approximate solution
Proof. A: the set of edges selected in step 4
Let A be the set of selected edges.
| C|  2| A| When one edge is selected, 2 vertices are added into C.

| A| | C*| No two edges in A share a common


endpoint due to step 6.
| C|  2| C*|

11
The traveling salesperson problem
with triangle inequality
 Given a graph G=(V, E), the TSP problem is to
find a tour, starting from any vertex, visiting every
other vertex and returning to the starting vertex,
with the minimum cost.
 Triangle inequality for the cost matrix:
c( u, w )  c( u, v )  c( v , w ) u, v , w V

12
The TSP with triangle inequality

APPROX_TSP_TOUR(G,c)
1 Select a vertex r V [ G ] to be a root vertex
2 grow a MST T for G from root r using
MST_PRIM(G,c,r)
3 Let L be the list of vertices visited in a preorder
walk of T.
4 return the hamiltonian cycle H that visit the vertices in
the order L.

13
a d T a d T a d
e e e
b f g b f g b f g
c h c h c h

optimal
T a d a d solution
e e
b f g b f g
c h H c h H*

14
Theorem 35.2. APPROX_TSP_TOUR is an approximation
algorithm with ratio bound of 2 for TSP with triangular
inequality.
Proof.
c( T )  c( H*)

c( W )  2 c( T )  2 c( H*)

c( H )  c( W )

 c( H )  2 c( H*)
15
Q&A
16

You might also like