np-complete problems prof. sin-min lee department of computer science

50
NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Upload: juliana-walsh

Post on 18-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

NP-complete Problems

Prof. Sin-Min Lee

Department of Computer Science

Page 2: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 3: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 4: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Decision Problems

To keep things simple, we will mainly concern ourselves with decision problems. These problems only require a single bit output: ``yes'' and ``no''.

How would you solve the following decision problems?

Is this directed graph acyclic? Is there a spanning tree of this undirected graph with total weight less than w? Does this bipartite graph have a perfect (all nodes matched) matching? Does the pattern p appear as a substring in text t?

Page 5: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 6: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

P

P is the set of decision problems that can be solved in worst-case polynomial time:

If the input is of size n, the running time must be O(nk). Note that k can depend on the problem class, but not the particular instance.

All the decision problems mentioned above are in P.

P: Polynomial algorithms - These include all the sorting algorithms we've seen, with running times on the order of nlgn and n2. Running times like n3 and 4, though considerably slower, are also polynomial time.

Page 7: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 8: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 9: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

NP

Technically speaking:

A problem is in NP if it has a short accepting certificate. An accepting certificate is something that we can use to quickly show that the answer is ``yes'' (if it is yes). Quickly means in polynomial time. Short means polynomial size.

This means that all problems in P are in NP (since we don't evenneed a certificate to quickly show the answer is ``yes'').

But other problems in NP may not be in P. Given an integer x, is it composite? How do we know this is in NP?

Page 10: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Good Guessing

Another way of thinking of NP is it is the set of problems that can solved efficiently by a really good guesser.

The guesser essentially picks the accepting certificate out of the air(Non-deterministic Polynomial time). It can then convince itself that it is correct using a polynomialtime algorithm. (Like a right-brain, left-brain sort of thing.)

Clearly this isn't a practically useful characterization: how could we build such a machine?

Page 11: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Exponential Upperbound

Another useful property of the class NP is that all NP problems canbe solved in exponential time (EXP).

This is because we can always list out all short certificates in exponential time and check all O(2nk) of them.

Thus, P is in NP, and NP is in EXP. Although we know that P isnot equal to EXP, it is possible that NP = P, or EXP, or neither. Frustrating! NP-hardness

As we will see, some problems are at least as hard to solve as any problem in NP. We call such problems NP-hard.

How might we argue that problem X is at least as hard (to within a polynomial factor) as problem Y?

Page 12: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

If X is at least as hard as Y, how would we expect an algorithm that is able to solve X to behave? NP-CompletenessBasically, computer scientists have used computer theory to prove that some of the problems we want to solve are members of a group of problems called NP-Complete. A problem can be included in this group by proving its similarity to other problems in the group. By similarity, we mean that if one member of the group can be solved in polynomial time, we can translate the solution appropriately to solve any other problem in the group in polynomial time. So, this is a very important group. A solution for any of these problems that is polynomial proves that P=NP (not just P-NP-complete.)

Page 13: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 14: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Cook's Theorem

The Satisfiability problem

x = ((A+B)C)((ABC')+C)(ABC')

Can you assign boolean (true or false) values to each of A, B, and C so that x is true?

If so, we say that the circuit is 'satisfiable.'

This circuit (which could also be drawn with AND/OR/NOT gates) is unsatisfiable. (Make sure you review how to draw an AND/OR/NOT circuit from a boolean equation. You've usually seen the equations written with x, y, and z instead of A, B, and C.)

Page 15: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 16: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 17: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 18: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 19: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 20: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 21: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 22: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 23: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 24: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 25: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 26: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 27: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 28: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 29: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 30: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 31: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 32: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 33: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 34: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 35: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 36: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 37: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 38: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 39: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 40: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 41: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 42: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 43: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 44: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 45: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 46: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 47: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 48: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 49: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science
Page 50: NP-complete Problems Prof. Sin-Min Lee Department of Computer Science

Implications of NP-Completeness

Most people don't believe that P=NP, because so many computer scientists have tried to solve so many of the problems in the NP-Complete group of problems that it's unlikely that they all weren't capable. So, once you prove that a problem is NP-Complete, conventional wisdom tells you to stop trying to solve the problem.