240 likes | 267 Views
The Brick Wall: NP-Completeness. Christopher King Joshua Greenspan. History. Before 1950s computers will solve anything 1950s & 1960s: The wall Computers can’t solve basic problems. Today: The wall still stands. John von Neumann, 1950. The Wall.
E N D
The Brick Wall:NP-Completeness Christopher King Joshua Greenspan
History • Before 1950s computers will solve anything • 1950s & 1960s: The wall • Computers can’t solve basic problems. • Today: The wall still stands John von Neumann, 1950
The Wall • Many fundamentally important problems can’t be solved in tractable time • Engineering • Operations research • VLSI chip design • Database management • Etc. • NP Complete (Nondeterministic Polynomial time) • 2n or worse • Every time ‘n’ increases by 1, processing doubles • n! • Every time ‘n’ increases by 1, processing takes ‘n’ times longer
Scheduling Example Industry: Welding Schedule • Manufacturing-line welding • Fastest path = Line speed • Finding fastest path: • Tabulate all possible paths • Compute path times • Choose best path • All possible paths = n! (n = #welds) • 3!=6, 4!=24, 5!=120, 6!=720, 30!=2.6x1032 • 30! Compute (1 trillion schedules)/sec = 30 years • 31! = 930 years
Jackhammer through the wall Faster Computers & Massive Parallelization • Turn every molecule in the universe into processor: • 1060 processors • Every processor: 1,000 times faster than current • 1015 schedules/second • Compute a schedule with 63 welds in 1000 years • 64 welds: 64,000 years or 63 more universes • Even improving algorithm to 2n would allow 240 welds • Exponential Explosion of Complexity
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D • 18 • Total = 18
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D – E • 18 + 14 • Total = 32
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D – E – C • 18 + 14 + 14 • Total = 46
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D – E – C – B • 18 + 14 + 14 + 22 • Total = 68
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D – E – C – B – A • 18 + 14 + 14 + 22 + 25 • Total = 93
Avoiding the wall • n!, or even 2n wont work • n2 needed, or even nk • Greedy Algorithm? • Start at arbitrary point • Take optimal path • A – D – E – C – B – A • 18 + 14 + 14 + 22 + 25 = 93 • A – D – C – E – B – A • 18 + 15 + +14 +18 +25 = 90
Avoiding the wall • For scheduling problem • No n2, n100, or nk algorithm has ever been found • No nk will ever be found • For all NP-complete problems • No n2, n100, or nk algorithm has ever been found • No nk will ever be found • Can good solutions be made efficiently? • For non-Euclidean, no such guarantee • For scheduling problem using Euclidean distances • Polynomial can be found to produce 50% optimal • Many other NP-C problems can be approximated efficiently
Bin packing problem • Goal: Store telephones of different sizes in bins • Optimal solution: Use as few bins as possible • First Fit Algorithm • Place each phone in first bin it fits in • No bin except last can be less then half full • This means: FF requires no more then 2x optimal + 1 • Proof: If two bins are less then half full • You can combine the contents of these bins into 1
Efficient approximation guarantee • Better algorithms can be found • First-Fit Decreasing - Put the biggest phone in the lowest bin it fits in • guarantee within 22% of optimal • proof is complex • Shows ratio of bins produced by FFD to optimal is 11/9 Example of worst case
Probabilistic Results • Guarantees can be much worse than actual • Consider where you have infinite phones with sizes between 0 to bin-size • Always find two phones to fit in a bin • Actually holds for more general cases using a finite number of phones of even size distribution • High probability that two phones will fit bin • Proved that under uniform distribution • Constant number of bins are wasted • Combining locally optimal solutions can make NP-C approximations efficient • Not all NP-C can be solved using locally optimal solutions
Satisfiability (SAT) problem • Important because first to be shown NP-C • Used to prove many other problems are NP-C • Boolean equation in Conjunctive Normal Form • Equation is an “AND” of clauses • Clause is an “OR” of literals • Literals are True or false • Clause is true if at least one literal is true • Equation is satisfiable (true) if every clause is true • Problem: Determine if given formula is satisfiable • Known solution is O(2n)
SAT Problem • Since it is either satisfiable or not satisfiable • No approximations • No locally optimal solutions • SAT allows research into NP-C problems • Special classes of SAT can be solved efficiently • Restrict to 2 literals, time to solve proportional to size of formula • Restrict so only 1 non-negated literal, also proportional to size of formula • Problems with 3 literals per clause are those of NP-C problems
Probability of Satisfiability • It is trivial to find satisfiabilities probabilistically • Given M clauses and N literals • Formula is likely satisfiable if M/N < 4.2 • Near 100% not-satisfiable if M/N > 4.3 • It is non-trivial to find satisfiability with certainty • Known special classes are likely only with M/N < 1 • Other efficient solutions are likely (Near 100%) if M/N < 3.003 • No known efficiently solution when M/N > 4.3
Other NP Problems • NP • All decision problems where ‘yes’ answers have simple proofs • Ex. Integer factorization • NP Complete (NPC) • Most challenging NP problems • Proving 1 NP-C=P proves all NP=P • Proving 1 NP-C≠P proves all NP-C≠P • Ex. Boolean • NP Easy • At most as hard as NP • NP Hard • At least as hard as NP • May not be NP • Ex. (NP-C) Subset Sum, Traveling Salesperson • Ex. (! NP-C) Halting problem
Proving NP-C • Prove a problem is NP-C • Prove NP • Reduce problem to a known NP-C • n4 reduces to n*n*n*n
Does NP≠P • It has yet to be shown if NP problems can be solved in Polynomial Time • Clay Mathematics Institute (CMI): $1,000,000 • If NP-C≠P for one problem: The same for all • If NP-C=P: Solutions to all CMI problems • If NP-C=P: All life’s mysteries will be solved, artificially intelligent beings will emerge, and they will enslave humanity [Stross, 2000]