CS 126 Lecture T6: NP-Completeness

Similar documents
COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

NP-Completeness. Until now we have been designing algorithms for specific problems

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

CSE 105 THEORY OF COMPUTATION

Time Complexity. CS60001: Foundations of Computing Science

Introduction to Complexity Theory

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

NP-Complete Reductions 1

Turing Machines and Time Complexity

CSE 105 THEORY OF COMPUTATION

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

Models of Computation

CS154, Lecture 17: conp, Oracles again, Space Complexity

P, NP, NP-Complete, and NPhard

Quantum Computing Lecture 8. Quantum Automata and Complexity

Quantum Complexity Theory. Wim van Dam HP Labs MSRI UC Berkeley SQUINT 3 June 16, 2003

Lecture 20: conp and Friends, Oracles in Complexity Theory

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

P vs. NP. Data Structures and Algorithms CSE AU 1

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Complexity Theory Part I

Computational Complexity

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

NP-Completeness Part II

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

Automata Theory. Definition. Computational Complexity Theory. Computability Theory

Design and Analysis of Algorithms

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Complexity (Pre Lecture)

Umans Complexity Theory Lectures

CS154, Lecture 13: P vs NP

CSE 105 Theory of Computation

Notes on Complexity Theory Last updated: October, Lecture 6

NP-Complete Problems. More reductions

Complexity Theory Part Two

Computational Complexity

20.1 2SAT. CS125 Lecture 20 Fall 2016

NP-Completeness Review

SAT, NP, NP-Completeness

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Lecture 22: Quantum computational complexity

Lecture 4 : Quest for Structure in Counting Problems

CSE 105 THEORY OF COMPUTATION

NP-Completeness. NP-Completeness 1

conp, Oracles, Space Complexity

The Cook-Levin Theorem

NP-Completeness Part II

Complexity Theory: The P vs NP question

ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

Computability Theory

Lecture 12 Combinatorial Planning in High Dimensions

Lecture 2: From Classical to Quantum Model of Computation

Lecture 18: PCP Theorem and Hardness of Approximation I

Intro to Theory of Computation

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Complexity Classes in Membrane Computing

CS154, Lecture 13: P vs NP

MTAT Complexity Theory September 15th, Lecture 3

Adiabatic quantum computation a tutorial for computer scientists

Complexity, P and NP

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Polynomial-time reductions. We have seen several reductions:

Algorithms. Grad Refresher Course 2011 University of British Columbia. Ron Maharik

Computational Complexity

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

Complexity Classes IV

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

Lecture 24: How to become Famous with P and NP

3. Algorithms. What matters? How fast do we solve the problem? How much computer resource do we need?

BBM402-Lecture 11: The Class NP

Friday Four Square! Today at 4:15PM, Outside Gates

Introduction to Computational Complexity

6.5.3 An NP-complete domino game

Complexity Classes V. More PCPs. Eric Rachlin

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

CSE 105 THEORY OF COMPUTATION

Recap from Last Time

CS151 Complexity Theory. Lecture 1 April 3, 2017

Introduction to Advanced Results

CSE 105 THEORY OF COMPUTATION

Lecture 21: Algebraic Computation Models

Compute the Fourier transform on the first register to get x {0,1} n x 0.

Automata Theory CS S-FR2 Final Review

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

- Why aren t there more quantum algorithms? - Quantum Programming Languages. By : Amanda Cieslak and Ahmana Tarin

Great Ideas in Theoretical Computer Science. Lecture 28: A Gentle Introduction to Quantum Computation

More NP-Complete Problems

CS 311 Sample Final Examination

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Transcription:

CS 126 Lecture T6: NP-Completeness Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem NP-Completeness: Reduction Conclusions CS126 19-1 Randy Wang

Where We Are T1 - T4: - Computability: whether a problem is solvable at all - Bad news: most problems are not solvable! T5 - T6: - Complexity: how long it takes to solve a problem - Bad news: many hard problems take so long to solve that they are almost as bad as non-solvable! Tuesday: - Examples of fast vs. slow algorithms Today: - Classes of problems depending on how hard they are CS126 19-2 Randy Wang The Good vs. the Bad CS126 19-3 Randy Wang

Efficient vs. Inefficient Examples Sorting: O(N*LogN) TSP: O(N!) Who cares? - How long does it take to do TSP(1000)? - How big is 1000!? CS126 19-4 Randy Wang

Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem NP-Completeness: Reduction Conclusions CS126 19-6 Randy Wang

Another NP Example: CLIQUE CS126 19-9 Randy Wang

Another NP Example: Satisfiability CS126 19-10 Randy Wang P vs. NP CS126 19-11 Randy Wang

Possible Exception: Quantum Computing Quantum mechanics: coherent superposition - A photon can be here and there simultaneously - An atom can be in two electronic states simultaneously - In general, a qubit can be 0 and 1 simultaneously! - A k-bit quantum register can store 2 k values simultaneously! Quantum computing - A single quantum instruction, effected by a laser pulse, for example, can transform a quantum register from one multistate to another in one step - A classical computer needs 2 K steps or 2 K parallel registers to match this power Non-determistic TM: no more power than TM, but a lot faster than a determistic TM CS126 19-12 Randy Wang P = NP? (The Holy Grail) CS126 19-13 Randy Wang

NP-Completeness CS126 19-14 Randy Wang Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem - A digression in logic - The very first NP-Complete problem NP-Completeness: Reduction Conclusions CS126 19-15 Randy Wang

A Puzzle A Digression in Logic Classical logic had its origin in Aristotle Turing Machine was invented to settle whether logic satisfiability was solvable FSAs and PDAs were developed as simplifications of TMs History: perfect reversal of our presentation CS126 19-17 Randy Wang

Propositional Logic and Satisfiability Proof Representation: Th: Today is Thursday Fr: Tomorrow is Friday Th and Fr can be 0 or 1 Given: Th Th -> Fr Prove: Fr Proof: Assume Fr, Th * (Th->Fr) * Fr = Th * (Th +Fr) * Fr There is no assignment of Th and Fr that can make this formula true, so assumption must be wrong. Like the boolean algebra that we have learned Extension to predicate calculus to make it more powerful A powerful language for describing real world processes A darling artificial intelligence tool CS126 19-18 Randy Wang A More Complex Example: The Puzzle Representation: M i =0, if Man is on left bank at time i M i =1, if Man is on right bank at time i Similarly define W i, G i, and C i for Wolf, Goat, and Cabbage. Given: M 0 =W 0 =G 0 =C 0 =0 M i W i G i C i -> M i+1 W i+1 G i+1 C i+1 M i W i G i C i -> M i+1 W i+1 G i+1 C i+1 M i W i G i C i -> M i+1 W i+1 G i+1 C i+1...(many more similar rules) Prove: M k =W k =G k =C k =1 (for some sufficiently large k) Proof: Similar as previous slide, assignment of M i, W i, G i, C i gives solution CS126 19-19 Randy Wang

What s the Relevance of This Puzzle? Propositional and Predicate Calculi as Descriptions of Computational Processes The puzzle is really a computational process - The initial locations of the man, wolf, goat, and cabbage are the input state - The movement rules are a program: + for each current state, + non-deterministically apply one of the applicable rules + transform to next state - The final locations: the desired output state If we can find a variable assignment to make the corresponding logic formula true, we have found a solution to the problem CS126 19-20 Randy Wang Cook s Theorem A non-deterministic TM with its input is like a puzzle We can encode it with a logic formula like we did If we can find a variable assignment to make the formula true, we have found a solution to the puzzle, namely a simulation of the TM that solves the problem Therefore, if we can solve SATISFIABILITY quickly, then we can find solutions to non-determistic TMs quickly Any NP problem can be solved by a non-determistic TM by definition Therefore, if we can solve SATISFIABILITY quickly, we can solve any NP problem quickly SATISFIABILITY is the very first problem proven to be NP-Complete: a landmark theorem! CS126 19-21 Randy Wang

In Other Words... An NP problem = An instance of non-deterministic TM = A SATISFIABILITY problem A solution to an NP problem = A successful simulation of the non-deterministic TM = A solution to the SATISFIABILITY problem Therefore, if we can solve SATISFIABILITY quickly, we can solve any NP problem quickly Now that we have found our first NP-Complete problem, are there others? CS126 19-22 Randy Wang Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem NP-Completeness: Reduction - The basic idea: to show a problem is NP-Complete, we show it s harder than SATISFIABILITY Conclusions CS126 19-23 Randy Wang

Reduction CS126 19-24 Randy Wang An NP-Complete Example: CLIQUE CS126 19-25 Randy Wang

Proving CLIQUE Is NP-Complete We have already shown CLIQUE is NP Now we will show SATISFIABILITY reduces to CLIQUE (A note) - We have seen that any logic formula can be expressed as a sum-of-products form - Any logic formula can also be expressed as a product-of-sums form CS126 19-26 Randy Wang Transforming SAT to CLIQUE x y z x y z y z x y z CS126 19-27 Randy Wang

Solution to CLIQUE = SOLUTION to SAT x y z x y z x y z (x +y+z)(x+y +z)(y+z)(x +y +z) Solution to SAT ==> solution to CLIQUE Solution to CLIQUE ==> solution to SAT So, CLIQUE is NP-Complete y CS126 19-28 Randy Wang z More NP-Complete Problems CS126 19-29 Randy Wang

More NP-Complete Problems Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem NP-Completeness: Reduction Conclusions CS126 19-31 Randy Wang

What We Have Learned Today What are P, NP, NP-Complete problems? What are their relationships? What s Cook s Theorem? What s reduction? CS126 19-34 Randy Wang