1 / 70

P vs NP: what is efficient computation?

Exploring efficient algorithms, graph coloring, P vs. NP complexity, and defining the class P in computational theory. Can we achieve poly-time algorithms efficiently? A fascinating journey into computational complexity.

fsantana
Download Presentation

P vs NP: what is efficient computation?

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. P vs NP:what is efficient computation?

  2. A Graph Named “Gadget”

  3. NODES or VERTICES

  4. EDGES

  5. K-COLORING • We define a k-coloring of a graph: • Each node get colored with one color • At most k different colors are used • If two nodes have an edge between them, then they must have different colors • A graph is called k-colorable iff it has a k-coloring • Sometimes also called “proper” colorings.

  6. A 2-CRAYOLA Question! • Is Gadget 2-colorable?

  7. No, it contains a triangle. A 2-CRAYOLA Question! • Is Gadget 2-colorable?

  8. A 3-CRAYOLA Question! • Is Gadget 3-colorable?

  9. A 3-CRAYOLA Question! • Is Gadget 3-colorable?

  10. A 3-CRAYOLA Question! • Is Gadget 3-colorable?

  11. A 3-CRAYOLA Question! • Is Gadget 3-colorable? Yes.

  12. A 3-CRAYOLA Question.

  13. A 3-CRAYOLA Question.

  14. 3-Coloring Is Decidable by brute force • Try out all 3n colorings until you determine if G has a 3-coloring. • Membership in 3COLOR is not undecidable. • But is it efficient to decide this?

  15. What is an efficient algorithm? • Is an O(n) time algorithm efficient? • How about O(n log n)? • O(n2) ? • O(n10) ? • O(nlog n) ? • O(2n) ? • O(n!) ? • O(222n) ? polynomial time O(nc) for some constant c non-polynomial time

  16. Does an algorithm running in O(n100) time count as efficient?

  17. We consider non-polynomial time algorithms to be inefficient. And hence a necessary condition for an algorithm to be efficient is that it should run in poly-time.

  18. Asking for a poly-time algorithm for a problem sets a (very) low bar when asking for efficient algorithms. The question is: can we achieve even this?

  19. I see! Once we know that our favorite problems have polynomial time algorithms, we can then worry about making them run in O(n log n)or O(n2) time! But we don’t know that yet for many common problems…

  20. The class P defined in the 50’s. • The Intrinsic Computational Difficulty of Functions, Alan Cobham, 1964. • Paths, Trees and Flowers, Jack Edmonds, 1965. this is indeed Jack Edmonds not the correct Alan Cobham

  21. Paths, Trees and Flowers, Jack Edmonds, 1965. • An explanation is due on the use of the words "efficient algorithm"…I am not prepared to set up the machinery necessary to give it formal meaning, nor is the present context appropriate for doing this…For practical purposes the difference between algebraic and exponential order is more crucial than the difference between [computable and not computable]… • It would be unfortunate for any rigid criterion to inhibit the practical development of algorithms which are either not known or known not to conform nicely to the criterion… However, if only to motivate the search for good, practical algorithms, it is important to realize that it is mathematically sensible even to question their existence. Edmonds called them “good algorithms”

  22. The Intrinsic Computational Difficulty of Functions, Alan Cobham, 1964. • For several reasons the class P seems a natural one to consider. For one thing, if we formalize the definition relative to various general classes of computing machines we seem always to end up with the same well-defined class of functions. Thus we can give a mathematical characterization of P having some confidence it characterizes correctly our informally defined class. • This class then turns out to have several natural closure properties, being closed in particular under explicit transformation, composition and limited recursion on notation (digit-by-digit recursion). if p( ) and q( ) are polynomials, then p(q( )) is also a polynomial

  23. The class P • Definition: • We say a language L µΣ* is in P if there is a program A and • a polynomial p() • such that for any x in Σ*, • A (given x as input) runs for ≤ p(|x|) time and answers question “is x in L?” correctly.

  24. The class P • Definition: • We say function F: Σ*Σ* is in P if there is • a program A and • a polynomial p() • such that for any x in Σ*, • A (given x as input) runs for ≤ p(|x|) time and A(x) = F(x). technically called FP, but we will blur the distinction for this lecture

  25. The class P • The set of all languages L that can be recognized in polynomial time. • The set of functions that can be computed in polynomial time.

  26. Why are we looking only at languages Σ*? What if we want to work with graphs or boolean formulas?

  27. Requiring that L Σ* is not really restrictive, since we can encode graphs and Boolean formulas as strings of 0’s and 1’s. In fact, we do this all the time: inputs for all our programs are just sequences of 0’s and 1’s encoded in some suitable format.

  28. Languages/functions in P? • Example 1: • CONN = {graph G: G is a connected graph} • Algorithm A1: • If G has n nodes, then run depth first search from any node, and count number of distinct nodes you see. If you see n nodes, G  CONN, else not. • Time: p1(|x|) = Θ(|x|).

  29. Languages/functions in P? • Example 2: • 2COLOR = {connected G : vertices of G can be 2-colored so • that adjacent nodes don’t have same color} • (Such colorings are called “proper colorings”.) • Program A2: • Pick a vertex and color it red. • Repeat { if uncolored node has both red and blue neighbors, abort. if uncolored node has some neighbors red, color it blue. if uncolored node has some neighbors blue, color it red. } If aborted, then G not 2-colorable, else have 2-coloring.

  30. Languages/functions in P? • Example 3: • 3COLOR = {G : vertices of G can be 3-colored} NOT KNOWN!

  31. Languages/functions in P? • And now a problem for Boolean circuits C:

  32. Languages/functions in P? • And, now a problem dealing with Combinational Circuits: • AND, OR, NOT, 0, 1 gates wired together with no feedback allowed.

  33. x1 x2 x3 AND AND AND OR OR OR OR

  34. 1 1 0 AND NOT Yes, this circuit is satisfiable. It has satisfying assignment 110. AND 1 CIRCUIT-SATISFIABILITY • Given a circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)?

  35. Languages/functions in P? • Example 4: • CIRCUIT-SATISFIABILITY • Given: A circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)? • “Brute force”: try all 2^n assignments. Exponential time… NOT KNOWN!

  36. Onto the new class, NP

  37. Recall the class P • We say a language L µΣ* is in P if there is a program A and • a polynomial p() • such that for any x in Σ*, • A (given x as input) runs for ≤ p(|x|) time and answers question “is x in L?” correctly. can think of A as “proving” that x in L.

  38. The new class NP • We say a language L µΣ* is in NP if there is a program A and a polynomial p() • such that for any x in Σ*, • If x  L, there exists a “proof” y with |y| ≤ p(|x|)A(x, y) runs for ≤ p(|x|) time and answers question “x in L” correctly. • If x  L, for all “proofs” y • A(x, y) answers “x not in L” correctly. a short proof that x in L that can be quickly “verified” Verifier rejects all “fake” proofs

  39. The class NP • The set of languages L for which there exist “short” proofs of membership (of polynomial length) that can “quickly” verified (in polynomial time). • Recall: A doesn’t have to find these proofs y; it just needs to be able to verify that y is a “correct” proof.

  40. Which languages are in NP?

  41. P NP • For any L in P, we can just take y to be the empty string and satisfy the requirements. • Hence, every language in P is also in NP. • $106 question: is NP P ?

  42. Languages/functions in NP? • Example 3: • 3COLOR = {G : vertices of G can be 3-colored so} • Short proof y: a color Cv for each node v of G. • Verifier A: For each edge (u,v) in G, ensure Cu Cv Ensure only 3 colors were used. • Proof length: a list of n colors. • Verifier runs in time O(number of edges + number of nodes). YES

  43. Languages/functions in NP? • Example 4: • CIRCUIT-SAT • Given: A circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)? • Proof: satisfying assignment • Verifier just evaluates circuit. YES

  44. Summary: P versus NP • Language L is in P if membership in L can be decided in poly-time. • Language L is in NP if • each x in L has a short “proof of membership” that can be verified in poly-time. • Fact: P  NP • Question: Does NP  P ?

  45. Hamilton Cycle f b e g a d c i h a cycle that passes through every node exactly once

  46. NP contains lots of problemswe don’t know to be in P • Classroom Scheduling • Packing objects into bins • Scheduling jobs on machines • Finding cheap tours visiting a subset of cities • Allocating variables to registers • Finding good packet routings in networks • Decryption • … Hence proving P = NP would break cryptosystems

  47. The $1,000,000 question • In order to celebrate mathematics in the new millennium, The Clay Mathematics Institute of Cambridge, Massachusetts (CMI) has named seven Prize Problems. The Scientific Advisory Board of CMI selected these problems, focusing on important classic questions that have resisted solution over the years. The Board of Directors of CMI designated a $7 million prize fund for the solution to these problems, with $1 million allocated to each. • Problem #4: The P vs NP problem.

  48. How can we prove that NP  P? I would have to show thatevery language in NP has a polynomial time algorithm… How do I do that? It may take forever! Also, what if I forgot one of the languages in NP?

  49. Relax, Bonzo! We can describe one language L in NP, such that if this language L is in P, then NP  P. It is a language that cancapture all other languagesin NP.

  50. The Magic Language: CIRCUITSAT • Example 6: • CSAT = {circuit C: C has at least 1 satisfying assignment} • If we can write a program A that • takes as input a circuit C • A(C) runs in time polynomial(|C|) • correctly decides if C is satisfiable • then • NP  P Steven Cook Leonid Levin

More Related