Theory of NP-Completeness

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Computational Complexity
Turing Machines January 2003 Part 2:. 2 TM Recap We have seen how an abstract TM can be built to implement any computable algorithm TM has components:
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Chapter 11: Models of Computation
Turing Machines.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-Completeness.
1 P, NP, and NP-Complete Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
Complexity Classes: P and NP
25 seconds left…...
Time Complexity P vs NP.
Complexity ©D.Moshkovits 1 Where Can We Draw The Line? On the Hardness of Satisfiability Problems.
Introduction to Computability Theory
Finite-state Recognizers
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 13: Turing Machines.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Cook’s Theorem The Foundation of NP-Completeness.
 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.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
1 dKS, Spring Some practical information Lecturers: Kristoffer Arnsfelt Hansen and Peter Bro Miltersen. Homepage:
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
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.
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
Fall 2004COMP 3351 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
Complexity theory and combinatorial optimization Class #2 – 17 th of March …. where we deal with decision problems, finite automata, Turing machines pink.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
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.
P Vs NP Turing Machine. Definitions - Turing Machine Turing Machine M has a tape of squares Each Square is capable of storing a symbol from set Γ (including.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
NPC.
1 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
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.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CS623: Introduction to Computing with Neural Nets (lecture-7) Pushpak Bhattacharyya Computer Science and Engineering Department IIT Bombay.
Complexity ©D.Moshkovitz 1 Our First NP-Complete Problem The Cook-Levin theorem A B C.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
Chapter 10 NP-Complete Problems.
Part VI NP-Hardness.
Time Complexity Costas Busch - LSU.
Turing Machines Acceptors; Enumerators
Computational Complexity
Time Complexity We use a multitape Turing machine
Chapter 34: NP-Completeness
NP-Complete Problems.
Recall last lecture and Nondeterministic TMs
CS21 Decidability and Tractability
Umans Complexity Theory Lectures
Our First NP-Complete Problem
Presentation transcript:

Theory of NP-Completeness Topics: Turing Machines Cook’s Theorem Implications Courtesy to Randal E. Bryant NP-complete.ppt

Turing Machine Formal Model of Computer Very primitive, but computationally complete Program Controller Action State Head • • • Tape B 1 1 B B B B • • •

Turing Machine Components Tape Conceptually infinite number of “squares” in both directions Each square holds one “symbol” From a finite alphabet Initially holds input + copies of blank symbol ‘B’ Tape Head On each step Read current symbol Write new symbol Move Left or Right one position

Components (Cont.) Controller Program Has state between 0 and m-1 Initial state = 0 Accepting state = m-1 Performs steps Read symbol Write new symbol Move head left or right Program Set of allowed controller actions Current State, Read Symbol  New State, Write Symbol, L|R

Turing Machine Program Example Language Recognition Determine whether input is string of form 0n1n Input Examples Should reach state m-1 Should never reach state m-1 B 1 • • • B 1 • • •

Algorithm Keep erasing 0 on left and 1 on right Terminate and accept when have blank tape B 1 • • • B 1 • • • B 1 • • • B • • •

Program States 0 Initial Read Symbol 1 Check Left 2 Scan Right 3 Check Right 4 Scan Left 5 Accept Read Symbol B 1 1,B,R — — 1 5,B,R 2,B,R — 2 3,B,L 2,0,R 2,1,R Current State 3 — — 4,B,L 4 1,B,R 4,0,L 4,1,L 5 — — — ‘—’ means no possible action from this point Deterministic TM: At most one possible action at any point

Non Deterministic Turing Machine Language Recognition Determine whether input is string of form xx For some string x  {0,1}* Input Examples Should reach state m-1 Should never reach state m-1 B 1 • • • B 1 • • •

Nondeterministic Algorithm B 1 • • • Record leftmost symbol and set to B Scan right, stopping at arbitrary position with matching symbol, and mark it with 2 Scan left to end, and run program to recognize x2+x B 1 • • • B 1 2 • • • B 1 2 • • •

Nondeterministic Algorithm Might make bad guess Program will never reach accepting state Rule String accepted as long as reach accepting state for some sequence of steps B 1 2 • • •

Nondeterministic Program States 0 Initial 1 Record 2 Look for 0 3 Look for 1 4 Scan Left 5+ Rest of program Read Symbol B 1 1,B,R — — 1 accept,B,R 2,B,R 3,B,R 2 — 2,0,R 4,2,L 2,1,R Current State 3 — 3,0,R 3,1,R 4,2,L 4 5,B,R 4,0,L 4,1,L Nondeterministic TM:  2 possible actions from single point

Turing Machine Complexity Machine M Recognizes Input String x Initialize tape to x Consider all possible execution sequences Accept in time t if can reach accepting state in t steps t(x): Length of shortest accepting sequence for input x Language of Machine L(M) Set of all strings that machine accepts x  L when no execution sequence reaches accepting state Might hit dead end Might run forever Time Complexity TM(n) = Max { t(x) | x  L |x| = n } Where |x| is length of string x

P and NP Language L is in P Language L is in NP There is some deterministic TM M L(M) = L TM(n) ≤ p(n) for some polynomial function p Language L is in NP There is some nondeterministic TM M Any problem that can be solved by intelligent guessing

Example: Boolean Satisfiability Problem Variables: x1, ..., xk Literal: either xi or xi Clause: Set of literals Formula: Set of clauses Example: {x3,x3} {x1,x2 } { x2,x3 } { x1,x3 } Denotes Boolean formula x3x3  x1x2  x2x3  x1x3

Encoding Boolean Formula Represent each clause as string of 2k 0’s and 1’s 1 bit for each possible literal First bit: variable, Second bit: Negation of variable {x3,x3}: 000011 {x1,x2 }: 101000 {x2,x3 }: 000110 {x1,x3 }: 100001 Represent formula as clause strings separated by ‘$’ 000011$101000$000110$100001

SAT is NP Claim Algorithm There is a NDTM M such that L(M) = encodings of all satisfiable Boolean formulas Algorithm Phase 1: Determine k and generate some string {01,10} Append to end of formula This will be a guess at satisfying assignment E.g., 000011$101000$000110$100001$100110 Phase 2: Check each clause for matching 1

SAT is NP-complete Cook’s Theorem Translation Procedure Can generate Boolean formula that checks whether NDTM accepts string in polynomial time Translation Procedure Given NDTM M Polynomial function p Input string x Generate formula F F is satisfiable iff M accepts x in time p(|x|) Size of F is polynomial in |x| Procedure generates F in (deterministic) time polynomial in |x| Translation M x p F

Construction Parameters Formula Variables Key Observation |x| = n m states v tape symbols (including B) Formula Variables Q[i,k] 0 ≤ i ≤ p(n), 0 ≤ k ≤ m-1 At time i, M is in state k H[i,j] 0 ≤ i ≤ p(n), -p(n) ≤ j ≤ p(n) At time i, tape head is over square j S[i,j,k] 0 ≤ i ≤ p(n), -p(n) ≤ j ≤ p(n), 1 ≤ k ≤ v At time i, tape square j holds symbol k Key Observation For bounded computation, can only visit bounded number of squares

Clause Groups Uniqueness Initialization Accepting Legal Computation Formula clauses divided into “clause groups” Uniqueness At each time i, M is in exactly one state At each time i, tape head over exactly one square At each time i, each square j contains exactly one symbol Initialization At time 0, tape encodes input x, head in position 0, controller in state 0 Accepting At some time i, state = m-1 Legal Computation Tape/Head/Controller configuration at each time i+1 follows from that at time i according to some legal action

Implications of Cook’s Theorem Suppose There Were an Efficient Algorithm for Boolean Satisfiability Then could take any problem in NP, convert it to Boolean formula and solve it quickly! Many “hard” problems would suddenly be easy Big Question P =? NP Formulated in 1971 Still not solved Most believe not

Complements of Problems Language Complement Define ~L = { x | x  L} E.g., ~SAT Malformed formulas (easy to detect) Unsatisfiable formulas P Closed Under Complementation If L is in P, then so is ~L Run TM for L on input x for p(|x|) steps Has unique computation sequence If haven’t reached accepting state by then, then x  L

NP vs. co-NP (cont.) Is NP = co-NP? Proper Terminology Having NDTM for ~L doesn’t help for recognizing L Would have to check all computation sequences of length ≤ p(|x|). Could have exponentially many sequences Proper Terminology Generally want algorithm that can terminate with “yes” or “no” answer to decision problem If underlying problem (or its complement) is NP, then full decision problem is “NP-Hard”

Showing Problems NP-Complete To show Problem X is NP-complete 1. Show X is in NP Can be solved by “guess and check” Generally easy part 2. Show known NP-complete problem Y can be reduced to X Devise translation procedure Given arbitrary instance y of Y, can generate problem x in X such that y  LY iff x  LX Lx: set of all strings x for which decision problem answer is “yes” Size of x must be polynomial in y, and must be generated by (deterministic) polynomial algorithm.