1 / 12

Introduction to NP-Completeness

Introduction to NP-Completeness. Tahir Azim. The Downside of Computers. Many problems can be solved in linear time or polynomial time But there are also problems that can’t be solved so easily… Moral: know thy problem!. P vs NP. P = Problems that can be solved in polynomial time

oshin
Download Presentation

Introduction to NP-Completeness

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to NP-Completeness Tahir Azim

  2. The Downside of Computers • Many problems can be solved in linear time or polynomial time • But there are also problems that can’t be solved so easily… • Moral: know thy problem!

  3. P vs NP • P = Problems that can be solved in polynomial time • NP = Problems for which you can test the correctness of a solution in polynomial time • Example? • Solutions in P are also in NP • But not necessarily vice versa • Undecidable Problems: Cannot be solved by a computer. Picture Courtesy: Wikipedia

  4. Examples of hard problems • Long simple paths: Given a graph G, vertices s and t, and a number k, does there exist a path from s to t with at least k edges and no cycles? • In NP. Why? • In P? No! • RSA: In NP, but not in P! • Chess-Playing: In NP, but not in P! • Halting Problem

  5. yes if Q(Q) halts no otherwise run forever if Q(Q) halts halt if Q(Q) runs forever Unsolvability of the halting problem • Suppose P solves variant of halting problem • On input Q, assume P(Q) = • Build program D • D(Q) = • Does this make sense? What can D(D) do? • If D(D) halts, then D(D) runs forever. • If D(D) runs forever, then D(D) halts. • CONTRADICTION: program P must not exist.

  6. How to solve such problems? • Heuristics • Approximation • Use the exponential time solution anyway • Add more assumptions to simplify it

  7. Is P=NP? • If it's always easy to check a solution, should it also be easy to find the solution? • Most famous open problem in theoretical CS • Most expect it to be false, but there is no proof

  8. NP-Complete Problems (NPC) • The hardest of all problems in NP • NP-hard: A problem that is at least as hard as any problem in NP • Does not necessarily have to be in NP, e.g. the Halting Problem • A problem is said to be NP-complete if it is • (i) in NP • and (ii), it is NP-hard

  9. How to prove if a problem Y is NP-hard • By showing that an instance X of an NP-hard problem can be reduced to Y in polynomial time • Informally, a problem A is reducible to B if A can be solved by using B as a sub-routine • i.e. if B returns “yes”, then A also returns yes. • The idea is the following: • If Y was not NP-hard, then X could be solved “easily” by using Y • Therefore, X would no longer be a hard problem • X is NP-hard • Therefore, Y is NP-hard.

  10. More common method (slightly different) • Generally, a slightly different approach is used • A problem Y is said to be NP-complete if it is • (i) in NP • and, (ii) an instance of an NP-complete problem can be reduced to Y in polynomial time • Notation: X <p Y, Ǝ X Ɛ NPC • Where did the first NP-complete problem come from? • Stephen Cook (1971) showed that SAT is an NP-complete problem from first principles

  11. Examples of various NP-complete problems and their reductions • Additional Problems: • Graph Coloring • Karp's 21 NP-complete problems (1972) Picture Courtesy: Wikipedia

  12. More of the good stuff… • If you can prove one NP-complete problem to be solvable in polynomial time, you can prove that all others are also solvable in polynomial time • One way to prove P=NP! • Follow up: • Wikipedia, of course  But check your sources! Don’t trust Wikipedia!

More Related