Approximation Algorithms II Max 3 SAT
Approximation Algorithms II Max 3 SAT
Approximation algorithms II
By Sariel Har-Peled, December 7, 2009¬ Version: 0.3
Clearly, since 3SAT is NP-C it implies that Max 3SAT is NP-H. In particular, the
formula F becomes the following set of two clauses:
x1 + x2 + x3 and x4 + x1 + x2 .
Definition 7.1.1 Algorithm Alg for a maximization problem achieves an approximation factor α
if for all inputs, we have:
Alg(G)
≥ α.
Opt(G)
1
Definition 7.1.2 (Linearity of expectations.) Given two random variables X, Y (not necessarily in-
dependent, we have that E[X + Y] = E[X] + E[Y].
Theorem 7.1.3 One can achieve (in expectation) (7/8)-approximation to Max 3SAT in polynomial
time. Namely, if the instance has m clauses, then the generated assignment satisfies (7/8)m clauses
in expectation.
Proof: Let x1 , . . . , xn be the n variables used in the given instance. The algorithm works by
randomly assigning values to x1 , . . . , xn , independently, and equal probability, to 0 or 1, for each
one of the variables.
Let Yi be the indicator variables which is 1 if (and only if) the ith clause is satisfied by the
generated random assignment and 0 otherwise, for i = 1, . . . , m. Formally, we have
1 Ci is satisfied by the generated assignment,
Yi =
0
otherwise.
Now, the number of clauses satisfied by the given assignment is Y = mi=1 Yi . We claim that
P
E[Y] = (7/8)m, where m is the number of clauses in the input. Indeed, we have
m m
X X
E[Y] = E Yi =
E[Yi ]
i=1 i=1
by linearity of expectation. Now, what is the probability that Yi = 0? This is the probability that all
three literals appear in the clause Ci are evaluated to FALSE. Since the three literals are instance
of three distinct variable, these three events are independent, and as such the probability for this
happening is
1 1 1 1
Pr[Yi = 0] = ∗ ∗ = .
2 2 2 8
(Another way to see this, is to observe that since Ci has exactly three literals, there is only one
possible assignment to the three variables appearing in it, such that the clause evaluates to FALSE.
Now, there are eight (8) possible assignments to this clause, and thus the probability of picking a
FALSE assignment is 1/8.) Thus,
7
Pr[Yi = 1] = 1 − Pr[Yi = 0] = ,
8
and
7
E[Yi ] = Pr[Yi = 0] ∗ 0 + Pr[Yi = 1] ∗ 1 = .
8
Namely, E[# of clauses sat] = E[Y] = mi=1 E[Yi ] = (7/8)m. Since the optimal solution satisfies
P
at most m clauses, the claim follows.
Curiously, Theorem 7.1.3 is stronger than what one usually would be able to get for an ap-
proximation algorithm. Here, the approximation quality is independent of how well the optimal
solution does (the optimal can satisfy at most m clauses, as such we get a (7/8)-approximation. Cu-
riouser and curiouser , the algorithm does not even look on the input when generating the random
assignment.
“Curiouser and curiouser!” Cried Alice (she was so much surprised, that for the moment she quite forgot how to
speak good English). – Alice in wonderland, Lewis Carol
2
7.2 Approximation Algorithms for Set Cover
7.2.1 Guarding an Art Gallery
You are given the floor plan of an art gallery, which is a two
dimensional simple polygon. You would like to place guards that
see the whole polygon. A guard is a point, which can see all points
around it, but it can not see through walls. Formally, a point p can
see a point q, if the segment pq is contained inside the polygon.
See figure on the right, for an illustration of how the input looks
like.
A visibility polygon at p (depicted as the yellow polygon on
the left) is the region inside the polygon that p can see. WE would
like to find the minimal number of guards needed to guard the
p given art-gallery? That is, all the points in the art gallery should
be visible from at least one guard we place.
The art-gallery problem is a set-cover problem. We have a
ground set (the polygon), and family of sets (the set of all visibility
polygons), and the target is to find a minimal number of sets covering the whole polygon.
It is known that finding the minimum number of guards needed is NP-H. No approximation
is currently known. It is also known that a polygon with n corners, can be guarded using n/3 + 1
guards. Note, that this problem is harder than the classical set-cover problem because the number
of subsets is infinite and the underlining base set is also infinite.
An interesting open problem is to find a polynomial time √ approximation algorithm, such that
given P, it computes a set of guards, such that #guards ≤ nkopt , where n is the number of vertices
of the input polygon P, and kopt is the number of guards used by the optimal solution.
Example 7.2.1 Consider the set S = {1, 2, 3, 4, 5} and the following family of subsets
n o
F = {1, 2, 3}, {2, 5}, {1, 4}, {4, 5} .
n o
Clearly, the smallest cover of S is Xopt = {1, 2, 3}, {4, 5} .
3
The greedy algorithm GreedySetCover for this prob- GreedySetCover(S , F )
lem is depicted on the right. Here, the algorithm al- X ← ∅; T ← S
ways picks the set in the family that covers the largest while T not empty do
number of elements not covered yet. Clearly, the algo- U ← set in F covering
rithm is polynomial in the input size. Indeed, we are largest # of elements in T
given a set S of n elements, and m subsets. As such, the X ← X ∪ {U}
input size is at most Ω(m + n), and the algorithm takes T ←T \U
time polynomial in m and n. Let Xopt = {V1 , . . . , Vk } be
the optimal solution. return X.
Let T i denote the elements not covered in the be-
ginning ith iteration of GreedySetCover, where T 1 = S . Let Ui be the set added to the cover in the
ith iteration, and αi = |Ui ∩ T i | be the number of new elements being covered in the ith iteration.
Theorem 7.2.4 The algorithm GreedySetCover generates a cover of S using at most O(k log n)
sets of F , where k is the size of the cover in the optimal solution.
Proof: We have that |T i | ≤ (1 − 1/k) |T i−1 | ≤ (1 − 1/k)i |T 0 | = (1 − 1/k)i n. In particular, for
M = d2k ln ne we have
!M ! !
1 1 d2k ln ne 1
|T M | ≤ 1 − n ≤ exp − M n = exp − n ≤ < 1,
k k k n
since 1 − x ≤ e−x , for x ≥ 0. Namely, |T M | = 0. As such, the algorithm terminates before reaching
the Mth iteration, and as such it outputs a cover of size O(k log n), as claimed.
4
Bibliography
[FG95] U. Feige and M. Goemans. Approximating the value of two power proof systems, with
applications to max 2sat and max dicut. In ISTCS ’95: Proceedings of the 3rd Israel
Symposium on the Theory of Computing Systems (ISTCS’95), page 182, Washington,
DC, USA, 1995. IEEE Computer Society.
[Has97] J. Hastad. Some optimal inapproximability results. In Proc. 29th Annu. ACM Sympos.
Theory Comput., pages 1–10, 1997.