NP-Completeness. NP-Completeness 1

Similar documents
NP-Complete Reductions 1

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

NP-Complete problems

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

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

Essential facts about NP-completeness:

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

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

1.1 P, NP, and NP-complete

Computational Complexity

Introduction to Complexity Theory

1. Introduction Recap

CMPT307: Complexity Classes: P and N P Week 13-1

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

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

NP-Completeness. Subhash Suri. May 15, 2018

BBM402-Lecture 11: The Class NP

Lecture 19: Finish NP-Completeness, conp and Friends

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than.

Limitations of Algorithm Power

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

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

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

Correctness of Dijkstra s algorithm

NP-Completeness. NP-Completeness 1

CS154, Lecture 13: P vs NP

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

NP Completeness and Approximation Algorithms

CS21 Decidability and Tractability

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

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

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

Lecture 18: PCP Theorem and Hardness of Approximation I

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

NP, polynomial-time mapping reductions, and NP-completeness

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Complexity Theory: The P vs NP question

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

NP-completeness. Chapter 34. Sergey Bereg

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

6-1 Computational Complexity

Lecture 3: Nondeterminism, NP, and NP-completeness

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

Computational complexity theory

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

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

: Computational Complexity Lecture 3 ITCS, Tsinghua Univesity, Fall October 2007

CSE 135: Introduction to Theory of Computation NP-completeness

conp, Oracles, Space Complexity

The Cook-Levin Theorem

Principles of Knowledge Representation and Reasoning

ECS122A Handout on NP-Completeness March 12, 2018

P, NP, NP-Complete, and NPhard

Lecture 14 - P v.s. NP 1

CS154, Lecture 13: P vs NP

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

Problem Complexity Classes

Computational complexity theory

Definition: conp = { L L NP } What does a conp computation look like?

CS21 Decidability and Tractability

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Complexity, P and NP

Introduction. Pvs.NPExample

Lecture 4 : Quest for Structure in Counting Problems

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?

Computability and Complexity Theory

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

More Completeness, conp, FNP,etc. CS254 Chris Pollett Oct 30, 2006.

from notes written mostly by Dr. Matt Stallmann: All Rights Reserved

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

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

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

CS 583: Algorithms. NP Completeness Ch 34. Intractability

SAT, NP, NP-Completeness

CSE 105 THEORY OF COMPUTATION

CSC 421: Algorithm Design & Analysis. Spring 2018

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

CSC 1700 Analysis of Algorithms: P and NP Problems

NP Complete Problems. COMP 215 Lecture 20

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Lecture 22: Quantum computational complexity

Review of unsolvability

Graph Theory and Optimization Computational Complexity (in brief)

Theory of Computer Science

DAA 8 TH UNIT DETAILS

CSE 548: (Design and) Analysis of Algorithms

NP and NP Completeness

Chapter 34: NP-Completeness

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

Theory of Computer Science. Theory of Computer Science. E1.1 Motivation. E1.2 How to Measure Runtime? E1.3 Decision Problems. E1.

CS 350 Algorithms and Complexity

Transcription:

NP-Completeness x x x 2 x 2 x 3 x 3 x 4 x 4 2 22 32 3 2 23 3 33 NP-Completeness

Outline and Reading P and NP ( 3.) Definition of P Definition of NP Alternate definition of NP NP-completeness ( 3.2) Definition of NP-hard and NP-complete The Cook-Levin Theorem NP-Completeness 2

Running Time Revisited Input size, n To be exact, let n denote the number of bits in a nonunary encoding of the input All the polynomial-time algorithms studied so far in this course run in polynomial time using this definition of input size. Exception: any pseudo-polynomial time algorithm SFO 843 ORD 849 42 PVD HNL 2555 337 LAX 743 233 802 DFW 387 20 LGA 099 MIA NP-Completeness 3

Dealing with Hard Problems What to do when we find a problem that looks hard I couldn t find a polynomial-time algorithm; I guess I m too dumb. NP-Completeness (cartoon inspired by [Garey-Johnson, 79]) 4

Dealing with Hard Problems Sometimes we can prove a strong lower bound (but not usually) I couldn t find a polynomial-time algorithm, because no such algorithm exists! NP-Completeness (cartoon inspired by [Garey-Johnson, 79]) 5

Dealing with Hard Problems NP-completeness let s us show collectively that a problem is hard. I couldn t find a polynomial-time algorithm, but neither could all these other smart people. NP-Completeness (cartoon inspired by [Garey-Johnson, 79]) 6

Polynomial-Time Decision Problems To simplify the notion of hardness, we will focus on the following: Polynomial-time as the cut-off for efficiency Decision problems: output is or 0 ( yes or no ) Examples: Does a given graph G have an Euler tour? Does a text T contain a pattern P? Does an instance of 0/ Knapsack have a solution with benefit at least K? Does a graph G have an MST with weight at most K? NP-Completeness 7

Problems and Languages A language L is a set of strings defined over some alphabet Σ Every decision algorithm A defines a language L L is the set consisting of every string x such that A outputs yes on input x. We say A accepts x in this case Example: If A determines whether or not a given graph G has an Euler tour, then the language L for A is all graphs with Euler tours. NP-Completeness 8

The Complexity Class P A complexity class is a collection of languages P is the complexity class consisting of all languages that are accepted by polynomial-time algorithms For each language L in P there is a polynomial-time decision algorithm A for L. If n= x, for x in L, then A runs in p(n) time on input x. The function p(n) is some polynomial NP-Completeness 9

The Complexity Class NP We say that an algorithm is non-deterministic if it uses the following operation: Choose(b): chooses a bit b Can be used to choose an entire string y (with y choices) We say that a non-deterministic algorithm A accepts a string x if there exists some sequence of choose operations that causes A to output yes on input x. NP is the complexity class consisting of all languages accepted by polynomial-time non-deterministic algorithms. NP-Completeness 0

NP example Problem: Decide if a graph has an MST of weight K Algorithm:. Non-deterministically choose a set T of n- edges 2. Test that T forms a spanning tree 3. Test that T has weight at most K Analysis: Testing takes O(n+m) time, so this algorithm runs in polynomial time. NP-Completeness

The Complexity Class NP Alternate Definition We say that an algorithm B verfies the acceptance of a language L if and only if, for any x in L, there exists a certificate y such that B outputs yes on input (x,y). NP is the complexity class consisting of all languages verified by polynomial-time algorithms. We know: P is a subset of NP. Major open question: P=NP? Most researchers believe that P and NP are different. NP-Completeness 2

NP example (2) Problem: Decide if a graph has an MST of weight K Verification Algorithm:. Use as a certificate, y, a set T of n- edges 2. Test that T forms a spanning tree 3. Test that T has weight at most K Analysis: Verification takes O(n+m) time, so this algorithm runs in polynomial time. NP-Completeness 3

Equivalence of the Two Definitions Suppose A is a non-deterministic algorithm Let y be a certificate consisting of all the outcomes of the choose steps that A uses We can create a verification algorithm that uses y instead of A s choose steps If A accepts on x, then there is a certificate y that allows us to verify this (namely, the choose steps A made) If A runs in polynomial-time, so does this verification algorithm Suppose B is a verification algorithm Non-deterministically choose a certificate y Run B on y If B runs in polynomial-time, so does this non-deterministic algorithm NP-Completeness 4

An Interesting Problem A Boolean circuit is a circuit of AND, OR, and NOT gates; the CIRCUIT-SAT problem is to determine if there is an assignment of 0 s and s to a circuit s inputs so that the circuit outputs. Inputs: Logic Gates: NOT 0 0 0 Output: OR 0 0 AND NP-Completeness 5

CIRCUIT-SAT is in NP Non-deterministically choose a set of inputs and the outcome of every gate, then test each gate s I/O. Inputs: Logic Gates: NOT 0 0 0 Output: OR 0 0 AND NP-Completeness 6

NP-Completeness A problem (language) L is NP-hard if every problem in NP can be reduced to L in polynomial time. That is, for each language M in NP, we can take an input x for M, transform it in polynomial time to an input x for L such that x is in M if and only if x is in L. L is NP-complete if it s in NP and is NP-hard. NP poly-time L NP-Completeness 7

Cook-Levin Theorem CIRCUIT-SAT is NP-complete. We already showed it is in NP. To prove it is NP-hard, we have to show that every language in NP can be reduced to it. Let M be in NP, and let x be an input for M. Let y be a certificate that allows us to verify membership in M in polynomial time, p(n), by some algorithm D. Let S be a circuit of size at most O(p(n) 2 ) that simulates a computer (details omitted ) NP M poly-time CIRCUIT-SAT NP-Completeness 8

Cook-Levin Proof We can build a circuit that simulates the verification of x s membership in M using y. Let W be the working storage for D (including registers, such as program counter); let D be given in RAM machine code. Simulate p(n) steps of D by replicating circuit S for each step of D. Only input: y. Circuit is satisfiable if and only if x is accepted by D with some certificate y Total size is still polynomial: O(p(n) 3 ). < p(n) cells ninputs D W y x S D W y x NP-Completeness 9 S p(n) steps S D W y x Output 0/ from D

Some Thoughts about P and NP NP-complete problems live here NP P CIRCUIT-SAT Belief: P is a proper subset of NP. Implication: the NP-complete problems are the hardest in NP. Why: Because if we could solve an NP-complete problem in polynomial time, we could solve every problem in NP in polynomial time. That is, if an NP-complete problem is solvable in polynomial time, then P=NP. Since so many people have attempted without success to find polynomial-time solutions to NP-complete problems, showing your problem is NP-complete is equivalent to showing that a lot of smart people have worked on your problem and found no polynomialtime algorithm. NP-Completeness 20