CompSci 1 11.1 What can be computed l What class of problems can be solved? ä Google Datacenter, Desktop computer, Cell phone, pencil? ä Alan Turing proved.

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

Lecture 19. Reduction: More Undecidable problems
8/25/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 1 Theory of Computation Course information Overview of the area Finite Automata Sofya.
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
1 The Limits of Computation Intractable and Non-computable functions.
CS420 lecture one Problems, algorithms, decidability, tractability.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
The Theory of NP-Completeness
Today - Limits of computation - Complexity analysis examples.
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
CS10 The Beauty and Joy of Computing Lecture #23 : Limits of Computing Thanks to the success of the Kinect, researchers all over the world believe.
What computers just cannot do. COS 116: 2/28/2008 Sanjeev Arora.
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.
Algorithms: Selected Exercises Goals Introduce the concept & basic properties of an algorithm.
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.
Duke University Computer Science 1 Why Computer Science is Uglier and Prettier than Mathematics Owen Astrachan Duke University
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:
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
CompSci Topics since midterm l Java  Methods  Sound  Graphics l Software design  Recursion  Arrays  Copyright issues l Computer systems.
CPS Topics since last test l Recursion l Software design  Object-oriented  Copyright issues l Computer systems  Hardware  Architecture  Operating.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 What can a computer be commanded to do?
Computer Science and Everything 1 Big Ideas in Computer Science l “Mathematics is the Queen of the Sciences” Carl Friedrich Gauss l What is Computer Science?
Cliff Shaffer Computer Science Computational Complexity.
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 Theory: Models of Computation  Readings:  Chapter 11 & Chapter 3.6 of [SG]  Content:  What is a Model  Model of Computation  Model of a Computing.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Compsci 06/101, Spring What is Computing? Informatics? l What is computer science, what is its potential?  What can we do with computers in.
1 Computability CS 101E Spring 2007 Michele Co. 2 So Far In Class We’ve seen the following programming constructs –if, if-else, if-else-if –switch –for.
CPS Topics since last test l Recursion l Sound l Graphics l Software design  Object-oriented  Copyright issues l Computer systems  Hardware 
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.)
CompSci 100e 13.1 Topics l Data Structures  Arrays ArrayLists  Linked Lists Circular Doubly-linked  Binary Trees Binary Search Trees AVL Trees Heaps.
CPS 100, Fall What is Computing? Informatics? l What is computer science, what is its potential?  What can we do with computers in our lives?
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.
CS10: The Beauty and Joy of Computing Lecture #22 Limits of Computing Warning sign posted at Stern Hall. Also, Apple releases new operating.
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.
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
David Evans Class 16: NP-Completeness / The Story so Far CS150: Computer Science University of Virginia Computer Science.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
Week 13 - Monday.  What did we talk about last time?  B-trees  Hamiltonian tour  Traveling Salesman Problem.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
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.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
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.
Compsci 101, Fall LWoC l Review Recommender, dictionaries, files  How to create recommendations in order? food.txt  Toward a Duke eatery-recommender.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
Compsci 06/101, Fall What is Computing? Informatics? l What is computer science, what is its potential?  What can we do with computers in our.
Hardware Trends CSE451 Andrew Whitaker. Motivation Hardware moves quickly OS code tends to stick around for a while “System building” extends way beyond.
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)
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
Introduction to Computing Science and Programming I
Chapter 12: Theory of Computation
What is Computing? Informatics?
CSE 311 Foundations of Computing I
Unsolvable Problems December 4, 2017.
How Hard Can It Be?.
Halting Problem.
CSC 380: Design and Analysis of Algorithms
CSC 380: Design and Analysis of Algorithms
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
What is Computer Science at Duke?
Announcements Jack group member by Thursday!! Quiz-8? HW10
Presentation transcript:

CompSci What can be computed l What class of problems can be solved? ä Google Datacenter, Desktop computer, Cell phone, pencil? ä Alan Turing proved some things, hypothesized others Halting problem, Church-Markov-Turing thesis l What class of problems can be solved efficiently? ä Problems with no practical solution what does practical mean? ä Problems for which we can’t find a practical solution solving one solves them all

CompSci Schedule students, minimal conflicts l Given student requests, available teachers ä write a program that schedules classes ä Minimize conflicts l Add a GUI too ä Web interface ä … I can’t write this program because I’m too dumb

CompSci One better scenario I can’t write this program because it’s provably impossible

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

CompSci Types of Problems l Tractable ä Problems that can be solved by a computer in a “reasonable” amount of time. l Intractable ä Problems that can’t be solved by a computer in a “reasonable” amount of time, ä But can be solved eventually. l Non-computable ä Problems that can never be solved by a computer.

CompSci Is there a path from Ann to Bob? AnnJoe Jim John Kim Jen Bob

CompSci Is there a path from Ann to Bob? AnnJoe Jim John Kim Jen Bob Suzy Kyle Frank Josh Jen Brett Ben Julie Lucy

CompSci How much oil can flow?

CompSci How much oil can flow?

CompSci Can you color this map with 4 colors?

CompSci Can you color this map with 3 colors?

CompSci Can you color this map with 3 colors?

CompSci Can you color this map with 3 colors?

CompSci Dealing with hard problems l Random Numbers ä Can “expect” to solve some in reasonable time l Approximation ä Can guarantee that we’re “close” to the right answer l Parallel Computers?

CompSci Non-Computable Problems l Problems that cannot be solved by a computer ever

CompSci Not impossible, but impractical l Towers of Hanoi ä How long to move n disks? l What combination of switches turns the light on? ä Try all combinations, how many are there? ä Is there a better way?

CompSci Travelling Salesperson l Visit every city exactly once l Minimize cost of travel or distance l Is there a tour for under $2,000 ? less than 6,000 miles? l Is close good enough? 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...

CompSci Complexity Classifications l This route hits all cities for less than $2, verify properties of route efficiently. l Hard to find optimal solution Pack trucks with barrels, use minimal # trucks Ideas? Problems are the “same hardness”: solve one efficiently, solve them all

CompSci Are hard problems easy? l P = easy problems, NP = “hard” problems ä P means solvable in polynomial time Difference between N, N 2, N 10 ? ä NP means non-deterministic, polynomial time guess a solution and verify it efficiently l Question: P = NP ? Rich or famous? ä if yes, a whole class of difficult problems can be solved efficiently---one problem is reducible to another ä if no, none of the hard problems can be solved efficiently ä showing the first problem was in NP was an exercise in intellectual bootstrapping (1971)

CompSci Theory and Practice l Number theory: pure mathematics ä How many prime numbers are there? ä How do we factor? ä How do we determine primeness? l Computer Science ä Primality is “easy” ä Factoring is “hard” ä Encryption is possible top secret public-key cryptography randomized primality testing

CompSci Halt or not l Does the following code eventually terminate?... while (x > 1): if (x > 2): x = x – 2 else: x = x + 2 l What if x is 8? How about 9?

CompSci Halt or not l Does the following code eventually terminate?... while (x > 1): if (x % 2 == 0) x = x / 2 else x = 3*x + 1 l What if x is 8? How about 7? How about all numbers > 0?

CompSci If you start this program, will it ever stop running? public class Client { public static void main(String[] args) { if(args.length != 2) { System.out.println("Usage: vbj Client \n"); return; } String carrierName = args[0]; String aircraftName = args[1]; org.omg.CORBA.Object carrier = null; org.omg.CORBA.Object aircraft = null; org.omg.CORBA.ORB orb = null; try { orb = org.omg.CORBA.ORB.init(args, null); } catch (org.omg.CORBA.SystemException se) { System.err.println("ORB init failure " + se); System.exit(1); } { // scope try { carrier = orb.bind("IDL:Ship/AircraftCarrier:1.0", carrierName, null, null); } catch (org.omg.CORBA.SystemException se) { System.err.println("ORB init failure " + se); System.exit(1); } org.omg.CORBA.Request request = carrier._request("launch"); request.add_in_arg().insert_string(aircraftName); request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_objref)); request.invoke(); aircraft = request.result().value().extract_Object(); } { // scope org.omg.CORBA.Request request = aircraft._request("codeNumber"); request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)); request.invoke(); String designation = request.result().value().extract_string(); System.out.println ("Aircraft " + designation + " is coming your way"); } { // scope org.omg.CORBA.Request request = aircraft._request("attitude"); int altitude = 10000; org.omg.CORBA.Any ioAltitude = request.add_inout_arg(); ioAltitude.insert_long(altitude); } try { carrier = orb.bind("IDL:Ship/AircraftCarrier:1.0", carrierName, null, null); } catch (org.omg.CORBA.SystemException se) { System.err.println("ORB init failure " + se); System.exit(1); } org.omg.CORBA.Request request = carrier._request("launch"); request.add_in_arg().insert_string(aircraftName); request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_objref)); request.invoke(); aircraft = request.result().value().extract_Object(); } { // scope org.omg.CORBA.Request request = aircraft._request("codeNumber"); request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)); request.invoke(); String designation = request.result().value().extract_string(); System.out.println ("Aircraft " + designation + " is coming your way"); } { // scope org.omg.CORBA.Request request = aircraft._request("attitude"); int altitude = 10000; org.omg.CORBA.Any ioAltitude = request.add_inout_arg(); ioAltitude.insert_long(altitude); String direction = "headup"; request.add_in_arg().insert_string(direction); request.invoke(); altitude = ioAltitude.extract_long(); System.out.println ("Aircraft is heading up to " + altitude + " Feet."); } } }

CompSci The halting problem: writing DoesHalt def doesHalt(progname, s):  returns true if progname halts given s as input, false otherwise if (doesHalt(f,s)): print "does halt" else: print "does not halt" l Programs that read program l A compiler is a program that reads other programs as input ä Can a word counting program count its own words? The doesHalt function might simulate, analyze, … ä One program/function that works for any program/input

CompSci Consider this code // f is a filename of this program if (doesHalt(f,f)): while True: # do nothing forever return 0; We want to show writing doesHalt is impossible ä Proof by contradiction: ä Assume possible, show impossible situation results

CompSci Noncomputable problems l What other questions can we not answer? ä Do two programs do the same thing? ä Do programs have any bugs? ä Do programs do what they’re supposed to do? l Halting Problem. l Program Equivalence. l Optimal Data Compression. l Virus Identification. l Impossible to write Pythonprogram to solve any of these problem!

CompSci The exam l Tuesday, April 28, 7pm-10pm in Soc Sci 136 l Open book/open note l ~50% multiple choice/short answer l Cumulative l By noon on Sunday, April 26: ä All grades up (except final project) ä Midterm solutions out ä Grade problems: Submit Blackboard assignment issues l Final grades up Friday, May 1 l Available by appointment throughout reading period and exam week l Help session Wednesday in class

CompSci Questions for the Exam l What is Computer Science? What does a Computer Scientist do? l How many bits are required to represent a population? l How is a webpage designed and deployed? l Why does digital media and the Internet present challenges for intellectual property law? l How do you keep secrets with computers? l What is better: a faster computer or a faster algorithm? l How do you write a program to filter a sound or image? l Google indexes A LOT of websites. How does it return an answer to a search so quickly? l How can a system predict what item you would like?

CompSci Essential concepts There is beauty at all levels of sophistication and all levels of abstraction. - David A. Blackwell If life were really fair, algebra would actually come in handy - Amstel Light commercial

CompSci Laws governing computer science l What’s computable? l Which algorithm, program, or processor is faster? l Moore’s Law (1965) ä The number of transistors per area on a chip double every 18 months ä Density of transistors => more functionality and speed l How about multiple computers? l Amdahl’s Law (1967) ä Given: fraction ( s ) of work to be done is serial (i.e. isn’t parallelizable) ä Maximum speedup with infinite number of processors is 1/s

CompSci What are computers for? l Simulation l Communication among people ä Storage = communication across time l Control ä Get physical ä Get real (time) ä Get mobile

CompSci Application l Simulation ä Models of the real world (e.g. planets, cities, molecules) l Communication among people ä Information at your fingertips ä Telepresence ä Home l Control ä Robots ä Software agents

CompSci What’s next l CompSci 4 ä Alice ä Games & Java l CompSci 6 ä Assumes knowledge of loops & arrays l CompSci 82 ä IP 2 l Seminars ä Google ä Other topics l Interdisciplinary minor ä Computational Biology & Bioinformatics ä Computational Economics