34.NP Completeness Hsu, Lih-Hsing. Computer Theory Lab. Chapter 34P.2 為何學 NP-Complete 50 年前的電腦 ( 一間房間大 ) 可解的問題的極限 與現在電腦 ( 個人電腦 ) 可解的極限理論上是相 同的, 除非電腦的製程有重大突破.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

NP-Hard Nattee Niparnan.
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
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
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.
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
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
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
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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
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.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
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.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
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 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
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
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.
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. 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.
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.
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.
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.
ICS 353: Design and Analysis of Algorithms
Chapter 34: NP-Completeness
Prabhas Chongstitvatana
Presentation transcript:

34.NP Completeness Hsu, Lih-Hsing

Computer Theory Lab. Chapter 34P.2 為何學 NP-Complete 50 年前的電腦 ( 一間房間大 ) 可解的問題的極限 與現在電腦 ( 個人電腦 ) 可解的極限理論上是相 同的, 除非電腦的製程有重大突破 ( 即不是用目 前半導體技術 ) 。 請問 C , C++ , java, Which one is best? 學習的態度是如果你發現你的問題是屬於 NP- C 則大部份的努力的方向是要放在找 Approximate algorithm 而不是 fast algorithm.

Computer Theory Lab. Chapter 34P.3 P and NP Non-formal description P: solvable polynomial time NP: nondeterministic polynomial time Verifiable in polynomial time by deterministic Turing machine.

Computer Theory Lab. Chapter 34P.4 NP-complete NP-Complete: 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.

Computer Theory Lab. Chapter 34P.5 千禧年大獎問題 2000 年 5 月 7 大問題懸賞求解 100 萬美元。由美國克 萊數學院提供 P 與 NP

Computer Theory Lab. Chapter 34P.6 Given a description of a program and a finite input, decide whether the program Finishes running or will run forever.

Computer Theory Lab. Chapter 34P.7

Computer Theory Lab. Chapter 34P.8 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.9

Computer Theory Lab. Chapter 34P.10 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.11 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.12 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.13 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.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.59

Computer Theory Lab. Chapter 34P.60

Computer Theory Lab. Chapter 34P.61

Computer Theory Lab. Chapter 34P.62

Computer Theory Lab. Chapter 34P NP-Complete Problems

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

Computer Theory Lab. Chapter 34P.74

Computer Theory Lab. Chapter 34P.75

Computer Theory Lab. Chapter 34P.76

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

Computer Theory Lab. Chapter 34P.78 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.79 widget

Computer Theory Lab. Chapter 34P.80 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.81

Computer Theory Lab. Chapter 34P.82 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.83 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.84 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.85

Computer Theory Lab. Chapter 34P.86

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

Computer Theory Lab. Chapter 34P.88 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.89 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.90 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.91 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.92 3-CNF formula  is satisfiable iff there is a subset S ’  S whose sum is t.