



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




CS787: Advanced Algorithms Scribe: Shijin Kong and David Malec Lecturer: Shuchi Chawla Topic: NP-Completeness, Approximation Algorithms Date: 10/1/
As we’ve already seen in the preceding lecture, two important classes of problems we can consider are P and N P. One very prominent open question is whether or not these two classes of problems are in fact equal. One tool that proves useful when considering this question is the concept of a problem being complete for a class. In the first two portions of this lecture, we show two problems to be complete for the class N P , and demonstrate two techniques for proving completeness of a problem for a class. We then go on to consider approximation algorithms, which have as a goal providing efficient near-optimal solutions to problems for which no known efficient algorithm for finding an optimal solution exists.
The Cook-Levin Theorem gives a proof that the problem SAT is N P -Complete, via the technique of showing that any problem in N P may be reduced to it. Before proceeding to the theorem itself, we revisit some basic definitions relating to N P -Completeness.
First, we need to understand what problems belong to the classes P and N P. If we restrict ourselves to decision problems, every problem has a set of accepted inputs; we call this set of inputs a language, and can think of the original problem as reducing to the question of whether or not a given input is in this language. Then, P is the class of languages for which membership can be decided in polynomial time, and N P is the class of languages such that x ∈ L if and only if there’s a certificate of its membership that can be verified in polynomial time.
Second, we need the notion of reducibility of one problem to another. We say that a that a problem B can be reduced to A, or B (^6) p A if, given access to a solution for A, we can solve B in polynomial time using polynomially many calls to this solution for A. This idea of reducibility is crucial to completeness of a problem for a class. If a problem L ∈ N P satifies that for any L′^ ∈ N P , L′^6 p L, then we say L is N P -Complete. It is worth noting that for proving N P -Completeness, typically a more restrictive form of reduction is used, namely a Karp reduction. It follows the same basic structure, but requires that only one query be made to the solution for the problem being reduced to, and that the solution be directly computable from the result of the query.
The Cook-Levin Theorem shows that SAT is N P -Complete, by showing that a reduction exists to SAT for any problem in N P. Before proving the theorem, we give a formal definition of the SAT problem (Satisfiability Problem):
Given a boolean formula φ in CNF (Conjuctive Normal Form), is the formula satisfiable? In other words, we are given some boolean formula φ with n boolean variables x 1 , x 2 ,... , xn, φ = C 1 ∧ C 2 ∧ · · · ∧ Ck, where each of the Ci is a clause of the form (ti 1 ∨ ti 2 ∨... ∨ til), with each lij is a literal drawn from the set {x 1 , x 2 ,... , xn, x¯ 1 , ¯x 2 ,... , x¯n}. We need to decided whether or not the exists some setting of the x 1 , x 2 ,... , xn that cause the formula φ to be satisfied (take on a boolean
value of true).
Theorem 9.1.1 Cook-Levin Theorem: SAT is NP-complete.
Proof: Suppose L is a NP problem; then L has a polynomial time verifier V :
We can build a circuit with polynomial size for the verifier V , since the verifier runs in polynomial time (note that this fact is nontrivial; however, it is left to the reader to verify that it is true). The circuit contains AND, OR and NOT gates. The circuit has |x| + |y| sources, where |x| of them are hardcoded to the values of the bits in x and the rest |y| are variables.
Now to solve problem L, we only need to find a setting of |y| variables in the input which causes the circuit to output a 1. That means problem the problem L has been reduced to determining whether or not the circuit can be caused to output a 1. The following shows how the circuit satisfication problem can be reduced to an instance SAT.
Each gate in the circuit can be represented by a 3CNF (each clause has exactly three terms). For example:
Suppose we have q gates in V marked as Z 1 , Z 2 ,... , Zq with Zq representing the final output of V. Each of them either takes some of the sources or some intermediate output Zi as input. Therefore the whole circuit can be represented as a formula in CNF:
φ = C 1 ∧ C 2 ∧... ∧ Cq ∧ Zq
where
Ci = (t 1 ∨ t 2 ∨ t 3 ), t 1 , t 2 , t 3 ∈ (x, y, Z 1 , Z 2 ,... Zq, Z¯ 1 , Z¯ 2 ,... , Z¯q)
As we said before, even if the last clause of φ has only one term Zq , we may extend φ to an equivalent formula in 3CNF by adding independent variables. Thus, we have shown that the circuit can be reduced to φ, a formula in 3CNF which is satisfiable if and only if the original circuit could be made to output a value of 1. Hence, L (^6) p SAT. Since SAT can be trivially shown to be in N P (any
Figure 9.2.2: The gadget Xi Figure 9.2.3: The gadget Ci
not, add the vertex back into the graph, and try the next one. When k reaches 0, we have our vertex cover. This property of being able to solve a search problem via queries to an oracle for its decision variant is called self-reducibility.
Theorem 9.2.1 The decision version of Vertex Cover is NP-Complete.
Proof: It is immediate that Vertex Cover ∈ NP. We can verify a proposed vertex cover of the appropriate size in polynomial time, and so can use these as certificates of membership in the language.
All we need to show then is that VC is NP-Hard. We do so by reducing 3-SAT to it. Given some formula φ in 3-CNF, with n variables x 1 ,... , xn and m clauses c 1 ,... , cm, we will build a graph, starting with the following gadgets.
For each variable xi, we will build a gadget Xi. Xi will have two vertices, one corresponding to each of xi and ¯xi, and these two vertices will be connected by an edge (see figure 9.2.2). Notice that by construction, any vertex cover must pick one of these vertices because of the edge between them.
For each clause ci, we will build a gadget Ci. Since φ is in 3-CNF, we may assume that ci = (li 1 ∨ li 2 ∨ li 3 ) for some set of literals li 1 , li 2 , li 3. The gadget Ci will consist of a complete graph of size 3, with a vertex corresponding to each of the literals in the clause ci (see figure 9.2.3). Notice that since all of the vertices are connected by edges, any vertex cover must include at least two of them.
Given the preceding gadgets for each of the variables xi and each of the clauses ci, we describe how the gadgets are connected. Consider the gadget Ci, representing the clause ci = (l 1 i ∨ l 2 i ∨ l 3 i). For each of the literals in ci, we add an edge from the corresponding vertex to the vertex for the appropriate boolean value of the literal. So if li 1 = xk, we will add an edge from the vertex for li 1 in the clause gadget Ci to the vertex for xk in the variable gadget Xk; similarly, if li 1 = ¯xk, we add and edge to the vertex for x¯k in Xk. Figure 9.2.4 gives the connections for an example where ci = (x 1 ∨ x¯ 2 ∨ x 4 ).
Now that we have our graph, we consider what we can say about its minimum vertex cover. As previously noted, at least one vertex from any variable gadget must be included in a vertex cover; similarly, at least 2 vertices from any clause gadget must be included. Since we have n variables and m clauses, we can thus see that no vertex cover can have size strictly less than n + 2m.
Figure 9.2.4: Connecting the gadgets
Furthermore, we show that a vertex cover of exactly this size exists if and only if the original formula φ is satisfiable.
Assume that such a vertex cover exists. Then, for each of the gadgets Xi, it contains exactly one vertex. If we set each xi so that the node in the vertex cover corresponds to a boolean value of true, we will have a satisfying assignment. To see this, consider any clause ci. Since the vertex cover is of size exactly n + 2m, only two of the vertices in the gadget Ci are included. Now, the vertex which wasn’t selected is connected to the node corresponding to its associated literal. Thus, since we have a vertex cover, that node must be in it. So, the unselected literal must have a boolean value of true in our setting of the xi, and so the clause is satisfied.
Similarly, if an assignment of the xi exists which satisfies φ, we can produce a vertex cover of size n + 2m. In each gadget Xi, we simply choose the vertex corresponding to a boolean value of true in our satisying assignment. Then, since it is a satisfying assignment, each clause contains at least one literal with a boolean value of true. If we leave the corresponding vertex, and include the others, we get a vertex cover. The edges inside the gadget Ci are satisfied, since we have chosen all but one of its vertices; the edges from it to variable gadgets are satisfied, since for each one, either the vertex in Ci has been included or the vertex in the corresponding Xi has been chosen.
Thus, we can see that the original formula is satisfiable if and only if the constructed graph has a vertex cover of size n + 2m. Thus, since 3SAT is NP-Hard, we get that VC is NP-Hard as well. As we have previously noted, VC ∈ NP, and hence VC is NP-Complete.
In this section we consider another topic: approximation algorithms. There are many cases where no polynomial time algorithm is known for finding an optimal solution. In those situations, we can compromise by seeking a polynomial time near-optimal solution. However, we want to guarantee in this case that this alternative is close to optimal in some well-defined sense. To demonstrate
Now, we try to get an α-approximation for the vertex cover problem.
Lemma 9.3.1 Given a graph G, the size of any matching in G is a lower bound on the size of any vertex cover.
Proof: The key insight here is that the edges in a matching do not share any common vertices. So according to the definition of the vertex cover problem, any vertex cover problem must choose at least one vertex from any edge in the matching. Therefore, the size of any matching provides a lower bound for the size of any vertex cover.
Using a maximal matching with the above will give us a sufficiently good bound to derive an α-approximation.
Lemma 9.3.2 Given a graph G and any maximal matching M on G, we can find a vertex cover for G of size at most 2 |M |.
Proof: First, we prove that for any maximal matching M , there exists a solution for the vertex cover problem with size no more than 2|M |. We start by choosing both vertices incident on each of the edges in M. This gives us a set of vertices of size 2|M |. We claim this vertex set constitutes a valid vertex cover. Assume by way of contradiction that it does not; then we can find a edge e of which neither node is picked present in our set of vertices. But then, we may add e to our original matching M to form a larger matching M ′. But by assumption M is a maximal, and so this is a contradiction. Thus, we have found a vertex cover for G of size 2|M |
Theorem 9.3.3 There exists a polynomial time 2-approximation for vertex cover problem.
Proof: Finding a maximum matching M can be done in polynomial time. Once we find M , we simply apply the strategy outlined above to get our vertex cover. Since we showed that the size of any matching provides a lower bound for the size of any vertex cover, we may conclude that the optimal vertex cover must be of size at least |M |. Thus, since our proposed vertex cover will have size 2|M |, our algorithm will provide a 2-approximation for the vertex cover problem.