Document

Computability and Complexity
24-1
Approximation
Computability and Complexity
Andrei Bulatov
Computability and Complexity
Optimization Problems
In an optimization problem, for every possible instance x we have
• a set S(x) of feasible solutions
• for every solution y  S(x), we have a positive goodness m(x,y)
• optimization parameter opt  {min,max}
To solve an optimization problem we must find for any given x  I, a
solution y  S(x) such that
m( x, y )  opt{m( x, z ) | z  S ( x)}
The optimal value will be denoted OPT(x)
24-2
Computability and Complexity
Relative Error
Sometimes it is sufficient to find an approximate solution
Definition
The relative error of a solution y (with respect to an instance x)
is
| OPT( x )  m( x, y ) |
OPT( x )
• In a maximization problem m(x,y) is always smaller than OPT(x),
so the relative error lies between 0 and 1
• In a minimization problem the relative error can be arbitrarily large
24-3
Computability and Complexity
Approximation Algorithms
Definition
An algorithm A is an -approximating algorithm for an
optimization problem if, for any instance x, A computes a
feasible solution with relative error less than  in a time which is
polynomial in |x|
Definition
A problem is approximable if it has an -approximating algorithm
for some 
24-4
Computability and Complexity
Example
Consider the following naive algorithm for solving Minimal
Vertex Cover on the graph (V,E)
• Set M = 
• While E  do
- Pick any edge e and add both endpoints to M
- Remove e from E, and also remove all incident
edges from E
Is this an -approximating algorithm?
24-5
Computability and Complexity
24-6
The naive algorithm is a 1-approximating algorithm for Minimal
Vertex Cover
• The cover chosen contains | M |
2
disjoint edges
• Hence any cover must contain at least | M |
2
vertices
• Hence the relative error is at most 1
Surprisingly, this is the best approximation algorithm possible!
Computability and Complexity
Example
Consider the following greedy algorithm for solving Minimal
Vertex Cover on the graph (V,E)
• Set M = 
• While E  do
- Pick a vertex with the highest degree and add it to M
- Remove this vertex from V, and also remove all incident
edges from E
Is this an -approximating algorithm?
24-7
Computability and Complexity
Max-SAT
Max-SAT
Instance: A formula  in CNF.
Objective: Find an assignment for  that satisfies the maximal
number of clauses
Theorem
There is a 1/2-approximating algorithm for Max-SAT
24-8
Computability and Complexity
Satisfying Clauses
We present an algorithm which, given a formula , computes a solution
with relative error at most 1k where k is the minimal number of literals
2
in a clause of 
Let   C1  C2    Cn and Ci has k i literals
The probability that a random assignment to the variables of  satisfies
2 ki  1
1
is
p
(
C
)


1

Ci
i
2 ki
2 ki
Therefore, the expected number of clauses satisfied by a random assignment
n
n
1
ki
i 1 2
E (  )   p ( Ci )  n  
i 1
24-9
Computability and Complexity
In a similar way we can compute E ( |X 0 ) and E ( |X 1 )
It follows from Probability Theory that
1
E ( )  E ( |X 0 )  E ( |X 1 ) 
2
Therefore E ()  max E ( |X 0 ), E ( |X 1 ) 
24-10
Computability and Complexity
Algorithm
Given CNF , let X 1 ,, X m be variables in 
• for i = 1 to n do
• compute E ( |X i 0 ) and E ( |X i 1 )
•
if E ( | X
0
)  E ( | X i 1 ) then
set X i  0 and  :  |X i 0
• otherwise
set X i  1 and  :  |X i 1
• return the assignment X 1 ,, X m
24-11
Computability and Complexity
24-12
Analysis
The algorithm builds a sequence of formulas    0 , 1 ,,  m
such that E ()  E ( 0 )  E (1 )    E ( m )
Consider formula  m . It contains no variables, therefore E ( m )
is the number of satisfied clauses
Compute the relative error.
Since OPT()  n
| OPT(  )  E ( m ) | OPT(  )  E ( m )
E ( m )

 1
OPT(  )
OPT(  )
OPT(  )
n
E ( m )
E ( )
 1
 1
 1
n
n
n
 p(Ci )
i 1
n
1  1 
  2ki 
 1  i 1
n
n
n
n
1
1
1
1
n   ki
n



ki
k
k
1
2
i 1 2
i 1 2
i 1 2


 1
 11

n
2k
n
n
n