Lecture 22 More NPC problems

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Advertisements

Lecture 23. Subset Sum is NPC
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
NP-Completeness: Reductions
An NP-completeness Example. The graph CLIQUE problem Undirected Graph G = (V, E) –a clique is a complete subgraph of G Subset V’ of vertices that are.
NP-Completeness More Reductions. Definitions P: is the class of all decision problems which can be solved in polynomial time, O(n^k) for some constant.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Graphs 4/16/2017 8:41 PM NP-Completeness.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NP-Complete Problems Problems in Computer Science are classified into
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Fall 2006Costas Busch - RPI1 More NP-complete Problems.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Clique Cover Cook’s Theorem 3SAT and Independent Set
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
Unit 9: Coping with NP-Completeness
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
CS 461 – Nov. 30 Section 7.5 How to show a problem is NP-complete –Show it’s in NP. –Show that it corresponds to another problem already known to be NP-complete.
28.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NPC.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
NP Hard Problems Instructor Neelima Gupta Presentation Edited by Sapna Grover.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-complete problems
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness (36.4-5) P: yes and no in pt NP: yes in pt NPH  NPC
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
NP-Completeness Proofs
Richard Anderson Lecture 28 NP-Completeness
NP-Complete Problems.
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CSE 6408 Advanced Algorithms.
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
CHAPTER 7 Time complexity
Presentation transcript:

Lecture 22 More NPC problems Talk at U of Maryland Lecture 22 More NPC problems Dick Karp Today, we prove three problems to be NP-complete 3CNF-SAT Clique problem Vertex cover

3-CNF SAT is NP-complete A boolean formula is in 3-conjunctive normal form (3-CNF) if it consists of clauses connected by ANDs, and each clause is the OR of exactly three literals. (A literal is a variable or its negation). Example, (x1 OR x2 OR ~x3) AND (~x3 OR x4 OR ~x5)

Theorem. 3CNF-SAT is NPC Proof. Step 1. 3-CNF-SAT is clearly in NP as given an assignment, we can verify efficiently. Step 2. We choose SAT to reduce to 3CNF-SAT.

Proof continues … Step 3. To show SAT ≤p 3-CNF-SAT, we design the mapping function in three stages. In the first stage, We add parentheses so that no connective (AND OR) has more than two arguments. This formula gives a tree in which each node has out-degree at most 2. The leaves are the literals, and the internal nodes represent the connectives. Then apply the same transformation as in CIRCUIT-SAT ≤P SAT. This gives a formula with at most three variables per clause. That is: (a OR b) becomes: (c iff (a OR b) )

Proof continues … In stage 2, we take this new formula, and treat each clause separately. Since each clause C has at most three variables, we can make a truth table for the function represented by the clause. Now look at ~C, and rewrite it in disjunctive normal form--that is, as the OR of AND-clauses. For example: we can rewrite C = (y1 IFF (y2 AND ~x2)) as ~C = (y1 AND y2 AND x2 ) OR (y1 AND ~y2 AND x2) OR (y1 AND ~y2 AND ~x2) OR (~y1 AND y2 AND ~x2). By de Morgan's laws, we get C = (~y1 OR ~y2 OR ~x2) AND (~y1 OR y2 OR ~x2) AND (~y1 OR y2 OR x2) AND (y1 OR ~y2 OR x2).

Proof continues … In stage 3, we fix up those clauses having only 1 or 2 variables per clause, as follows: replace the clause (x1 OR x2) by (x1 OR x2 OR p) AND (x1 OR x2 OR ~p), and replace the clause (x1) by (x1 OR p OR q) AND (x1 OR ~p OR q) AND (x1 OR p OR ~q) AND (x1 OR ~p OR ~q). Here p and q are new variables. The new formula is satisfiable iff the old formula is because the reduction preserves the satisfiability. Step 4. We can compute f in polynomial time, say O(n2) time, all transformations being local. Therefore 3-CNF-SAT is NP-complete. QED

Clique problem Definition: we say a graph G=(V,E) has a clique of size k if there exists a subset V', with |V'| = k, of the vertices V such that for all u, v in V', the edge (u,v) is in E. In other words, the induced subgraph on the vertices V' is the complete graph of k vertices. One version of the CLIQUE problem is as follows: given a graph G, find a clique of maximum size. (There may be several.) -- this is not in NP. We will use the decision version of the CLIQUE problem: given a graph G = (V,E), and an integer k, does it have a clique of size k? Note that we can solve CLIQUE in (k choose 2)(|V| choose k) step. But this is not polynomial time.

CLIQUE example {2,4,5,7} is a clique of size 4, the largest in this graph. 1 2 3 4 5 6 7

Theorem. CLIQUE is NP-complete Proof. Step 1. Clique is in NP (certificate: the clique) Step 2. Pick an instance of 3-SAT, Φ, with k clauses Step 3. Reduction. We construct a graph G: Make a vertex for each literal Connect each vertex to the literals in other clauses that are not its negation Any k-clique in G corresponds to a satisfying assignment (needs a proof) The reduction is polynomial time. QED

An example of reduction 3-SAT < CLIQUE

Claim. F is a satisfiable boolean formula if and only if G = (V,E) has a clique V' of size k. Proof. Suppose that F is satisfiable. Then each clause has at least one literal that takes on the value 1. From each clause, choose one such literal, and let V' be the set of vertices corresponding to these literals. Then I claim that V' is a clique of size n. Since there is one vertex for each clause, clearly |V'| = k. If two literals in V’s are not connected by an edge, then they are negation to each other --contradicting the fact that we chose a literal with the value 1 from each clause. Suppose that G has a clique V' of size k. Since there are no edges between vertices whose labels appear in the same clause, for all i, V' must contain at most one vertex labeled with a literal in clause Ci. On the other hand, |V'| = k, so V' must contain exactly one vertex labeled with a literal in clause i, for all i. Assign each literal in V' the value 1. This will be a satisfying assignment. The assignment is consistent because V' will not contain both a literal and its negation. QED

VEXTEX-COVER Problem We say a graph G = (V,E) has a vertex cover of size k if there is a subset V’ of V such that for all edges (u,v) in E, either u is in V' or v is in V' (or both), and |V’|=k. Thus, a vertex-cover is a set of vertices V' such that every edge in E is incident on a vertex in V'. The VERTEX-COVER problem is: given a graph G and an integer k, does it have a vertex-cover V' of size k?

Vertex-Cover example V’ = {2,3,7} is a vertex cover of size 3. 1 2 3 5 4 6 7

Theorem. VERTEX-COVER is NP-complete. Proof. 1. VERTEX-COVER is in NP. A certificate is a list of vertices V' forming the alleged vertex cover, checking is trivial 2. Choose to reduce CLIQUE ≤P VERTEX-COVER. 3. Lemma: G has a clique of size k iff G complement has a vertex cover of size |V|-k. This lemma shows that the map f that transforms an instance of CLIQUE to an instance of vertex cover is: (G, k) ----> (G complement, |V|-k) 4. This transformation can be done in polynomial time. QED

Proof of the lemma Proof. Suppose V' is a clique of size k in G = (V,E). Then let (u,v) be an edge of E complement in G complement. Then (u,v) is not in E. Hence either u is not in V', or v is not in V', for if they were both in V', (u,v) would be in E. Therefore either u is in V-V' or v is in V-V'. Thus each edge (u,v) in E complement has at least one endpoint in V-V', so V-V' is a vertex cover for G complement, of size |V|-k. On the other hand, suppose G complement has a vertex cover V'' of size |V|-k. Then for any edge (u,v) in E complement, either u is in V'' or v is in V''. Taking the contrapositive, if u is not in V'', AND v is not in V'', then (u,v) is not in E complement. In other words, if u is in V-V'', and v is in V-V'', then (u,v) is in E. In other words, V-V'' is a clique of size |V|-(|V|-k) = k.

Proof by Picture G ~G 1 2 1 2 3 5 3 5 4 4 6 6 7 7

Summary To show a problem to be NP-complete, we do it in 4 steps: Show the problem in NP Choose an NPC problem (it is important to choose the right problem). Do the reduction Show the reduction is polynomial time. Of course, not all problems are NPC. How do we know if a problem may be NPC? We fail to find a polynomial solution We can guess a solution, and check it quickly.