NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Polynomial-time reductions We have seen several reductions:
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.
Department of Computer Science & Engineering
Lecture 21 NP-complete problems
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
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.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
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.
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Hardness Results for Problems
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
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.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
1 Design and Analysis of Algorithms Yoram Moses Lecture 11 June 3, 2010
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
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.
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.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
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.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
Chapter 10 NP-Complete Problems.
NP-Completeness Yin Tat Lee
NP-Complete Problems.
NP-Completeness Yin Tat Lee
The Theory of NP-Completeness
CSE 589 Applied Algorithms Spring 1999
RAIK 283 Data Structures & Algorithms
Presentation transcript:

NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition of complexity class NP –NP-complete and NP-hard problems

 1 ≤ p  2 &  2 ≤ p  3   1 ≤ p  3 Let R 1 be the reduction used to prove  1 ≤ p  2 Let R 2 be the reduction used to prove  2 ≤ p  3 Let x be an input to  1 Define R 3 (x) to be R 2 (R 1 (x))

Answer-preserving argument Because R 1 is a reduction between  1 and  2, we know that R 1 (x) is a yes input instance of  2 iff x is a yes input instance of  1 Because R 2 is a reduction between  2 and  3, we know that R 2 (R 1 (x)) is a yes input instance of  3 iff R 1 (x) is a yes input instance of  2 Applying transitivity of iff, we get that R 3 (x) is a yes input of  3 iff x is a yes input instance of  1

Polynomial-time Argument Let R 1 take time n c1 Let R 2 take time n c2 Let n be the size of x Then the R 1 call of R 3 takes time at most n c1 Furthermore, R 1 (x) has size at most max(n,n c1 ) Therefore, the R 2 call of R 3 takes time at most max(n c2, (n c1 ) c2 ) = max (n c2, n c1 c2 ) In either case, the total time taken by R 3 is polynomial in n

NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition of complexity class NP –NP-complete and NP-hard problems

Utility of Relative Classification Results Consider only a pair of problems  1 and  2 What does  1 ≤ p  2 mean? –If  1 is not in P, then  2 is not in P –Intuitively,  2 is at least as hard as  1 What does  1 ≤ p  2 and  2 ≤ p  1 mean? –If either  1 or  2 is not in P, then the other is not in P –Intuitively, these two problems are equivalent in difficulty In isolation, these results have relatively little impact unless you care about these two specific problems

Utility of Relative Classification Results cont’d Consider only a set of problems C What does “for all  ’  C  ’ ≤ p  mean? –If any problem in C is not in P, then  is not in P. –If  is in P, then all problems in C are in P. –Intuitively,  is the hardest problem in C union {  } What does “for all  ’  C  ’ ≤ p  mean? –If any one of the problems in C is not in P, then they all are not in P. –If any one of the problems in C is in P, then they all are in P. –Intuitively, the problems in C are roughly equivalent in complexity. The importance of these results depends on the class C

Definition of C-hard and C-complete Let C be a set of problems C-hard definition –A problem  is C-hard if for all  ’  C  ’ ≤ p  holds. –Intuitively,  is the hardest problem in C union {  } C-complete –A problem  is C-complete if –  is C-hard and –  is in C –That is,  is in C and is the “hardest” problem in C (with respect to being in P)

Observations All C-complete problems are equivalent in difficulty with respect to being in P Proving a new problem  is C-hard –If there is a known C-hard problem  ’ (usually a C- complete problem), then we can prove  is C-hard by showing that  ’ ≤ p  This follows from transitivity of poly-time reductions –If there is no known C-hard problem  ’, we require some method for proving that all problems in C polynomial-time many-one reduce to 

NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition of complexity class NP –NP-complete and NP-hard problems

Motivation for Complexity Class NP It includes many interesting problems It seems unlikely that P = NP We can show many interesting problems have the property of being NP-complete

Definition of NP-hard and NP-complete A problem  is NP-hard if –for all  ’  NP  ’ ≤ p  holds. A problem  is NP-complete if –  is NP-hard and –  is in NP Proving a problem  is NP-complete –Show  is in NP (usually easy step) –Prove for all  ’  NP  ’ ≤ p  holds. Table method, simulation based method: Cook’s Thm Show that  ’ ≤ p  for some NP-hard problem  ’

Importance of NP-completeness Importance of “Is P=NP” Question Practitioners view –There exist a large number of interesting and seemingly different problems which have been proven to be NP-complete –The P=NP question represents the question of whether or not all of these interesting and different problems belong to P –As the set of NP-complete problems grows, the question becomes more and more interesting

Importance of NP-completeness Importance of “Is P=NP” Question Theoretician’s view –We will show that NP is exactly the set of problems which can be “verified” in polynomial time –Thus “Is P=NP?” can be rephrased as follows: Is it true that any problem that can be “verified” in polynomial time can also be “solved” in polynomial time? Hardness Implications –It seems unlikely that all problems that can be verified in polynomial time also can be solved in polynomial time –If so, then P is not equal to NP –Thus, proving a problem to be NP-complete is a hardness result as such a problem will not be in P if P is not equal to NP.

Traditional definition of NP Turing machine model of computation –Simple model where data is on an infinite capacity tape –Only operations are reading char stored in current tape cell, writing a char to current tape cell, moving tape head left or right one square Deterministic versus nondeterministic computation –Deterministic: At any point in time, next move is determined –Nondeterministic: At any point in time, several next moves are possible NP: Class of problems that can be solved by a nondeterminstic turing machine in polynomial time

Turing Machines A Turing machine has a finite-state-control (its program), a two way infinite tape (its memory) and a read-write head (its program counter) Head Tape …. Finite State Control

Nondeterministic Running Time We measure running time by looking at height of computation tree, NOT number of nodes explored Both computation have same height 4 and thus same running time Deterministic Computation Nondeterministic Computation

ND computation returning yes If any leaf node returns yes, we consider the input to be a yes input. If all leaf nodes return no, then we consider the input to be a no input. Yes ResultNo Result

Showing a problem is in NP Hamiltonian Path –Input: Undirected graph G = (V,E) –Y/N Question: Does G contain a HP? Nondeterministic polynomial-time solution –Guess a hamiltonian path P (ordering of vertices) V! possible orderings For binary tree, V log V height to generate all guesses –Verify guessed ordering is correct –Return yes/no if ordering is actually a HP

Illustration Yes input graph Guess Phase Nondeterministic Verify Phase Deterministic No input graph Guess Phase Nondeterministic Verify Phase Deterministic

Alternate definition of NP Preliminary Definitions –Let  be a decision problem –Let I be an input instance of  –Let Y(  ) be the set of yes input instances of  –Let N(  ) be the set of no input instances of   belongs to NP iff For any I  Y(  ), there exists a “certificate” [solution] C(I) such that a deterministic algorithm can verify I  Y(  ) in polynomial time with the help of C(I) For any I  N(  ), no “certificate” [solution] C(I) will convince the algorithm that I  Y(  ).

Connection Yes input graph Guess Phase Nondeterministic Verify Phase Deterministic No input graph Guess Phase Nondeterministic Verify Phase Deterministic Certificate [Solution] A Hamiltonian Path C(I 1 ): 123 or 321 C(I 2 ): none Verification Alg: Check for edge between all adjacent nodes in path

Example: Clique Problem Clique Problem –Input: Undirected graph G = (V,E), integer k –Y/N Question: Does G contain a clique of size ≥ k? Certificate –A clique C of size at least k Verification algorithm –Verify that all nodes in C are connected in E

Proving a problem is in NP You need to describe what the certificate C(I) will be for any input instance I You need to describe the verification algorithm –usually trivial You need to argue that all yes input instances and only yes input instances have an appropriate certificate C(I) –also usually trivial (typically do not require)

Example: Vertex Cover Problem Vertex Cover Problem –Input: Undirected graph G = (V,E), integer k –Y/N Question: Does G contain a vertex cover of size ≤ k? Vertex cover: A set of vertices C such that for every edge (u,v) in E, either u is in C or v is in C (or both are in C) Certificate –A vertex cover C of size at most k Verification algorithm –Verify that all edges in E contain a node in C

Example: Satisfiability Problem Satisfiability Problem –Input: Set of variables X and set of clauses C over X –Y/N Question: Is there a satisfying truth assignment T for the variables in X such that all clauses in C are true? Certificate? Verification algorithm?

Example: Unsatisfiability Problem Unsatisfiability Problem –Input: Set of variables X and set of clauses C over X –Y/N Question: Is there no satisfying truth assignment T for the variables in X such that all clauses in C are true? Certificate? Verification algorithm?

Key recap Proving a problem  is NP-complete –Show  is in NP (usually easy step) –Prove for all  ’  NP  ’ ≤ p  holds. Assuming we have an NP-hard problem  ’ Show that  ’ ≤ p  for some NP-hard problem  ’ For this to work, we need a “first” NP- hard problem  –Cook’s Theorem and SAT