Design and Analysis of Algorithms

Size: px
Start display at page:

Download "Design and Analysis of Algorithms"

Transcription

1 CSE 101, Winter 2018 Design and Analsis of Algorithms Lecture 15: NP-Completeness Class URL:

2 From Application to Algorithm Design Find all maimal regularl-spaced, collinear subsets of given pointset Lower bound? Naïve algorithm? Simpler variants?

3 What is an EFFICIENT Algorithm? The algorithms we have studied so far have runtimes that are tpicall bounded b some polnomial in the size of the input We call these efficient algorithms But for man problems, no polnomial-time algorithm is known We suspect that man of these problems can never be solved efficientl

4 Boolean Satisfiabilit Conjunctive normal form (CNF) = Product of Sums A Boolean epression S in CNF is the product (and) of several sums (or) S ( z) ( z) ( z)

5 Boolean Satisfiabilit Conjunctive normal form (CNF) = Product of Sums A Boolean epression S in CNF is the product (and) of several sums (or) S ( z) ( z) ( z) A Boolean epression is satisfiable if there eists an assignment of 0 s and 1 s to its variables such that the epression evaluates to 1.

6 The Satisfiabilit Problem (SAT) ( z) ( ) ( z) ( z ) ( z) SAT(F): Given a Boolean formula F in CNF, is there a satisfing assignment of truth values to the variables? This is a Decision question: Answer is YES or NO If F has n variables, there are 2 n different truth assignments Answer in above case:?

7 A Problem is a Language Decision problem: A problem whose answer (to an instance) is either es or no Eample: RodCutIncome(R,k) Can income of $k be obtained from RodCut instance R? A decision problem can be viewed as a languagerecognition problem Is (R,k) RodCutIncome? U: the set of possible inputs to the decision problem L U is the set of inputs which ield es L: the language corresponding to the problem

8 A Problem is a Language PA3 Optimization Decision

9 A Problem is a Language Decision problem: A problem whose answer is either es or no Eample: TSP(G,k): Does there eist a TSP tour in graph G that has total edge length k? A decision problem can be viewed as a languagerecognition problem Is (G,k) TSP? is w TSP? U: the set of possible inputs w to the decision problem L U is the set of inputs which ield es L: the language corresponding to the problem

10 A Problem is a Language G: w: (1,2,7); (1,3,5); (1,4,20); (2,3,2); (3,4,3); #15# TSP(G,15) = Does there eist a TSP tour in G with cost 15? YES w L TSP TSP(G, 50) = NO w L TSP

11 Polnomial-Time Reducibilit Let L 1 and L 2 be two languages from the input spaces U 1 and U 2 Definition: L 1 is polnomiall reducible to L 2 if there eists a polnomial-time algorithm that converts each input u 1 U 1 to another input u 2 U 2 such that u 1 L 1 iff u 2 L 2 Recall:

12 Polnomial-Time Reducibilit SORT reduces to CHULL What is u 1 U 1? What is u 2 U 2? such that u 1 L 1 iff u 2 L 2

13 Polnomial-Time Reducibilit L 1 is polnomiall reducible to L 2 if there eists a polnomial-time algorithm that converts each input u 1 U 1 to another input u 2 U 2 such that u 1 L 1 iff u 2 L 2 Instance of A = u 1 Pol-time Transform Instance of B = u 2 Decider of B YES NO YES NO Decider of A Note: polnomial-time in size of input u 1 also polnomial in the size of u 1. (Wh?) size of u 2 is

14 Polnomial-Time Reducibilit Definition: X is polnomial-time reducible to Y, written X P Y, if there eists an algorithm for solving X that would be polnomial if we took no account of the time needed to solve arbitrar instances of Y. Eamples of Decision questions: for convenience, require n > 2 X(n): Is_It_Prime? Y(n): Is_Largest_Factor_Other_Than_Itself_Greater_Than_Or_Equ al_to_2? Z(n,k): Is_Number_Of_Distinct_Factors_Greater_Than_k? Claim 1: X P Y Claim 2: X P Z

15 Polnomial-Time Reducibilit Definition: X is polnomial-time reducible to Z, written X P Z, if there eists an algorithm for solving X that would be polnomial if we took no account of the time needed to solve arbitrar instances of Z. Eample: X(n): Is_It_Prime? Z(n,k): Is_Number_Of_Distinct_Factors_Greater_Than_k? Claim: X P Z Instance of = u 1 Pol-time Transform Instance of = u 2 Decider of _ YES NO YES NO Decider of _

16 Polnomial-Time Reducibilit Definition: X is polnomial-time reducible to Y, written X P Y, if there eists an algorithm for solving X that would be polnomial if we took no account of the time needed to solve arbitrar instances of Y. Eample: X(n): Is_It_Prime? Y(n): Is_Largest_Factor_Other_Than_Itself_Greater_Than_Or_Equal_To_2? Claim: X P Y Instance of = u 1 Pol-time Transform Instance of = u 2 Decider of _ YES NO YES NO Decider of _

17 Observations About Pol-Time Reducibilit L 1 P L 2 and L 2 P L 3 L 1 P L 3 L 1 P L 2 and L 2 P L 1 L 2, L 1 are polnomiall equivalent

18 Observations About Pol-Time Reducibilit L 1 P L 2 and L 2 P L 3 L 1 P L 3 L 1 P L 2 and L 2 P L 1 L 2, L 1 are polnomiall equivalent Where this is going Solvable problems have polnomial-time algorithms Some problems (TSP, SAT, etc.) are hard ( non-solvable ) The hard problems have equivalent difficult: the are all polnomiall equivalent. If we can solve an one of them in polnomial time, then we can solve them all in polnomial time

19 Checkpoint Suppose A reduces to B. i.e., A is pol-time reducible to B Instance of A = u 1 Pol-time Transform Instance of B = u 2 Decider of B YES NO YES NO Decider of A What can we conclude: If B is eas A must be eas If A is eas NOTHING If A is hard B must be hard If B is hard NOTHING

20

21 The Classes P and NP Classes of Decision Problems P: Problems for which there eists a deterministic polnomial-time algorithm NP: Problems for which there eists a nondeterministic polnomial-time algorithm What is non-deterministic polnomial-time? Solutions are small (== polnomial-size) Guessing is free, but solutions must be checkable in polnomial time Succinct Certificate P NP, but whether P = NP is not known Most people believe P!= NP, which would impl P NP

22 NP-Hard, NP-Complete NP-Hard: Problem X is NP-hard if ever problem in NP is polnomiall reducible to X NP-Complete: Problem X is NP-complete if: X belongs to NP, and X is NP-hard Also, Y is NP-complete if Y NP and some NPcomplete problem X is polnomiall reducible to Y NP-Complete problems are the hardest problems in NP

23 Picture of P, NP, NP-Hard, NP-Complete

24 Picture of P, NP, NP-Hard, NP-Complete

25 SAT is NP-Complete (Cook, 1971) Cook s theorem (1971): The SAT problem is NP-complete Also, Levin (1972) Once we know an NP-complete problem, proving other problems NP-complete becomes easier A new problem Y is NP-complete if: (1) Y is in NP (2) SAT or an other NP-complete problems, is polnomiall reducible to Y I.e., reduce from SAT to Y

26 NP-Complete Problems 0, 0 Number Partition: Given a set of numbers S = { 1, 2,, n }, is there a disjoint partition of S into S 1, S 2 (i.e., where S 1 S 2 = S, and S 1 S 2 = ) such that the sum of numbers in S 1 = sum of numbers of S 2? k-tolerant Number Partition: Given a set of numbers S = { 1, 2,, n } and a number k, is there a disjoint partition of S into S 1, S 2 (i.e., where S 1 S 2 = S, and S 1 S 2 = ) such that sum of numbers in S 1 - sum of numbers of S 2 k? Task: Reduce k-tolerant Number Partition to Number Partition

27 NP-Complete Problems 0, 0 Number Partition: Given a set of numbers S = { 1, 2,, n }, is there a disjoint partition of S into S 1, S 2 (i.e., where S 1 S 2 = S, and S 1 S 2 = ) such that the sum of numbers in S 1 = sum of numbers of S 2? k-tolerant Number Partition: Given a set of numbers S = { 1, 2,, n } and a number k, is there a disjoint partition of S into S 1, S 2 (i.e., where S 1 S 2 = S, and S 1 S 2 = ) such that sum of numbers in S 1 - sum of numbers of S 2 k? Task: Reduce k-tolerant Number Partition to Number Partition

28 Two Parts To An NP-Completeness Proof Problem is in NP A known NP-complete problem reduces to it

29 NP-Complete Problems 0, 0 Reduce k-tolerant Number Partition to Number Partition

30 NumPart, Bin-Packing NumPart(S): Given a set of numbers S = { 1, 2,, n } with 0 < i 1, there a disjoint partition of S into S 1, S 2 (i.e., where S 1 S 2 = S, and S 1 S 2 = ) such that i S 1 = j S 2? Bin-Packing(L,B): Given a list of items L = { 1, 2,, n } with 0 < i 1, and a number B, can L be packed into B unit-capacit bins? Given that NumPart is NP-complete, prove that Bin-Packing is NP-complete

31 NP-Complete Problems #1, #2, #3 The following five problems are NP-complete (Manber, Introduction to Algorithms: A Creative Approach) Definition: A verte cover of G =( V, E) is V V such that ever edge in E is incident to some v V. VC(G,k): Given undirected G = (V, E) and integer k, does G have a verte cover with k vertices? CLIQUE(G,k): Does G contain a clique of size k? 3COLOR(G): Is G properl colorable with 3 colors?

32 NP-Complete Problems #1, #2, #3 VC(G,k): Given undirected G = (V, E) and integer k, does G have a verte cover with k vertices? CLIQUE(G,k): Does G contain a clique of size k? 3COLOR(G): Is G properl colorable with 3 colors?

33 NP-Complete Problems #4, #5 Definition: A dominating set D of G = (V, E) is D V such that ever v V is either in D or adjacent to at least one verte of D DS(G,k): given G, k, does G have a dominating set of size k? 3SAT(F): Given Boolean epression F in CNF such that each clause has eactl 3 variables, is F satisfiable?

34 NP-Completeness Proofs: Reductions All NP problems Clique 1 Verte Cover SAT 4 3 3SAT 5 3-Colorabilit 2 Dominating Set To prove NP-completeness of a new problem: Prove that the problem belongs to NP Show polnomial reducibilit from a known NPcomplete problem This slide shows the order in which we will develop some classic reductions

35 NP-Completeness Proof: Verte Cover (VC) Problem: Given undirected G = (V, E) and integer k, does G have a verte cover with k vertices? Theorem: The VC problem is NP-complete. Proof: Approach: Reduction from CLIQUE I.e., given that CLIQUE is NP-complete, we will prove that VC is NP-complete VC is in NP. This is true since we can guess a cover of size k and check it in polnomial time Goal: Transform arbitrar CLIQUE instance into VC instance such that CLIQUE answer is es iff VC answer is es

36 NP-Completeness Proof: Verte Cover (VC) Claim: CLIQUE(G, k) has same answer as VC ( G, n-k), where n = V. Observe: If C = (u, F) clique in G, then v-u is VC in G.

37 NP-Completeness Proof: Verte Cover(VC) Observe: If D is a VC in G, then G has no edge between vertices in V-D. So, we have that a k-clique in G a size (n-k) VC in G Can transform in polnomial time.

38 NP-Completeness Proof: DS Definition: A dominating set D of G = (V, E) is D V such that ever v V is either in D or adjacent to at least one verte of D Problem: given G, k does G have a dominating set of size k? Theorem: DS is NP-complete Proof: (reduction from VC) DS NP Given instance (G,k) of VC, make ever edge of G into a triangle and answer DS.

39 NP-Completeness Proof: DS G: v w G : z u vz G has DS D of size k iff G has VC C of size k. Without loss of generalit, assume DV, D is a DS ever edge hits some verte in D D is a VC in G C is a VC new and old vertices dominated v z vu vw zu w u uw

40 NP-Completeness Proof: 3SAT 3SAT: Given a Boolean epression in CNF such that each clause has eactl 3 variables, determine satisfiabilit. Theorem: 3SAT is NP-Complete Proof: 3SATNP Let E be an arbitrar instance of SAT arbitrar clause of E For k 4 )... ( 2 1 k C ) (... ) ( ) ( ) ( ' k k k C

41 NP-Completeness Proof: 3SAT C is satisfiable iff C is satisfiable: C = 1 at least one i = 1 C = 1 C = 1 at least one i = 1 can set i s so that C = 1 ) ( ) ( ) ( ) ( ' ) ( ) ( ) ( ' ) ( C C C C

42 NP-Completeness Proof: CLIQUE Problem: Does G=(V,E) contain a clique of size k? Theorem: Clique is NP-Complete. (reduction from SAT) Idea: Make column of k vertices for each clause with k variables. No edge within a column. All other edges present ecept between and

43 NP-Completeness Proof: CLIQUE Eample: G = G has m-clique (m is the number of clauses in E), iff E is satisfiable. (Assign value 1 to all variables in clique) ) ( ) ( ) ( z z z E z z z

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 0, Winter 208 Design and Analsis of Algorithms Lecture 6: NP-Completeness, Part 2 Class URL: http://vlsicad.ucsd.edu/courses/cse0-w8/ The Classes P and NP Classes of Decision Problems P: Problems for

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

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

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

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

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

Polynomial-time Reductions

Polynomial-time Reductions Polynomial-time Reductions Disclaimer: Many denitions in these slides should be taken as the intuitive meaning, as the precise meaning of some of the terms are hard to pin down without introducing the

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

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

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

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

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

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

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

CS Fall 2011 P and NP Carola Wenk

CS Fall 2011 P and NP Carola Wenk CS3343 -- Fall 2011 P and NP Carola Wenk Slides courtesy of Piotr Indyk with small changes by Carola Wenk 11/29/11 CS 3343 Analysis of Algorithms 1 We have seen so far Algorithms for various problems Running

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

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

Correctness of Dijkstra s algorithm

Correctness of Dijkstra s algorithm Correctness of Dijkstra s algorithm Invariant: When vertex u is deleted from the priority queue, d[u] is the correct length of the shortest path from the source s to vertex u. Additionally, the value d[u]

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

Spring Lecture 21 NP-Complete Problems

Spring Lecture 21 NP-Complete Problems CISC 320 Introduction to Algorithms Spring 2014 Lecture 21 NP-Complete Problems 1 We discuss some hard problems: how hard? (computational complexity) what makes them hard? any solutions? Definitions Decision

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

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

Computational Complexity

Computational Complexity Computational Complexity Problems, instances and algorithms Running time vs. computational complexity General description of the theory of NP-completeness Problem samples 1 Computational Complexity What

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

NP-Completeness Review

NP-Completeness Review CS124 NP-Completeness Review Where We Are Headed Up to this point, we have generally assumed that if we were given a problem, we could find a way to solve it. Unfortunately, as most of you know, there

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

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

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

Toda s Theorem: PH P #P

Toda s Theorem: PH P #P CS254: Computational Compleit Theor Prof. Luca Trevisan Final Project Ananth Raghunathan 1 Introduction Toda s Theorem: PH P #P The class NP captures the difficult of finding certificates. However, in

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

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

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

Lecture 19: Finish NP-Completeness, conp and Friends

Lecture 19: Finish NP-Completeness, conp and Friends 6.045 Lecture 19: Finish NP-Completeness, conp and Friends 1 Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input

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

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

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

Polynomial-time reductions. We have seen several reductions:

Polynomial-time reductions. We have seen several reductions: Polynomial-time reductions We have seen several reductions: Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in

More information

Chapter 3: Proving NP-completeness Results

Chapter 3: Proving NP-completeness Results Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises 1.1 Six Basic NP-Complete Problems 3-SATISFIABILITY (3SAT)

More information

Chapter 34: NP-Completeness

Chapter 34: NP-Completeness Graph Algorithms - Spring 2011 Set 17. Lecturer: Huilan Chang Reference: Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. Chapter 34: NP-Completeness 2. Polynomial-time

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9 1 Computational Complexity and Intractability: An Introduction to the Theory of NP Chapter 9 2 Objectives Classify problems as tractable or intractable Define decision problems Define the class P Define

More information

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs Computational Complexity IE 496 Lecture 6 Dr. Ted Ralphs IE496 Lecture 6 1 Reading for This Lecture N&W Sections I.5.1 and I.5.2 Wolsey Chapter 6 Kozen Lectures 21-25 IE496 Lecture 6 2 Introduction to

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

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction Algorithms and Theory of Computation Lecture 19: Class P and NP, Reduction Xiaohui Bei MAS 714 October 29, 2018 Nanyang Technological University MAS 714 October 29, 2018 1 / 26 Decision Problems Revisited

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-problems continued

NP-problems continued NP-problems continued Page 1 Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity.

More information

Provable intractability. NP-completeness. Decision problems. P problems. Algorithms. Two causes of intractability:

Provable intractability. NP-completeness. Decision problems. P problems. Algorithms. Two causes of intractability: Provable intractabilit -completeness Selected from Computer and Intractabilit b MR Gare and DS Johnson (979) Two causes of intractabilit: The problem is so difficult that an exponential amount of time

More information

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP 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

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion.

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion. Theory of Computer Science May 31, 2017 E5. Some NP-Complete Problems, Part II Theory of Computer Science E5. Some NP-Complete Problems, Part II E5.1 Routing Problems Malte Helmert University of Basel

More information

Complexity, P and NP

Complexity, P and NP Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity

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

Lecture 18: P & NP. Revised, May 1, CLRS, pp

Lecture 18: P & NP. Revised, May 1, CLRS, pp Lecture 18: P & NP Revised, May 1, 2003 CLRS, pp.966-982 The course so far: techniques for designing efficient algorithms, e.g., divide-and-conquer, dynamic-programming, greedy-algorithms. What happens

More information

Formal definition of P

Formal definition of P Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity. In SAT we want to know if

More information

CSE 421 NP-Completeness

CSE 421 NP-Completeness CSE 421 NP-Completeness Yin at Lee 1 Cook-Levin heorem heorem (Cook 71, Levin 73): 3-SA is NP-complete, i.e., for all problems A NP, A p 3-SA. (See CSE 431 for the proof) So, 3-SA is the hardest problem

More information

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35. NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16 NP-Completeness Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16 bspanda1@gmail.com 1 Decision Problem A problem whose answer is either yes or no ( 1 or 0) Examples: HC

More information

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete) CS5371 Theory of Computation Lecture 19: Complexity IV (More on NP, NP-Complete) Objectives More discussion on the class NP Cook-Levin Theorem The Class NP revisited Recall that NP is the class of language

More information

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi CSL 356: Analysis and Design of Algorithms Ragesh Jaiswal CSE, IIT Delhi Computational Intractability NP and NP-completeness Computational Intractability: NP & NP-complete NP: A problem X is in NP if and

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

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k. Complexity Theory Problems are divided into complexity classes. Informally: So far in this course, almost all algorithms had polynomial running time, i.e., on inputs of size n, worst-case running time

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

Today: NP-Completeness (con t.)

Today: NP-Completeness (con t.) Today: NP-Completeness (con t.) COSC 581, Algorithms April 22, 2014 Many of these slides are adapted from several online sources Reading Assignments Today s class: Chapter 34.5 (con t.) Recall: Proving

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

CSC 1700 Analysis of Algorithms: P and NP Problems

CSC 1700 Analysis of Algorithms: P and NP Problems CSC 1700 Analysis of Algorithms: P and NP Problems Professor Henry Carter Fall 2016 Recap Algorithmic power is broad but limited Lower bounds determine whether an algorithm can be improved by more than

More information

There are two types of problems:

There are two types of problems: Np-complete Introduction: There are two types of problems: Two classes of algorithms: Problems whose time complexity is polynomial: O(logn), O(n), O(nlogn), O(n 2 ), O(n 3 ) Examples: searching, sorting,

More information

NP-Complete Problems

NP-Complete Problems NP-Complete Problems Max Bisection Is NP-Complete max cut becomes max bisection if we require that S = V S. We shall reduce the more general max cut to max bisection. Add V isolated nodes to G to yield

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

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

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity CS 350 Algorithms and Complexity Winter 2019 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

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

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Logistics HW7 due tonight Thursday's class: REVIEW Final exam on Thursday Dec 8, 8am-11am, LEDDN AUD Note card allowed

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 7.2, 7.3 Distinguish between polynomial and exponential DTIME Define nondeterministic

More information

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016 CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016 Intractable Problems There are many problems for which the best known algorithms take a very long time (e.g., exponential in some

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

Notes for Lecture 21

Notes for Lecture 21 U.C. Berkeley CS170: Intro to CS Theory Handout N21 Professor Luca Trevisan November 20, 2001 Notes for Lecture 21 1 Tractable and Intractable Problems So far, almost all of the problems that we have studied

More information

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness Marc Uetz University of Twente m.uetz@utwente.nl Lecture 9: sheet 1 / 31 Marc Uetz Discrete Optimization Outline 1 N P and co-n P 2 N P-completeness

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

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

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

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

The Complexity of Optimization Problems

The Complexity of Optimization Problems The Complexity of Optimization Problems Summary Lecture 1 - Complexity of algorithms and problems - Complexity classes: P and NP - Reducibility - Karp reducibility - Turing reducibility Uniform and logarithmic

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

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

More information

CS 5114: Theory of Algorithms

CS 5114: Theory of Algorithms CS 5114: Theory of Algorithms Clifford A. Shaffer Department of Computer Science Virginia Tech Blacksburg, Virginia Spring 2014 Copyright c 2014 by Clifford A. Shaffer CS 5114: Theory of Algorithms Spring

More information

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness. Overview Problem classification Tractable Intractable P and NP Reductions Tools for classifying problems according to relative hardness Inge Li Gørtz Thank you to Kevin Wayne, Philip Bille and Paul Fischer

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

NP-Hardness reductions

NP-Hardness reductions NP-Hardness reductions Definition: P is the class of problems that can be solved in polynomial time, that is n c for a constant c Roughly, if a problem is in P then it's easy, and if it's not in P then

More information

NP-Completeness Theory

NP-Completeness Theory NP-Completeness Theory The topics we discussed so far are positive results: Given a problem, how to design efficient algorithms for solving it. NP-Completeness (NPC for sort) Theory is negative results.

More information

CSC 373: Algorithm Design and Analysis Lecture 15

CSC 373: Algorithm Design and Analysis Lecture 15 CSC 373: Algorithm Design and Analysis Lecture 15 Allan Borodin February 13, 2013 Some materials are from Stephen Cook s IIT talk and Keven Wayne s slides. 1 / 21 Announcements and Outline Announcements

More information

BBM402-Lecture 11: The Class NP

BBM402-Lecture 11: The Class NP BBM402-Lecture 11: The Class NP Lecturer: Lale Özkahya Resources for the presentation: http://ocw.mit.edu/courses/electrical-engineering-andcomputer-science/6-045j-automata-computability-andcomplexity-spring-2011/syllabus/

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