25.12.2014 Views

An Introduction to Approximation Algorithms - School of Technology ...

An Introduction to Approximation Algorithms - School of Technology ...

An Introduction to Approximation Algorithms - School of Technology ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

<strong>An</strong> <strong>Introduction</strong> <strong>to</strong> <strong>Approximation</strong> <strong>Algorithms</strong><br />

Daya Gaur<br />

Department <strong>of</strong> Computer Science and Engineering<br />

Indian Institute <strong>of</strong> <strong>Technology</strong> Ropar<br />

IGGA Workshop at DAIICT<br />

14 March 2012


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

approximation algorithms<br />

Example<br />

trade o accuracy for time.<br />

for every instance we compute an α approximate solution in<br />

polynomial time.<br />

Travelling salesperson: an approximation algorithm returns a <strong>to</strong>ur<br />

no more than twice the length <strong>of</strong> the shortest <strong>to</strong>ur for every<br />

instance.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Types <strong>of</strong> approximation algorithms<br />

Good news: there are problems in NP that admit FPTAS.<br />

Bad news: there are problems in NP than do not admit any<br />

approximation algorithm (unless..)<br />

Inapproximability can be thought <strong>of</strong> as more rened study <strong>of</strong> class<br />

NP-C.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Vertex cover<br />

IP : minimize ∑ w v x v<br />

v∈V<br />

x u + x v >= 1 ∀(u,v) ∈ E<br />

x v ∈ {0,1} ∀v ∈ V<br />

LP : minimize ∑ w v x v<br />

v∈V<br />

x u + x v >= 1 ∀(u,v) ∈ E<br />

x v ≥ 0 ∀v ∈ V


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Matching<br />

D − LP : minimize ∑ y uv<br />

(u,v)∈e<br />

∑ y uv ≤ w u for all u ∈ V<br />

v∈n(u)<br />

y uv ≥ 0 ∀v ∈ V<br />

M : minimize ∑ y uv<br />

(u,v)∈e<br />

∑ y uv ≤ w u for all u ∈ V<br />

v∈n(u)<br />

y uv ∈ {0,1} ∀v ∈ V


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Set cover<br />

IP : minimize ∑ w s x s<br />

s∈S<br />

∑ x s >= 1 ∀v ∈ U<br />

s:v∈s<br />

x s ∈ {0,1} ∀s ∈ S<br />

LP : minimize ∑ w s x s<br />

v∈v<br />

∑ x s >= 1 ∀v ∈ U<br />

s:v∈s<br />

x s ≥ 0 ∀s ∈ S


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Set cover: dual<br />

LP : maximize ∑ y u<br />

u∈V<br />

∑ y v ≤ w s ∀s ∈ S<br />

v∈s<br />

y v ≥ 0 ∀v ∈ V<br />

ILP : maximize ∑ y u<br />

u∈V<br />

∑ y v ≤ w s ∀s ∈ S<br />

v∈s<br />

y v ∈ {0,1} ∀v ∈ V


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Shortest paths in digraphs<br />

⎧<br />

⎨<br />

∑ x e =<br />

⎩<br />

e∈n(v)<br />

ip : minimize ∑ w e x e<br />

e∈e<br />

1 if v = s<br />

−1 if v = t<br />

0 otherwise<br />

x e ∈ {0,1} ∀e ∈ E<br />

vertex, edge incidence matrix. (u,e) is 1 is edge goes out from u,<br />

−1 otherwise.<br />

LP relaxation poly<strong>to</strong>pe is integral (integrality gap is 1).


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Constrained shortest paths<br />

⎧<br />

⎨<br />

∑ x e =<br />

⎩<br />

e∈n(v)<br />

ip : minimize ∑ w e x e<br />

e∈e<br />

1 if v = s<br />

−1 if v = t<br />

0 otherwise<br />

∑ d e x e ≤ d<br />

e∈e<br />

x e ∈ {0,1}∀e ∈ e


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Constrained shortest paths<br />

IP 1 : min ∑<br />

e∈e<br />

w e x e + λ(∑<br />

∑ x e =<br />

e∈n(v)<br />

⎧<br />

⎨<br />

⎩<br />

e∈e<br />

d e x e − d)<br />

1 if v = s<br />

−1 if v = t<br />

0 otherwise<br />

∑ d e x e ≤ d<br />

e∈e<br />

x e ∈ {0, 1} ∀e ∈ e<br />

Let x∗ be the optimal integral solution <strong>to</strong> the constrainted shortest<br />

path problem. v(ip, x∗) ≥ v(IP 1 , x∗) for λ ≥ 0.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Constrained shortest paths<br />

IP L : min ∑<br />

e∈e<br />

∑ x e =<br />

e∈n(v)<br />

w e x e + λ(∑<br />

⎧<br />

⎨<br />

⎩<br />

e∈e<br />

d e x e − d)<br />

1 if v = s<br />

−1 if v = t<br />

0 otherwise<br />

x e ∈ {0,1} ∀e ∈ e<br />

Let x ′ be the optimal integral solution <strong>to</strong> IP L .<br />

v(IP 1 , x∗) ≥ v(IP L , x ′ ) ∀λ ≥ 0.<br />

Theorem<br />

The value <strong>of</strong> optimal solution <strong>to</strong> IP L is a lower bound on the value <strong>of</strong> x∗.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Lagrangian relaxation<br />

IP L is the lagrangian relaxation.<br />

we want the best possible lower bound, therefore nd λ such<br />

that optimal <strong>to</strong> IP L maximized.<br />

largarangian can be solved using subgradient methods (note<br />

that the function might not be dierentiable).<br />

or using column generation (dantzig-wolfe decomposition).<br />

lagrangian bound is atleast as good as the linear programming<br />

bound, for integral poly<strong>to</strong>pes the two bounds coincide


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Greedy algorithm for set cover<br />

r = {}<br />

sol = {}<br />

while r != u<br />

s : min { w(s)/|s \ r| }<br />

sol


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

<strong>An</strong>alysis<br />

Pro<strong>of</strong>.<br />

∑ p(e) = w(sol)<br />

e∈u<br />

consider a set s = (s 1 ,...,s k )<br />

for all<br />

∑<br />

s i<br />

∈s<br />

i, p(s i ) ≤ w(s)<br />

k − i<br />

p(s i ) ≤ w(s)h(k)<br />

p(e)/h(n) is feasible in the dual<br />

by weak duality the performance ratio is h(n).<br />

s ′ is are ordered in the order they are covered by the greedy.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Vertex cover<br />

ip : minimize ∑<br />

v∈v<br />

w v x v<br />

x u + x v >= 1 ∀(u, v) ∈ e<br />

x v ∈ {0, 1} ∀v ∈ v<br />

lp : minimize ∑ w v x v<br />

v∈v<br />

x u + x v >= 1 ∀(u, v) ∈ e<br />

x v ≥ 0 ∀v ∈ v<br />

let x ∗ be the optimal lp solution.<br />

x v =<br />

{ 1 if x ∗<br />

v >= 1 2<br />

0 otherwise.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Vertex cover<br />

each constraint contains atleast one variable with value ≥ 1/2<br />

in x ∗ .<br />

rounding gives a feasible integral solution.<br />

value <strong>of</strong> the integral solution is at most double the value <strong>of</strong> the<br />

optimal lp solution.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Half integrality <strong>of</strong> vertex cover<br />

Denition<br />

A solution <strong>to</strong> an LP is an extreme point if it cannot be expressed as<br />

a convex combination <strong>of</strong> two other feasible solutions.<br />

Lemma<br />

Every extreme point solution is half integral i.e., x v ∈ {0,1/2,1}.<br />

Pro<strong>of</strong>.<br />

a v =<br />

V p = {v | x ∗ v > 1/2} V n = {v | xv ∗ < 1/2}<br />

⎧<br />

⎨ x ∗ ⎧<br />

v + ɛ if v ∈ V p ⎨ x<br />

xv ∗ v ∗ − ɛ<br />

− ɛ if v ∈ V n b<br />

⎩<br />

v = xv ∗ + ɛ<br />

⎩<br />

x ∗ v<br />

otherwise.<br />

x ∗ v<br />

if v ∈ V p<br />

if v ∈ V n<br />

otherwise.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Pricing method for vertex cover<br />

Denition<br />

p e ≥ 0 is the price associated with each edge e.<br />

w v is the cost associated with each vertex v.<br />

price p is fair if for every vertex ∑ e on v p e ≤ w v .<br />

Theorem<br />

A fair price is a lower bound on the cost <strong>of</strong> any vertex cover.<br />

∑<br />

∑ p e ≤ w v<br />

e on v<br />

p e ≤ w(s)<br />

∑<br />

v∈s e on v


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Algorithm<br />

Denition<br />

A vertex is saturated if ∑ e on v p e = w v<br />

an edge is uncovered if neither <strong>of</strong> its endpoints are in the cover.<br />

price <strong>of</strong> e = 0<br />

while there exists an<br />

uncovered edge e<br />

raise price on e<br />

without violating<br />

fairness<br />

s = { v | v is saturated}


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

<strong>An</strong>alysis<br />

Theorem<br />

Cost <strong>of</strong> vertex cover produced is at most twice the fair price.<br />

Pro<strong>of</strong>.<br />

Every vertex in the cover is saturated.<br />

∑<br />

∑ p e = w v<br />

e on v<br />

p e = w(s)<br />

∑<br />

v∈s e on v<br />

2∑<br />

e<br />

p e ≥ w(s)


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Complementary slackness<br />

n<br />

∑<br />

i=1<br />

P : min<br />

a ji x i ≥ b j ,<br />

∑ n i=1 c ix i<br />

j = 1..m<br />

x i ≥ 0<br />

m<br />

∑<br />

j=1<br />

D : max<br />

a ji y j ≤ c i ,<br />

∑ m j=1 b jy j<br />

i = 1..n<br />

y j ≥ 0


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Complementary slackness<br />

Theorem<br />

Let x,y be primal and dual feasible solutions. x,y are optimal if<br />

and only if following conditions are satised:<br />

1 x i (∑ m j=1 a jiy j − c i ) = 0 for all 1 ≤ i ≤ n<br />

2 y j (∑ n i=1 a jix i − b j ) = 0 for all 1 ≤ j ≤ m.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Relaxed complementary slackness<br />

Denition<br />

Let x,y be primal and dual feasible solutions. x,y are said <strong>to</strong> satisfy<br />

relaxed complementary slackness condition if:<br />

1 x i > 0 =⇒ c i<br />

α ≤ ∑m j=1 a jiy j ≤ c i = 0 for all 1 ≤ i ≤ n<br />

2 y j > 0 =⇒ (b j ≤ ∑ n i=1 a jix i ≤ βb j ) = 0 for all 1 ≤ j ≤ m.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

rcsc<br />

Theorem<br />

If x,y are feasible and satisfy rcsc then ∑ n i=1 c ix i ≤ αβ ∑ m j=1 b jy j .<br />

Pro<strong>of</strong>.<br />

n<br />

∑<br />

i=1<br />

n<br />

∑<br />

m∑<br />

c i x i ≤ α<br />

i=1(<br />

j=1<br />

m<br />

∑<br />

j=1( n∑<br />

i=1<br />

a ij x i<br />

)<br />

y j ≤ β<br />

a ij y j<br />

)<br />

x i<br />

m<br />

∑ b j y j<br />

j=1


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Pricing method for vertex cover revisited<br />

α = 1, β = 2<br />

x v > 0 =⇒ ∑ e on v p e = w v<br />

p e > 0 =⇒ x u + x v ≤ 2<br />

primal conditions: pick only saturated vertices in the cover.<br />

dual conditions: from every edge pick atmost two vertices in<br />

the cover.<br />

primal conditions satised by pricing algorithm, dual conditions<br />

satised au<strong>to</strong>matically


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Point Cover<br />

all the horizontal lines (12) comprise the optimal solution, and the greedy<br />

algorithm will pick all the vertical lines (22). the example can be<br />

generalized.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

2D<br />

The problem is equivalent <strong>to</strong> vertex cover in bipartite graphs in 2-D.<br />

Theorem ( KönigEgerváry)<br />

The size <strong>of</strong> the minimum vertex cover is the same as the size <strong>of</strong> the<br />

maximum matching in a bipartite graph.<br />

2-D can be solved optimally.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

d dimensions<br />

Let L be the set <strong>of</strong> all the axis parallel lines, associated with each<br />

line l ∈ L is a binary variable y l whose value is 1 if the line is picked<br />

in the solution, 0 otherwise. L(x i ) is the set <strong>of</strong> axis parallel lines<br />

through point x i .<br />

IP: min ∑ y l (1)<br />

l∈L<br />

∑<br />

l : l∈L(x i )<br />

y l ≥ 1 ∀ x i (2)<br />

y l ∈ {0,1} (3)


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

The linear programming relaxation LP <strong>to</strong> the integer program IP, is<br />

obtained by replacing constraints <strong>of</strong> type (3) with non-negativity<br />

constraints y l ≥ 0. The linear programming dual <strong>of</strong> LP is:<br />

LP-dual: max<br />

n<br />

∑<br />

i=1<br />

z i (4)<br />

∑ z i ≤ 1 ∀ l ∈ L (5)<br />

i : l∈L(x i )<br />

z i ≥ 0 (6)


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

Primal-dual d approximation<br />

while there exists an uncovered point, the algorithm picks all<br />

the d axis parallel lines that go through the point.<br />

set y l = 1 if the line is picked by the algorithm else y l = 0. let<br />

x i be the uncovered point picked in iteration j, then set z i = 1.<br />

solutions constructed above are feasible, and the value <strong>of</strong> the<br />

primal solution is at most d times the value <strong>of</strong> the dual<br />

solution, i.e. the performance ratio is d.


<strong>Introduction</strong> Lower bounds Dual tting Rounding Primal-dual Point cover<br />

R. Bar-Yehuda and S. Even, A linear-time approximation algorithm for the weighted cover<br />

problem. Journal <strong>of</strong> <strong>Algorithms</strong>, 2:198203, 1981.<br />

G. B. Dantzig, L. R. Ford, D. R. Fulkerson, A primal-dual algorithm for linear programs, In Linear<br />

Inequalities and Related Systems, Edi<strong>to</strong>rs Kuhn and Tucker, pages 171181, Prince<strong>to</strong>n University<br />

Press, 1956.<br />

T. Gonzalez, edi<strong>to</strong>r, Handbook <strong>of</strong> <strong>Approximation</strong> <strong>Algorithms</strong> and Meta Heuristics, CRC Press,<br />

2007.<br />

D. Hochbaum, edi<strong>to</strong>r, <strong>Approximation</strong> <strong>Algorithms</strong> for NP-hard problems, PWS Publishing, Bos<strong>to</strong>n,<br />

1997.<br />

V. Vazirani, <strong>Approximation</strong> <strong>Algorithms</strong>, Springer, 2001.<br />

Figures are from Wikipedia.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!