instructor: dr. gautamdas february 24, 2009 class notes by ranganath m r

16
Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Upload: patricia-york

Post on 20-Jan-2018

226 views

Category:

Documents


0 download

DESCRIPTION

NP Hard Problems A problem p belongs to NP – Hard if, p is as hard as any NP complete problem i.e. if any NP complete problem ≤ p p ii is not known to have a polynomial verification time for p.

TRANSCRIPT

Page 1: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Instructor: Dr. GautamDas February 24, 2009

Class notes by Ranganath M R

Page 2: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

OverviewNP Hard ProblemsP Space (Polynomial Space)Quantified SAT (P Space complete problem)Deterministic Approximation AlgorithmsVertex Cover approximation algorithm.

Page 3: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

NP Hard ProblemsA problem p belongs to NP – Hard if,

p is as hard as any NP complete problem i.e. if any NP complete problem ≤p p

ii is not known to have a polynomial verification time for p.

Page 4: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

P Space (Polynomial space)A problem p belongs to P Space if,

There exists an algorithm to solve the problem that only requires a polynomial amount of extra memory.

Input : n Extra memory polynomial (n)

The P Space extends even outside the NP complete space and Co-NP Space

Page 5: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

ExampleThe SAT problem is closed under P Space.

We can have an integer whose length in bits is equal to the number of variables of the SAT problem. Example if we 8 variables in SAT, then we take an integer with 8 bits(byte). Each bit of the integer represents the variable of the SAT problem. Hence the entire truth assignments can be verified in extra space which is poynomial.

Page 6: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Quantified SAT problemExample: let f: (X1 v X2) ^ (X1 v X3bar ) ^

(X2 v X1 v X3bar v X4 bar ) Does there exist X1 and X2 such that for all X3

and X4 f(X1, X2,X3,X4) = 1 (true).

This Problem is P space complete as this problem takes extra memory which is not polynomial. This is because we should check the function F, for every value of X3 and X4 when X1 and X2 are fixed. Hence this problem is P Space complete.

Page 7: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

In general, if a problem of the sort ( there exists ………….For all ……….. There

exists…………for all) are all P space complete.

Page 8: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Deterministic Approximation AlgorithmsVertex Cover Problem:

Input: G(V,E)Vertex Cover Problem: Approx algorithm A

for the VC problem is one that produces a VC , Vapprox such that

A runs in poly time 1 ≤ (Vapprox / Vopt ) ≤ C.

Vopt is the optimal Vertex cover for the same graph

C is some constant.

Page 9: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

An approximation algorithm for VCLets us consider this graph for the VC

problem.A

C D

B

E

Page 10: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Approximation Algorithm for calculating VCStep1: Select any edge, then add the two

nodes which are at the edge into the VC set.Step2: Delete all the edges originating from

those two verticies.Step3: If all the edges are not covered, then

go to step 1Else : we have the VC being the approximate

vertex cover set.

Page 11: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Example of the problemSelect edge BE. Vapprox = {B,E}

A

C D

B

E

Page 12: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Now the edges are originating from B and E are removed . VC = {B,E}

A

C D

B

E

Page 13: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Now select AC. Vapprox = {B,E,A,C}

A

C D

B

E

Page 14: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Now no edges are remaining hence Vapprox = {B,E,A,C}

A

C D

B

E

Page 15: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Now, the Vopt , should atleast contain two of the vertices or more.

A

C D

B

E

Page 16: Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R

Hence in general, the if the Vapprox contains 2L nodes, the Vopt will contain atleast L nodes. Hence C in this case is less than or equal to 2L/L.