+ All Categories
Home > Engineering > np complete

np complete

Date post: 03-Jul-2015
Category:
Upload: gayathri-gaayu
View: 304 times
Download: 2 times
Share this document with a friend
32
Module 3
Transcript
Page 1: np complete

Module 3

Page 2: np complete
Page 3: np complete
Page 4: np complete
Page 5: np complete
Page 6: np complete
Page 7: np complete

Three classes of decision problems

• P is the set of decision problems that can besolved in polynomial time.3 Intuitively, P is theset of problems that can be solved quickly.

• NP is the set of decision problems with thefollowing property: If the answer is YES, thenthere is a proof of this fact that can be checked inpolynomial time.

• co-NP is the opposite of NP. If the answer to aproblem in co-NP is NO, then there is a proof ofthis fact that can be checked in polynomial time.

Page 8: np complete

Three classes of decision problems

Page 9: np complete
Page 10: np complete
Page 11: np complete
Page 12: np complete
Page 13: np complete
Page 14: np complete

NP-Completeness

• How would you define NP-Complete?

• They are the “hardest” problems in NP

P

NP

NP-Complete

Page 15: np complete

Definition of NP-Complete

• Q is an NP-Complete problem if:

• 1) Q is in NP

• 2) every other NP problem polynomial time reducible to Q

Page 16: np complete
Page 17: np complete
Page 18: np complete
Page 19: np complete
Page 20: np complete
Page 21: np complete

SAT

• 3SAT: – n variables (taking values 0 and 1)– m clauses, each being OR of 3 variables or their

negations • E.g. (¬x1) x2 (¬x3)

– 3SAT formula: AND of these m clauses• E.g. ((¬x1) x2 x3) ((¬x2) x4 (¬x5)) (x1 x3 x5)

• 3SAT Problem: Is there an assignment of variables s.t. the formula evaluates to 1?– i.e. satisfying all clauses.

Page 22: np complete

Hard

• 3SAT is known as an NP-complete problem.

– Very hard: no polynomial algorithm is known.

– Conjecture: no polynomial algorithm exists.

– If a polynomial algorithm exists for 3SAT, then polynomial algorithms exist for all NP problems.

• Later in this course

Page 23: np complete
Page 24: np complete
Page 25: np complete
Page 26: np complete

NP-Complete

• To prove a problem is NP-Complete show a polynomial time reduction from 3-SAT

• Other NP-Complete Problems:– PARTITION

– SUBSET-SUM

– CLIQUE

– HAMILTONIAN PATH (TSP)

– GRAPH COLORING

– MINESWEEPER (and many more)

Page 27: np complete

NP-Completeness Proof Method

• To show that Q is NP-Complete:

• 1) Show that Q is in NP

• 2) Pick an instance, R, of your favorite NP-Complete problem (ex: Φ in 3-SAT)

• 3) Show a polynomial algorithm to transform R into an instance of Q

Page 28: np complete

Example: Clique

• CLIQUE = { <G,k> | G is a graph with a clique of size k }

• A clique is a subset of vertices that are all connected

• Why is CLIQUE in NP?

Page 29: np complete

Reduce 3-SAT to Clique

• Pick an instance of 3-SAT, Φ, with k clauses

• Make a vertex for each literal

• Connect each vertex to the literals in other clauses that are not the negation

• Any k-clique in this graph corresponds to a satisfying assignment

Page 30: np complete
Page 31: np complete

Example: Independent Set

• INDEPENDENT SET = { <G,k> | where G has an independent set of size k }

• An independent set is a set of vertices that have no edges

• How can we reduce this to clique?

Page 32: np complete

Independent Set to CLIQUE

• This is the dual problem!


Recommended