COMPUTER SCIENCE. Computer Science. 16. Intractability. Computer Science. An Interdisciplinary Approach. Section 7.4.

Size: px
Start display at page:

Download "COMPUTER SCIENCE. Computer Science. 16. Intractability. Computer Science. An Interdisciplinary Approach. Section 7.4."

Transcription

1 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y Computer Science Computer Science An Interdisciplinary Approach Section 7.4 ROBERT SEDGEWICK K E V I N WAY N E Intractability

2 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PART II: ALGORITHMS, MACHINES, and THEORY 16. Intractability Reasonable questions P and NP Poly-time reductions NP-completeness Living with intractability CS.16.A.Intractability.Questions

3 Context Fundamental questions What is a general-purpose computer? Are there limits on what we can do with digital computers? Are there limits on what we can do with the machines we can build? focus of today's lecture Kurt Gödel John Nash Michael Rabin Dana Scott Dick Karp Steve Cook Leonid Levin Asked the question in a "lost letter" to von Neumann Asked the question in a "lost letter" to the NSA Introduced the critical concept of nondeterminism Asked THE question Answer still unknown 3

4 A difficult problem Traveling salesperson problem (TSP) Given: A set of N cities, distances between each pair of cities, and a threshold M. Problem: Is there a tour through all the cities of length less than M? Exhaustive search. Try all N! orderings of the cities to look for a tour of length less than M. 4

5 How difficult can it be? Excerpts from a recent blog... If one took the 100 largest cities in the US and wanted to travel them all, what is the distance of the shortest route? I'm sure there's a simple answer. Anyone wanna help? A quick google revealed nothing. I don't think there's any substitute for doing it manually. Google the cities, then pull out your map and get to work. It shouldn't take longer than an hour. Edit: I didn't realize this was a standardized problem. Writing a program to solve the problem would take 5 or 10 minutes for an average programmer. However, the amount of time the program would need to run is, well, a LONG LONG LONG time. My Garmin could probably solve this for you. Edit: probably not. Someone needs to write a distributed computing program to solve this IMO. 5

6 How difficult can it be? Imagine an UBERcomputer (a giant computing device) With as many processors as electrons in the universe Each processor having the power of today's supercomputers Each processor working for the lifetime of the universe quantity value (conservative estimate) electrons in universe 1079 supercomputer instructions per second 1013 age of universe in seconds 1017 Q. Could the UBERcomputer solve the TSP for 100 cities with the brute force algorithm? A. Not even close. 100! > >> = Would need 1048 UBERcomputers Lesson. Exponential growth dwarfs technological change. 6

7 Reasonable questions about algorithms Q. Which algorithms are useful in practice? Model of computation Running time: Number of steps as a function of input size N. Poly-time: Running time less than an b for some constants a and b. Definitely not poly-time: Running time ~c N for any constant c >1. Specific computer generally not relevant (simulation uses only a polynomial factor). "Extended Church-Turing thesis" (stay tuned) Def (in the context of this lecture). An algorithm is efficient if it is poly-time for all inputs. outside this lecture: "guaranteed polynomial time" or just "poly-time" Q. Can we find efficient algorithms for the practical problems that we face? 7

8 Reasonable questions about problems Q. Which problems can we solve in practice? A. Those for which we know efficient (guaranteed poly-time) algorithms. Definition. A problem is intractable if no efficient algorithm exists to solve it. Q. Is there an easy way to tell whether a problem is intractable? A. Good question! Focus of today's lecture. Existence of a faster algorithm like mergesort is not relevant to this discussion Example 1: Sorting. Not intractable. (Insertion sort takes time proportional to N 2.) Example 2: TSP.??? (No efficient algorithm known, but no proof that none exists.) 8

9 Four fundamental problems LSOLVE Solve simultaneous linear equations. Variables are real numbers. Example of an instance x1 + x2 = 1 2x0 + 4x1 2x2 = 0.5 3x1 + 15x2 = 9 A solution x0 =.25 x1 =.5 x2 =.5 LP Solve simultaneous linear inequalities. Variables are real numbers. 48x0 + 16x x2 88 5x0 + 4x1 + 35x x0 4x1 + 20x2 23 x0, x1, x2 0 x0 = 1 x1 = 1 x2 = 0.2 ILP Solve simultaneous linear inequalities. Variables are 0 or 1. x1 + x2 1 x0 + x2 1 x0 + x1 + x2 2 x0 = 0 x1 = 1 x2 = 1 SAT Solve simultaneous boolean sums. Variables are true or false. x1 x2 = true x0 x1 x2 = true x1 x2 = true x0 x1 x2 = false = true = true 9

10 Reasonable questions LSOLVE, LP, ILP, and SAT are all important problemsolving models with countless practical applications. Q. Do we have efficient algorithms for solving them? A. Difficult to discern, despite similarities (!)?? LSOLVE. Yes. LP. Yes. appropriate version of Gaussian elimination Ellipsoid algorithm (tour de force solution) IP. No polynomial-time algorithm known. SAT. No polynomial-time algorithm known. Q. Can we find efficient algorithms for IP and SAT? LSOLVE Solve simultaneous linear equations. Variables are real numbers. LP Solve simultaneous linear inequalities. Variables are real numbers. ILP Solve simultaneous linear inequalities. Variables are 0 or 1. SAT Solve simultaneous boolean sums. Variables are true or false. Q. Can we prove that no such algorithms exist? 10

11 Intractability Definition. An algorithm is efficient if it is poly-time for all inputs. Definition. A problem is intractable if no efficient algorithm exists to solve it. Definition. A problem is tractable if it solvable by an efficient algorithm. Turing taught us something fundamental about computation by Identifying a problem that we might want to solve. Showing that it is not possible to solve it. A reasonable question: Can we do something similar for intractability? decidable : undecidable :: tractable : intractable Q. We do not know efficient algorithms for a large class of important problems. Can we prove one of them to be intractable? 11

12 Another profound connection to the real world Extended Church-Turing thesis. Resources used by all reasonable machines are within a polynomial factor of one another. Remarks A thesis, not a theorem. Not subject to proof. Is subject to falsification. New model of computation or new physical process? Use simulation to prove polynomial bound. Example: TOY simulator in Java (see TOY lectures). Example: Java compiler in TOY. Implications Validates exponential/polynomial divide. Enables rigorous study of efficiency. = NO HALT = YES

13 COMPUTER SCIENCE S E D G E W I C K / W A Y N E Image sources CS.16.A.Intractability.Questions

14 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PART II: ALGORITHMS, MACHINES, and THEORY 16. Intractability Reasonable questions P and NP Poly-time reductions NP-completeness Living with intractability CS.16.B.Intractability.PandNP

15 Search problems Search problem. Any problem for which an efficient algorithm exists to certify solutions. Example: TSP. Problem instance: Set of cities, pairwise distances, and threshold M. Certify solution by adding distances and checking that the total is less than M Solution: Permutation of the cities. 15

16 NP Definition. NP is the class of all search problems. problem description instance I solution S algorithm TSP ( S, M ) Find a tour of cities in S of length < M Add up distances and check that the total is less than M ILP ( A, b ) Find a binary vector x that satisfies Ax b plug in values and check each equation SAT ( A, b ) Find a boolean vector x that satisfies Ax = b plug in values and check each equation FACTOR ( M ) Find a nontrivial factor of the integer M long division Significance. Problems that scientists, engineers, and applications programmers aspire to solve. 16

17 Brute force search Brute-force search. Given a search problem, find a solution by checking all possibilities. problem description N (size) number of possibilities TSP ( S, M ) Find a tour of cities in S of length < M number of cities N! ILP ( A, b ) Find a binary vector x that satisfies Ax b number of variables 2 N SAT ( Φ, b ) Find a boolean vector x that satisfies Ax = b number of variables 2 N FACTOR ( x ) Find a nontrivial factor of the integer M number of digits in M 10 N Challenge. Brute-force search is easy to implement, but not efficient. 17

18 P Definition. P is the class of all tractable search problems. solvable by an efficient (guaranteed poly-time) algorithm problem description efficient algorithm SORT ( S ) Find a permutation that puts the items in S in order Insertion sort, Mergesort 3-SUM ( S ) Find a triple in S that sums to 0 Triple loop LSOLVE ( A, b ) Find a vector x that satisfies Ax = b Gaussian elimination* LP ( A, b ) Find a vector x that satisfies Ax b Ellipsoid Significance. Problems that scientists, engineers and applications programmers do solve. Note. All of these problems are also in NP. 18

19 Types of problems Search problem. Find a solution. Decision problem. Does there exist a solution? Optimization problem. Find the best solution. Some problems are more naturally formulated in one regime than another. Example: TSP is usually formulated as an optimization problem. "Find the shortest tour connecting all the cities." The regimes are not technically equivalent, but conclusions that we draw apply to all three. Note. Classic definitions of P and NP are in terms of decision problems. 19

20 The central question NP. Class of all search problems, some of which seem solvable only by brute force. P. Class of search problems solvable in poly-time. The question: Is P = NP? P NP Intractable search problems exist. Brute force search may be the best we can do for some problems. P = NP All search problems are tractable. Efficient algorithms exist for IP, SAT, FACTOR... all problems in NP. NP P Intractable problems P = NP Frustrating situation. Researchers believe that P NP but no one has been able to prove it (!!) 20

21 Nondeterminism: another way to view the situation A nondeterministic machine can choose among multiple options at each step and can guess the option that leads to the solution. Example: Java. either x[0] = 0; or x[0] = 1; either x[1] = 0; or x[1] = 1; either x[2] = 0; or x[2] = 1; Seems like a fantasy, but... solves ILP Example: Turing two choices 0:0 L #:1 0:1 P NP P = NP Intractable search problems exist. Nondeterministic machines would admit efficient algorithms. No intractable search problems exist. Nondeterministic machines would be of no help! Frustrating situation. No one has been able to prove that nondeterminism would help (!!) 21

22 Creativity: another way to view the situation Creative genius versus ordinary appreciation of creativity. Examples Mozart composes a piece of music; the audience appreciates it. Wiles proves a deep theorem; a colleague checks it. Boeing designs an efficient airfoil; a simulator verifies it. Einstein proposes a theory; an experimentalist validates it. Creative genius Computational analog. P vs NP. Ordinary appreciation Frustrating situation. No one has been able to prove that creating a solution to a problem is more difficult than checking that it is correct. 22

23 COMPUTER SCIENCE S E D G E W I C K / W A Y N E Image sources CS.16.B.Intractability.PandNP

24 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PART II: ALGORITHMS, MACHINES, and THEORY 19. Intractability Reasonable questions P and NP Poly-time reductions NP-completeness Living with intractability CS.16.C.Intractability.Reductions

25 Classifying problems Q. Which problems are in P? A. The ones that we're solving with efficient algorithms. Q. Which problems are intractable (in NP but not in P)? A. Difficult to know (no one has found even one such problem). Can I solve it on my cellphone or do I need UBERcomputers?? Possible starting point: Assume that SAT is intractable (and hence P NP) Brute-force algorithm finds solution for any SAT instance. No known efficient algorithm does so. A reasonable assumption. Next. Proving relationships among problems. Q. If P NP and SAT is intractable, which other problems are intractable? 25

26 Poly-time reduction Definition. Problem X poly-time reduces to problem Y if you can use an efficient solution to Y to develop an efficient solution to X. X Y Typical reduction: Given an efficient solution to Y, solve X by Using an efficient method to transform the instance of X to an instance of Y. Calling the efficient method that solves Y. Using an efficient method to transform the solution of Y to an solution of X. Similar to using a library method in modular programming. Method for solving X Method for solving Y instance of X Transform input instance of Y solution of Y Transform result solution of X Note. Many ways to extend. (Example: Use a polynomial number of instances of Y.) 26

27 Key point: poly-time reduction is transitive If X poly-time reduces to Y and Y poly-time reduces to Z, then X poly-time reduces to Z. If X Y and Y Z then X Z Method for solving X Method for solving Y instance of X Transform input instance of Y solution of Y Transform result solution of X Method for solving Y Method for solving Z instance of Y Transform input instance of Z solution of Z Transform result solution of Y 27

28 Two ways to exploit reduction Method for solving X Method for solving Y instance of X Transform input instance of Y instance of Y Transform result solution to X To design an algorithm to solve a new problem X Find a problem Y with a known efficient algorithm that solves it. Poly-time reduce X to Y. The efficient algorithm for Y gives an efficient algorithm for X. Not emphasized in this lecture. Interested in details? Take a course in algorithms. To establish intractability of a new problem Y (assuming SAT is intractable) Find a problem X with a known poly-time reduction from SAT. Poly-time reduce X to Y. An efficient algorithm for Y would imply an efficient algorithm for X (and SAT). Critical tool for this lecture. Easiest option: Just reduce SAT to Y (next) 28

29 Example: SAT poly-time reduces to ILP SAT Solve simultaneous boolean sums. Variables are true or false ILP Solve simultaneous linear inequalities. Variables are 0 or 1. x0 x1 x2 = true x0 x1 x2 = true x0 x1 x2 = true x0 x1 x3 = true An instance of SAT x0 x1 x2 x3 = false = true = true = false A solution (1 t0) + t1 + t2 1 t0 + (1 t1) + t2 1 (1 t0) + (1 t1) + (1 t2) 1 (1 t0) + (1 t1) + t3 1 ti = 0 iff xi = false ti = 1 iff xi = true Poly-time reduction to an instance of ILP t0 = 0 t1 = 1 t2 = 1 t3 = 0 A solution Implication. If SAT is intractable, so is ILP. 29

30 More poly-time reductions from SAT SAT 3-COLOR ILP VERTEX COVER EXACT COVER CLIQUE HAMILTON CYCLE Dick Karp 1985 Turing Award SUBSET SUM INDEPENDENT SET TSP PARTITION KNAPSACK BIN PACKING Reasonable assumption. SAT is intractable. Implication. All of these problems are intractable. 30

31 Still more poly-time reductions from SAT field of study typical problem known to be intractable if SAT is intractable Aerospace engineering Optimal mesh partitioning for finite elements Biology Phylogeny reconstruction Chemical engineering Heat exchanger network synthesis Chemistry Protein folding Civil engineering Equilibrium of urban traffic flow Economics Computation of arbitrage in financial markets with friction Electrical engineering VLSI layout Environmental engineering Optimal placement of contaminant sensors Financial engineering Minimum risk portfolio of given return Game theory Nash equilibrium that maximizes social welfare Mechanical engineering Structure of turbulence in sheared flows Medicine Reconstructing 3d shape from biplane angiocardiogram Operations research Traveling salesperson problem, integer programming Physics Partition function of 3d Ising model Politics Shapley-Shubik voting power Pop culture Versions of Sudoko, Checkers, Minesweeper, Tetris Statistics Optimal experimental design 6,000+ scientific papers per year. Reasonable assumption. SAT is intractable. Implication. All of these problems are intractable. 31

32 CS.16.C.Intractability.Reductions COMPUTER SCIENCE S E D G E W I C K / W A Y N E

33 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PART II: ALGORITHMS, MACHINES, and THEORY 19. Intractability Reasonable questions P and NP Poly-time reductions NP-completeness Living with intractability CS.16.D.Intractability.NPcomplete

34 NP-completeness Definition. An NP problem is NP-complete if all problems in NP poly-time reduce to it. Theorem (Cook; Levin, 1971). SAT is NP-complete. Extremely brief proof sketch Convert non-deterministic TM notation to SAT notation. An efficient solution to SAT gives an efficient solution to any problem in NP. Nondeterministic Turing machine SAT instance Corollary. SAT is tractable if and only if P = NP. Equivalent. Assuming that SAT is intractable is the same as assuming that P NP. 34

35 Cook-Levin theorem SAT 3-COLOR ILP VERTEX COVER EXACT COVER CLIQUE HAMILTON CYCLE Steve Cook 1982 Turing Award Leonid Levin SUBSET SUM INDEPENDENT SET TSP PARTITION KNAPSACK BIN PACKING All problems in NP poly-time reduce to SAT. 35

36 Karp + Cook-Levin SAT 3-COLOR ILP VERTEX COVER Steve Cook Leonid Levin Dick Karp EXACT COVER CLIQUE HAMILTON CYCLE SUBSET SUM INDEPENDENT SET TSP PARTITION All of these problems are NP-complete. KNAPSACK BIN PACKING A provably efficient algorithm for any one of them would yield a provably efficient algorithm for all of them 36

37 Two possible universes P NP Intractable search problems exist. Nondeterminism would help. Computing an answer is more difficult than correctly guessing it. Can prove a problem to be intractable by poly-time reduction from an NP-complete problem. P = NP No intractable search problems exist. Nondeterminism is no help. Finding an answer is just as easy as correctly guessing an answer. Guaranteed poly-time algorithms exist for all problems in NP. NP P NP-complete P = NP = NPC Frustrating situation. No progress on resolving the question despite 40+ years of research. 37

38 Summary NP. Class of all search problems, some of which seem solvable only by brute force. P. Class of search problems solvable in poly-time. NP-complete. "Hardest" problems in NP. Intractable. Search problems not in P (if P NP). TSP, SAT, ILP, and thousands of other problems are NP-complete. Use theory as a guide An efficient algorithm for an NP-complete problem would be a stunning scientific breakthrough (a proof that P = NP) You will confront NP-complete problems in your career. It is safe to assume that P NP and that such problems are intractable. Identify these situations and proceed accordingly. 38

39 Princeton CS building, west wall 39

40 Princeton CS building, west wall (closeup) char ASCII binary P = N P ?

41 CS.16.D.Intractability.NPcomplete COMPUTER SCIENCE S E D G E W I C K / W A Y N E

42 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PART II: ALGORITHMS, MACHINES, and THEORY 16. Intractability Reasonable questions P and NP Poly-time reductions NP-completeness Living with intractability CS.16.E.Intractability.Living

43 Living with intractability When you encounter an NP-complete problem It is safe to assume that it is intractable. What to do? Four successful approaches Don't try to solve intractable problems. Try to solve real-world problem instances. Look for approximate solutions (not discussed in this lecture). Exploit intractability. 43

44 Living with intractability: Don't try to solve intractable problems Knows no theory I can't find an efficient algorithm. I guess I'm just to dumb. Knows computability Knows intractability I can't find an efficient algorithm, because no such algorithm is possible! I can't find an efficient algorithm, but neither can all these famous people! 44

45 Understanding intractability: An example from statistical physics 1926: Ising introduces a mathematical model for ferromagnetism. 1930s: Closed form solution is a holy grail of statistical mechanics. 1944: Onsager finds closed form solution to 2D version in tour de force. 1950s: Feynman and others seek closed form solution to 3D version. 2000: Istrail shows that 3D-ISING is NP-complete. Bottom line. Search for a closed formula seems futile. 45

46 Living with intractability: look for solutions to real-world problem instances Observations Worst-case inputs may not occur for practical problems. Instances that do occur in practice may be easier to solve. Reasonable approach: relax the condition of guaranteed poly-time algorithms. SAT Chaff solves real-world instances with 10,000+ variables. Princeton senior independent work (!) in TSP solution for 13,509 US cities TSP Concorde routinely solves large real-world instances. 85,900-city instance solved in ILP CPLEX routinely solves large real-world instances. Routinely used in scientific and commercial applications. 46

47 Exploiting intractability: RSA cryptosystem Modern cryptography applications Electronic banking. Credit card transactions with online merchants. Secure communications. [very long list] Ron Rivest Adi Shamir Len Adelman RSA cryptosystem exploits intractability To use: Multiply/divide two N-digit integers (easy). To break: Factor a 2N-digit integer (intractable?). Multiply (easy) * Factor (difficult) 47

48 Exploiting intractability: RSA cryptosystem RSA cryptosystem exploits intractability To use: Multiply/divide two N-digit integers (easy). To break: Solve FACTOR for a 2N-digit integer (difficult). Example: Factor this 212-digit integer Q. Would an efficient algorithm for FACTOR prove that P = NP? A. Unknown. It is in NP, but no reduction from SAT is known. equivalent statement: "FACTOR is not known to be NP-complete" Q. Is it safe to assume that FACTOR is intractable? A. Maybe, but not as safe an assumption as for an NP-complete problem. 48

49 Fame and fortune through intractability Factor this 212-digit integer $30,000 prize claimed in July, 2012 Create an e-commerce company based on the difficulty of factoring RSA sold to EMC for $2.1 billion in 2006 Resolve P vs. NP $1 million prize unclaimed since 2000 probably another $1 million for Turing award plus untold riches for breaking e-commerce if P=NP or... sell T-shirts 49

50 A final thought Example: Factor this 212-digit integer Q. Would an efficient algorithm for FACTOR prove that P = NP? A. Unknown. It is in NP, but no reduction from SAT is known. Q. Is it safe to assume that FACTOR is intractable? A. Maybe, but not as safe an assumption as for an NP-complete problem. Q. What else might go wrong? Theorem (Shor, 1994). An N-bit integer can be factored in N 3 steps on a quantum computer. Q. Do we still believe in the Extended Church-Turing thesis? Resources used by all reasonable machines are within a polynomial factor of one another. A. Whether we do or not, intractability demands understanding. 50

51 COMPUTER SCIENCE S E D G E W I C K / W A Y N E Image sources CS.16.E.Intractability.Living

52 COMPUTER SCIENCE S E D G E W I C K / W A Y N E PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y Computer Science Computer Science An Interdisciplinary Approach Section 7.4 ROBERT SEDGEWICK K E V I N WAY N E Intractability

Computer Science. 16. Intractability. 16. Intractability. Computer Science. Reasonable questions. P and NP Poly-time reductions NP-completeness

Computer Science. 16. Intractability. 16. Intractability. Computer Science. Reasonable questions. P and NP Poly-time reductions NP-completeness PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y Computer Science 6. Intractability Computer Science Reasonable

More information

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities?

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? Intractability A difficult problem Traveling salesperson problem (TSP) Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? An algorithm

More information

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP)

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP) A difficult problem Intractability A Reasonable Question about Algorithms Q. Which algorithms are useful in practice? A. [von Neumann 1953, Gödel 1956, Cobham 1964, Edmonds 1965, Rabin 1966] Model of computation

More information

7.8 Intractability. Overview. Properties of Algorithms. Exponential Growth. Q. What is an algorithm? A. Definition formalized using Turing machines.

7.8 Intractability. Overview. Properties of Algorithms. Exponential Growth. Q. What is an algorithm? A. Definition formalized using Turing machines. Overview 7.8 Intractability Q. What is an algorithm? A. Definition formalized using Turing machines. Q. Which problems can be solved on a computer? A. Computability. Q. Which algorithms will be useful

More information

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine. Overview 10.3: Intractability What is an algorithm? Turing machine. What problems can be solved on a computer? Computability. What ALGORITHMS will be useful in practice? Analysis of algorithms. Which PROBLEMS

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

7.8: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

7.8: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine. Overview 7.8: Intractability What is an algorithm? Turing machine. Which problems can be solved on a computer? Computability. Which ALGORITHMS will be useful in practice? Analysis of algorithms. Which

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

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P Efficient Certification and completeness There is a big difference between FINDING a solution and CHECKING a solution Independent set problem: in graph G, is there an independent set S of size at least

More information

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES Decision Problems NP and NP completeness Identify a decision problem with a set of binary strings X Instance: string s. Algorithm A solves problem X: As) = yes iff s X. Polynomial time. Algorithm A runs

More information

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

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

More information

3/22/2018. CS 580: Algorithm Design and Analysis. Circuit Satisfiability. Recap. The "First" NP-Complete Problem. Example.

3/22/2018. CS 580: Algorithm Design and Analysis. Circuit Satisfiability. Recap. The First NP-Complete Problem. Example. Circuit Satisfiability CS 580: Algorithm Design and Analysis CIRCUIT-SAT. Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output

More information

CS 580: Algorithm Design and Analysis

CS 580: Algorithm Design and Analysis CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Homework 5 due on March 29 th at 11:59 PM (on Blackboard) Recap Polynomial Time Reductions (X P Y ) P Decision problems

More information

3/22/2018. CS 580: Algorithm Design and Analysis. 8.3 Definition of NP. Chapter 8. NP and Computational Intractability. Decision Problems.

3/22/2018. CS 580: Algorithm Design and Analysis. 8.3 Definition of NP. Chapter 8. NP and Computational Intractability. Decision Problems. CS 580: Algorithm Design and Analysis 8.3 Definition of NP Jeremiah Blocki Purdue University Spring 208 Recap Decision Problems Polynomial Time Reductions (X P Y ) Key Problems Independent Set, Vertex

More information

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Recap Polynomial Time Reductions (X P Y ) Key Problems Independent Set, Vertex Cover, Set Cover, 3-SAT etc Example Reductions

More information

Announcements. Analysis of Algorithms

Announcements. Analysis of Algorithms Announcements Analysis of Algorithms Piyush Kumar (Lecture 9: NP Completeness) Welcome to COP 4531 Based on Kevin Wayne s slides Programming Assignment due: April 25 th Submission: email your project.tar.gz

More information

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Recap Polynomial Time Reductions (X P Y ) View 1: A polynomial time algorithm for Y yields a polynomial time algorithm

More information

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

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

More information

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

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

SAT, NP, NP-Completeness

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

More information

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harry Lewis November 19, 2013 Reading: Sipser 7.4, 7.5. For culture : Computers and Intractability: A Guide to the Theory

More information

INTRACTABILITY BBM ALGORITHMS TODAY DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. May. 14, A simple model of computation: DFAs

INTRACTABILITY BBM ALGORITHMS TODAY DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. May. 14, A simple model of computation: DFAs BBM 202 - ALGORITHMS TODAY DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM Intractability Search problems P vs. NP Classifying problems NP-completeness INTRACTABILITY May. 14, 2015 Acknowledgement:.The$course$slides$are$adapted$from$the$slides$prepared$by$R.$Sedgewick$

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

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

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

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

More information

CS 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

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

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

More information

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

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

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

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

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

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

More information

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

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

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 6.5 REDUCTIONS. designing algorithms establishing lower bounds classifying problems intractability

Algorithms 6.5 REDUCTIONS. designing algorithms establishing lower bounds classifying problems intractability 6.5 REDUCTIONS Algorithms F O U R T H E D I T I O N designing algorithms establishing lower bounds classifying problems intractability R O B E R T S E D G E W I C K K E V I N W A Y N E Algorithms, 4 th

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

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

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

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

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

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

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

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

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

NP Complete Problems. COMP 215 Lecture 20

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

More information

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

Approximation and Randomized Algorithms (ARA) Lecture 2, September 1, 2010

Approximation and Randomized Algorithms (ARA) Lecture 2, September 1, 2010 Approximation and Randomized Algorithms (ARA) Lecture 2, September 1, 2010 Last time Algorithm Revision Algorithms for the stable matching problem Five illustrative algorithm problems Computatibility Today

More information

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

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

More information

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples Lecture 23 Computational Complexity 6.006 Fall 2011 Lecture 23: Computational Complexity Lecture Overview P, EXP, R Most problems are uncomputable NP Hardness & completeness Reductions Definitions: P =

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 7 Define NP-completeness Give examples of NP-complete problems Use polynomial-time

More information

Lecture 24: How to become Famous with P and NP

Lecture 24: How to become Famous with P and NP Lecture 4: How to become Famous with P and NP Agenda for today s class: The complexity class P The complexity class NP NP-completeness The P =? NP problem Major extra-credit problem (due: whenever) Fun

More information

Analysis of Algorithms. Unit 5 - Intractable Problems

Analysis of Algorithms. Unit 5 - Intractable Problems Analysis of Algorithms Unit 5 - Intractable Problems 1 Intractable Problems Tractable Problems vs. Intractable Problems Polynomial Problems NP Problems NP Complete and NP Hard Problems 2 In this unit we

More information

Problems and Solutions. Decidability and Complexity

Problems and Solutions. Decidability and Complexity Problems and Solutions Decidability and Complexity Algorithm Muhammad bin-musa Al Khwarismi (780-850) 825 AD System of numbers Algorithm or Algorizm On Calculations with Hindu (sci Arabic) Numbers (Latin

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

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

Computational Complexity

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

More information

Intro to Theory of Computation

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

More information

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

Problem Complexity Classes

Problem Complexity Classes Problem Complexity Classes P, NP, NP-Completeness and Complexity of Approximation Joshua Knowles School of Computer Science The University of Manchester COMP60342 - Week 2 2.15, March 20th 2015 In This

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

Computer Science. Questions for discussion Part II. Computer Science COMPUTER SCIENCE. Section 4.2.

Computer Science. Questions for discussion Part II. Computer Science COMPUTER SCIENCE. Section 4.2. COMPUTER SCIENCE S E D G E W I C K / W A Y N E PA R T I I : A L G O R I T H M S, T H E O R Y, A N D M A C H I N E S Computer Science Computer Science An Interdisciplinary Approach Section 4.2 ROBERT SEDGEWICK

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

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

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

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011 The P-vs-NP problem Andrés E. Caicedo September 10, 2011 This note is based on lecture notes for the Caltech course Math 6c, prepared with A. Kechris and M. Shulman. 1 Decision problems Consider a finite

More information

1 Computational problems

1 Computational problems 80240233: Computational Complexity Lecture 1 ITCS, Tsinghua Univesity, Fall 2007 9 October 2007 Instructor: Andrej Bogdanov Notes by: Andrej Bogdanov The aim of computational complexity theory is to study

More information

Lecture 5: Computational Complexity

Lecture 5: Computational Complexity Lecture 5: Computational Complexity (3 units) Outline Computational complexity Decision problem, Classes N P and P. Polynomial reduction and Class N PC P = N P or P = N P? 1 / 22 The Goal of Computational

More information

Turing Machines and Time Complexity

Turing Machines and Time Complexity Turing Machines and Time Complexity Turing Machines Turing Machines (Infinitely long) Tape of 1 s and 0 s Turing Machines (Infinitely long) Tape of 1 s and 0 s Able to read and write the tape, and move

More information

Lecture 19: Finish NP-Completeness, conp and Friends

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

More information

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

Principles of Computing, Carnegie Mellon University. The Limits of Computing

Principles of Computing, Carnegie Mellon University. The Limits of Computing The Limits of Computing Intractability Limits of Computing Announcement Final Exam is on Friday 9:00am 10:20am Part 1 4:30pm 6:10pm Part 2 If you did not fill in the course evaluations please do it today.

More information

Σ w j. Σ v i KNAPSACK. for i = 1, 2,..., n. and an positive integers K and W. Does there exist a subset S of {1, 2,..., n} such that: and w i

Σ w j. Σ v i KNAPSACK. for i = 1, 2,..., n. and an positive integers K and W. Does there exist a subset S of {1, 2,..., n} such that: and w i KNAPSACK Given positive integers v i and w i for i = 1, 2,..., n. and an positive integers K and W. Does there exist a subset S of {1, 2,..., n} such that: Σ w j W i S and Σ v i K i S A special case: SUBSET

More information

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

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems COSE215: Theory of Computation Lecture 21 P, NP, and NP-Complete Problems Hakjoo Oh 2017 Spring Hakjoo Oh COSE215 2017 Spring, Lecture 21 June 11, 2017 1 / 11 Contents 1 The classes P and N P Reductions

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

Computational Complexity

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

More information

What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein

What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein Combination lock Why is it secure? (Assume it cannot be

More information

6-1 Computational Complexity

6-1 Computational Complexity 6-1 Computational Complexity 6. Computational Complexity Computational models Turing Machines Time complexity Non-determinism, witnesses, and short proofs. Complexity classes: P, NP, conp Polynomial-time

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

NP completeness and computational tractability Part II

NP completeness and computational tractability Part II Grand challenge: Classify Problems According to Computational Requirements NP completeness and computational tractability Part II Some Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All

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

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

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

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

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

More information

CSC 1700 Analysis of Algorithms: P and NP Problems

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

More information

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

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

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

Limits of Computation. Antonina Kolokolova

Limits of Computation. Antonina Kolokolova Limits of Computation Antonina Kolokolova What is computation? What is information? What is learning? Are there any limits of our ability to solve problems? Theoretical Computer Science Is there a perfect

More information

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity 15-251 Great Theoretical Ideas in Computer Science Lecture 7: Introduction to Computational Complexity September 20th, 2016 What have we done so far? What will we do next? What have we done so far? > Introduction

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

CS 6901 (Applied Algorithms) Lecture 3

CS 6901 (Applied Algorithms) Lecture 3 CS 6901 (Applied Algorithms) Lecture 3 Antonina Kolokolova September 16, 2014 1 Representative problems: brief overview In this lecture we will look at several problems which, although look somewhat similar

More information

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 8.5 Sequencing Problems Basic genres.! Packing problems: SET-PACKING,

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

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