COMP 382. Unit 10: NP-Completeness

Size: px
Start display at page:

Download "COMP 382. Unit 10: NP-Completeness"

Transcription

1 COMP 382 Unit 10: NP-Completeness

2 Time complexity 1 log n n n 2 n 3 2 n n n

3 Space complexity 1 log n n n 2 n 3 2 n n n

4 Complexity theory Focus on decidability (yes/no) problems

5 What is P? Deterministic, Sequential, Polynomial Time

6 Example problems in P Is x a multiple of y? Is x prime? Are x and y relatively prime? Is the edit distance between x and y less than 5? Is there a path between u and v of length less than 10? Most problems mentioned so far in class.

7 Understanding non-determinism: Guess & check define SubsetSum(input: set of integer, returns boolean subset = Guess() value: integer) return sum(subset) == value Two views of semantics: Oracle makes correct guesses Guess forks for all possibilities at once. Search succeeds if check succeeds for any guess.

8 Understanding non-determinism: Given a certificate, check it define SubsetSum_Certifier (input: set of integer, value: integer, witness: set of integer) returns boolean return subset(witness, input) && sum(witness) == value Original inputs Proof / Certificate / Witness Only needs to verify inputs on which SubetSum would return True.

9 Can simulate non-determinism Previously discussed ND TMs non-deterministic choice of transition Simulate guess & check: Generate all possible guesses one at a time Check Backtrack

10 What is NP? Non-deterministic, Sequential, Polynomial Time ND TM is polynomial time Check phase is polynomial time Includes all of P Includes lots not known to be in P

11 Example problems in NP: SAT Given a Boolean formula, is there a satisfying value assignment? a b b d c b c Deterministic algorithm to solve? Deterministic algorithm to check? What is appropriate certificate?

12 Example problems in NP: Directed Hamiltonian Cycle Given a directed graph, does it have a simple cycle through every vertex? B E A C D F Deterministic algorithm to solve? Deterministic algorithm to check? What is appropriate certificate?

13 Example Problems in NP: Composite Given an integer, is it composite? Deterministic algorithm to solve? Deterministic algorithm to check? What is appropriate certificate?

14 Many open questions L=P? P=BPP? P=NP? P=PSPACE? NP=co-NP? BPP=NEXP?

15 If P=NP Many hard problems would actually be in P. We d have a path to finding polynomial algorithms for them. Many other complexity open questions would be answered. Someone wins $1M from Clay Math. Institute and becomes famous. If P = NP, then the world would be a profoundly different place than we usually assume it to be. There would be no special value in creative leaps, no fundamental gap between solving a problem and recognizing the solution once it's found. -- Scott Aaronson

16 A reduces to B in polynomial time: A P B Map instance of one problem to instance(s) of another in P-time. define A(args): // Polynomial calls to subroutine B(), plus // Polynomial other steps. return Prove correctness: Problem A says yes exactly when this implementation of A says yes.

17 A reduces to B in polynomial time: A P B Typical: Map instance of one problem to instance of another in P-time. define A(a_args): b_args = // Polynomial steps. return B(b_args) Prove correctness: Problem A says yes exactly when problem B says yes on its constructed inputs.

18 Using P-reductions: Which is true? A. If B P and A P B, then A P. B. If A P and A P B, then B P.

19 Using P-reductions: Which is true? A. If B P and A P B, then A P. B. If A P and A P B, then B P.

20 NP-Complete A problem Y NP is NPC if for all problems X in NP, X P Y. Theorem: If Y is NPC, then Y P, iff P=NP. Proof: Y is NP-Hard ( ) By assumption, Y NP. If P=NP, then Y P. ( ) Suppose Y P. Let X be any problem in NP. Since X P Y, then X P. So, NP P. Since we already know P NP, then P=NP.

21

22 First NPC problem Circuit-SAT Previously said the equivalent Boolean-formula version is in NP.

23 First NPC problem Circuit-SAT For all problems X in NP, X P Circuit SAT: X solvable by a ND TM in O f n steps, where f is polynomial. Goal: Given input x, produce a circuit that is satisfiable iff x X. Circuit s inputs: Hardcoded x Unknown certificate c, of f x bits

24 First NPC problem Circuit-SAT: Example constructed circuit

25 General NPC Proof Strategy Show Y NP. Pick some NPC problem X. Prove X P Y. In theory, the choice of X is irrelevant. In practice, it is very important.

26 3-CNF SAT is NPC Given a Boolean formula in 3-CNF, is there a satisfying value assignment? a b c a c d b c d b c d In NP Just a special case of SAT.

27 Which do we need to show? A. Circuit SAT P 3 CNF SAT B. 3 CNF SAT P Circuit SAT

28 Circuit SAT P 3 CNF SAT Given a circuit, construct an equivalent 3-CNF formula: 1. Label wires. 2. Construct 3-CNF clauses for each gate. 3. AND all the pieces together. a b c c = a b a b c a b c a b c a b c a b c a b = c F F F T F F T F F T F F F T T T T F F F T F T T T T F F T T T T

29 Independent set is NPC Given an undirected graph and integer k, does the graph have a subset of k vertices which are not adjacent to each other? Deterministic algorithm to check? What is appropriate certificate?

30 3 CNF SAT P IndependentSet Given 3-CNF formula, construct a graph with a k-independent set iff the formula is satisfiable. 1. Form a triangle for each clause. 2. Link complementary nodes. 3. Let k = the number of clauses. a b c a b d b c d a d e a a b a b c b d c d d e

31 Vertex cover is NPC Given a graph and an integer k, is there a set S of vertices, such that S k and every edge has an endpoint in S. Deterministic algorithm to check? What is appropriate certificate?

32 IndependentSet P VertexCover Given graph G, use the same G. Claim: S is an independent set of G iff V S is a vertex cover for G.

33 IndependentSet P VertexCover: Proof Claim: S is an independent set of G iff V S is a vertex cover for G. Let S be any independent set. Consider arbitrary edge u, v. u S or v S u V S or v V S V S covers u, v

34 IndependentSet P VertexCover: Proof Claim: S is an independent set of G iff V S is a vertex cover for G. Let V S be any vertex cover. Consider arbitrary u S and v S. u, v E Thus, no two nodes in S are linked by an edge. So, S is an independent set.

35 Set cover is NPC Given a set U of elements, a collection of subsets of U, and an integer k, does there exist a collection of at most k of these subsets whose union is U?

36 Set cover example U = 1,2,3,4,5,6,7, k = 2 S 1 = 3,7 S 2 = 3,4,5,6 S 3 = 1 S 4 = 2,4 S 5 = 5 S 6 = 1,2,6,7 What is a set cover?

37 VertexCover P SetCover Given graph and k, construct U, a collection of subsets, and k that have a set cover iff the graph has a vertex cover. U = E, Subsets = e E: e is incident to v, k = k f a e b e 3 e 2 7 e 6 e 4 e 1 e 5 e d c U = 1,2,3,4,5,6,7, k = 2 S a = 3,7, S b = 2,4 S c = 3,4,5,6, S d = 5 S e = 1, S f = 1,2,6,7

38 Directed Hamiltonian cycle is NPC Given a directed graph, does it have a simple cycle through every vertex? B E A C D F Previously saw in NP.

39 3 CNF SAT P DirHamCycle Given a 3-CNF formula, construct a directed graph that has a HamCycle iff the formula is satisfiable.

40 3 CNF SAT P DirHamCycle: Step 1 x 1 2 n Ham. cycles x 2 One per variable x 3

41 3 CNF SAT P DirHamCycle: Step 2 One pair per clause 2k + 2 nodes

42 3 CNF SAT P DirHamCycle: Step 3 One per clause x 1 x 2 x 3 Positive literal: left-to-right Negative literal: right-to-left x 1 x 2 x 3

43 3 CNF SAT P DirHamCycle: Proof Claim: Formula is satisfiable iff graph has Hamiltonian cycle. Suppose formula has satisfying assignment x. Define Hamiltonian cycle: If x i = 1, traverse row i from left to right. If x i = 0, traverse row i from right to left. For each clause j, there will be at least one row i in which the cycle goes in the correct direction to splice clause node j into the cycle.

44 3 CNF SAT P DirHamCycle: Proof Claim: Formula is satisfiable iff graph has Hamiltonian cycle. Assume constructed graph G has Hamiltonian cycle. Cycle must traverse each row i. Set x i = 1 iff this cycle traverses row i left to right. Cycle must use each clause node j. Must enter and leave via a pair of edges to/from same row. This pair of edges must go in same direction that cycle traverses the row. So each clause is satisfied by the truth assignment.

45 3-Coloring is NPC Given an undirected graph, does there exist a way of coloring the nodes with three colors, so that no two adjacent nodes have the same color? Deterministic algorithm to check? What is appropriate certificate?

46 3 CNF SAT P 3 Color Given 3-CNF formula, create a graph that is 3-colorable iff the formula is satisfiable.

47 3 CNF SAT P 3 Color: Step 1 T F B Ensures each variable has one literal colored like T, one like F. x 1 x 1 x 2 x 2 x 3 x 3 x n x n One pair per variable

48 3 CNF SAT P 3 Color: Step 2 T F B Ensures each clause has at least one literal colored like T. x 1 x 2 x 3 x 1 x 2 x 3 For each clause:

49 3 CNF SAT P 3 Color: Gadget cases 0 T F B Not 3-colorable

50 3 CNF SAT P 3 Color: Gadget cases 1 T F T F T F B B B

51 3 CNF SAT P 3 Color: Gadget cases 2 T F T F T F T F T F B B B B B T B F T B F T B F T B F

52 3 CNF SAT P 3 Color: Gadget cases 3 T F T F T F T F B B B B

53 Subset sum is NPC Given a set of natural numbers and a number S, is there a subset that adds up to S? Note: Reduction must be polynomial in the encoding size. Deterministic algorithm to check? What is appropriate certificate? U = 9, 2,3,6,7,8,12,35 S = 16

54 3 CNF SAT P SubsetSum Given 3-CNF formula, create a set and total that has a subset sum iff the formula is satisfiable. a b c a b d b c d a b c d C 1 C 2 C 3 Set: a ,000,110 a 1 1,000,000 b ,010 b ,101 c ,100 c ,001 d 1 1 1,001 d 1 1 1, S ,111,444

55 3 CNF SAT P SubsetSum Given 3-CNF formula, create a set and total that has a subset sum iff the formula is satisfiable. Exactly one literal picked for each variable. Exactly one number of each pair picked for sum. a b c a b d b c d a b c d C 1 C 2 C 3 Set: a ,000,110 a 1 1,000,000 b ,010 b ,101 c ,100 c ,001 d 1 1 1,001 d 1 1 1, S ,111,444

56 3 CNF SAT P SubsetSum Given 3-CNF formula, create a set and total that has a subset sum iff the formula is satisfiable. Picking literal satisfies corresponding clauses. a b c a b d b c d a b c d C 1 C 2 C 3 Set: a ,000,110 a 1 1,000,000 b ,010 b ,101 c ,100 c ,001 d 1 1 1,001 d 1 1 1, S ,111,444

57 3 CNF SAT P SubsetSum Given 3-CNF formula, create a set and total that has a subset sum iff the formula is satisfiable. Must pick at least one row/number to satisfy each clause. C i s total from the top is 1, 2, or 3 the bottom rows/numbers take up the slack but aren t sufficient alone. a b c a b d b c d a b c d C 1 C 2 C 3 Set: a ,000,110 a 1 1,000,000 b ,010 b ,101 c ,100 c ,001 d 1 1 1,001 d 1 1 1, S ,111,444

58 Common Reduction Strategies Simple mapping/equivalence IndependentSet P VertexCover Special to general case VertexCover P SetCover Complicated encodings Circuit SAT P 3 CNF SAT 3 CNF SAT P IndependentSet 3 CNF SAT P DirHamCycle 3 CNF SAT P 3 Color 3 CNF SAT P SubsetSum (general to special case)

59

60 Exercise: Hitting set is NPC Given a set U of elements, a collection of subsets, and integer k, does there exist a subset of U of size k that overlaps with all the given subsets?

61 Exercise: Efficient recruiting is NPC Suppose you are helping organize a summer camp. The camp is supposed to have at least one counselor who is skilled at each of the n sports covered by the camp (baseball, volleyball, ). They have received job applicants from m potential counselors. For each of the n sports, there is a subset of the m applicants qualified in that sport. The question: For a given number k < m, is it possible to hire at most k counselors and have at least one counselor qualified in each sport?

62 Exercise: Zero-weight cycle is NPC Given a directed graph with weighted edges, is there a simple cycle of total weight 0?

Polynomial-Time Reductions

Polynomial-Time Reductions Reductions 1 Polynomial-Time Reductions Classify Problems According to Computational Requirements Q. Which problems will we be able to solve in practice? A working definition. [von Neumann 1953, Godel

More information

Computational Intractability 2010/4/15. Lecture 2

Computational Intractability 2010/4/15. Lecture 2 Computational Intractability 2010/4/15 Professor: David Avis Lecture 2 Scribe:Naoki Hatta 1 P and NP 1.1 Definition of P and NP Decision problem it requires yes/no answer. Example: X is a set of strings.

More information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Polynomial-Time Reduction Desiderata'. Suppose we could solve X in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Reduction.

More information

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

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015 CS 374: Algorithms & Models of Computation, Spring 2015 NP Completeness Lecture 23 November 19, 2015 Chandra & Lenny (UIUC) CS374 1 Spring 2015 1 / 37 Part I NP-Completeness Chandra & Lenny (UIUC) CS374

More information

NP-Complete Problems. More reductions

NP-Complete Problems. More reductions NP-Complete Problems More reductions Definitions P: problems that can be solved in polynomial time (typically in n, size of input) on a deterministic Turing machine Any normal computer simulates a DTM

More information

NP and NP-Completeness

NP and NP-Completeness 0/2/206 Algorithms NP-Completeness 7- Algorithms NP-Completeness 7-2 Efficient Certification NP and NP-Completeness By a solution of a decision problem X we understand a certificate witnessing that an

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions Adam Smith; Sofya Raskhodnikova 4/18/2016 L25.1 The classes P and NP P is the class of languages decidable

More information

Chapter 8. NP and Computational Intractability. CS 350 Winter 2018

Chapter 8. NP and Computational Intractability. CS 350 Winter 2018 Chapter 8 NP and Computational Intractability CS 350 Winter 2018 1 Algorithm Design Patterns and Anti-Patterns Algorithm design patterns. Greedy. Divide-and-conquer. Dynamic programming. Duality. Reductions.

More information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Review Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets:

More information

More NP-Complete Problems

More NP-Complete Problems CS 473: Algorithms, Spring 2018 More NP-Complete Problems Lecture 23 April 17, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Recap NP: languages/problems that have

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 26 Computational Intractability Polynomial Time Reductions Sofya Raskhodnikova S. Raskhodnikova; based on slides by A. Smith and K. Wayne L26.1 What algorithms are

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

Reductions. Example 1

Reductions. Example 1 Reductions We want to compare the complexity of different problems. A reduction from problem X to problem Y means that problem X is easier (or, more precisely, not harder) than problem Y. We write X Y

More information

1.1 P, NP, and NP-complete

1.1 P, NP, and NP-complete CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: Introduction to NP-complete Problems Date: 11/01/2008 Lecturer: Lap Chi Lau Scribe: Jerry Jilin Le This lecture gives a general introduction

More information

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

CS 583: Algorithms. NP Completeness Ch 34. Intractability

CS 583: Algorithms. NP Completeness Ch 34. Intractability CS 583: Algorithms NP Completeness Ch 34 Intractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard working

More information

1. Introduction Recap

1. Introduction Recap 1. Introduction Recap 1. Tractable and intractable problems polynomial-boundness: O(n k ) 2. NP-complete problems informal definition 3. Examples of P vs. NP difference may appear only slightly 4. Optimization

More information

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

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1 NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1 NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320

More information

NP-Complete problems

NP-Complete problems NP-Complete problems NP-complete problems (NPC): A subset of NP. If any NP-complete problem can be solved in polynomial time, then every problem in NP has a polynomial time solution. NP-complete languages

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 20 February 23, 2018 February 23, 2018 CS21 Lecture 20 1 Outline the complexity class NP NP-complete probelems: Subset Sum NP-complete problems: NAE-3-SAT, max

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter 2006 NP-Completeness (Chapter 8) Given positive integers a, b, c Question 1: does there exist a positive integer x such that

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes: Classes of Problems We can characterize many problems into three classes: CS 461, Lecture 23 Jared Saia University of New Mexico P is the set of yes/no problems that can be solved in polynomial time. Intuitively

More information

Theory of Computation Time Complexity

Theory of Computation Time Complexity Theory of Computation Time Complexity Bow-Yaw Wang Academia Sinica Spring 2012 Bow-Yaw Wang (Academia Sinica) Time Complexity Spring 2012 1 / 59 Time for Deciding a Language Let us consider A = {0 n 1

More information

NP and NP Completeness

NP and NP Completeness CS 374: Algorithms & Models of Computation, Spring 2017 NP and NP Completeness Lecture 23 April 20, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 44 Part I NP Chandra Chekuri (UIUC) CS374 2 Spring

More information

Lecture 13, Fall 04/05

Lecture 13, Fall 04/05 Lecture 13, Fall 04/05 Short review of last class NP hardness conp and conp completeness Additional reductions and NP complete problems Decision, search, and optimization problems Coping with NP completeness

More information

8.5 Sequencing Problems

8.5 Sequencing Problems 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM 8. INTRACTABILITY I poly-time reductions packing and covering problems constraint satisfaction problems sequencing problems partitioning problems graph coloring numerical problems Lecture slides by Kevin

More information

Introduction. Pvs.NPExample

Introduction. Pvs.NPExample Introduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 09 NP-Completeness (Chapter 34) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu I

More information

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170 UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, 2003 Notes 22 for CS 170 1 NP-completeness of Circuit-SAT We will prove that the circuit satisfiability

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

Algorithms Design & Analysis. Approximation Algorithm

Algorithms Design & Analysis. Approximation Algorithm Algorithms Design & Analysis Approximation Algorithm Recap External memory model Merge sort Distribution sort 2 Today s Topics Hard problem Approximation algorithms Metric traveling salesman problem A

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURES 30-31 NP-completeness Definition NP-completeness proof for CIRCUIT-SAT Adam Smith 11/3/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova,

More information

Essential facts about NP-completeness:

Essential facts about NP-completeness: CMPSCI611: NP Completeness Lecture 17 Essential facts about NP-completeness: Any NP-complete problem can be solved by a simple, but exponentially slow algorithm. We don t have polynomial-time solutions

More information

CSI 4105 MIDTERM SOLUTION

CSI 4105 MIDTERM SOLUTION University of Ottawa CSI 4105 MIDTERM SOLUTION Instructor: Lucia Moura Feb 6, 2010 10:00 am Duration: 1:50 hs Closed book Last name: First name: Student number: There are 4 questions and 100 marks total.

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 31 P and NP Self-reducibility NP-completeness Adam Smith 12/1/2008 S. Raskhodnikova; based on slides by K. Wayne Central ideas we ll cover Poly-time as feasible most

More information

SAT, NP, NP-Completeness

SAT, NP, NP-Completeness CS 473: Algorithms, Spring 2018 SAT, NP, NP-Completeness Lecture 22 April 13, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Part I Reductions Continued Ruta (UIUC)

More information

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition. Lecture #14: 0.0.1 NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition. 0.0.2 Preliminaries: Definition 1 n abstract problem Q is a binary relations on a set I of

More information

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions Summary of the previous lecture Recall that we mentioned the following topics: P: is the set of decision problems (or languages) that are solvable in polynomial time. NP: is the set of decision problems

More information

8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability. Classify Problems

8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability. Classify Problems Chapter 8 8.1 Polynomial-Time Reductions NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Classify Problems According to Computational

More information

1 Primals and Duals: Zero Sum Games

1 Primals and Duals: Zero Sum Games CS 124 Section #11 Zero Sum Games; NP Completeness 4/15/17 1 Primals and Duals: Zero Sum Games We can represent various situations of conflict in life in terms of matrix games. For example, the game shown

More information

NP-Complete Reductions 2

NP-Complete Reductions 2 x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 447 11 13 21 23 31 33 Algorithms NP-Complete Reductions 2 Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline NP-Complete

More information

Lecture 24 : Even more reductions

Lecture 24 : Even more reductions COMPSCI 330: Design and Analysis of Algorithms December 5, 2017 Lecture 24 : Even more reductions Lecturer: Yu Cheng Scribe: Will Wang 1 Overview Last two lectures, we showed the technique of reduction

More information

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

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B That is, A P B When this is true, we say B is NP-hard On

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

NP-Completeness Part II

NP-Completeness Part II NP-Completeness Part II Recap from Last Time NP-Hardness A language L is called NP-hard iff for every L' NP, we have L' P L. A language in L is called NP-complete iff L is NP-hard and L NP. The class NPC

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas CSE 417 Introduction to Algorithms Winter 2007 Some Algebra Problems (Algorithmic) Given positive integers a, b, c Question 1: does there exist a positive integer x such that ax = c? NP-Completeness (Chapter

More information

NP Complete Problems. COMP 215 Lecture 20

NP Complete Problems. COMP 215 Lecture 20 NP Complete Problems COMP 215 Lecture 20 Complexity Theory Complexity theory is a research area unto itself. The central project is classifying problems as either tractable or intractable. Tractable Worst

More information

NP-Complete Reductions 1

NP-Complete Reductions 1 x x x 2 x 2 x 3 x 3 x 4 x 4 CS 4407 2 22 32 Algorithms 3 2 23 3 33 NP-Complete Reductions Prof. Gregory Provan Department of Computer Science University College Cork Lecture Outline x x x 2 x 2 x 3 x 3

More information

NP-Completeness. Subhash Suri. May 15, 2018

NP-Completeness. Subhash Suri. May 15, 2018 NP-Completeness Subhash Suri May 15, 2018 1 Computational Intractability The classical reference for this topic is the book Computers and Intractability: A guide to the theory of NP-Completeness by Michael

More information

NP and NP-Completeness

NP and NP-Completeness CSC 364S Notes University of Toronto, Spring, 2003 NP NP and NP-Completeness NP is a class of languages that contains all of P, but which most people think also contains many languages that aren t in P.

More information

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany Applied Computer Science II Chapter 7: Time Complexity Prof. Dr. Luc De Raedt Institut für Informati Albert-Ludwigs Universität Freiburg Germany Overview Measuring complexity The class P The class NP NP-completeness

More information

CSCI3390-Lecture 17: A sampler of NP-complete problems

CSCI3390-Lecture 17: A sampler of NP-complete problems CSCI3390-Lecture 17: A sampler of NP-complete problems 1 List of Problems We now know that if L is any problem in NP, that L P SAT, and thus SAT is NP-hard. Since SAT is also in NP we find that SAT is

More information

Theory of Computation Chapter 9

Theory of Computation Chapter 9 0-0 Theory of Computation Chapter 9 Guan-Shieng Huang May 12, 2003 NP-completeness Problems NP: the class of languages decided by nondeterministic Turing machine in polynomial time NP-completeness: Cook

More information

P, NP, NP-Complete, and NPhard

P, NP, NP-Complete, and NPhard P, NP, NP-Complete, and NPhard Problems Zhenjiang Li 21/09/2011 Outline Algorithm time complicity P and NP problems NP-Complete and NP-Hard problems Algorithm time complicity Outline What is this course

More information

Lecture 4: NP and computational intractability

Lecture 4: NP and computational intractability Chapter 4 Lecture 4: NP and computational intractability Listen to: Find the longest path, Daniel Barret What do we do today: polynomial time reduction NP, co-np and NP complete problems some examples

More information

Computability and Complexity Theory: An Introduction

Computability and Complexity Theory: An Introduction Computability and Complexity Theory: An Introduction meena@imsc.res.in http://www.imsc.res.in/ meena IMI-IISc, 20 July 2006 p. 1 Understanding Computation Kinds of questions we seek answers to: Is a given

More information

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

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P Easy Problems vs. Hard Problems CSE 421 Introduction to Algorithms Winter 2000 NP-Completeness (Chapter 11) Easy - problems whose worst case running time is bounded by some polynomial in the size of the

More information

Lecture 18: More NP-Complete Problems

Lecture 18: More NP-Complete Problems 6.045 Lecture 18: More NP-Complete Problems 1 The Clique Problem a d f c b e g Given a graph G and positive k, does G contain a complete subgraph on k nodes? CLIQUE = { (G,k) G is an undirected graph with

More information

Lecture 15 - NP Completeness 1

Lecture 15 - NP Completeness 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 29, 2018 Lecture 15 - NP Completeness 1 In the last lecture we discussed how to provide

More information

CSCI 1590 Intro to Computational Complexity

CSCI 1590 Intro to Computational Complexity CSCI 1590 Intro to Computational Complexity NP-Complete Languages John E. Savage Brown University February 2, 2009 John E. Savage (Brown University) CSCI 1590 Intro to Computational Complexity February

More information

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time Last week: Defined Polynomial Time Reduc7ons: Problem X is poly 7me reducible to Y X P Y if can solve X using poly computa7on and a poly number

More information

Introduction to Computational Complexity

Introduction to Computational Complexity Introduction to Computational Complexity Tandy Warnow October 30, 2018 CS 173, Introduction to Computational Complexity Tandy Warnow Overview Topics: Solving problems using oracles Proving the answer to

More information

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof T-79.5103 / Autumn 2006 NP-complete problems 1 NP-COMPLETE PROBLEMS Characterizing NP Variants of satisfiability Graph-theoretic problems Coloring problems Sets and numbers Pseudopolynomial algorithms

More information

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

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA. Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA NP Completeness Susmita Sur-Kolay Advanced Computing and Microelectronics Unit

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 25 NP Completeness Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 NP-Completeness Some

More information

NP-Completeness Part II

NP-Completeness Part II NP-Completeness Part II Please evaluate this course on Axess. Your comments really do make a difference. Announcements Problem Set 8 due tomorrow at 12:50PM sharp with one late day. Problem Set 9 out,

More information

Computational Complexity

Computational Complexity p. 1/24 Computational Complexity The most sharp distinction in the theory of computation is between computable and noncomputable functions; that is, between possible and impossible. From the example of

More information

Algorithms: COMP3121/3821/9101/9801

Algorithms: COMP3121/3821/9101/9801 NEW SOUTH WALES Algorithms: COMP3121/3821/9101/9801 Aleks Ignjatović School of Computer Science and Engineering University of New South Wales LECTURE 9: INTRACTABILITY COMP3121/3821/9101/9801 1 / 29 Feasibility

More information

NP Completeness and Approximation Algorithms

NP Completeness and Approximation Algorithms Winter School on Optimization Techniques December 15-20, 2016 Organized by ACMU, ISI and IEEE CEDA NP Completeness and Approximation Algorithms Susmita Sur-Kolay Advanced Computing and Microelectronic

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

More on NP and Reductions

More on NP and Reductions Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

Show that the following problems are NP-complete

Show that the following problems are NP-complete Show that the following problems are NP-complete April 7, 2018 Below is a list of 30 exercises in which you are asked to prove that some problem is NP-complete. The goal is to better understand the theory

More information

ECS122A Handout on NP-Completeness March 12, 2018

ECS122A Handout on NP-Completeness March 12, 2018 ECS122A Handout on NP-Completeness March 12, 2018 Contents: I. Introduction II. P and NP III. NP-complete IV. How to prove a problem is NP-complete V. How to solve a NP-complete problem: approximate algorithms

More information

A An Overview of Complexity Theory for the Algorithm Designer

A An Overview of Complexity Theory for the Algorithm Designer A An Overview of Complexity Theory for the Algorithm Designer A.1 Certificates and the class NP A decision problem is one whose answer is either yes or no. Two examples are: SAT: Given a Boolean formula

More information

CS 3719 (Theory of Computation and Algorithms) Lectures 23-32

CS 3719 (Theory of Computation and Algorithms) Lectures 23-32 CS 3719 (Theory of Computation and Algorithms) Lectures 23-32 Antonina Kolokolova March 2011 1 Scaling down to complexity In real life, we are interested whether a problem can be solved efficiently; just

More information

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University Algorithms NP -Complete Problems Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr The Class P Definition 13.2 Polynomially bounded An algorithm is said to be polynomially bounded if its worst-case

More information

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?

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? N P NP Completeness Announcements Friday Four Square! Today at 4:15PM, outside Gates. Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Explore P, NP, and their connection. Did

More information

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

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems COSE215: Theory of Computation Lecture 20 P, NP, and NP-Complete Problems Hakjoo Oh 2018 Spring Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 1 / 14 Contents 1 P and N P Polynomial-time reductions

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 18 February 16, 2018 February 16, 2018 CS21 Lecture 18 1 Outline the complexity class NP 3-SAT is NP-complete NP-complete problems: independent set, vertex cover,

More information

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem? Admin Two more assignments No office hours on tomorrow NP-COMPLETE PROBLEMS Run-time analysis Tractable vs. intractable problems We ve spent a lot of time in this class putting algorithms into specific

More information

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

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class Complexity Agenda What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class Complexity class A complexity class is a set All problems within

More information

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

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine. The Class NP NP is the problems that can be solved in polynomial time by a nondeterministic machine. NP The time taken by nondeterministic TM is the length of the longest branch. The collection of all

More information

CSC373: Algorithm Design, Analysis and Complexity Fall 2017

CSC373: Algorithm Design, Analysis and Complexity Fall 2017 CSC373: Algorithm Design, Analysis and Complexity Fall 2017 Allan Borodin October 25, 2017 1 / 36 Week 7 : Annoucements We have been grading the test and hopefully they will be available today. Term test

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

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

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch] NP-Completeness Andreas Klappenecker [based on slides by Prof. Welch] 1 Prelude: Informal Discussion (Incidentally, we will never get very formal in this course) 2 Polynomial Time Algorithms Most of the

More information

NP-Complete Reductions 3

NP-Complete Reductions 3 x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 4407 1 13 21 23 31 33 Algorithms NP-Complete Reductions 3 Prof. Gregory Provan Department of Computer Science University College Cork 1 HARDEST PROBLEMS IN NP

More information

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

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Computational Complexity CLRS 34.1-34.4 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 50 Polynomial

More information

CSCI 1010 Models of Computa3on. Lecture 11 Proving Languages NP-Complete

CSCI 1010 Models of Computa3on. Lecture 11 Proving Languages NP-Complete CSCI 1010 Models of Computa3on Lecture 11 Proving Languages NP-Complete Overview P-3me reduc3ons Composi3on of P-3me reduc3ons Reduc3on from CIRCUIT SAT to SAT SAT is NP-complete. 3-SAT is NP-complete.

More information

Automata Theory CS Complexity Theory I: Polynomial Time

Automata Theory CS Complexity Theory I: Polynomial Time Automata Theory CS411-2015-17 Complexity Theory I: Polynomial Time David Galles Department of Computer Science University of San Francisco 17-0: Tractable vs. Intractable If a problem is recursive, then

More information

NP-complete Problems

NP-complete Problems NP-complete Problems HP, TSP, 3COL, 0/1IP Dimitris Diamantis µπλ November 6, 2014 Dimitris Diamantis (µπλ ) NP-complete Problems November 6, 2014 1 / 34 HAMILTON PATH is NP-Complete Definition Given an

More information

CSE 421 Algorithms. NP-Completeness (Chapter 8)

CSE 421 Algorithms. NP-Completeness (Chapter 8) CSE 421 Algorithms NP-Completeness (Chapter 8) 1 What can we feasibly compute? Focus so far has been to give good algorithms for specific problems (and general techniques that help do this). Now shifting

More information

Hamiltonian Cycle. Hamiltonian Cycle

Hamiltonian Cycle. Hamiltonian Cycle Hamiltonian Cycle Hamiltonian Cycle Hamiltonian Cycle Problem Hamiltonian Cycle Given a directed graph G, is there a cycle that visits every vertex exactly once? Such a cycle is called a Hamiltonian cycle.

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information