34.NP Completeness. Computer Theory Lab. Chapter 34P.2.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Polynomial-time reductions We have seen several reductions:
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
The Theory of NP-Completeness
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Graphs 4/16/2017 8:41 PM NP-Completeness.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NP-Complete Problems Problems in Computer Science are classified into
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Analysis of Algorithms CS 477/677
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.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
34.NP Completeness Hsu, Lih-Hsing. Computer Theory Lab. Chapter 34P.2 為何學 NP-Complete 50 年前的電腦 ( 一間房間大 ) 可解的問題的極限 與現在電腦 ( 個人電腦 ) 可解的極限理論上是相 同的, 除非電腦的製程有重大突破.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
P, NP, and NP-Complete Suzan Köknar-Tezel.
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.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
MCS312: NP-completeness and Approximation Algorithms
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.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Lecture 22 More NPC problems
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.
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.
Polynomial-time reductions We have seen several reductions:
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.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
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
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.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
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.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
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
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
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.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
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
More NP-complete problems
Richard Anderson Lecture 26 NP-Completeness
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
Chapter 34: NP-Completeness
Prabhas Chongstitvatana
The Theory of NP-Completeness
Presentation transcript:

34.NP Completeness

Computer Theory Lab. Chapter 34P.2

Computer Theory Lab. Chapter 34P.3

Computer Theory Lab. Chapter 34P.4 The subject of this chapter, however, is an interesting class of problems, called the “ NP-complete” problems, whose status is unknown. No polynomial-time algorithm has yet been discovered for an NP-computer problem, nor has anyone yet been able to prove that no polynomial-time algorithm can exist for any one of them. This so-called P ≠ NP question has been one of the deepest, most perplexing open research problems in theoretical computer science since it was first posed in 1971.

Computer Theory Lab. Chapter 34P.5

Computer Theory Lab. Chapter 34P.6 The difference between these problems Shortest vs. longest simple paths: Euler tour vs. hamiltonian cycle: 2-CNF satisfiability vs. 3 CNF satisfiablility NP-completeness and the classes P and NP Overview of showing problems to be NP- complete Decision problems vs. optimization problems

Computer Theory Lab. Chapter 34P.7 Reductions Suppose that there is a different decision problem, say B, that we already know how to solve in polynomial time. Finally, suppose that we have a procedure that transforms any instance  of A into some instance  of B with the following characteristics: 1.The transformation takes polynomial time. 2.The answer are the same. That is, the answer for  is “yes” if and only if the answer for  is also “yes.”

Computer Theory Lab. Chapter 34P.8 We can call such a procedure a polynomial-time reduction algorithm and, it provides us a way to solve problem A in polynomial time: 1.Given an instance  of problem A, use a polynomial- time reduction algorithm to transform it to an instance  of problem B. 2.Run the polynomial-time decision algorithm for B on the instance . 3.Use the answer for  as the answer for . Polynomial-time reduction algorithm Polynomial-time algorithm to decide A Polynomial-time Algorithm to decide B   yes no

Computer Theory Lab. Chapter 34P.9 A First NP-complete problem Because the technique of reduction relies on having a problem already known to be NP-complete in order to prove a different problem NP-complete, we need a “ first ” NPC problem. Circuit-satisfiability problem

Computer Theory Lab. Chapter 34P.10

Computer Theory Lab. Chapter 34P.11

Computer Theory Lab. Chapter 34P.12

Computer Theory Lab. Chapter 34P.13

Computer Theory Lab. Chapter 34P.14

Computer Theory Lab. Chapter 34P.15

Computer Theory Lab. Chapter 34P.16

Computer Theory Lab. Chapter 34P.17

Computer Theory Lab. Chapter 34P.18

Computer Theory Lab. Chapter 34P.19

Computer Theory Lab. Chapter 34P.20

Computer Theory Lab. Chapter 34P.21

Computer Theory Lab. Chapter 34P.22

Computer Theory Lab. Chapter 34P.23

Computer Theory Lab. Chapter 34P.24

Computer Theory Lab. Chapter 34P.25

Computer Theory Lab. Chapter 34P.26

Computer Theory Lab. Chapter 34P.27

Computer Theory Lab. Chapter 34P.28

Computer Theory Lab. Chapter 34P.29

Computer Theory Lab. Chapter 34P.30

Computer Theory Lab. Chapter 34P.31

Computer Theory Lab. Chapter 34P.32

Computer Theory Lab. Chapter 34P.33

Computer Theory Lab. Chapter 34P.34

Computer Theory Lab. Chapter 34P.35

Computer Theory Lab. Chapter 34P.36

Computer Theory Lab. Chapter 34P.37

Computer Theory Lab. Chapter 34P.38

Computer Theory Lab. Chapter 34P.39

Computer Theory Lab. Chapter 34P.40

Computer Theory Lab. Chapter 34P.41

Computer Theory Lab. Chapter 34P.42

Computer Theory Lab. Chapter 34P.43

Computer Theory Lab. Chapter 34P.44

Computer Theory Lab. Chapter 34P.45

Computer Theory Lab. Chapter 34P.46

Computer Theory Lab. Chapter 34P.47

Computer Theory Lab. Chapter 34P.48

Computer Theory Lab. Chapter 34P.49

Computer Theory Lab. Chapter 34P.50

Computer Theory Lab. Chapter 34P.51

Computer Theory Lab. Chapter 34P.52

Computer Theory Lab. Chapter 34P.53

Computer Theory Lab. Chapter 34P.54

Computer Theory Lab. Chapter 34P.55

Computer Theory Lab. Chapter 34P.56

Computer Theory Lab. Chapter 34P.57

Computer Theory Lab. Chapter 34P.58

Computer Theory Lab. Chapter 34P NP-Complete Problems

Computer Theory Lab. Chapter 34P.60

Computer Theory Lab. Chapter 34P.61

Computer Theory Lab. Chapter 34P.62

Computer Theory Lab. Chapter 34P.63

Computer Theory Lab. Chapter 34P.64

Computer Theory Lab. Chapter 34P.65

Computer Theory Lab. Chapter 34P.66

Computer Theory Lab. Chapter 34P.67

Computer Theory Lab. Chapter 34P.68

Computer Theory Lab. Chapter 34P.69

Computer Theory Lab. Chapter 34P.70

Computer Theory Lab. Chapter 34P.71

Computer Theory Lab. Chapter 34P.72

Computer Theory Lab. Chapter 34P.73 Theorem The hamiltonian cycle problem is NP- complete.

Computer Theory Lab. Chapter 34P.74 Proof. First, show that HAM-CYCLE belongs to NP. We now prove that VERTEX-COVER  p HAM- CYCLE, which shows that HAM-CYCLE is NP- complete. Given an undirected graph G=(V,E) and an integer k, we construct an undirected graph G ’ =(V ’,E ’ ) that has a hamiltonian cycle iff G has a vertex cover of size k.

Computer Theory Lab. Chapter 34P.75 widget

Computer Theory Lab. Chapter 34P.76 The reduction of an instance of the vertex-cover problem to an instance of the hamiltonian-cycle problem. (a) An undirected graph G with a vertex of size 2, consisting if the lightly shaded vertices w and y. (b) the undirected graph G ’ produced by the reduction, with the hamiltonian path corresponding to the vertex cover shaded. The vertex cover {w,y} corresponds to edges (s 1,[w,x,1]) and (s 2,[y,x,1]) appearing in the hamiltonian cycle.

Computer Theory Lab. Chapter 34P.77

Computer Theory Lab. Chapter 34P.78 Three types of edges in E ’ 1. Edges in widget. 2. {([u,u (i),6],[u,u (i+1),1]) : 1  i  degree(u)-1} 3. {(s j,[u,u (1),1]) : u  V and 1  j  k}  {(s j,[u,u (degree(u)),6]) : u  V and 1  j  k}

Computer Theory Lab. Chapter 34P.79 The reduction performed in polynomial time |V ’ | = 12|E| + k  12|E| + |V| |E ’ | = (14|E|) + (2|E| -|V|) + (2k|V|) = 16|E| + (2k-1)|V|  16|E| + (2|V|-1)|V|

Computer Theory Lab. Chapter 34P.80 The transformation from graph G to G ’ is a reduction. That is, G has a vertex cover of size k iff G ’ has a hamiltonian cycle.

Computer Theory Lab. Chapter 34P.81

Computer Theory Lab. Chapter 34P.82

Computer Theory Lab. Chapter 34P.83 Theorem The subset-sum problem is NP- complete.

Computer Theory Lab. Chapter 34P.84 Proof. First, show that SUBSET-SUM is in NP. We now show that 3-CNF-SAT  p SUBSET- SUM. Given a 3-CNF formula  over variables x 1, x 2, …, x n with clauses C 1, C 2, …, C k, each containing exactly three distinct literals. The reduction algorithm constructs an instance of the subset-sum problem such that  is satisfiable iff there is a subset of S whose sum is exactly t.

Computer Theory Lab. Chapter 34P.85 Example The formula in 3-CNF is  = C 1  C 2  C 3  C 4, where C 1 = (x 1  ¬ x 2  ¬ x 3 ), C 2 = ( ¬ x 1  ¬ x 2  ¬ x 3 ), C 3 = ( ¬ x 1  ¬ x 2  x 3 ), and C 4 = (x 1  x 2  x 3 ). A satisfying assignment of  is.

Computer Theory Lab. Chapter 34P.86 The reduction of 3-CNF-SAT to SUBSET-SUM C 4 has no ¬x 1 C 4 has x 2

Computer Theory Lab. Chapter 34P.87 The reduction performed in polynomial time The set S contains 2n+2k values, each of which has n+k digits, and the time to produce each digit is polynomial in n+k. The target t has n+k digits, and the reduction produces each in constant time.

Computer Theory Lab. Chapter 34P.88 3-CNF formula  is satisfiable iff there is a subset S ’  S whose sum is t.