 2004 SDU Lecture17-P,NP, NPC.  2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Graphs 4/16/2017 8:41 PM NP-Completeness.
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
Analysis of Algorithms CS 477/677
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Complexity Classes Kang Yu 1. NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP.
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.
Lecture 22 More NPC problems
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
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.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
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.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
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.
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.
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.
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.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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
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.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
 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
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
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
Hard Problems Introduction to NP
Lecture 24 NP-Complete Problems
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Chapter 34: NP-Completeness
NP-Complete Problems.
Prabhas Chongstitvatana
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

 2004 SDU Lecture17-P,NP, NPC

 2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of P and NP 3.Polynomial reduction and NP-complete Definition of polynomial reduction Definition of NP-complete 4.Cook’s theorem The first NP-complete problem Concepts concerning NP- completeness

 2004 SDU 3 Why decision problem? 1.Easy to give uniform definition, and thus convenient to study 2.Many optimization problems can be converted to decision problems. E.g., TSP. Optimization version: Given n cities and the distances between them. Find the shortest tour that visits each city exactly once. Decision version: Given n cities and the distance between them, and an integer K. Does there exist a tour that visits each city exactly once and with cost less than K? 3. The proof of the first NPC problem use the uniform descriptions of problems in NP. Formal description of a decision problem: Describe the parameters of instances and the yes-no problem. Input: Given two graphs G1=(V1,E1) and G2=(V2,E2) Question: Does G1 contain a sub-graph that is isomorphic to G2? Decision problem

 2004 SDU 4 TSP:  = {c,[,],/,0,1,2,3,4,5,6,7,8,9,#} c[1]c[2]c[3]c[4]//10/5/9//6/9//3#25 Language: Let  be a finite set of characters,  * be the set of all the finite strings over . Then any subset of  * is called a language on . Decision problem лdescribed as language: Under a coding system, each instance is coded as a string I. All the instances form the language D л. The “yes” instances form the language Y л. Then for each I  Dл, is I  Yл? Language and decision problem

 2004 SDU 5 Solve decision problem  by algorithms  Decide language D  by a Turing machine. For a decision problem , there may be many coding systems. U. w. l. g., we mean a reasonable coding system: No redundant characters Numbers are coded in binary (What happens if in unary?) Decodable Under different reasonable coding systems, the lengths of instances: D  Z + are polynomial related, i.e., suppose e, e’ be two reasonable coding systems, the lengths of instance I under e and e’ are L[I] and L’[I], respectively, then there are polynomials P and P’ such that L’[I]  P(L[I]), L[I]  P’(L’[I]) Language and decision problem

 2004 SDU 6 Class P: The set of decision problems that can be solved in polynomial time. Class NP: The set of decision problems that can be verified in polynomial time (also called solved non-deterministically). An algorithm A verifies a decision problem  : For an instance I  D , A first guesses a witness y, and then on input, it produces an answer. And I  Y   there exists a witness y , such that A answers “yes” on input. Polynomial verifier A: There exists polynomial P, such that on each input, A halts in P(length[I]) time. P and NP -- Informal definitions

 2004 SDU 7 1. The length of guess “y” is no more than P(length[I]) 2. For an “yes” instance I  Y  , there exists at least one such witness y , such that on input, A answers “yes”. 3. Such a verifier could be viewed as an infinite parallel machine that on an instance I, guesses all the witnesses and if on one witness, one process answers “yes”, then the whole machine halts and answers “yes”. The shortest time for answering “yes” can be the running time on this instance. Notes on NP!

 2004 SDU 8 A decision problem  and its complement  c.  : given an instance I , ask if X holds?  c : given an instance I , ask if X does not hold? i.e., D  =D  c, Y  =D  c - Y  c, Y  c =D  - Y .  P   c  P  NP   c  NP? Not necessarily. e.g., Hamilton cycle problem and its complement. Non-symmetric of NP

 2004 SDU 9 P={L: there exists polynomial Turing Machine M such that L=L M } NP={L: there exists polynomial non-deterministic Turing Machine such that L=L M } P and NP—formal definitions

 2004 SDU 10 P  NP P = NP ? P and NP—relationships

 2004 SDU 11 Theorem: If L  NP, then there exists polynomial P such that L can be solved by a DTM in O(2 P(n) ) time. proof. L  NP, then there exists NDTM M, and polynomial q, such that on each x  L,|x|=n, there exists a witness y, |y|  q(n), such that M answers “yes” on in q(n) time. Note that the number of witnesses shorter than q(n) is at most K q(n), K=|  |. Construct DTM M’ as follows: On instance I, write all the witnesses y shorter than q(n) one by one, and on, simulate the verifying process of M. If on one such y, M answers “yes” within q(n) steps, then M’ answers “Yes” and halt; if on all such y’s, M answers “no”, then M’ answers “no”. Obviously L M’ = L M. Time(M’)= O(K q(n) q(n)) = O(2 P(n) ) How hard is problem in NP?

 2004 SDU 12 Polynomial reduction: Let  1,  2 be two decision problems. If there exists a function f: D  1  D  2, such that I. f can be computed in polynomial time II.  I  D  1, I  Y  1  f(I)  Y  2 then we say that f is a polynomial reduction from  1 o  2, and that  1 is polynomial reduced to  2, denoted as  1   2. Steps to construct reduction : 1.Construct function f: D  1  D  2, that is, for each instance I in D  1, construct an instance f(I) of D  2 2.Prove that I  Y  1  f(I)  Y  2 3.Prove f(I) can be constructed in polynomial time. Polynomial Reduction

 2004 SDU 13 HC  TSP HC : Given a graph G=(V,E), does there exist a tour that visits each vertex exactly once? TSP : Given cities C={c1,c2,…,cm}, and integers d(ci,cj) , 1  i<j  m , and an integer B, does there exist a tour no more than B that visits each city exactly once? f : For an given instance G, construct: C=V. B=|V|.  vi, vj  V (i<j), Polynomial Reduction-an example

 2004 SDU 14 Conclusion: f is a polynomial reduction from HC to TSP. Proof. 1. If G has a HC, then is also a tour in f(G). Obviously each edge on this tour has length 1, hence, the total length of this tour is m. Hence, f(G) is also a “yes” instance of TSP. The opposite. Suppose is a tour of f(G) no more than B. Then since each edge has length either 1 or 2, and since there are B edges on the tour, each edge on the tour must have length 1. Thus proves that this tour is also a HC of G. 2. Concerning polynomial. We have to construct m(m-1)/2 d(vi, vj), i<j. For each construction, test whether {vi,vj} is in E. This could obviously be finished within polynomial time. Polynomial Reduction-an example

 2004 SDU 15 1 ) If L1  L2, then L2  P  L1  P. 2 ) If L1  L2, L2  L3, then L1  L3. Proof ? Polynomial Reduction--properties

 2004 SDU 16 NP-complete: If L  NP, and for each L’  NP, L’  L, then we call L NP-complete. Denote L  NPC. Properties of NP-completeness ( 1 ) If L1,L2  NP, L1  NPC, and L1  L2, then L2  NPC. ( 2 ) If L  NPC, then L  P  P = NP. ( 3 ) If P  NP, then NPC  P= . Proofs? NP-complete

 2004 SDU 17 A boolean formula (in conjunctive normal form)is a conjunction of clauses: A finite set of boolean variables: U={u 1,u 2,...,u m } Literals: u and  u Clause: disjunction of finite literals Truth assignment for a boolean formula: A set of values for the variables. Satisfying assignment: A truth assignment that causes a formula to evaluate to 1. SAT problem: Given a boolean formula, does there exist a satisfying assignment? Cook’s theorem—the first NPC problem

 2004 SDU 18 Cook’s Theorem: SAT is in NPC. 1. SAT  NP. A verifier is as follows: Guesses a truth assignment for an input instance, and then tests whether this is a satisfying assignment. This can be finished within polynomial time. 2.For each L  NP, L  SAT. The proof is left to the interested people. Cook’s theorem—the first NPC problem There are many other NPC problems, you may find one…