from notes written mostly by Dr. Matt Stallmann: All Rights Reserved

Size: px
Start display at page:

Download "from notes written mostly by Dr. Matt Stallmann: All Rights Reserved"

Transcription

1 CSC 505, Fall 000: Week 0 Objectives: understand problem complexity and classes defined by it understand relationships among decision, witness, evaluation, and optimization problems understand what it means to reduce one problem to another understand the meaning of membership in the class NP, and NP-completeness Page of

2 A complexity class (a class of problems that are related based on the efficiency -- time or space -- of the best possible algorithms for them) Class P is the class of all decision problems that can be solved in time polynomial in the input size. Questions:. Why polynomial? (i.e. why is P an important class?). Why decision problems? 3. How do we count time and input size? Page of

3 MST as a decision problem/language MST decision problem: Given a weighted,undirected graph G = (V,E,w) and an integer k, does G have a spanning tree whose total weight is k? L MST = { strings z z encodes a graph G = (V,E,w) and an integer k and G has a spanning tree T with w(t) k } 4 5 G = 8 3 z = #0#00####0##0##000### Do the details of the encoding matter? Page 3 of

4 Rules for this particular encoding alphabet = {0,,#} fixed, finite instance ::= graph ### int G and k graph ::= edge {## edge } list of edges edge ::= vertex #vertex # int ends and weight vertex ::= int vertex names are ints int ::= bit { bit } ints are in binary bit ::= Another example: G = k =8 #0#000####0###0#00###00###0#00#0###000 Page 4 of

5 Types of combinatorial problems Optimization a combinatorial object (set, sequence,... ) of optimum (min/max) weight Example: Output a minimum spanning tree T of G = (V,E,w). Evaluation the weight of an optimum object Example: Output w(t ), the weight of a minimum spanning tree T of G = (V,E,w). Decision yes/no (does an object of a certain weight or better exist) Example: Given G = (V,E,w) and an integer k, does there exist a spanning tree T such that w(t) k? Witness a certificate for the decision problem, i.e. proof of a yes answer if such proof exists Example: Given G = (V,E,w) and an integer k, output a spanning tree T with w(t) k or report that none exists. Page 5 of

6 Are the problem types related? If you can solve the optimization problem (in polynomial time), you can solve the evaluation, decision, and witness problems (in polynomial time). (Obvious. Why?) If you can solve the decision problem, you can solve the evaluation problem. (Binary search on the interval of possible solution values) If you can solve both the evaluation and the witness problem, you can solve the optimization problem. (Easy. How?) The missing link is how to solve the witness problem using the decision problem. Page 6 of

7 Self-reducibility u w v Graph G has a spanning tree with weight k. Can you determine if edge (u,v) is in such a spanning tree? Your only resource is a black box that allows you to input a graph and a weight and will output yes if there is a spanning tree with that weight or less, no otherwise. You can perform modifications on G but you can t look at it (i.e. you can put a modified form of G into the box). Page 7 of

8 Using the decision problem to solve the witness problem function MST-Witness(G, k) is returns a spanning tree of G with weight k, if one exists. Pick an arbitrary u V [G] for each v Adj[u] do if MST-Decision(G/uv, k w(uv)) then return MST-Witness(G/uv, k w(uv)) G/uv is G with u and v joined into one vertex. ERROR: no such tree end MST-Witness Time bound, i.e. number of times MST-Decision is called? Page 8 of

9 Non-deterministic algorithm for MST-Decision function MST-Decision(G, k) is returns true iff a spanning tree of G with weight k exists Choose n edges to form a subset T E[G] Use DFS (for example) to check that T is a spanning tree (quit when a cycle is found or there s more than one tree). Add up edge costs and check that the total is k. if T passes both tests then return true else return false end MST-Witness Guess a certificate and then check the validity of the certificate. Page 9 of

10 What is nondeterminism and what is NP? How nondeterminism works. If there exists a choice that leads to a yes answer, the algorithm answers yes (true) for that instance. magic no computational device works this way. Why nondeterminisim is useful. Algorithms are simple. Algorithms can be simulated by deterministic ones. It is a useful way to classify problems. N P is the class of all decision problems that can be solved by a nondeterministic algorithm (guess a certificate and check) in polynomial time (certificate has polynomial size; checking takes polynomial time). Compare with text! Page 0 of

11 P and NP: what s all the fuss about? NP?? Traveling salesperson problem Polynomial algorithm? Non-polynomial lower bound? At least as hard as... P Minimum spanning-tree problem TSP: Given an n x n distance matrix D (where D[i,j] = distance from city i to city j) and an integer K, does there exist a permutation p of {,...,n} so that D[p(n),p()] + sum i from to n of D[p(i),p(i+)] is at most K? Page of

12 Reduction: a confusing concept A reduces to B means A can be solved in terms of B, or A is at least as easy as B. In divide-and-conquer, greedy, dynamic and programming: reduce (an instance of) a problem to (a smaller instance of) itself. Witness problem can be solved in terms of decision problem. An instance of transitive closure is reduced to several instances of matrix multiplication and 3 smaller instances of transitive closure. So an O(n α )-time algorithm for matrix multiplication with α implies an O(n α )-time algorithm for transitive closure. But A reduces to B can also mean B is at least as hard as A. If transitive closure can t be solved in O(n α ) time for some α, neither can matrix multiplication! If A is known to be hard (NP-complete) and A reduces (in polynomial time) to B, then B is also hard (NP-complete). Page of

13 Reduction: technical details (Decision) problem P reduces in polynomial time to problem P, notation P P P, if there exists a polynomialtime reduction algorithm F that transforms an arbitrary instance of P to an instance of P so that F (x) has a yes answer in P if and only if x has a yes answer in P. Simple example: PATH P SR. An instance of PATH is a directed, unweighted graph G = (V,E) and two vertices s and t answer yes if there is a path from s to t in G. An instance of SR (shortest route) is an n n distance matrix D = {D[i, j]}, two cities s and t, and an integer B answer yes if there is a sequence s = x 0, x,...,x k = t so that k i=0 D[x i,x i+ ] B. How does the reduction algorithm work? Page 3 of

14 Proof of correctness for the reduction Let F (G, s, t) be defined by the following:. Number V [G] from to n, where n = V [G].. For each pair i, j, if ij E[G], let D[i, j] = 0, otherwise let D[i, j] =. Let B = 0 and output D,s,t,B. Claim: There is a path from s to t in G iff there is a path with sum of all edges = 0 from s to t using the distance matrix D. Page 4 of

15 Another reduction: TSP to Longest simple path TSP P LSP. An instance of LSP (longest simple path) is a weighted, directed graph G = (V,E,w), two vertices s and t, and an integer bound B answer yes if G has a path P from s to t with w(p ) B. Let F(D,K) be defined by the following:. Let V = {,...,n } {s, t} and E = {uv u, v n } {su u n } {ut u n }.. Let ˆd be the largest distance in D and let w(u, v) = ˆd D[u, v] if u, v n. Let w(s, u) = ˆd D[n, u] and let w[u, t] = ˆd D[u, n]. 3. Let B = n ˆd K and output G, s, t, and B. Page 5 of

16 Example of the TSP to LSP reduction TSP: 3 Corresponding LSP: 0 s 3 as 3 source Transform: cycle to path, to t 3 as target Counterclockwise tour: 3 > > >3 6 Cost = 3 3 High-Low path: s > > >t Cost = Low-High path: s > > >t Cost = Clockwise tour: 3 > > >3 Cost = Page 6 of

17 Correctness of the reduction? Need to prove:. Certificate for TSP instance D,K implies certificate for LSP instance F (D,K). Let π be a permutation that certifies D,K and assume wlog that π() = n (since only the cyclic order matters). This means that D[π(n), n] + n i= D[π(i), π(i+ )] K. From the construction of the LSP instance, we can see that the path s π()π(3)...π(n) t has total weight ( ˆd D[π(n), n])+ n i= ( ˆd D[π(i), π(i+ )]) n ˆd K = B. The converse: Certificate for LSP instance F(D,K) implies certificate for TSP instance D,K. Suppose s = v...v k = t is a simplepath from s to t with weight B, that is, k i= w(v i, v i+ ) B. There s a problem here: we d like to transform his path into a permutation. What might prevent that? Page 7 of

18 A possible problem with the proof Let K = 5 s 3 as source t 3 as target Then B = 3 x 5 = and s t is a path with weight B. Page 8 of

19 Adjusting the transformation The largest reasonable value for K is n ˆd (Otherwise we can transform to a trivial yes-instance). Suppose in F (D,K) we let w(u, v) = n ˆd + D[u, v] and B = n ˆd + n K. weight of a certificate path B = n ˆd + n K n ˆd + n n ˆd > (n )(n ˆd + ) weight of a path with < n edges Thus, a certificate path for F (D,K) must have at least n edges, and, being a simple path, must visit every vertex. Page 9 of

20 The bad example revisited s 3 as source t 3 as target w(u,v) = 3 x + D[u,v] 3 Let K = 5 Then B = 9 x = 6 A certificate has weight at least K and the edges have weight 7 a, 7 b, and 7 c. Thus, a + b + c K. Page 0 of

21 Summary of polynomial reduction Proving that A P B: Specify in detail how any instance x of A is to be transformed into an instance f(x) of B. This should be like a recipe, so that there s no ambiguity and no doubt that it can be done in polynomial time. Show how a certificate y for x can be converted to a certificate for f(x). Show how a certificate z for f (x) can be converted to a certificate for x. This is important. Page of

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

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

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

Tractable & Intractable Problems

Tractable & Intractable Problems Tractable & Intractable Problems We will be looking at : What is a P and NP problem NP-Completeness The question of whether P=NP The Traveling Salesman problem again Programming and Data Structures 1 Polynomial

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

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

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

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

More information

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

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size. 10 2.2. CLASSES OF COMPUTATIONAL COMPLEXITY An optimization problem is defined as a class of similar problems with different input parameters. Each individual case with fixed parameter values is called

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

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

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g. NP-Completeness ch34 Hewett Problem Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g., O(2 n ) computationally feasible poly-time alg. sol. E.g., O(n k ) No

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

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization Problem set 8: solutions 1. Fix constants a R and b > 1. For n N, let f(n) = n a and g(n) = b n. Prove that f(n) = o ( g(n) ). Solution. First we observe that g(n) 0 for all

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

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

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

More information

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

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

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

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

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

More information

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

CMPT307: Complexity Classes: P and N P Week 13-1

CMPT307: Complexity Classes: P and N P Week 13-1 CMPT307: Complexity Classes: P and N P Week 13-1 Xian Qiu Simon Fraser University xianq@sfu.ca Strings and Languages an alphabet Σ is a finite set of symbols {0, 1}, {T, F}, {a, b,..., z}, N a string x

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

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

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness x x x 2 x 2 x 3 x 3 x 4 x 4 2 22 32 3 2 23 3 33 NP-Completeness Outline and Reading P and NP ( 3.) Definition of P Definition of NP Alternate definition of NP NP-completeness ( 3.2) Definition

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

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

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

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides P and NP Inge Li Gørtz Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides 1 Overview Problem classification Tractable Intractable Reductions Tools for classifying problems

More information

NP-Complete Problems and Approximation Algorithms

NP-Complete Problems and Approximation Algorithms NP-Complete Problems and Approximation Algorithms Efficiency of Algorithms Algorithms that have time efficiency of O(n k ), that is polynomial of the input size, are considered to be tractable or easy

More information

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

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

More information

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

Lecture 14 - P v.s. NP 1

Lecture 14 - P v.s. NP 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 27, 2018 Lecture 14 - P v.s. NP 1 In this lecture we start Unit 3 on NP-hardness and approximation

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

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

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

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

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

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005 Algorithms and Complexity Theory Chapter 8: Introduction to Complexity Jules-R Tapamo Computer Science - Durban - September 2005 Contents 1 Introduction 2 1.1 Dynamic programming...................................

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

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

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

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

Computational Complexity

Computational Complexity Computational Complexity Algorithm performance and difficulty of problems So far we have seen problems admitting fast algorithms flow problems, shortest path, spanning tree... and other problems for which

More information

Lecture 15 - NP Completeness 1

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

More information

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

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm Outline 1 NP-Completeness Theory 2 Limitation of Computation 3 Examples 4 Decision Problems 5 Verification Algorithm 6 Non-Deterministic Algorithm 7 NP-Complete Problems c Hu Ding (Michigan State University)

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

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

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

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

NP Completeness and Approximation Algorithms

NP Completeness and Approximation Algorithms Chapter 10 NP Completeness and Approximation Algorithms Let C() be a class of problems defined by some property. We are interested in characterizing the hardest problems in the class, so that if we can

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

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam Limits to Approximability: When Algorithms Won't Help You Note: Contents of today s lecture won t be on the exam Outline Limits to Approximability: basic results Detour: Provers, verifiers, and NP Graph

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

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20 NP-complete problems CSE 101: Design and Analysis of Algorithms Lecture 20 CSE 101: Design and analysis of algorithms NP-complete problems Reading: Chapter 8 Homework 7 is due today, 11:59 PM Tomorrow

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

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

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar.. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar.. Complexity Class P NP-Complete Problems Abstract Problems. An abstract problem Q is a binary relation on sets I of input instances

More information

Chapter 2 : Time complexity

Chapter 2 : Time complexity Dr. Abhijit Das, Chapter 2 : Time complexity In this chapter we study some basic results on the time complexities of computational problems. concentrate our attention mostly on polynomial time complexities,

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

ABHELSINKI UNIVERSITY OF TECHNOLOGY

ABHELSINKI UNIVERSITY OF TECHNOLOGY Approximation Algorithms Seminar 1 Set Cover, Steiner Tree and TSP Siert Wieringa siert.wieringa@tkk.fi Approximation Algorithms Seminar 1 1/27 Contents Approximation algorithms for: Set Cover Steiner

More information

Algorithm Design Strategies V

Algorithm Design Strategies V Algorithm Design Strategies V Joaquim Madeira Version 0.0 October 2016 U. Aveiro, October 2016 1 Overview The 0-1 Knapsack Problem Revisited The Fractional Knapsack Problem Greedy Algorithms Example Coin

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

10.4 The Kruskal Katona theorem

10.4 The Kruskal Katona theorem 104 The Krusal Katona theorem 141 Example 1013 (Maximum weight traveling salesman problem We are given a complete directed graph with non-negative weights on edges, and we must find a maximum weight Hamiltonian

More information

Data Structures and Algorithms (CSCI 340)

Data Structures and Algorithms (CSCI 340) University of Wisconsin Parkside Fall Semester 2008 Department of Computer Science Prof. Dr. F. Seutter Data Structures and Algorithms (CSCI 340) Homework Assignments The numbering of the problems refers

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

8.5 Sequencing Problems

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

More information

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

Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P, N P and co-n P

Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P, N P and co-n P Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P, N P and co-n P Marc Uetz University of Twente m.uetz@utwente.nl Lecture 8: sheet 1 / 32 Marc Uetz Discrete Optimization Outline 1 Lagrangian

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

fsat We next show that if sat P, then fsat has a polynomial-time algorithm. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 425

fsat We next show that if sat P, then fsat has a polynomial-time algorithm. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 425 fsat fsat is this function problem: Let φ(x 1, x 2,..., x n ) be a boolean expression. If φ is satisfiable, then return a satisfying truth assignment. Otherwise, return no. We next show that if sat P,

More information

P vs. NP. Data Structures and Algorithms CSE AU 1

P vs. NP. Data Structures and Algorithms CSE AU 1 P vs. NP Data Structures and Algorithms CSE 373-18AU 1 Goals for today Define P, NP, and NP-complete Explain the P vs. NP problem -why it s the biggest open problem in CS. -And what to do when a problem

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

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

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

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch 6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch Today: More Complexity Theory Polynomial-time reducibility, NP-completeness, and the Satisfiability (SAT) problem Topics: Introduction

More information

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved! N P NP Announcements Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved! Now in cabinets in the Gates open area near the drop-off box. The Complexity Class

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

July 18, Approximation Algorithms (Travelling Salesman Problem)

July 18, Approximation Algorithms (Travelling Salesman Problem) Approximation Algorithms (Travelling Salesman Problem) July 18, 2014 The travelling-salesman problem Problem: given complete, undirected graph G = (V, E) with non-negative integer cost c(u, v) for each

More information

Algorithm Design and Analysis

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

More information

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

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

More information

Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006

Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006 Introduction to Complexity Theory Bernhard Häupler May 2, 2006 Abstract This paper is a short repetition of the basic topics in complexity theory. It is not intended to be a complete step by step introduction

More information

Algorithm Design and Analysis

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

More information

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

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

More information

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

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

On the Computational Hardness of Graph Coloring

On the Computational Hardness of Graph Coloring On the Computational Hardness of Graph Coloring Steven Rutherford June 3, 2011 Contents 1 Introduction 2 2 Turing Machine 2 3 Complexity Classes 3 4 Polynomial Time (P) 4 4.1 COLORED-GRAPH...........................

More information

Friday Four Square! Today at 4:15PM, Outside Gates

Friday Four Square! Today at 4:15PM, Outside Gates P and NP Friday Four Square! Today at 4:15PM, Outside Gates Recap from Last Time Regular Languages DCFLs CFLs Efficiently Decidable Languages R Undecidable Languages Time Complexity A step of a Turing

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

Lecture Notes 4. Issued 8 March 2018

Lecture Notes 4. Issued 8 March 2018 CM30073 Advanced Algorithms and Complexity 1. Structure of the class NP Lecture Notes 4 Issued 8 March 2018 Recall that it is not known whether or not P = NP, the widely accepted hypothesis being that

More information

Decision Problems TSP. Instance: A complete graph G with non-negative edge costs, and an integer

Decision Problems TSP. Instance: A complete graph G with non-negative edge costs, and an integer Decision Problems The theory of NP-completeness deals only with decision problems. Why? Because if a decision problem is hard, then the corresponding optimization problem must be hard too. For example,

More information

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: 2017 2018 Time Allowed 2 Hours INSTRUCTIONS TO STUDENTS 1. This assessment consists of Eight (8) questions and comprises

More information

IS 2610: Data Structures

IS 2610: Data Structures IS 2610: Data Structures Graph April 12, 2004 Graph Weighted graph call it networks Shortest path between nodes s and t in a network Directed simple path from s to t with the property that no other such

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

A An Overview of Complexity Theory for the Algorithm Designer

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

More information

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