140 likes | 263 Views
NP-Complete Problems. What are they?. Book is a little hard to read here “Non-deterministic, Polynomial time Complete” Start with some interesting examples…. N-Queens Problem. Where She Can Attack. Why this is hard. Problem: Place 8 queens such that no queen can attack another
E N D
NP-Complete Problems Jeff Chastine
What are they? • Book is a little hard to read here • “Non-deterministic, Polynomial time Complete” • Start with some interesting examples… Jeff Chastine
N-Queens Problem Jeff Chastine
Where She Can Attack Jeff Chastine
Why this is hard • Problem: Place 8 queens such thatno queen can attack another • On a standard 8x8 chessboard • The first queen has 64 spots to choose from • The second queen has 63 spots to choose from • And so on… Yes, 178 trillion Jeff Chastine
Why this is so easy! • How long to verify a correct board? Jeff Chastine
Why this is so easy! • How long to verify a correct board? Polynomial time One word down, a few to go… Jeff Chastine
Packing Boxes • What’s the most efficient way to pack a UPS truck with varying-sized boxes? • Why this is hard • Different order of boxes • Different positions • Different orientations • How many different ways are there? Jeff Chastine
The BIG QUESTION • Someone shows you “a solution” • Shows you the truck • Shows you all the boxes in the truck • Is it correct? How do you know? • How long to verify? Jeff Chastine
Difference • The n-Queens problem is “NP-Soft” • Exponential time to generate solution • Polynomial time to verify • The truck packing is “NP-Hard” • Exponential time to generate solution • Exponential time to verify Jeff Chastine
Difference • The n-Queens problem is “NP-Soft” • Exponential time to generate solution • Polynomial time to verify • The truck packing is “NP-Hard” • Exponential time to generate solution • Exponential time to verify Fascinating to mathematicians Jeff Chastine
Non-determinism • Idea from “Theory of Computing” • Automaton replicates itself for each decision • Each replica follows unique path • All machines halt when a solution is found • Questions: • How many machines for n-Queens • What is most time a machine would take? Note: Is this futuristic? Nope. It’s called Quantum Computing! Jeff Chastine
What about “Complete” • Here’s the amazing thing: If you solve one of these problemsyou solve them all! Jeff Chastine
So… • Non-deterministic, Polynomial time • We have a machine that replicates itself at decision points • The computing time for each machine is polynomial • Complete • This class of problems is all the same • If you solve one, you solve all NP-Complete problems Jeff Chastine