1 CSE 326: Data Structures: Graphs Lecture 24: Friday, March 7 th, 2003.

Slides:



Advertisements
Similar presentations
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.
Advertisements

The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
CSE 326: Data Structures Lecture #20 Really, Really Hard Problems Henry Kautz Winter Quarter 2002.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
1 CSE 326: Data Structures: Graphs Lecture 22: Monday, March 3 rd, 2003.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Clique Cover Cook’s Theorem 3SAT and Independent Set
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Lecture 22 More NPC problems
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
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.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
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-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.
CS 461 – Nov. 30 Section 7.5 How to show a problem is NP-complete –Show it’s in NP. –Show that it corresponds to another problem already known to be NP-complete.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
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.
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.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
1 CSE 326: Data Structures: Graphs Lecture 23: Wednesday, March 5 th, 2003.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
NP-Completeness A problem is NP-complete if: It is in NP
NP-completeness Ch.34.
P & NP.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
Computational Complexity
NP-Complete Problems.
CSC 4170 Theory of Computation The class NP Section 7.3.
NP-Completeness Yin Tat Lee
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Presentation transcript:

1 CSE 326: Data Structures: Graphs Lecture 24: Friday, March 7 th, 2003

2 Today Finish NP complete problems Course evaluation forms

3 NP-Complete Problems Recall: A Hamiltonean path = a paths that goes through each node exactly once How to find one ? Try out all paths. Exponential time, and nobody knows better Why don’t we prove that there is no better algorithm ? Because we don’t know how to prove it

4 P and NP Recall: A problem is in P (or PTIME) if we can solve it in time O(n k ), for some k > 0 A problem is in NP if we can check a candidate solution in P Hamiltonean cycle (HC) is in NP In fact, P  NP But what about NP ⊈ P or NP  P ? Nobody knows.

5 Another NP Problem SAT: Given a formula in Boolean logic, e.g. determine if there is an assignment of values to the variables that makes the formula true (=1). Why is it in NP?

6 SAT is NP-Complete Cook (1971) showed the following: Including Hamiltonean Cycle (HC) In some sense, SAT is the hardest problem in NP We say that “SAT is NP-Hard” A problem that is NP-Hard and in NP is called NP- complete Theorem Suppose that we can solve the SAT problem in polynomial time. Then there is a way to solve ANY NP problem in polynomial time !!! Theorem Suppose that we can solve the SAT problem in polynomial time. Then there is a way to solve ANY NP problem in polynomial time !!!

7 SAT is NP-Complete Proof of Cook’s theorem: Suppose we can solve SAT in time O(m 7 ), where m is the size of the formula Let some other problem in NP: we can check a candidate solution in, say, time O(n 5 ), where n is the size of the problem’s input

8 SAT is NP-Complete: Proof To solve that other problem, do the following We have a program A that checks some candidate solution in time O(n 5 ) Construct a HUGE boolean formula that represents the execution of A: its variables are the candidate solution (which we don’t know) plus all memory bits Then check if this formula is satisfiable (i.e. there exists some candidate solution)

9 SAT is NP-Complete: Proof Time = 0 Memory (at most n 5 memory words (why ?)) Program counter Input Candidate solution (unknown) Time = 1 Time = n 5 Boolean expression size = n 5  n 5 Answer (0 or 1) HUGE boolean formula of size O( n 5  n 5  n 5 )  check satisfiability in time O(( n 5  n 5  n 5 ) 7 )

10 The Graph of NP-Completeness What is special about SAT ? Nothing ! There are hundreds of NP-complete problems: Directed Hamiltonean Path (DHP) Vertex Cover Clique etc, etc,...

11 Directed Hamiltonean Path is NP-Complete Proof: by reducing SAT to DHP: Then use transitivity to argue than we can solve any NP problem in polynomial time I’ll show you how to prove the lemma... Theorem Directed Hamiltonean Path (DHP) is NP Complete Lemma If we can solve DHP in polynomial time, then we can solve SAT in polynomial time

12 Directed Hamiltonean Path is NP-Complete Suppose you are given a boolean formula in conjunctive normal form: Construct a directed graph G s.t. it admits a Hamiltonean cycle iff the formula is satisfiable

13 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 Step 1: construct this subgraph

14 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 Step 2: now replicate it once for each boolean variable c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 a b c

15 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 Step 3: now add a new node for each clause c 1, c 2,... c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 a b c c1c1 c2c2 c3c3

16 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 Step 4: now connect the variable graphs to the clause nodes in clever way E.g. for c 2 : c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 a b c c1c1 c2c2 c3c3 Right-left for  a Left-right for c

17 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 Step 5: finally, the formula is satisfiable iff there exists a Hamiltonean path ! E.g a=1, b=0, c=1 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 aa bb cc c 1 (true because of a) c 2 (true because of c) c 3 (true because of c)

18 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 E.g a=1, b=0, c=1 c1c1 c2c2 c3c3 c1c1 c2c2 c3c3 aa bb cc c 1 (true because of a) c 2 (true because of c) c 3 (true because of c)

19 A Great Book You Should Own! Computers and Intractability: A Guide to the Theory of NP-Completeness, by Michael S. Garey and David S. Johnson

20 Your Chance to Win a Turing Award: P = NP? Nobody knows whether NP  P –Proving or disproving this will bring you instant fame! It is generally believed that P  NP, i.e. there are problems in NP that are not in P –But no one has been able to show even one such problem! –Practically all of modern complexity theory is premised on the assumption that P  NP A very large number of useful problems are in NP Alan Turing ( )

21 P, NP, and Exponential Time Problems All currently known algorithms for NP-complete problems run in exponential worst case time –Finding a polynomial time algorithm for any NPC problem would mean: Diagram depicts relationship between P, NP, and EXPTIME (class of problems that provably require exponential time to solve) It is believed that P  NP  EXPTIME EXPTIME NP P NPC

22 Coping with NP-Completeness 1.Settle for algorithms that are fast on average: Worst case still takes exponential time, but doesn’t occur very often. But some NP-Complete problems are also average-time NP-Complete! 2.Settle for fast algorithms that give near-optimal solutions: But finding even approximate solutions to some NP- Complete problems is NP-Complete! 3.Just get the exponent as low as possible! Much work on exponential algorithms for Boolean satisfiability: in practice can often solve problems with 1,000+ variables But even 2 n/100 will eventual hit the exponential curve!