Approximation Algorithms: Lecture Notes on Vertex Cover Problem and Knapsack Problem, Study notes of Computer Science

These lecture notes cover the vertex cover problem and knapsack problem in the context of approximation algorithms. The notes discuss absolute approximation, definition of approximation algorithms, and the concept of relative and absolute error. The notes also provide examples of approximation algorithms for the knapsack problem and the vertex cover problem, as well as a theorem stating that unless p=np, no polynomial-time absolute approximation algorithm exists for the knapsack problem.

Typology: Study notes

Pre 2010

Uploaded on 08/01/2009

koofers-user-0rt-1
koofers-user-0rt-1 🇺🇸

9 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS491I Approximation Algorithms
The Vertex-Cover Problem
Lecture Notes
Xiangwen Li
March 8th and March 13th, 2001
Absolute Approximation
Given an optimization problem
P
, an algorithm
A
is an
approximation algorithm for
P
if, for any given instance Ix
,
it returns an approximation solution, that is a feasible solution
)(xA.
Definition 1 Given an optimization problem
P
, for any instance
x
of
P
and an arbitrary
feasible solution
y
.
Denote )(
*xm the optimum value of
x
and ),(yxm the value of
function at feasible point
y
for the instance
x
. The absolute
error of
y
with respect to
x
is defined as
.|),()(|*yxmxm
Given an NP-hard optimization problem, it would be very
satisfactory to have a polynomial-time approximation algorithm
that is capable of providing a solution with a bounded absolute
error for every instance
x
.
Definition 2 Given an optimization problem
P
and an approximation
algorithm
A
for
P
, we say that
A
is an absolute approximation
algorithm if there exists a constant k such that, for every
instance
x
of
P
, .|))(,()(|*kxAxmxm .
Example Let us consider the problem of determining the minimum
number of colors needed to color a planar graph. It is well-known
that a 6-coloring of a planar graph can be found in polynomial
pf3
pf4
pf5
pf8

Partial preview of the text

Download Approximation Algorithms: Lecture Notes on Vertex Cover Problem and Knapsack Problem and more Study notes Computer Science in PDF only on Docsity!

CS491I Approximation Algorithms

The Vertex-Cover Problem

Lecture Notes

Xiangwen Li

March 8th and March 13th, 2001

Absolute Approximation

Given an optimization problem P , an algorithm A is an

approximation algorithm for P if, for any given instance xI , it returns an approximation solution, that is a feasible solution A ( x ).

Definition 1 Given an optimization problem P , for any instance x of P and an arbitrary feasible solution y.

Denote m *^ ( x ) the optimum value of x and m ( x , y ) the value of function at feasible point y for the instance x. The absolute error of (^) y with respect to x is defined as

| m * (^ x )− m ( x , y )|.

Given an NP-hard optimization problem, it would be very satisfactory to have a polynomial-time approximation algorithm that is capable of providing a solution with a bounded absolute error for every instance x.

Definition 2 Given an optimization problem P and an approximation algorithm A for P , we say that A is an absolute approximation algorithm if there exists a constant k such that, for every

instance x of P , | m *^ ( x )− m ( x , A ( x ))|≤ k ..

Example Let us consider the problem of determining the minimum number of colors needed to color a planar graph. It is well-known that a 6-coloring of a planar graph can be found in polynomial

time[1]. It is also known that establishing whether the graph is 1-colorable (that is, the set of edges is empty) or 2-colorable( that is, the graph is bipartite) is decidable in polynomial time whereas the problem of deciding whether three colors are enough is NP-complete( see [2] for detail).

Algorithm D

begin

If the graph is 1- or 2-colorable, return either a 1- or a 2-coloring of the vertices of G.

else return a 6-coloring of the vertices of G.

end

Then we obtain an approximate solution with absolute error bounded by 3, | m *− mD |≤ 3.

Consider the Knapsack Problem. This problem is characterized by n objects O 1 (^) , O 2 ,,, On where each Oi is associated with a profit Pi and

a weight Wi. We want to choose a subset of objects to maximize the

profit without violating the fact that the knapsack has a limit weight W. The Integer Programming Formulation is:

=

n

i

pi xi 1

max

1 ∈

= i

n

i

i i

x

wx W

Let g be an instance of the Knapsack problem n items with profits

P 1 (^) , P 2 ,,, P n and sizes W 1 (^) , W 2 ,,,, Wn. Suppose that the problem has a

polynomial time approximation algorithm A with absolute error k

and suppose that m * and m (^) A are the optimum solution and the

approximation solution respectively. Then

| m *− mA |≤ k. Let y be instance of n items with profits

vV

i i i

min w x

x (^) i + xj ≥ 1 ∀( xi , xj )∈ E , xi ∈{ 0 , 1 }.

Let LP be the linear program obtained by relaxing the integrality

constraints to simple non-negativeness constraints (i.e., x (^) i ≥ 0 for

each viV ).

Program A

begin

  1. V '= 0 ;
  2. Relax ILP to LP , by replacing the constraints xi ∈{ 0 , 1 }. with x (^) i ∈[ 0 , 1 ].;i.e. xi is a continuous variable between 0 and 1.
  3. For each vi such that 2

xi

V ' = V '∪{ v (^) i } return V '

end

Theorem 2 Given a graph G with non-negative vertex weights, Program A finds a feasible solution of minimum weighted vertex

cover with value mLP ( G ) such that mLP ( G )≤ 2 m *( G ).

Proof. Let V ' be the solution returned by the algorithm. The feasibility of V ' can be easily proved by contradiction. Assume

that V ' does not cover edge ( vi , vj ). This implies that both xi *^ ( G ) and

x * (^) j^ ( G ) are less than 0.5 and hence x * i^ ( G )+ x * (^) j^ ( G )<1, a contradiction.

Let m * ( G ) be the value of an optimal solution and let m * LP^ ( G ) be the optimal value of the relaxed linear program.

Since the value of an optimal solution is always larger than the optimal value of the relaxed linear program, we have

m * ( G )≥ m * LP^ ( G ).

If viV ', then 2

xi ≥ and

2 ( ). '

'

∈ ∈

v V

i i v V

i i i

w wx G

Since V ' ⊆ V ,

vV

i i i

w x *( G )≤ 2 ∑ w ix * i^ ( G ).

By the linear program algorithm,

'

w x *^ G m G m G LP IP v V

i i i

∑ ≤^ ≤

Therefore the theorem follows.

Primal-dual algorithms

The implementation of program A requires the solution of a linear program with a possibly large number of constrains. Therefore it is computationally expensive. Another approach known as primal- dual allows us to obtain an approximate solution more efficiently. The chief idea is that any dual feasible solution is a good lower bound on the minimization primal problem. We start with a primal dual pair (x, y), where x* is a primal variable, which is not necessarily feasible, while y* is the dual variable, which is not necessarily optimal. At each step of the algorithm, we attempt to make y* “more optimal” and x* “more feasible”; the algorithm stops when x* becomes feasible. Given a weighted graph G = ( V , E ), the dual

of the previously defined LP is the following program DLP :

y v v E

y w v V

y

ij i j

i vv E

ij i

vv E

ij

i j

i j

min

( )

( )

,

,

Note that the solution in which all yij are zero is a feasible

solution with value 0 of DLP. Also note that there is no dual for an integer program; we are taking the dual of the linear programming relaxation of the primal integer program. The primal dual algorithm is described the following.

vV '

vvE

ij i j

y ( , )

viV

vvE

ij i j

y ( , )

Since every edge of E counts two times in ∑

viV

vvE

ij i j

y ( , )

viV

vvE

ij i j

y ( , )

vvE

ij i j

y ( , )

Since ∑

vvE

ij i j

y ( , )

m * ( G ), the theorem follows.

Randomization

Let X be a discrete random variable and take the values a (^) 1 , a 2 ,,,, an ,

with probabilities p ( ai ), p ( a 2 ),.. p ( an ). The expectation of X is

defined as

=

n

i

E X ai pai 1

Linearity properties of Expectation

1. E ( X 1 + X 2 )= E ( X 1 )+ E ( X 2 ).

  1. E ( aX )= aE ( X ), where a is a positive, real number.

Example 1 Suppose that there are 40 sailors and 40 keys one of which is for one room. Suppose that each sailor takes one key randomly and opens his room with this key. What is the Expected number of sailors in their own rooms?

Let xi = 1 if sailor i enters his room, x (^) i = 0 otherwise.

By using linearity of expectation, we have

= =

40

1

40

1

i i

E Xi E Xi

We have used the fact that E ( Xi )= 1. pi + 0 .( 1 − pi ), since this is a

binary event. Thus, E ( Xi )=( 1 / 40 ), for all i

Example 2 A Boolean expression is said to be in k-conjunctive normal form ( k-SAT ) if it is the conjunction of clauses such that each clause contains exactly k variables. Suppose that there are m clauses and n variables in the Boolean expression. The goal is to find an

assignment of {True/False} to each of the variables, so that the given Boolean expression is satisfied. The corresponding optimization problem is to maximize the number of clauses that are satisfied ( The optimization problem is called MAX-SAT and is also NP-complete. ). Consider a random assignment of {True/False} to the variables i.e. each variable xi is set to True or False, depending upon the random outcome of flipping a fair coin. It is easy to see that the probability that

A single clause is not satisfied is at most (^) k 2

, since in order to

falsify a given clause, all its variables must be set to False, in

the random assignment. Hence, with probability ( (^) k 2

1 − ), each clause

is satisfied. We want to know the expected number of clauses that are satisfied by our random assignment. By using linear properties of expectation, we have

= = =

m

i

m

i

i k k

m

i

E Xi E X m 1 1 1

Note that the maximum number of clauses that can be satisfied under any assignment is m. Hence, our random assignment is an

approximation algorithm with approximation factor ( (^) k 2

( Exercise: Substitute various values of k and see how good the approximation gets. )

Reference:

[1] B.korte and J.Vygen, Combinatorial Optimization, Springer- Verlag, 2000. [2] M. R. Garey and D. S. Johnson, Computers and intractability—a guide to the theory of NP-completeness, 1979.