The Beauty and Joy of The Beauty and Joy of Computing Computing Lectur Lecture #23 e #23 Limits of Computing Limits of Computing UC Berkeley EECS UC Berkeley EECS You’ll have the opportunity for extra credit on your project! After you submit it, Sr Lectur Sr Lecturer SOE er SOE you can make a ≤ 5min YouTube video. Dan Garcia Dan Gar cia Researchers at Facebook and the University of Milan found that the avg # of “friends” separating any two people in the world was < 6. www.nytimes.com/2011/11/22/technology/between-you-and-me-4-74-degrees.html �
Computer Science … A UCB view § CS research areas: ú Artificial Intelligence ú Biosystems & Computational Biology ú Database Management Systems ú Graphics ú Human-Computer Interaction ú Networking ú Programming Systems ú Scientific Computing ú Security ú Systems ú Theory Complexity theory ú … Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (2) (2)
Let’s revisit algorithm complexity § Problems that… ú are tractable with efficient solutions in reasonable time ú are intractable ú are solvable approximately, not optimally ú have no known efficient solution ú are not solvable Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (3) (3)
Tractable with efficient sols in reas time § Recall our algorithm § Order of growth is complexity lecture, polynomial in the size we’ve got several of the problem common orders of § E.g., growth ú Searching for an item in ú Constant a collection ú Logarithmic ú Sorting a collection ú Linear ú Finding if two numbers in a collection are same ú Quadratic § These problems are ú Cubic called being “in P” ú Exponential (for polynomial) Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (4) (4)
Intractable problems § Problems that can be solved, but not solved fast enough § This includes exponential problems ú E.g., f(n) = 2 n as in the image to the right § This also includes poly-time algorithm with a huge exponent ú E.g, f(n) = n 10 § Only solve for small n Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (5) (5)
Solvable approximately, not optimally in reas time § A problem might have an optimal solution that cannot be solved in reasonable time § BUT if you don’t need to know the perfect solution, there might exist algorithms which could give pretty good answers in reasonable time Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability : Limits of Computability (7) (7)
Have no known efficient solution § Solving one of them would solve an entire class of them! ú We can transform one to another, i.e., reduce ú A problem P is “hard” for a class C if every § If you guess an element of C can be answer, can I verify it “reduced” to P in polynomial time? § If you’re “in NP” and ú Called being “in NP” “NP-hard”, then ú Non-deterministic (the you’re “NP-complete” “guess” part) Polynomial Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (8) (8)
The fundamental question. Is P = NP? § This is THE major If P ≠ NP, then unsolved problem in Computer Science! ú One of 7 “millennium prizes” w/a $1M reward § All it would take is solving ONE problem in § Other NP-Complete the NP-complete set in ú Traveling salesman who polynomial time!! needs most efficient ú Huge ramifications for route to visit all cities cryptography, others and return home Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (9) (9)
imgs.xkcd.com/comics/np_complete.png Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability : Limits of Computability (10) (10)
imgs.xkcd.com/comics/travelling_salesman_problem.png Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability : Limits of Computability (11) (11)
Problems NOT solvable § Decision problems June 23, 2012 was his 100 th birthday celebration!! answer YES or NO for an infinite # of inputs ú E.g., is N prime? ú E.g., is sentence S grammatically correct? § An algorithm is a solution if it correctly answers YES/NO in a finite amount of time § A problem is decidable if it has a solution Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (12) (12)
Review: Proof by Contradiction § Infinitely Many Primes? § Assume the contrary, then prove that it’s impossible ú Only a finite # of primes ú Number them p 1 , p 2 , …, p n ú Consider the number q q = (p 1 * p 2 * … * p n ) + 1 Dividing q by any prime would give a remainder of 1 So q isn’t composite, q is prime But we said p n was the biggest, and q is bigger than p n ú So there IS no biggest p n Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (13) (13)
Turing’s proof : The Halting Problem § Given a program and some input, will that program eventually stop? (or will it loop) § Assume we could write it, then let’s prove a contradiction ú 1. write Stops on Self? ú 2. Write Weird ú 3. Call Weird on itself Gar Garcia cia UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability (14) (14)
Conclusion § Complexity theory important part of CS § If given a hard problem, rather than try to solve it yourself, see if others have tried similar problems § If you don’t need an exact solution, many approximation algorithms help § Some not solvable! Garcia Gar cia UC Berkeley “The Beauty and Joy of Computing” UC Berkeley “The Beauty and Joy of Computing” : Limits of Computability : Limits of Computability (15) (15)
Recommend
More recommend