CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 29.

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
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.
CSCI 256 Data Structures and Algorithm Analysis Lecture 22 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
The Theory of NP-Completeness
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
NP-COMPLETENESS. 2 Classify Problems According to Computational Requirements Q. Which problems will we be able to solve in practice? A working definition.
Graphs 4/16/2017 8:41 PM NP-Completeness.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
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.
NP and Computational Intractability
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 22.
1 Algorithm Design Patterns and Anti-Patterns Algorithm design patterns.Ex. n Greed.O(n log n) interval scheduling. n Divide-and-conquer. O(n log n) FFT.
11/3/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURES NP-completeness.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Piyush Kumar (Lecture 7: Reductions)
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.
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.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 27.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
CSEP 521 Applied Algorithms Richard Anderson Lecture 10 NP Completeness.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 33.
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.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Sailesh Prabhu Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
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.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
30.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
28.
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
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. Algorithms.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Advanced Algorithms Piyush Kumar (Lecture 8: NP Completeness) Welcome to COT5405 Based on Kevin Wayne’s slides.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 3.
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.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Data Structures and Algorithm Analysis Lecture 24
Data Structures and Algorithm Analysis Lecture 23
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Polynomial-Time Reduction
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 25 Min Cut Applications and NP-Completeness
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Intro to Theory of Computation
Richard Anderson Lecture 25 NP-Completeness
Chapter 8 NP and Computational Intractability
NP-Completeness Yin Tat Lee
CSE 589 Applied Algorithms Spring 1999
Presentation transcript:

CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 29

3-SAT Reduces to Independent Set Claim: 3-SAT  P INDEPENDENT-SET –Pf: Given an instance  of 3-SAT, we construct an instance (G, k) of INDEPENDENT-SET that has an independent set of size k iff  is satisfiable Construction –G contains 3 vertices for each clause, one for each literal –Connect 3 literals in a clause in a triangle –Connect literal to each of its negations k = 3 G

3-SAT Reduces to Independent Set Claim: G contains independent set of size k = |  | iff  is satisfiable Pf:  Let S be independent set of size k –S must contain exactly one vertex in each triangle –Set these literals to true –Truth assignment is consistent and all clauses are satisfied Pf:  Given satisfying assignment, select one true literal from each triangle. This is an independent set of size k k = 3 G

Transitivity of Reductions Transitivity: If X  P Y and Y  P Z, then X  P Z –Pf idea: Compose the two algorithms –Ex: 3-SAT  P INDEPENDENT-SET  P VERTEX-COVER  P SET-COVER

Decision Problems Theory developed in terms of yes/no problems –Independent set Given a graph G and an integer K, does G have an independent set of size at least K –Vertex cover Given a graph G and an integer K, does the graph have a vertex cover of size at most K

Decision Problems Decision problem –X is a set of strings –Instance: string s –Algorithm A solves problem X: A(s) = yes iff s  X Polynomial time: Algorithm A runs in poly-time if for every string s, A(s) terminates in at most p(|s|) "steps", where p(  ) is some polynomial PRIMES: X = { 2, 3, 5, 7, 11, 13, 17, 23, 29, 31, 37, …. } –Algorithm: [Agrawal-Kayal-Saxena, 2002] p(|s|) = |s| 8 length of s

P ProblemDescriptionAlgorithmYesNo MULTIPLEIs x a multiple of y? Grade school division 51, 1751, 16 RELPRIME Are x and y relatively prime? Euclid (300 BCE) 34, 3934, 51 PRIMESIs x prime?AKS (2002) 5351 EDIT- DISTANCE Is the edit distance between x and y less than 5? Dynamic programming niether neither acgggt ttttta LSOLVE Is there a vector x that satisfies Ax = b? Gauss- Edmonds elimination P: Decision problems for which there is a poly-time algorithm

NP Certification algorithm intuition –Certifier views things from "managerial" viewpoint –Certifier doesn't determine whether s  X on its own; rather, it checks a proposed proof t that s  X Def: Algorithm C(s, t) is a certifier for problem X if for every string s, s  X iff there exists a string t such that C(s, t) = yes NP: Decision problems for which there exists a poly-time certifier Remark: NP stands for nondeterministic polynomial-time "certificate" or "witness" C(s, t) is a poly-time algorithm and |t|  p(|s|) for some polynomial p(  ).

Certificate Examples Independent set of size K –The Independent Set Satifisfiable formula –Truth assignment to the variables Hamiltonian Circuit Problem –A cycle including all of the vertices K-coloring a graph –Assignment of colors to the vertices

Are There Even Harder Problems? Simple game: –Players alternating selecting nodes in a graph Score points associated with node Remove node’s neighbors –When neither can move, player with most points wins

Competitive Facility Location For a particular player P i, is there a strategy so that, no matter how the other players play, P i will be able to select a set of nodes with a total value of at least X? Hard to convince someone of the answer to this question (i.e., no short proof, lengthy case-by-case analysis), compare with Independent Set Problem PSPACE-complete

Certifiers and Certificates: Composite COMPOSITES: Given an integer s, is s composite? Certificate: A nontrivial factor t of s. Note that such a certificate exists iff s is composite. Moreover |t|  |s| Certifier Instance: s = 437,669 Certificate: t = 541 or 809 Conclusion: COMPOSITES is in NP boolean C(s, t) { if (t  1 or t  s) return false else if (s is a multiple of t) return true else return false }

Certifiers and Certificates: 3-SAT SAT: Given a CNF formula , is there a satisfying assignment? Certificate: An assignment of truth values to the n boolean variables Certifier: Check that each clause in  has at least one true literal Ex: Conclusion: SAT is in NP instance s certificate t

Certifiers and Certificates: Hamiltonian Cycle HAM-CYCLE: Given an undirected graph G = (V, E), does there exist a simple cycle C that visits every node? Certificate: A permutation of the n nodes Certifier: Check that the permutation contains each node in V exactly once, and that there is an edge between each pair of adjacent nodes in the permutation Conclusion: HAM-CYCLE is in NP instance scertificate t

P, NP, EXP P: Decision problems for which there is a poly-time algorithm EXP: Decision problems for which there is an exponential-time algorithm NP: Decision problems for which there is a poly-time certifier Claim: P  NP –Pf: Consider any problem X in P –By definition, there exists a poly-time algorithm A(s) that solves X –Certificate: t = , certifier: C(s, t) = A(s) Claim: NP  EXP –Pf: Consider any problem X in NP –By definition, there exists a poly-time certifier C(s, t) for X –To solve input s, run C(s, t) on all strings t with |t|  p(|s|) –Return yes, if C(s, t) returns yes for any of these

Extra Credit Homework Question Does P = NP? [Cook 1971, Edmonds, Levin, Yablonski, Gödel] –Is the decision problem as easy as the certification problem? –$1 million prize (plus the extra credit) –If yes: Efficient algorithms for 3-COLOR, TSP, FACTOR, SAT, … –If no: No efficient algorithms possible for 3-COLOR,TSP, SAT,… –Consensus opinion on P = NP? Probably no would break RSA cryptography (and potentially collapse economy) EXP NP P If P  NPIf P = NP EXP P = NP

NP-Complete NP-complete: A problem Y in NP with the property that for every problem X in NP, X  p Y Theorem: Suppose Y is an NP-complete problem. Then Y is solvable in poly-time iff P = NP –Pf:  If P = NP then Y can be solved in poly-time since Y is in NP –Pf:  Suppose Y can be solved in poly-time Let X be any problem in NP. Since X  p Y, we can solve X in poly-time. This implies NP  P We already know P  NP. Thus P = NP Fundamental question: Do there exist "natural" NP- complete problems?