Black-box (oracle)

41
lack-box (oracle) Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

description

Black-box (oracle). Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G. Black-box (oracle). 5. Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G. 2. 2. Black-box (oracle). 5. - PowerPoint PPT Presentation

Transcript of Black-box (oracle)

Page 1: Black-box (oracle)

Black-box (oracle)

Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

Page 2: Black-box (oracle)

2

5

2

Black-box (oracle)

Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

Page 3: Black-box (oracle)

2

5

2

Black-box (oracle)

Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

5

Page 4: Black-box (oracle)

Black-box (oracle)Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

here is a graph G, find the max-weight matching

G

Page 5: Black-box (oracle)

Black-box (oracle)Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.

here is a graph G, find the max-weight matching

pick a vertex uV(G) for each edge {u,v}E(G) wundefined if oracle(G-u-v) + w(u,v) = oracle (G) then wv if w is undefined then recurse on (G-u) else print({u,w}); recurse on (G-u-v)

Page 6: Black-box (oracle)

3-SAT

x = variablex = negation of a variable

literals

clause = disjunction of literals x y z x z

Page 7: Black-box (oracle)

3-SAT

INSTANCE: collection C of clauses, each clause has at most 3 literalsQUESTION: does there exist an assignment of true/false to the variables which satisfies all the clauses in C

Page 8: Black-box (oracle)

3-SAT INSTANCE: collection C of clauses, each clause has at most 3 literalsQUESTION: does there exist an assignment of true/false to the variables which satisfies all the clauses in C

x y zx y zx yx

Page 9: Black-box (oracle)

Independent Set

subset S of vertices such that notwo vertices in S are connected

Page 10: Black-box (oracle)

Independent Set

subset S of vertices such that notwo vertices in S are connected

Page 11: Black-box (oracle)

Independent Set

INSTANCE: graph GSOLUTION: independent set S in GMEASURE: maximize the size of S

INSTANCE: graph G, number KQUESTION: does G have independent set of size K

OPTIMIZATION VERSION:

DECISION VERSION:

Page 12: Black-box (oracle)

Independent Set 3-SAT

“is easier than”

if we have a black-box for 3-SAT then we can solve Independent Setin polynomial time

Independent Set reduces to 3-SAT

Page 13: Black-box (oracle)

Independent Set 3-SATif we have a black-box for 3-SAT then we can solve Independent Set in polynomial time

Give me a 3-SATformula and I willtell you if it is satisfiable

We would like to solve theIndependent Set problemusing the black box in polynomial time.

Page 14: Black-box (oracle)

Independent Set 3-SATGive me a 3-SATformula and I willtell you if it is satisfiable

Graph G, K 3-SAT formula F

efficient transformation (i.e., polynomial – time)G has independent set of size K F is satisfiable

Page 15: Black-box (oracle)

Independent Set 3-SATGive me a 3-SATformula and I willtell you if it is satisfiable

Graph G, K 3-SAT formula F

V = {1,...,n} variables x1,....,xn

E = edges xi xj for ij E

+ we need to ensure that K ofthe xi are TRUE

Page 16: Black-box (oracle)

3-SAT Independent SetGive me a graph G and a number K and I willtell you if G has independentset of size K

3-SAT formula F graph G, number K

Page 17: Black-box (oracle)

3-SAT Independent SetGive me a graph G and a number K and I willtell you if G has independentset of size K

3-SAT formula F graph G, number K

x y z w y z

xw

y y

zz

Page 18: Black-box (oracle)

3-SAT Independent Set

3-SAT formula F graph G, number K

x y z w y z

xw

y y

zz

1) efficiently computable2) F satisfiable IS of size m3) IS of size m F satisfiable

Page 19: Black-box (oracle)

3-SAT Independent SetIndependent Set 3-SAT

if 3-SAT is in P then Independent Set is in Pif Independent Set is in P then 3-SAT is in P

3-SATIndependent Set

Page 20: Black-box (oracle)

Many more reductions

3-SATIndependent Set

CliqueSubset-Sum3-COLPlanar 3-COLHamiltonian path

Page 21: Black-box (oracle)

P and NP

P = decision problems that can be solved in polynomial time.

NP = decision problems for which the YES answer can be certified and this certificate can be verified in polynomial time.

Page 22: Black-box (oracle)

NP = decision problems for which the YES answer can be certified and this certificate can be verified in polynomial time.

3-SAT Independent Set

NOT-3-SAT ?

Page 23: Black-box (oracle)

NP = decision problems for which the YES answer can be certified and this certificate can be verified in polynomial time.

Every problem A NP

A 3-SAT

COOK’S THEOREM

Page 24: Black-box (oracle)

NP = decision problems for which the YES answer can be certified and this certificate can be verified in polynomial time.

if every problem A NP

A B

B is NP-hard

B is NP-completeif B is NP-hard, andB is in NP

Page 25: Black-box (oracle)

NP

P

NP-complete

NP-hard

Page 26: Black-box (oracle)

3-SATIndependent Set

CliqueSubset-Sum3-COLPlanar 3-COLHamiltonian path

Some NP-complete problems

Page 27: Black-box (oracle)

Clique

subset S of vertices such that everytwo vertices in S are connected

Page 28: Black-box (oracle)

Clique

INSTANCE: graph G, number KQUESTION: does G have a clique of size K?

Page 29: Black-box (oracle)

Subset-Sum

INSTANCE: numbers a1,...,an,B QUESTIONS: is there S {1,...,n} such that

ai = B iS

Page 30: Black-box (oracle)

3-COL

INSTANCE: graph G

QUESTION: can the vertices of G be assigned colors red,green,blue so that no two neighboring vertices have the same color?

Page 31: Black-box (oracle)

3-SAT 3-COL

R G

B

x x

B

x y z

G G G

G R

G=true

Page 32: Black-box (oracle)

Planar-3-COL

INSTANCE: planar graph G

QUESTION: can the vertices of G be assigned colors red,green,blue so that no two neighboring vertices have the same color?

Page 33: Black-box (oracle)

3-COL Planar-3-COL

Page 34: Black-box (oracle)

4-COL

INSTANCE: graph G

QUESTION: can the vertices of G be assigned one of 4 colors so that no two neighboring vertices have the same color?

Page 35: Black-box (oracle)

3-COL 4-COL

Page 36: Black-box (oracle)

3-COL 4-COL

G G

Page 37: Black-box (oracle)

planar 4-COL INSTANCE: planar graph G

QUESTION: can the vertices of G be assigned one of 4 colors so that no two neighboring vertices have the same color?

planar 3-COL planar 4-COL ???

Page 38: Black-box (oracle)

4-COL 3-COL

Thus:

4-COL 3-COL

4-COL NPCook 4-COL 3-SAT3-SAT 3-COL

Page 39: Black-box (oracle)

2-COL 3-COL

Page 40: Black-box (oracle)

2-COL 3-COL

G G

Page 41: Black-box (oracle)

3-COL 2-COL ???

2-COL in P