1 / 6

NP-completeness

NP-completeness. Ch.34. The Holly Grail. Three classes of problems: Class P: problems solvable in polynomial time Class NP: problems verifiable in polynomial time (i.e. “give me a solution and I can verify that it is correct”)

suzannat
Télécharger la présentation

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. NP-completeness Ch.34

  2. The Holly Grail • Three classes of problems: • Class P: problems solvable in polynomial time • Class NP: problems verifiable in polynomial time (i.e. “give me a solution and I can verify that it is correct”) • Class NPC (NP-complete): problems that are NP and as “hard” as any problem in NP • If any NPC problem can be solved in polynomial time, then they all can; but so far nobody found any solution …. • There are many NPC problems that look very simple on surface • NPC problems are rather common

  3. Nature of NP-problems • NP-complete problems are decision problems (i.e. the answer is “yes/no”) • But usually optimization problems can be converted into decision problems

  4. Examples of NP-complete problems • Finding longest path between any two vertices in a graph • Circuit satisfiability: given a boolean circuit of AND, OR and NOT gates, is it satisfiable • 3-CNF satisfiability: Find out if there is a solution to a Boolean formula in conjuctive normal form that has 3 distinct “elements” for each OR • e.g. (x1 or x2’ or x3) AND (x1 or x2 or x3) AND (x4 or x1 or x3’)

  5. Example problems, cntd. • Find clique of max size in a graph (clique is a subset of vertices, and each pair is connected by an edge) • Find a hamiltonian cycle in a graph (a cycle that contains each vertex) • Traveling salesman problem: find a hamiltonian cycle which ends at the starting vertex (i.e. visit all nodes exactly once and finish at the node you started from)

  6. Practical Consequences • If a problem is proven to be NP-complete, do NOT bother writing an algorithm to solve it exactly, because you will not be able to find the solution, most likely (nobody did so far, and people have been trying for hundreds of years; so if you do, you will be a very very famous person); or if you want an exact solution, it will be a naïve check of all possibilities and will run much longer than polynomial time…. • Instead, solve the problem by approximations, or solve a special case that is tractable.

More Related