1 The Limits of Computation Intractable and Non-computable functions.

Slides:



Advertisements
Similar presentations
Algorithm Analysis.
Advertisements

Analysis of Algorithms
P, NP, NP-Complete Problems
NP-Complete Problems CIT 596, Spring Problems that Cross the Line What if a problem has: o An exponential upper bound o A polynomial lower bound.
Lecture # 38 Algorithms & Problem Solving: How Hard Can it Get?
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
Copyright © Cengage Learning. All rights reserved.
The Theory of NP-Completeness
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Tractable and intractable problems for parallel computers
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 21 Instructor: Paul Beame.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 19 Instructor: Paul Beame.
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
NP and NP- Completeness Bryan Pearsaul. Outline Decision and Optimization Problems Decision and Optimization Problems P and NP P and NP Polynomial-Time.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
1 CSC 421: Algorithm Design & Analysis Spring 2013 Complexity & Computability  lower bounds on problems brute force, decision trees, adversary arguments,
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Problems you shouldn’t tackle. Problem Complexity.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
CSC 413/513: Intro to Algorithms NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Halting Problem Introduction to Computing Science and Programming I.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
Halting Problem and TSP Wednesday, Week 8. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
Lecture # 39 What Can’t Be Computed?. Computability Tractable problems (P): Can be solved by a a computer is some deterministic (reasonable) polynomial.
Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Fundamentals of Informatics Lecture 13 Reduction Bas Luttik.
CompSci On the Limits of Computing  Reasons for Failure 1. Runs too long o Real time requirements o Predicting yesterday's weather 2. Non-computable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples:
1 Computability Tractable, Intractable and Non-computable functions.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 23: Intractable Problems (Smiley Puzzles.
1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
NP-Complete Problems.
1.5 Intractable problems.
How Hard Can It Be?.
Halting Problem.
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Presentation transcript:

1 The Limits of Computation Intractable and Non-computable functions

2 Decision Problems A specific set of computations are classified as decision problems. An algorithm describes a decision problem if its output is simply YES or NO, depending on whether a certain property holds for its input. Example: Given a set of n shapes, can these shapes be arranged into a rectangle?

3 Monkey Puzzle Problem Given: A set of n square cards whose sides are imprinted with the upper and lower halves of colored monkeys. n is a square number, such that n = m 2. Cards cannot be rotated. Problem: Determine if an arrangement of the n cards in an m X m grid exists such that each adjacent pair of cards display the upper and lower half of a monkey of the same color. Source: (2002)

4 Example Images from: Simonas Šaltenis, Aalborg University,

5 Analysis Simple algorithm: Pick one card for each cell of m X m grid. Verify if each pair of touching edges make a full monkey of the same color. If not, try another arrangement until a solution is found or all possible arrangements are checked. Answer "YES" if a solution is found. Otherwise, answer "NO" if all arrangements are analyzed and no solution is found.

6 Analysis If there are n = 9 cards (m = 3): To fill the first cell, we have 9 card choices. To fill the second cell, we have 8 card choices left. To fill the third cell, we have 7 card choices remaining. etc. The total number of unique arrangements for n = 9 cards is: 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 362,880

7 Analysis For n cards, the number of arrangements to examine is n! (n factorial) If we can analyze one arrangement in a microsecond: nTime to analyze all arrangements  s = s  s  s

8 Map Coloring Given a map of n territories, can the map be colored using k colors such that no two adjacent territories are colored with the same color? k=4: Answer is always yes. k=2: Only if the map contains no point that is the junction of an odd number of territories.

9 Map Coloring

10 Map Coloring Given a map of 48 territories, can the map be colored using 3 colors such that no two adjacent territories are colored with the same color? Pick a color for California (3 choices) Pick a color for Nevada (3 choices)... There are 3 48 = possible colorings (not necessarily valid). No one has come up with a better algorithmic solution that works in general for any map, so far.

11 Classifications Algorithms that are O(n k ) for some fixed k are polynomial-time algorithms. O(1), O(log n), O(n), O(n log n), O(n 2 ) reasonable, tractable All other algorithms are super-polynomial-time algorithms. O(2 n ), O(n!), O(n n ) unreasonable, intractable

12 Traveling Salesperson Given: a weighted graph of nodes representing cities and edges representing flight paths (weights represent cost) Is there a route that takes the salesperson through every city and back to the starting city with cost no more than k? The salesperson can visit a city only once (except for the start and end of the trip).

13 Traveling Salesperson A B D C G E F Is there a route with cost at most 52?YES (Route above costs 50.) Is there a route with cost at most 48?YES? NO?

14 Traveling Salesperson If there are n cities, what is the maximum number of routes that we might need to compute? Worst-case: There is a flight available between every pair of cities. Compute cost of every possible route. Pick a starting city Pick the next city (n-1 choices remaining) Pick the next city (n-2 choices remaining)... Maximum number of routes: (n-1)! = O(n!) how to build a route

15 P and NP The class P consists of all those decision problems that can be solved on a deterministic sequential machine (e.g. a computer) in an amount of time that is polynomial with respect to the size of the input The class NP consists of all those decision problems whose positive solutions can be verified in polynomial time given the right information. from Wikipedia

16 NP Complete The class NPC consists of all those problems in NP that are least likely to be in P. Each of these problems is called NP Complete. Monkey puzzle, Traveling salesperson, and map coloring are all in NPC. Every problem in NPC can be transformed to another problem in NPC. If there were some way to solve one of these problems in polynomial time, we should be able to solve all of these problems in polynomial time.

17 Complexity Classes NP Problems P Problems NP Complete Problems But does P = NP? If P ≠ NP, then all decision problems can be broken down into this classification scheme. If P = NP, then all three classes are one and the same. The Clay Mathematics Institute is offering a $1M prize for the first person to prove P = NP or P ≠ NP. ( We know that P < NP, since any problem that can be solved in polynomial time can certainly have a solution verified in polynomial time.

18

19 It gets worse... Tractable Problems Problems that have reasonable, polynomial- time solutions Intractable Problems Problems that may have no reasonable, polynomial-time solutions Noncomputable Problems Problems that have no algorithms at all to solve them

20 Noncomputability and Undecidability An algorithmic problem that has no algorithm is called noncomputable. If the noncomputable algorithm requires only a yes/no answer, the problem is called undecidable.

21 Noncomputability and Undecidability Example: Given any set of any number of different tile designs (examples shown above), with an infinite number of each type of tile, can we tile any area with these tiles without rotation so that like colored edges touch? This problem is undecidable!

22 Tiling Problem YES Note the periodicity in the tiling.

23 Tiling Problem NO For this 3 X 3 room, if we try all 3 9 tiling configurations, no tiling works.

24 Tiling Problem Possible algorithm: If we find a repeating pattern, report YES. If we find a floor we cannot tile, report NO. But this algorithm isn’t correct: there are some tilings which have no repeating pattern!

25 Tom’s Believe-It-Or-Not! If you take the same problem and allow tile rotations, you can ALWAYS tile any room regardless of the size. This problem is definitely computable!

26 Another Undecidable Problem: The Barber Paradox Suppose there is a town with one male barber; and that every man in the town keeps himself clean-shaven: some shave themselves and some are shaved by the barber. Only the barber can shave another man. The barber shaves all and only those men who do not shave themselves. Does the barber shave himself?

27 Program Termination Can we determine if a program will terminate given a valid input? Example: x = input (“Input a positive integer”) while x != 1: x = x - 2 Does this algorithm terminate when x = 15105? Does this algorithm terminate when x = 2008? Does this algorithm terminate for any positive x?

28 Program Termination Another Example: x = input (“Input a positive integer”) while x != 1: if x % 2 == 0: x = x / 2 else: x = 3 * x + 1 Does this algorithm terminate for x = 15? Does this algorithm terminate for x = 105? Does this algorithm terminate for any positive x?

29 The Halting Problem Suppose a program called the Terminator existed that could take ANY program and determine if it terminates or not. What happens if it tries to analyze this “evil” program P? Program P: Run the Terminator on program P (i.e. this program itself) and see what answer it gives. If the Terminator says YES (i.e. this program terminates): go into an infinite loop. Else: halt immediately.

30 The Halting Problem Can we write a general program Q that takes as its input any program P and an input I and determines if program P will terminate (halt) when run with input I? It will answer YES if P terminates successfully on input I. It will answer NO if P never terminates on input I. This computational problem is undecidable! No such general program Q can exist! It doesn’t matter how powerful the computer is. It doesn’t matter how much time we devote to the computation. The proof of this involves contradiction. Alan Turing

31 start end Does this algorithm end? yes no Contradiction

32 Contradiction isn't just for computer scientists...

33 The Big Ideas Many problems are Tractable Problems that have reasonable, polynomial-time solutions Some problems are Intractable Problems that have no reasonable, polynomial-time solutions NP Complete problems are those that are least likely to be tractable (but we haven’t proven or disproven this yet) Some problems are noncomputable Problems that have no algorithms at all to solve them in general