NP-Completeness NP-Completeness Graphs 4/17/2017 4:10 AM x x x x x x x

Slides:



Advertisements
Similar presentations
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
Advertisements

Department of Computer Science & Engineering
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Lecture 21 NP-complete problems
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
Great Theoretical Ideas in Computer Science for Some.
CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
CS21 Decidability and Tractability
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
Graphs 4/16/2017 8:41 PM NP-Completeness.
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.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCE350 Algorithms and Data Structure
NP-Completeness x 1 x 3 x 2 x 1 x 4 x 3 x 2 x
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
CSC 413/513: Intro to Algorithms NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
COMPSCI 102 Introduction to Discrete Mathematics.
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.
1 Design and Analysis of Algorithms Yoram Moses Lecture 11 June 3, 2010
COMPSCI 102 Introduction to Discrete Mathematics.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Unit 9: Coping with NP-Completeness
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 Prof. Sin-Min Lee Department of Computer Science.
NP-Complete Problems Algorithm : Design & Analysis [23]
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NP-Completness Turing Machine. Hard problems There are many many important problems for which no polynomial algorithms is known. We show that a polynomial-time.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Spring 2007NP-Completeness1 x 1 x 3 x 2 x 1 x 4 x 3 x 2 x
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
Graphs 4/13/2018 5:25 AM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 NP-Completeness.
NP-Completeness NP-Completeness Graphs 5/7/ :49 PM x x x x x x x
NP-Completeness Merge Sort 11/16/2018 2:30 AM Spring 2007
NP-Completeness NP-Completeness Graphs 11/16/2018 2:32 AM x x x x x x
NP-Completeness NP-Completeness Graphs 12/3/2018 2:46 AM x x x x x x x
NP-Completeness NP-Completeness Graphs 12/6/2018 1:58 PM x x x x x x x
Chapter 34: NP-Completeness
Presentation transcript:

NP-Completeness NP-Completeness Graphs 4/17/2017 4:10 AM x x x x x x x 3 3 4 4 12 22 32 11 13 21 23 31 33 NP-Completeness

Outline and Reading P and NP (§13.1) NP-completeness (§13.2) Definition of P Definition of NP Alternate definition of NP NP-completeness (§13.2) Definition of NP-hard and NP-complete The Cook-Levin Theorem NP-Completeness

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 ORD PVD MIA DFW SFO LAX LGA HNL 849 802 1387 1743 1843 1099 1120 1233 337 2555 142 NP-Completeness

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])

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])

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])

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 1 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/1 Knapsack have a solution with benefit at least K? Does a graph G have an MST with weight at most K? NP-Completeness

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

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

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

NP example Problem: Decide if a graph has an MST of weight K Algorithm: Non-deterministically choose a set T of n-1 edges Test that T forms a spanning tree 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

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-1 edges Test that T forms a spanning tree Test that T has weight at most K Analysis: Verification takes O(n+m) time, so this algorithm runs in polynomial time. NP-Completeness

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

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 1’s to a circuit’s inputs so that the circuit outputs 1. NP-Completeness

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. NP-Completeness

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

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 poly-time M CIRCUIT-SAT NP-Completeness

Cook-Levin Proof We can build a circuit that simulates the verification of x’s membership in M using y. S 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). D D D < p(n) W W W cells Output 0/1 from D S S Inputs y y y n x x x p(n) steps NP-Completeness

Some Thoughts about P and NP CIRCUIT-SAT NP-complete problems live here Some Thoughts about P and NP 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 polynomial-time algorithm. NP-Completeness