Cook’s theorem and NP-reductions

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

NP-Completeness.
NP-Hard Nattee Niparnan.
NP theory Pasi Fränti Turing machine vs. RAM © GEOFF DRAPER.
Cook’s Theorem The Foundation of NP-Completeness.
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
The Theory of NP-Completeness
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
88- 1 Chapter 8 The Theory of NP-Completeness P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class.
Time Complexity.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
1 1. Draw the machine schema for a TM which when started with input 001 halts with abbb on the tape in our standard input format. 2. Suppose you have an.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
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.
Reducing Knapsack to TSP Pasi Fränti. Knapsack problem Input: knapsack instance {2,3,5,7,11} Size of the knapsack S=15.
Cook’s theorem and NP-reductions Pasi Fränti
NP-complete Languages
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.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
Reducing Knapsack to TSP Professor Pasi Franti. Step 1: Equivalent Graph Construction Given Knapsack instance: –KP={2,3,5,7,11} Draw A node in the plane.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
The Theory of NP-Completeness
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
EMIS 8373: Integer Programming
Richard Anderson Lectures NP-Completeness
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
Intro to Theory of Computation
Intro to Theory of Computation
Lecture 24 NP-Complete Problems
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Richard Anderson Lecture 29 NP-Completeness
Approximation Algorithms
Richard Anderson Lecture 30 NP-Completeness
CLASSES P AND NP.
NP-Complete Problems.
P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ.
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
Our First NP-Complete Problem
The Theory of NP-Completeness
NP-Completeness Lecture for CS 302.
Richard Anderson Lecture 27 Survey of NP Complete Problems
CSE 589 Applied Algorithms Spring 1999
CSC 380: Design and Analysis of Algorithms
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Lecture 23 NP-Hard Problems
Presentation transcript:

Cook’s theorem and NP-reductions Pasi Fränti 6.11.2016

Satisfiability problem (SAT) is NP-complete Cook’s theorem Theorem: Satisfiability problem (SAT) is NP-complete Proof: TM ≤p SAT

Satisfiability problem F=(X1 X2  X3)  (X1 X2)  (X1 X3) x1 x2 x3 f1 f2 f3 F 1

Non-deterministic algorithm Satisfiability(F) FOR i1 TO n DO xi  Choose{0,1}; IF F(x)=1 THEN SUCCESS; ELSE FAIL; T(n)=O(n)  SAT  NP

Notations needed Implication Equivalence All are true Some is true Exactly one is true At least one is true At most one is true

Proof of Cook’s theorem Only valid Turing machine configurations can have value TRUE ai = tape position s has symbol ai qj = machine is at state qj and R/W head is at position s

Cook’s theorem Machine is at state q0 Tape content is {ai1, ai2, …, ain}

Cook’s theorem If not at position s, then content does not change If at position s and content is ai, then change state and content

Can be in any position s but machine must be in final state qk Cook’s theorem Can be in any position s but machine must be in final state qk

NP hard problems Satisfiability problem (SAT) Coloring problem (Color) Exact cover problem (EC) Knapsack problem (KP) Traveling salesman problem (TSP)

Satisfiability to Coloring Connect to all but those literals in fi Complete k-clique False color c1 c2 c3 ck … c0 Connect to all but ci Literals x1 x2 xk … x3 Color for fi xj fi xj fi Connect to all but those literals in fi

SP to Coloring example (X1 X2)  (X1 X3)

(X2  X3)  (X1 X3 )  (X1  X2) Additional example f1 f2 f3 (X2  X3)  (X1 X3 )  (X1  X2) x1 x2 x3 f1 f2 f3 F 1

Knapsack to TSP

Knapsack problem Input: knapsack instance {2,3,5,7,11} Size of the knapsack S=15.

Step 1: Create one node for every item Input: knapsack instance {2,3,5,7,11} Create a node for every knapsack element. 2 7 5 3 11

Step 2: Add start and end points Add node 0 as the home. Add node n+1 as the turning point. 2 7 5 n+1 3 11 n+2 nodes needed to represent the knapsack instance

Step 3: Create forward links Draw links from smaller to bigger with weights: w(i,j) = j w(i,n+1) = 0 7 2 2 7 7 7 7 5 5 5 n+1 5 11 11 3 3 11 3 11 11

Step 4: Create backward links Draw backward links from bigger to smaller nodes. Set weight of the link as w(j,i)=0. 2 7 5 n+1 3 11

KP  TSP All nodes have two incoming links with weights w(i,j) if item j is taken into knapsack (xj=1) 0 if item j not is taken (xj=0) Visit nodes selected in KP using w>0 link 2 3 7 11 5 select 7 n+1 5 select select 3

KP  TSP TSP = 0-3-5-7-(N+1)-11-2-0  KP = {3,5,7} (all nodes which arrival cost > 0) 2 3 7 11 5 select 7 n+1 5 select select 3

Empty space for notes