Lecture 21 NP-complete problems

Slides:



Advertisements
Similar presentations
Lecture 23. Subset Sum is NPC
Advertisements

NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Great Theoretical Ideas in Computer Science for Some.
CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
CS21 Decidability and Tractability
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
Graphs 4/16/2017 8:41 PM NP-Completeness.
1 Polynomial Church-Turing thesis A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only.
NP-Complete Problems Problems in Computer Science are classified into
NP-complete and NP-hard problems
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
1 NP-Completeness Poly time algorithm: input size n (in some encoding), worst case running time – O(n c ) for some constant c. Three classes of problems.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
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.
COMPSCI 102 Introduction to Discrete Mathematics.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
COMPSCI 102 Introduction to Discrete Mathematics.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Unit 9: Coping with NP-Completeness
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NPC.
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.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
1 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
CS21 Decidability and Tractability
P versus NP a Millennium Prize Problem
NP-Completeness Proofs
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Presentation transcript:

Lecture 21 NP-complete problems Talk at U of Maryland Lecture 21 NP-complete problems Why do we care about NP-complete problems? Because if we wish to solve the P=NP problem, we need to deal with the hardest problems in NP. Why do we want to solve the P=NP problem? Because it will solve other 3000 NPC problems. It is one of the fundamental mathematical problems: Millennium Prize (CMI) -- $1M for each problem: P versus NP The Hodge conjecture The Poincaré conjecture - solved, by Grigori Perelman The Riemann hypothesis Yang-Mills existence and mass gap Navier-Stokes existence and smoothness The Birch and Swinnerton-Dyer conjecture

Talk at U of Maryland NP-completeness Theorem. If there is a polynomial-time algorithm for any one NP-complete problem, then there is a polynomial-time algorithm for every problem in NP. (Proved in previous lecture.) Corollary. If no polynomial-time algorithm exists for some problem in NP, then there is no polynomial-time algorithm for any NP-complete problem.

Easy vs Hard Here are some examples of easy (P) and hard problems (NP-hard). Easy Hard 2SAT 3SAT Minimum spanning tree Traveling salesman Shortest path Longest path linear programming integer linear programming Eulerian cycle Hamiltonian cycle

“First Natural” NP-hard problem Circuit Satisfiability problem. An instance of the problem is a Boolean circuit (using AND, OR, and NOT gates connected by wires) that has n Boolean inputs and a single Boolean output. The circuit has no cycles. The size of the circuit is defined to be the total number of gates and wires. CIRCUIT-SAT = the decision problem, given a Boolean circuit C, is it satisfiable? CIRCUIT-SAT can be solved by simply trying all possible 2n assignments, not polynomial time. By S.A. Cook, 1971 STOC

Circuit SAT AND OR OR Find a satisfying assignment AND AND AND AND NOT x3 x4 x5 x1 x2

Thm. CIRCUIT-SAT is NP-complete Proof by hand-waving. CIRCUIT-SAT is clearly in NP. The "certificate” is a satisfying assignment. Given this, we can easily verify in polynomial time that the circuit outputs a 1. We now give a polynomial-time transformation from every problem L in NP to CIRCUIT-SAT. If L is in NP, then there is a verifier A(x,y) that runs in time T(|x|) = O(|x|k) for some k. We now construct a single boolean circuit M that maps one "configuration" of a machine that carries out the computation of A(x,y) (recording such things as the memory state, program counter, etc.) to the next "configuration". We now hook together T(|x|) of these circuits together, making the inputs to the circuit at the top the value of y, and the output the single bit that reflects the value of A(x,y). This big circuit C(x) is satisfiable (by a value of y) if and only if x was a "yes" instance of L. The size of this circuit is polynomial in x, and the transformation can be done in polynomial time. QED

4 step routine for proving NPC Four-step routine for proving NP-completeness of a decision problem A: 1. Prove A is in NP by describing the polynomial-time verifier V that verifies "yes" instances of A. What is the certificate? How is it verified? 2. Select a problem B that you already know to be NP-complete. 3. Design a function f that maps "yes" instances of B to "yes" instances of A, and “no” instances of B to “no” instances of A, and justify that. 4. Show that f can be computed in polynomial time.

Proving other NPC problems The following is the scheme of reductions we will use to prove some problems to be NP-complete (there are over 3000 of them – actually many more now): CIRCUIT-SAT | SAT 3-CNF-SAT / \ CLIQUE SUBSET-SUM / VERTEX-COVER

SAT problem. SAT. A boolean formula consists of boolean (1/0) variables joined by connectives: AND, OR, IMPLIES, IFF, NOT. Also, parentheses may be used. An example, F = ((x1 IMPLIES x2 ) OR NOT ((NOT x1 IFF x3) OR x4)) AND NOT x2 . An assignment is a specification of truth values of the various variables. For example, (x1,x2,x3,x4)=(0,0,0,1) is an assignment that makes F true (equal to 1). Such an assignment is called a satisfying assignment. If a formula F has a satisfying assignment, it is called satisfiable.

Theorem. SAT is NP-complete (Given a boolean formula F, is it satisfiable?) Proof. First, we need to show that SAT is in NP. Clearly there is a polynomial-time algorithm A(x,y) to verify that x is a "yes" instance of SAT, using y as the purported satisfying assignment for the boolean formula x. Second, we choose CIRCUIT-SAT (we do not have other choices at this moment) to reduce it to SAT. Third, we design a function that maps circuits to Boolean formulas. For each gate, label each wire coming out of a gate with a new variable name. Thus, for example, if an AND gate has inputs x6, x7, and x8, and output x9, introduce a clause x9 IFF (x6 AND x7 AND x8) Add a clause that just consists of xoutput , the label for output wire. Take the AND of all these clauses.

NPC of SAT, proof continues Clearly, C is a satisfiable circuit if and only if the formula f(C) is a satisfiable boolean formula. If C is satisfiable, then there exists some assignment to the input wires that results in the output being 1. Therefore, the exists some assignment to the variables input wires, plus the additional variables representing the output wires, that results in the formula f(C) evaluating to 1. Similarly, if the formula f(C) is satisfiable, then it corresponds to the circuit being satisfiable, and each output wire being correctly computed in terms of the gate type. Step 4. Clearly, f can be computed in polynomial time. We can simply do a breadth-first search on the graph representation of the circuit, outputting a formula for each gate. This completes our proof that SAT is NP-complete. QED