1. Tractable and Intractable Computational Problems So far in the course we have seen many problems that have polynomial-time solutions; that is, on

Size: px
Start display at page:

Download "1. Tractable and Intractable Computational Problems So far in the course we have seen many problems that have polynomial-time solutions; that is, on"

Transcription

1 . Tractable and Intractable Comptational Problems So far in the corse we have seen many problems that have polynomial-time soltions; that is, on a problem instance of size n, the rnning time T (n) = O(n k ) for some k, with k typically small. For example, we discssed sorting algorithms with T (n) = O(n lg n), and we showed how to find shortest paths in time T ( E, V ) = O ( E lg( V )) sing Dijkstra s algorithm. On the other hand, for the TSP we gave a dynamic programming soltion that solved the problem in T (n) = O(n n ), where n is the nmber of vertices. We did not give any polynomial-time bonded soltion for this problem. Problems that can be solved by a polynomial-time algorithm are considered tractable, and those that can not be solved in time bonded by a polynomial in the size of the inpt are considered intractable. Therefore, sorting and shortest-path are tractable. From or discssion so far we do not know if TSP is tractable (in fact it is nknown at present). The prpose of these notes is to explore this dichotomy between tractable and intractable problems. Or final reslt will not qite be a neat division into tractable and intractable problems. Rather, we will end p with two important classes: the problems we know are tractable (this class will be called P ), and the problems which are sspected to be intractable (NP C). A very famos nsolved problem is the qestion of whether or not NP C P ; that is, whether or not the seemingly intractable problems are in fact intractable. Why aim for sch a categorization? Before yo set ot to solve a problem, it is sefl to determine first if it is in NP C. If it is, yo know that most experts believe it nlikely that yo will ever find an efficient (polynomial-time) soltion. Unless yo are very ambitios and have a lot of time to devote to the problem, yo may decide at this point to abandon hope for a polynomial-time soltion and go with a non-polynomial time algorithm and confine yorself to relatively small problem instances. Alternatively, yo can se an approximation algorithm that might give a good answer (bt not garanteed to be the best) in polynomial time. Finally, yo might reformlate the original problem to a version that is in P. (Often the distinction between a problem in P and NP C can be sbtle.) We will develop a theory for decision problems; that is, problems that have a yes or no answer. For example, we considered the shortest path problem: Given a weighted digraph G and vertices s and t, what is the weight of the lightest path from vertex s to vertex t? The decision version of this problem is: Given a weighted digraph G, vertices s and t, and integer, is there a path of weight at most between s and t? The decision version is certainly no harder than the original optimization problem. If we can solve the optimization problem, then we only need to compare the optimal soltion with to solve the decision problem. The class of decision problems for which polynomial time algorithms exist is denoted P. Sppose that we are given an instance of the decision version of the shortest path problem with a yes answer, and someone offers a certificate that demonstrates that the problem is a yes instance. What form might this certificate take? Sppose it is a path from s to t that has length. The path has at most V edges, and so we can certainly check the certificate in time that is bonded by a polynomial in the size of the problem instance. This problem therefore has the sccinct certificate property: given a yes instance, there is at least one sccinct certificate (and possibly many) that verifies that the problem is a yes instance

2 in time that is bonded by a polynomial in the size of the problem instance. A no instance of the problem has no sch certificate. The decision version of the traveling salesman problem, which we will call TSP is: given n cities and distance matrix d and integer, is there a tor of the n cities with total length? This problem has the sccinct certificate property. If we are given a tor (permtation of the n cities), we can check in O(n) time to see if it has length. The class of yes-no problems that have the sccinct certificate property is called NP. (NP stands for nondeterministic polynomial.) Clearly P NP, since if the problem can be solved in polynomial time, then the soltion constrcted by the algorithm can certainly be checked in polynomial time. The decision version of the knapsack problem we discssed in class, which we call NAPSAC, is: Given a weight bdget W, n items of vale v i and weight w i, i =,,..., n, and vale, is there a choice of the items that weigh W and have total vale? We saw (in homework problem 6.-) that the optimization version can be solved in time O(nW ), so of corse the decision version can also be solved in time O(nW ). Does this mean that NAPSAC is in P? To answer this qestion, we mst be carefl abot the size of the inpt. It is fair to consider the data abot the n items to have size O(n), bt what abot W? In binary representation it has lg(w ) bits. So the size of the inpt is really abot n lg W. Therefore, the rnning time is exponential in the size of the problem instance. The decision version of knapsack does have the sccinct certificate property, however, and so it is in NP. Is it in P? We don t know; we have only arged that the particlar algorithm we came p with does not show it to be in P since it is not a polynomial time algorithm. The field of logic provides many examples of decision problems. The CIRCUIT- VALUE problem is: Given a Boolean circit and its inpts, is the otpt T? This problem is in P (see below). The SAT problem is: Given a Boolean circit, is there a way to assign vales to its inpts so that the otpt is T? While sperficially similar, SAT seems to be a mch more difficlt problem. The obvios soltion is to try all inpts, of which there are exponentially many. The linear programming problem (LP) is: Given an n m matrix A and an m vector b, are there nonnegative real nmbers x, x,..., x n satisfying Ax b? The integer linear programming problem (ILP), is: Given an n m matrix A and an m vector b, are there nonnegative integers x, x,..., x n satisfying Ax b? It trns ot that LP is in P, while ILP appears to be exponential. We next define a class of decision problems which are the hardest problems in the class NP. We first need to introdce redctions. Let A and B be two decision problems. A redction from A to B is a polynomialtime algorithm R which transforms inpts of A to eqivalent inpts to B. If x is an instance of problem A, then R(x) is an instance of problem B, and x is a yes instance of A if and only if R(x) is a yes instance of B. If we have a polynomial-time algorithm for problem B, and a redction from A to B, then we have a polynomial-time algorithm for problem A. To see this, sppose that or polynomial-time algorithm for problem B has rnning time T (n) = O(n k ) for some k, and sppose that or redction R has rnning time O(n j ). To solve an instance

3 x of A of length n, first convert x to R(x), an instance of B, in time O(n j ); notice that the length of R(x) is at most O(n j ). Then solve R(x), which takes time O((n j ) k ) = O(n jk ). Cook s Theorem: A problem is in NP if and only if it can be redced to SAT. Part of the theorem is easy to prove. If a problem can be redced to SAT, then it is in NP. A certificate of any yes instance wold be the redction of the instance with a certificate for the reslting inpt of SAT. Here is a sketch of the plasibility of the other half of the theorem: If a problem A is in NP then it can be redced to SAT. Since A is in NP, there exists a polynomial-time algorithm to check problem instances and certificates for validity. By combining polynomially many Boolean circits, we can implement the algorithm that does the validity checking (the inpt gates correspond to the bits of the problem instance and the certificate). Let x be an instance of problem A. Plg in the correct T/F vales for the inpt gates of the circit corresponding to the problem instance, and leave nknown the gates corresponding to the certificate. We now have an instance of SAT which captres the qestion of whether a valid certificate for x exists; that is, whether x is a yes instance of A. Therefore, we have redced A to SAT. If a problem is in NP and all other problems in NP redce to it, then we say that the problem is NP-Complete. Ths an NP-complete problem is (p to a polynomial) as hard as any other problem in NP. Cook s theorem gives s or first example of an NP-Complete problem.

4 . Examples of Redctions In these notes we will illstrate polynomial redctions. This allows one to show that a problem is NP-complete if we redce a known NP-complete problem to it. Let {,,, n } be a collection of Boolean variables. A trth assignment assigns a vale T of F to each variable. We se a bar to denote complement: ū is T if and only if is F. If is a variable, then and ū are literals. A clase is a set of literals, representing the disjnction (OR) of those literals, for example ( ū 5 ). This clase will be satisfied nless = F, = T, and 5 = F. A collection C of clases is satisfiable if and only if there is a trth assignment that simltaneosly satisfies all the clases in C. We will write sch a collection of clases by connecting them with (read AND ); sch a Boolean expression is in conjnctive normal form (CNF). The satisfiability problem (abbreviated SAT) is: Given a collection of clases C over variables U, is there a satisfying trth assignment for C? Cook s theorem states that SAT is NP-complete. We will now redce SAT to some other interesting problems, ths showing that they are NP-complete. A set of clases is in conjnctive normal form (-CNF) if each clase has exactly literals. The -SAT problem is the special case of SAT in which each clase has exactly three literals. SAT redces to -SAT Consider any formla F in CNF, consisting of clases C, C,..., C m over variables {,,..., n }. We shall constrct a new formla F with exactly three literals per clase that is satisfiable if and only if F is. We do this by examining each clase C i in trn, replacing it by an eqivalent set of clases, introdcing new variables if necessary. If C i already has exactly three literals, we do nothing. Otherwise, there are two cases to consider: C i has fewer than three literals and C i has more than three literals. First sppose that C i has one or two literals. If C i =, then introdce new variables z, z, α, β and replace C i by the clases ( z z ) and ( z α β) ( z ᾱ β) ( z α β) ( z ᾱ β) ( z α β) ( z ᾱ β) ( z α β) ( z ᾱ β). These last clases force the variables z and z to be false in any trth assignment satisfying F, so that the clase is eqivalent to its replacement. If C i = ( ), introdce only z, α, β and disregard the clases containing z. If C i has k > literals, say ( k ), then introdce new variables z, z,..., z k, and replace C i by ( z ) ( z z ) ( z z ) ( z k k k ). This last set of clases is satisfiable if and only if C i is: If C i has a trth assignment, let l be the smallest integer sch that l is tre. Then the new clase is satisfied with the same trth assignment and with z i = T for i l and z i = F for i > l. Conversely, sppose that the new clase is satisfied by some trth assignment. If C i is not satisfied by the trth assignment, then i = F for i k. Bt this wold imply that the new clase is not satisfied. It is clear that the redction can be accomplished in polynomial time. Let G = (V, E) be a graph. A sbset I V is called an independent set if no two vertices in I are directly connected by an edge in E. For example, in Figre, {,, 6} and {, 5} are two examples of independent sets.

5 5 The Independent Set problem is: Given a graph G and an integer, is there an independent set I V containing at least vertices? Independent Set is NP-complete. Proof. It is clearly in NP. We will redce -SAT to Independent Set; i.e., given a Boolean formla F in -CNF, prodce a graph G = (V, E) and integer sch that G has an independent set of size at least if and only if F is satisfiable. Here is the constrction: Let be the nmber of clases. For each clase, create a node for each literal in the clase, connected in all possible ways (a triangle for each clase). Also draw an edge between literals of different clases if contradictory; e.g., if i appears in one clase and ū i appears in a different clase, connect the corresponding nodes with an edge. For example, consider the formla ( ) (ū ) (ū ū 5 ). The graph is illstrated in Figre. 5 Figre. Graph sed in Independent Set redction. If there is an independent set of size at least, then it mst have exactly one node from each grop. Think of the chosen node in a grop as a literal that satisfies that clase. Since contradictory literals are connected by an edge, no nodes in I are contradictory, so the literals together comprise a satisfying trth assignment (if not sed, a variable can be set to either T or F ). Conversely, sppose that we have a satisfying trth assignment for F. Pick a T literal from each clase. The corresponding set I of nodes is an independent set (they are from the same trth assignment, so not contradictory). A cliqe in a graph G = (V, E) is a flly connected set of nodes. For example, in the following graph, {,, } and {,, 5, 6} are cliqes, as is {, } G G Figre. A graph and its complement.

6 6 The complement of a graph G, denoted Ḡ, is the graph with the same nodes as G, bt only the missing edges; see Figre for an example. Cliqe is NP-complete. This follows from the fact that a cliqe of size for G corresponds to an independent set of size for G: If each pair of nodes in a set is connected by an edge (that is, the nodes form a cliqe), then in the complementary graph none of the nodes will be connected by an edge (so they form an independent set). Finally, we consider the mltiprocessor schedling problem. There are m identical processors working in parallel. There are T discrete time slots, dring which a set J of jobs mst be schedled. In addition, there are precedence constraints of the type: job j i mst be processed before job j k. These constraints are represented by an acyclic directed graph (J, A), where (j i, j k ) A means j i mst be schedled before j k. A feasible schedle is a mapping S from the jobs to time slots, sch that at most m jobs are schedled dring any one slot, and all jobs complete within the allotted time T. Mltiprocessor schedling is NP-complete. Proof. The problem is clearly in NP, since it is easy to check if a given schedle is feasible. We will now redce CLIQUE to mltiprocessor schedling. Consider a graph G = (V, E) and an integer. We will constrct a set J of jobs, an acyclic digraph (J, A) representing precedence constraints, and integers m and T sch that there exists a feasible schedle for J if and only if G has a cliqe of size. Let the set of jobs be given by J = V E {b, b,, b nb } E {c, c,, c nc } E {d, d,, d nd } where the nmbers n b, n c, n d are chosen sch that ( ) ( ) (.) k + n b = + V + n c = E + n d and min{n b, n c, n d } =. Clearly sch a choice is possible. Let m be the common vale in (.) and set T =. (Notation: ( n m) (read n choose m ) is the nmber of sbsets of size m in a set with n elements.) To constrct the precedence constraint digraph, first add to A all arcs of the form (b i, c j ) and (c j, d k ). Then add all arcs (v, e) for all v V and e E sch that e is incident on v. We will now arge that the instance of mltiprocessor schedling jst constrcted has a feasible schedle if and only if G has a cliqe of size. Sppose first that there is a feasible schedle. Since T =, it mst be that S(b i ) =, S(c i ) =, and S(d i ) = for all i, since the b jobs mst precede the c jobs which mst precede the d jobs. Also, since J = m = T m by constrction, all m machines mst be bsy dring all three time slots. Now, in the last period, besides the d i jobs, only m n d = E ( ) jobs corresponding to edges can be exected, since if a vertex job were exected, then its incident edges cold not be processed ntil period, violating the feasibility of the schedle. We conclde that the remaining ( ) edge jobs mst be exected in the second period, and the

7 7 vertex jobs are exected in the first and second periods (with m n b = of them processed in the first period). Frthermore, the vertices corresponding to jobs that are exected in the first period mst inclde the endpoints of all ( ) edges correspond ( to jobs in the second period. Bt vertices can inclde endpoints of ) edges only if they form a cliqe of size. So the existence of a feasible schedle implies the existence of a cliqe of size. Conversely, sppose that G has a cliqe of size. Define a feasible schedle S by: S(b i ) =, S(c i ) =, S(d i ) = for all i, S(v) = if v is a member of the cliqe and S(v) = otherwise; S([v, ]) = if v and are in the cliqe and S([v, ]) = otherwise. (Here [v, ] is the job corresponding to the edge between vertices v and, if there is one.)

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

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

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

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

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

Worst-case analysis of the LPT algorithm for single processor scheduling with time restrictions

Worst-case analysis of the LPT algorithm for single processor scheduling with time restrictions OR Spectrm 06 38:53 540 DOI 0.007/s009-06-043-5 REGULAR ARTICLE Worst-case analysis of the LPT algorithm for single processor schedling with time restrictions Oliver ran Fan Chng Ron Graham Received: Janary

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

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

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

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

Scheduling parallel jobs to minimize the makespan

Scheduling parallel jobs to minimize the makespan J Sched (006) 9:433 45 DOI 10.1007/s10951-006-8497-6 Schedling parallel jobs to minimize the makespan Berit Johannes C Springer Science + Bsiness Media, LLC 006 Abstract We consider the NP-hard problem

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

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

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

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

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with

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

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

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

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

Lecture Notes On THEORY OF COMPUTATION MODULE - 2 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE - 2 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lectre Notes On THEORY OF COMPUTATION MODULE - 2 UNIT - 2 Prepared by, Dr. Sbhend Kmar Rath, BPUT, Odisha. Tring Machine- Miscellany UNIT 2 TURING MACHINE

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

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

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-Completeness. Until now we have been designing algorithms for specific problems NP-Completeness 1 Introduction Until now we have been designing algorithms for specific problems We have seen running times O(log n), O(n), O(n log n), O(n 2 ), O(n 3 )... We have also discussed lower

More information

CMSC 441: Algorithms. NP Completeness

CMSC 441: Algorithms. NP Completeness CMSC 441: Algorithms NP Completeness Intractable & Tractable Problems Intractable problems: As they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard

More information

4.2 First-Order Logic

4.2 First-Order Logic 64 First-Order Logic and Type Theory The problem can be seen in the two qestionable rles In the existential introdction, the term a has not yet been introdced into the derivation and its se can therefore

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

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle Directed Hamiltonian Cycle Chapter 8 NP and Computational Intractability Claim. G has a Hamiltonian cycle iff G' does. Pf. Suppose G has a directed Hamiltonian cycle Γ. Then G' has an undirected Hamiltonian

More information

P, NP, NP-Complete. Ruth Anderson

P, NP, NP-Complete. Ruth Anderson P, NP, NP-Complete Ruth Anderson A Few Problems: Euler Circuits Hamiltonian Circuits Intractability: P and NP NP-Complete What now? Today s Agenda 2 Try it! Which of these can you draw (trace all edges)

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

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

Linear System Theory (Fall 2011): Homework 1. Solutions

Linear System Theory (Fall 2011): Homework 1. Solutions Linear System Theory (Fall 20): Homework Soltions De Sep. 29, 20 Exercise (C.T. Chen: Ex.3-8). Consider a linear system with inpt and otpt y. Three experiments are performed on this system sing the inpts

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

Nonlinear parametric optimization using cylindrical algebraic decomposition

Nonlinear parametric optimization using cylindrical algebraic decomposition Proceedings of the 44th IEEE Conference on Decision and Control, and the Eropean Control Conference 2005 Seville, Spain, December 12-15, 2005 TC08.5 Nonlinear parametric optimization sing cylindrical algebraic

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

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

CS 350 Algorithms and Complexity

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

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

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

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

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

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1 CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY E. Amaldi Foundations of Operations Research Politecnico di Milano 1 Goal: Evaluate the computational requirements (this course s focus: time) to solve

More information

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Tractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?» Standard working definition: polynomial time» On an input

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

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

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

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

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 20.1 Introduction Definition 20.1.1 We say that an algorithm runs in polynomial time if its running

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

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

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

The Cryptanalysis of a New Public-Key Cryptosystem based on Modular Knapsacks

The Cryptanalysis of a New Public-Key Cryptosystem based on Modular Knapsacks The Cryptanalysis of a New Pblic-Key Cryptosystem based on Modlar Knapsacks Yeow Meng Chee Antoine Jox National Compter Systems DMI-GRECC Center for Information Technology 45 re d Ulm 73 Science Park Drive,

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

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

Concepts Introduced. Digital Electronics. Logic Blocks. Truth Tables

Concepts Introduced. Digital Electronics. Logic Blocks. Truth Tables Concepts Introdced Digital Electronics trth tables, logic eqations, and gates combinational logic seqential logic Digital electronics operate at either high or low voltage. Compters se a binary representation

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

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

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502) Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik Combinatorial Optimization (MA 4502) Dr. Michael Ritter Problem Sheet 1 Homework Problems Exercise

More information

IE418 Integer Programming

IE418 Integer Programming IE418: Integer Programming Department of Industrial and Systems Engineering Lehigh University 23rd February 2005 The Ingredients Some Easy Problems The Hard Problems Computational Complexity The ingredients

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

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

Reductions. Reduction. Linear Time Reduction: Examples. Linear Time Reductions

Reductions. Reduction. Linear Time Reduction: Examples. Linear Time Reductions Reduction Reductions Problem X reduces to problem Y if given a subroutine for Y, can solve X. Cost of solving X = cost of solving Y + cost of reduction. May call subroutine for Y more than once. Ex: X

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

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved. Chapter 11 Approximation Algorithms Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved. 1 P and NP P: The family of problems that can be solved quickly in polynomial time.

More information

Problem Class 4. More State Machines (Problem Sheet 3 con t)

Problem Class 4. More State Machines (Problem Sheet 3 con t) Problem Class 4 More State Machines (Problem Sheet 3 con t) Peter Cheng Department of Electrical & Electronic Engineering Imperial College London URL: www.ee.imperial.ac.k/pcheng/ee2_digital/ E-mail: p.cheng@imperial.ac.k

More information

BLOOM S TAXONOMY. Following Bloom s Taxonomy to Assess Students

BLOOM S TAXONOMY. Following Bloom s Taxonomy to Assess Students BLOOM S TAXONOMY Topic Following Bloom s Taonomy to Assess Stdents Smmary A handot for stdents to eplain Bloom s taonomy that is sed for item writing and test constrction to test stdents to see if they

More information

On the tree cover number of a graph

On the tree cover number of a graph On the tree cover nmber of a graph Chassidy Bozeman Minerva Catral Brendan Cook Oscar E. González Carolyn Reinhart Abstract Given a graph G, the tree cover nmber of the graph, denoted T (G), is the minimm

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

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

Travelling Salesman Problem

Travelling Salesman Problem Travelling Salesman Problem Fabio Furini November 10th, 2014 Travelling Salesman Problem 1 Outline 1 Traveling Salesman Problem Separation Travelling Salesman Problem 2 (Asymmetric) Traveling Salesman

More information

Elements of Coordinate System Transformations

Elements of Coordinate System Transformations B Elements of Coordinate System Transformations Coordinate system transformation is a powerfl tool for solving many geometrical and kinematic problems that pertain to the design of gear ctting tools and

More information

PhysicsAndMathsTutor.com

PhysicsAndMathsTutor.com C Integration - By sbstittion PhysicsAndMathsTtor.com. Using the sbstittion cos +, or otherwise, show that e cos + sin d e(e ) (Total marks). (a) Using the sbstittion cos, or otherwise, find the eact vale

More information

Cubic graphs have bounded slope parameter

Cubic graphs have bounded slope parameter Cbic graphs have bonded slope parameter B. Keszegh, J. Pach, D. Pálvölgyi, and G. Tóth Agst 25, 2009 Abstract We show that every finite connected graph G with maximm degree three and with at least one

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

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

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than.

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than. No Harder Than We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than. If we can reduce problem B to problem A appropriately, then we say that

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

Unit 1A: Computational Complexity

Unit 1A: Computational Complexity Unit 1A: Computational Complexity Course contents: Computational complexity NP-completeness Algorithmic Paradigms Readings Chapters 3, 4, and 5 Unit 1A 1 O: Upper Bounding Function Def: f(n)= O(g(n)) if

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

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

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

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

P,NP, NP-Hard and NP-Complete

P,NP, NP-Hard and NP-Complete P,NP, NP-Hard and NP-Complete We can categorize the problem space into two parts Solvable Problems Unsolvable problems 7/11/2011 1 Halting Problem Given a description of a program and a finite input, decide

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

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

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

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014 Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 2014 by Clifford A. Shaffer : Theory of Algorithms Title page : Theory of Algorithms Clifford A. Shaffer Spring 2014 Clifford

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

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? The conjecture that P is different from NP made its way on to several lists of the most important unsolved problems in Mathematics (never

More information

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

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

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

More information