Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.

Slides:



Advertisements
Similar presentations
Turing Machines January 2003 Part 2:. 2 TM Recap We have seen how an abstract TM can be built to implement any computable algorithm TM has components:
Advertisements

Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Problems and Their Classes
Complexity Classes: P and NP
Time Complexity P vs NP.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
The Big Picture Chapter 3. We want to examine a given computational problem and see how difficult it is. Then we need to compare problems Problems appear.
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
1 The Limits of Computation Intractable and Non-computable functions.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
The Theory of NP-Completeness
Analysis of Algorithms CS 477/677
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Chapter 11: Limitations of Algorithmic Power
Turing Machines CS 105: Introduction to Computer Science.
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.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
CPS Today’s topics l Computability ä Great Ideas Ch. 14 l Artificial Intelligence ä Great Ideas Ch. 15 l Reading up to this point ä Course Pack.
CPS What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread.
Computability and Modeling Computation What are some really impressive things that computers can do? –Land the space shuttle (and other aircraft) from.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
Lecture 30. P, NP and NP Complete Problems 1. Recap Data compression is a technique to compress the data represented either in text, audio or image form.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
P, NP, and Exponential Problems Should have had all this in CS 252 – Quick review Many problems have an exponential number of possibilities and we can.
Halting Problem Introduction to Computing Science and Programming I.
Compsci 100, Fall What is Computing? Informatics? l What is computer science, what is its potential?  What can we do with computers in our lives?
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
CPS What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread.
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
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.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Week 13 - Monday.  What did we talk about last time?  B-trees  Hamiltonian tour  Traveling Salesman Problem.
The Beauty and Joy of Computing Lecture #23 Limits of Computing Researchers at Facebook and the University of Milan found that the avg # of “friends” separating.
Computer Science/Ch. Algorithmic Foundation of CS 4-1 Chapter 4 Chapter 4 Algorithmic Foundation of Computer Science.
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Chapter.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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.
Chapter 17: Limitations of Computing Chapter 17 Limitations of Computing Page 196 What problems cannot be solved on a computer? What problems cannot be.
1 Introduction to Turing Machines
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
1 Computability Tractable, Intractable and Non-computable functions.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
Introduction to Computing Science and Programming I
Chapter 12: Theory of Computation
Part VI NP-Hardness.
What is Computing? Informatics?
CSE 311 Foundations of Computing I
1.5 Intractable problems.
Ch. 11 Theory of Computation
Chapter 9 TURING MACHINES.
Turing Machines (TM) Deterministic Turing Machine (DTM)
How Hard Can It Be?.
Discrete Mathematics CS 2610
CLASSES P AND NP.
Halting Problem.
Chapter 11 Limitations of Algorithm Power
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
What is Computer Science at Duke?
Week 11 - Wednesday CS221.
Presentation transcript:

Complexity & Computability

Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long problem can take years or centuries to finish  problem is not computable no computer program can solve the problem  we do not know how to write a program to solve the problem problems that can conceivably be solved artificial intelligence, computer vision understanding language, object recognition, tracking, prediction

What problems can be solved by computers?  Equivalent to: “What decision problems can be solved?”  Decision problem  problem where the answer is always YES/NO  Arbitrary problem can always be reduced to a decision problem  There are decision problems for which algorithms do not exist  there are more different decision problems than there are different programs.  If there are more decision problems than programs then it must be the case that some decision problems cannot be solved by programs since since a single program can solve only a single decision problem

Alan Turing  The first abstract model of computation was defined by Alan Turing in 1936  A basic Turing machine is a model for studying computation. Turing machines can solve decision problems and compute results based on inputs.  Church-Markov-Turing thesis  any nontrivial computer language that one can invent is apparently capable of computing no more and no fewer functions than all the other nontrivial programming languages, or  any algorithm that can be described in a natural language can be translated into any modern programming language in other words, if you can specify an algorithm concretely in English, you can program it

Turing Machines  A tape divided into adjacent cells  each cell is inscribed with symbol from a finite alphabet  alphabet contains blank symbol and at least one other symbol  tape is arbitrarily extendible to the left and to the right  cells that have not been written to before are assumed to be filled with the empty symbol.  A head to read & write symbols on the tape and move left & right  A state register that stores the state of the TM  number of different states is finite, one special start state with which the state register is initialized.  An action table tells TM what symbol to write, how to move the head and what its new state will be, given the symbol it has just read on the tape and the state it is currently in  if there is no entry in the table for the current combination of symbol and state then the machine will halt

A Turing Machine The tape is an infinite sequence of cells Each cell contains a symbol (possibly blank) R/W head moves left and right along the tape The number displayed represents its current state, which can change at it computes

Function evaluation  A decision problem is a question with a YES/NO answer:  Is a prime number?  Is my birthday on a Sunday next year?  Did I pass the CPS1 final exam?  Other problems require a unique but particular answer:  What is the smallest prime factor of ?  On which day of the week will is my birthday next year?  What grade did I get on the CPS1 final exam?  This type of problem can be viewed as the evaluation of a function, since the answer is unique  can also be viewed as a mapping of an input value to an output value

Computability  A function is computable if it can be computed by a Turing machine  or, a function is computable of a program exists that can compute it  or, a function is computable if there is an effective procedure (or algorithm) for evaluating the function which, given any input values for which the function is defined, produces the correct result and halts in a finite amount of time  Noncomputable functions: any function that cannot be computed by any program  many more functions then there are programs  not possible to have a program for every function

Example  List all subroutines that input an integer and return an integer  a short program:  another short program:  Can make infinitely many such short programs int prog(int x) { return x; } int prog(int x) { return 1; }

The halting problem  Programs that run forever  programs with infinite loops  Some programs may halt on some inputs but not on others  Programs with no loops always halt  composed of assignment statements, if statements and the return statement  However, existence of loop does not guarantee halting property!!! int programA( int x) { while( x == x ) x = x; return x; } int programB( int x) { while( x > 10 ) x = x; return x; }

The halting problem is noncomputable No finite program can be written that will check other programs and halt in a finite time giving a solution to the halting problem  Halting program is noncomputable  no single finite program that will answer the halting question for all programs Input program input DoesHalt() output “Halts on all inputs” or “Does not halt on all inputs”

Programs that read programs  Almost every problem related to the behavior of programs is noncomputable  programs to check for property X in the behavior of all other programs  halting, equivalence, printing, correctness  Programs that are computable: we can write programs to check almost any syntactic feature of programs  measure the length of programs, number of statements, characters, arithmetic expressions Program input Program output

Program execution time  Estimate how long a program requires to handle large blocks of data  Tractable computation: a calculation that can be completed in a reasonable time period  a computation is tractable if its running time on n inputs is logarithmic or polynomial in n searching or sorting n inputs  Intractable computation: cannot be realistically completed except for small examples  a computation is intractable if its running time on n inputs is exponential in n computing all permutations of n inputs

Scenario I can’t write this program because I’m too dumb

Better scenario I can’t write this program because it’s provably impossible

Another possible scenario I can’t write this program but neither can all these famous people

Not impossible, but impractical  Towers of Hanoi  how long to move n disks?  What combination of switches turns the light on?  try all combinations, how many are there?  is there a better way?

Traveling Salesperson  A traveling salesperson must visit each of some number of cities before returning home  knows the distance between each of the cities  wants to minimize the total distance traveled while visiting all of the cities  In what order should the salesperson visit the cities? Try all paths, from every starting point -- how long does this take? a, b, c, d, e, f, g b, a, c, d, e, f, g... a d g f e b c

Bin packing  Bin packing problem:  Pack a given set of items having different sizes into a minimum number of equal-sized bins.  Example:  Pack trucks with barrels, using minimal number of trucks  Ideas?

Complexity Classifications  Class P  consists of all decision problems that can be solved on a deterministic sequential machine in time polynomial in the size of the input  Class NP  non-deterministic, polynomial time  consists of all decision problems whose positive solutions can be verified in polynomial time, or  solution can be found in polynomial time on a non- deterministic machine  Biggest open question in computer science: Is P = NP?

Are hard problems easy?  P = “easy” problems, NP = “hard” problems  Question: P = NP? Rich or famous?  if yes, a whole class of difficult problems can be solved efficiently TSP and bin packing are “equally hard” one problem is reducible to another  if no, none of the hard problems can be solved efficiently  Widely conjectured that the answer is no  P versus NP is a Clay Mathematics Institute (CMI) Millennium Prize Problem  first person to solve will be awarded $1,000,000