Outline
- Defining Randomized Approximation
- MAX 3SAT approximation
- Quiz
- Linear Programming and Weighted Vertex Cover
Introduction
- Last week, we were talking about approximation algorithm for NP-complete problems.
- We said an algorithm for a problem has an approximation ratio of
`r(n)`, if for any input of size `n`, the cost `C` of the solution produced
by the algorithm is within a factor of `r(n)` of the cost `C^star` of the optimal solution.
That is, `max(C/C^star, C^star/C) le r(n)`.
- We call an algorithm that achieves an `r(n)`-approximation ratio an `r(n)`-approximation algorithm.
- We gave a 2-approximation algorithm for vertex cover by repeatedly selecting edges from the current edge set, adding its vertices to our cover, and deleting adjacent edges.
- We gave a 2-approximation algorithm for TSP with the triangle by constructing a minimal spanning tree for the graph in questions, and doing a pre-order walk around it.
- We showed it was NP-hard to give an approximation algorithm of ratio `d` for general TSP. This shows that it is possible to show inapproximaibility results for some NP-complete problems.
- We gave an `r(n) = H(max{|S| : S in F})` approximation ratio for SET-COVER. This shows that in coming up with approximation algorithm, we might want to make use properties of the instance size in our approximation, rather than geta result which is always a constant like 2.
- Finally, I said we were going to talk about randomized approximation. As a warm up, I gave a randomized algorithm for 2-SAT.
- Today, we will start by looking at a randomized approximation algorithm for MAX-3SAT.
Randomized Approximation Algorithms
- We say a randomized algorithm for a problem
has an approximation ratio of `r(n)` if for any input size `n`,
the expected cost `C` of the solution produced by the randomized algorithm
is within a factor of `r(n)` of the cost `C^star` of an optimal solution.
- We call a randomized algorithm that achieves an approximation ratio
of `r(n)` a randomized `r(n)`-approximation algorithm.
- Let MAX-kSAT be the problem of determining given a
`k`-CNF formula an assignment which makes as many clauses as possible evaluate to `1`.
Algorithm for MAX-3SAT
Theorem. Given an instance of MAX-3SAT with n variables and `m` clauses,
the randomized algorithm that independently sets each variable to `1` with probability `1/2`
and to `0` with probability `1/2` is an randomized `8/7`-approximation algorithm.
Proof. Define the indicator random variable `Y_i = I{`clause `i` is satisfied`}`.
Since no literal appears more than once in the same clause, and since we assume that
no variable and its negation appear in the same clause, the settings of the
three literals are independent. A clause is not satisfied only if all three of its
literals are set to `0`. We thus have:
- `Pr{`clause `i mbox( is not satisfied ) } = 1/8`
- `Pr{`clause `i mbox( is satisfied ) } = 7/8`.
- `E[Y_i] = 7/8`.
Let `Y = sum_i Y_i`. Then
`E[Y] = E[sum_i Y_i] = sum_iE[Y_i] = sum_i 7/8 = (7m)/8`.
As `m` is an upper bound on the number of possible clauses that could be satisfied,
this gives the result.
Quiz
Which of the following is true?
- In our reduction of 3SAT to SUBSET-SUM it is possible that two 3SAT instances with the same number of variables and clauses might reduce
to two different subset sum problems each of which has a different target.
- Set cover might be used to model hiring staff whose abilities cover a set of skills.
- Our randomized algorithm for 2SAT involved flipping a coin for each variable to generate an assignment, then checking if that assignment satisfied the 2SAT formula.
Weighted Vertex Cover
- The minimum-weight vertex cover problem is given a graph `G=(V, E)` and a positive weight function `w(v)` on vertices,
find a vertex cover `V' subseteq V`, such that `w(V') = sum_(v in V') w(v)` is as small as possible.
- Our vertex cover algorithm from before treats all vertices equally and may return a very heavy cover, so a new algorithm is needed for this problem.
- We are going to give a linear programming-based algorithm to get a solution.
0-1 Program for Minimum Weight Vertex Cover
- In a linear program, we are trying to maximize or minimize a function of several variables, subject to a set of linear inequalities on those variables.
- In our case, to each vertex `v in V` associate a 0 or 1 valued variable `x(v)`. We put `v` in the vertex cover iff `x(v)=1`.
- The constraint that for any edge `(u,v)` one of `u` or `v` must be in the vertex cover, can be represented as the constraint
`x(u) + x(v) ge 1`.
- This gives us the following 0-1 integer program for minimum weight vertex cover:
minimize
`sum_(v in V) w(v) x(v)`
subject to
`x(u) + x(v) ge 1` for each `(u,v) in E`
`x(v) in {0, 1}` for each `v in V`.
- The special case where all the `w(v)` are 1 is the optimization version of the NP-hard vertex cover problem, so the above kinds of programs are hard
to solve.
Using Relaxation to Approximately Solve Problems
- If instead of requiring `x(v) in {0,1}`, we only require `0 le x(v) le 1`, we obtain the following linear program:
minimize
`sum_(v in V) w(v) x(v)`
subject to
`x(u) + x(v) ge 1` for each `(u,v) in E`
`x(v) le 1` for each `v in V`.
`0 le x(v)` for each `v in V`.
- This is known as the linear programming relaxation of our 0-1 program.
- Notice any feasible solution (a setting to the variables that satisfies all the constraints) to the original 0-1 integer program is also a feasible solution to the linear program.
- So an optimal solution to the linear program gives a lower bound on the value of an optimal solution to the 0-1 integer program, and hence a lower bound on the optimal weight in the minimum weight vertex-cover problem.
Approximation Algorithm For Minimum Weight Vertex Cover
- We now use the linear program from the last slide together with rounding to get an approximation algorithm for minimum weight vertex-cover.
APPROX-MIN-WEIGHT-VC(G, w)
1 C = ∅
2 Compute x, an optimal solution to the
linear program of the previous slide
3 for each v ∈ V
4 if x(v) ≥ 1/2
5 C = C ∪ {v}
6 return C
- One can use the ellipsoid method to find an optimal solution to the linear program in `p`-time (`n^4L`, where `L` is the number of digits) (see Chapter 29 of the book). We will assume, we are just calling some software package that implements this.
APPROX-MIN-WEIGHT-VC is a 2-approximation algorithm
Theorem. APPROX-MIN-WEIGHT-VC is a polynomial time 2-approximation algorithm for the minimum-weight vertex-cover problem.
Proof. As we have already mentioned, line 2 in the algorithm can be done in p-time using the ellipsoid method.
Lines 3-5 are linear time in the number of vertices, so the whole algorithm is p-time.
Let `C^star` be an optimal solution to a minimum-weight vertex-cover problem. Let `z^star` be an optimal
solution to the linear program described on the previous slides. Since an optimal cover is a feasible solution to the
linear program, we have
`z^star le w(C^star)`.
The Theorem follows from the following claim which we prove on the next slide:
Claim. The rounding of variables `x(v)` in APPROX-MIN-WEIGHT-VC produces a set `C`
that is a vertex cover and satisfies `w(C) le 2z^star`.
Proof of Claim
As one of our constraints is `x(u) + x(v) ge 1`, at least one `x(u)` or `x(v)` must be at least 1/2. Therefore, at least one of `u` or `v` is included in the vertex cover, and so every edge is covered.
Consider the weight of the cover. We have
`z^star = sum_(v in V) w(v) x(v)`
`ge sum_(v in V; x(v) ge 1/2)w(v) x(v)`
`ge sum_(v in V; x(v) ge 1/2)w(v) 1/2`
`= sum_(v in C)w(v) 1/2`
`= 1/2 sum_(v in C)w(v)`
`= 1/2 w(C)`
So this gives:
`w(C) le 2z^star le 2w( C^star)`
completing the proof.