CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.

Slides:



Advertisements
Similar presentations
P, NP, NP-Complete Problems
Advertisements

1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
Theory of Computing Lecture 16 MAS 714 Hartmut Klauck.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Computational problems, algorithms, runtime, hardness
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 21 Instructor: Paul Beame.
NP and NP-completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Analysis of Algorithms CS 477/677
NP-Completeness NP-Completeness Graphs 4/17/2017 4:10 AM x x x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
CSCE350 Algorithms and Data Structure
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Great Theoretical Ideas in Computer Science.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
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.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
P vs NP: what is efficient computation? Great Theoretical Ideas In Computer Science Anupam GuptaCS Fall 2005 Lecture 29Dec 8, 2005Carnegie Mellon.
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
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.
MA/CSSE 473 Day 38 Problems Decision Problems P and NP.
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.
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. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
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.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NPC.
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. Algorithms.
Computational Complexity Shirley Moore CS4390/5390 Fall 2013 August 27, 2013.
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.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
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.
Great Theoretical Ideas In Computer Science Anupam GuptaCS Fall 2006 Lecture 28Dec 7th, 2006Carnegie Mellon University Complexity Theory: the P.
Great Theoretical Ideas in Computer Science.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
Great Theoretical Ideas in Computer Science
NP-Completeness Yin Tat Lee
Analysis and design of algorithm
P versus NP a Millennium Prize Problem
Chapter 11 Limitations of Algorithm Power
Great Theoretical Ideas In Computer Science
Presentation transcript:

CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1

Admin Homework 5 due TONIGHT at 11pm! Homework 6 is posted –Due one week from today, June 4 th at 11pm –No partners Spring 2014 CSE 373 Algorithms and Data Structures 2

The $1M question The Clay Mathematics Institute Millenium Prize Problems 1.Birch and Swinnerton-Dyer Conjecture 2.Hodge Conjecture 3.Navier-Stokes Equations 4.P vs NP 5.Poincaré Conjecture 6.Riemann Hypothesis 7.Yang-Mills Theory Spring 2014 CSE 373 Algorithms and Data Structures 3

The P versus NP problem Is one of the biggest open problems in computer science (and mathematics) today It’s currently unknown whether there exist polynomial time algorithms for NP-complete problems –That is, does P = NP? –People generally believe P ≠ NP, but no proof yet But what is the P-NP problem? Spring 2014 CSE 373 Algorithms and Data Structures 4

Sudoku 3x3x3 Spring 2014 CSE 373 Algorithms and Data Structures 5

Sudoku 3x3x3 Spring 2014 CSE 373 Algorithms and Data Structures 6

Sudoku 4x4x4 Spring 2014 CSE 373 Algorithms and Data Structures 7

Sudoku 4x4x4 Spring 2014 CSE 373 Algorithms and Data Structures 8

Sudoku n x n x n... Suppose you have an algorithm S(n) to solve n x n x n V(n) time to verify the solution Fact: V(n) = O(n 2 x n 2 ) Question: is there some constant such that S(n) = O(n constant )? Spring 2014 CSE 373 Algorithms and Data Structures 9

Sudoku n x n x n... P vs NP problem = Does there exist an algorithm for solving n x n x n Sudoku that runs in time p(n) for some polynomial p( ) ? Spring 2014 CSE 373 Algorithms and Data Structures 10

The P versus NP problem (informally) Is finding an answer to a problem much more difficult than verifying an answer to a problem? Spring 2014 CSE 373 Algorithms and Data Structures 11

Hamilton Cycle Given a graph G = (V,E), is there a cycle that visits all the nodes exactly once? Spring 2014 CSE 373 Algorithms and Data Structures 12 YES if G has a Hamilton cycle NO if G has no Hamilton cycle The Set “HAM” HAM = { graph G | G has a Hamilton cycle }

AND NOT Circuit-Satisfiability Input: A circuit C with one output Output:YES if C is satisfiable NO if C is not satisfiable Spring 2014 CSE 373 Algorithms and Data Structures 13 The Set “SAT” SAT = { all satisfiable circuits C }

Sudoku Input: n x n x n sudoku instance Output:YES if this sudoku has a solution NO if it does not The Set “SUDOKU” SUDOKU = { All solvable sudoku instances } Spring 2014 CSE 373 Algorithms and Data Structures 14

Polynomial Time and The Class “P” Spring 2014 CSE 373 Algorithms and Data Structures 15

What is an efficient algorithm? polynomial time O(n c ) for some constant c non-polynomial time Is an O(n) algorithm efficient? How about O(n log n)? O(n 2 ) ? O(n 10 ) ? O(n log n ) ? O(2 n ) ? O(n!) ? Spring 2014 CSE 373 Algorithms and Data Structures 16

Does an algorithm running in O(n 100 ) time count as efficient? Asking for a poly-time algorithm for a problem sets a (very) low bar when asking for efficient algorithms. We consider non-polynomial time algorithms to be inefficient. And hence a necessary condition for an algorithm to be efficient is that it should run in poly-time. Spring 2014 CSE 373 Algorithms and Data Structures 17 What is an efficient algorithm?

The Class P The class of all sets that can be verified in polynomial time. AND The class of all decision problems that can be decided in polynomial time. Spring 2014 CSE 373 Algorithms and Data Structures 18 P Binary Search Breadth-First Search Dijkstra’s Algorithm Sorting Algorithms

The question is: can we achieve even this for HAM? SAT? Sudoku? Spring 2014 CSE 373 Algorithms and Data Structures 19

Onto the new class, NP (Nondeterministic Polynomial Time) Spring 2014 CSE 373 Algorithms and Data Structures 20

Verifying Membership Is there a short “proof” I can give you to verify that: G  HAM? G  Sudoku? G  SAT? Spring 2014 CSE 373 Algorithms and Data Structures 21 Yes: I can just give you the cycle, solution, circuit

The Class NP The class of sets for which there exist “short” proofs of membership (of polynomial length) that can “quickly” verified (in polynomial time). Recall: The algorithm doesn’t have to find the proof; it just needs to be able to verify that it is a “correct” proof. Spring 2014 CSE 373 Algorithms and Data Structures 22 Fact: P  NP

P  NP Winter CSE373: Data Structures & Algorithms Binary Search Breadth-First Search Dijkstra’s Algorithm Sorting Algorithms … P NP Hamilton Cycle Sudoku SAT …

Summary: P versus NP P: in NP (membership verified in polynomial time) AND membership in a set can be decided in polynomial time. NP: “proof of membership” in a set can be verified in polynomial time. Fact: P  NP Question: Does NP  P ? i.e. Does P = NP? People generally believe P ≠ NP, but no proof yet Spring 2014 CSE 373 Algorithms and Data Structures 24

Why Care? Spring 2014 CSE 373 Algorithms and Data Structures 25

Classroom Scheduling Packing objects into bins Scheduling jobs on machines Finding cheap tours visiting a subset of cities Finding good packet routings in networks Decryption … NP Contains Lots of Problems We Don’t Know to be in P Spring 2014 CSE 373 Algorithms and Data Structures 26 OK, OK, I care...

We would have to show that every set in NP has a polynomial time algorithm… How do I do that? It may take a long time! Also, what if I forgot one of the sets in NP? Spring 2014 CSE 373 Algorithms and Data Structures 27 How could we prove that NP = P?

We can describe just one problem L in NP, such that if this problem L is in P, then NP  P. It is a problem that can capture all other problems in NP. The “Hardest” Set in NP We call these problems NP-complete Spring 2014 CSE 373 Algorithms and Data Structures 28 How could we prove that NP = P?

Theorem [Cook/Levin] SAT is one problem in NP, such that if we can show SAT is in P, then we have shown NP = P. SAT is a problem in NP that can capture all other languages in NP. We say SAT is NP-complete. Spring 2014 CSE 373 Algorithms and Data Structures 29

Poly-time reducible to each other Oracle for problem X Oracle for problem Y Instance of problem Y Map instance of Y into instance of X Takes polynomial time Answer Spring 2014 CSE 373 Algorithms and Data Structures 30 Any problem in NP SAT can be reduced (in polytime to) an instance of hence SAT is NP-complete Sudoku can be reduced (in polytime to) an instance of hence Sudoku is NP-complete

NP-complete: The “Hardest” problems in NP Sudoku SAT 3-Colorability Clique HAM Independent-Set These problems are all “polynomial-time equivalent” i.e., each of these can be reduced to any of the others in polynomial time If you get a polynomial-time algorithm for one, you get a polynomial-time algorithm for ALL. (you get millions of dollars, you solve decryption, … etc.) Spring 2014 CSE 373 Algorithms and Data Structures 31