Black-box (oracle)

Post on 07-Feb-2016

23 views 0 download

Tags:

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)

Black-box (oracle)

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

25

2

Black-box (oracle)

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

25

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

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

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)

3-SATx = variablex = negation of a variable

literalsclause = disjunction of literals x y z x z

3-SATINSTANCE: 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

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

Independent Set

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

Independent Set

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

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:

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

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.

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

Graph G, K 3-SAT formula Fefficient transformation (i.e., polynomial – time)G has independent set of size K F is satisfiable

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

Graph G, K 3-SAT formula FV = {1,...,n} variables x1,....,xnE = edges xi xj for ij E

+ we need to ensure that K ofthe xi are TRUE

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

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 Kx y z w y z

xw

y y

zz

3-SAT Independent Set3-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

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

Many more reductions

3-SATIndependent Set

CliqueSubset-Sum3-COLPlanar 3-COLHamiltonian path

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.

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 ?

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

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

NP

P

NP-complete

NP-hard

3-SATIndependent Set

CliqueSubset-Sum3-COLPlanar 3-COLHamiltonian path

Some NP-complete problems

Clique

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

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

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

ai = B iS

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?

3-SAT 3-COL

R G

B

x x

B

x y zG G G

G R

G=true

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?

3-COL Planar-3-COL

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?

3-COL 4-COL

3-COL 4-COL

G G

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 ???

4-COL 3-COL

Thus:

4-COL 3-COL

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

2-COL 3-COL

2-COL 3-COL

G G

3-COL 2-COL ??? 2-COL in P