Lec27_28_NP - The Theory of NPCompleteness Tractable and...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
The Theory of NP- Completeness Tractable and intractable problems NP-complete problems
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Classifying problems Classify problems as tractable or intractable. Problem is tractable if there exists at least one polynomial bound algorithm that solves it. An algorithm is polynomial bound if its worst case growth rate can be bound by a polynomial p ( n ) in the size n of the problem constant a is where ... ) ( 0 1 k a n a n a n p k n + + + =
Background image of page 2
Intractable problems Problem is intractable: All algorithms that solve the problem are not polynomial bound. E.g., undecidable problem (halting problem) It has a worst case growth rate f ( n ) which cannot be bound by a polynomial p(n) in the size n of the problem. For intractable problems the bounds are: f n c n n n ( ) , , log = or etc.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Halting Problem Halting problem: given a computer program and an input to it, determine whether the program will halt on that input or continue working indefinitely on it. Trial solution : Just run the program with the given input. If the program stops, we know the program stops. But if the program doesn't stop in a reasonable amount of time, we cannot conclude that it won't stop. Maybe we didn't wait long enough.
Background image of page 4
Halting Problem Halting Problem is unsolvable The proof was devised by Alan Turing, 1936 Suppose you have a solution to the halting problem, called H. H takes two inputs: A program P and an input I for the program P . H generates an output " halt " if H determines that P stops on input I; Or it outputs " loop " otherwise. Prog P Input I Halt or loop
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
We can take P as both input and the Program. Then we devise another program K. If H outputs Loop, then K outputs Halt. If H outputs Halt, then K outputs Loop forever; K will do the opposite of H's output. function K() { if (H()=="loop"){ return; } else { while(true); //loop forever } } H Prog P Loop? Halt F loop T Halting Problem
Background image of page 6
Halting Problem Since K is a program, let us use K as the input to K. If H says that K halts then K itself would loop (that's how we constructed it). If H says that K loops then K will halt. In either case H gives the wrong answer for K. Thus H cannot work in all cases. We've shown that it is possible to construct an input that causes any solution H to fail. H Prog K Loop? Halt F loop T
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Why is this classification useful? If problem is intractable, no point in trying to find an efficient algorithm All algorithms will be too slow for large inputs .
Background image of page 8
Turing showed some problems are so hard that no algorithm can solve them (undecidable) (e.g., Halting problem) Other researchers showed some decidable problems from automata, mathematical logic, etc. are intractable: Presburger Arithmetic. P
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/04/2010.

Page1 / 47

Lec27_28_NP - The Theory of NPCompleteness Tractable and...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online