lecture: approximationalgorithms · basicinformation lectures: mondays,12:15-13:45...

40
Jannik Matuschke October 24, 2016 Lecture: Approximation Algorithms

Upload: others

Post on 21-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Jannik Matuschke

October 24, 2016

Lecture: Approximation AlgorithmsLecture: Approximation Algorithms

Page 2: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Basic information

Lectures: Mondays, 12:15-13:45

Exercise sessions: Tuesdays (bi-weekly) 16:00-18:00(given by Marcus Kaiser)

Book: The Design of Approximation Algorithmsby D. Williamson and D. Shmoys

More info on the website.

Page 3: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Introduction toApproximation Algorithms

Page 4: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Motivation

Algorithmic wishlist1 fast (run in polynomial time)

2 universal (work for any instance)

3 optimal (find best solution)

Choose two.(unless P = NP)

Page 5: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Motivation

Algorithmic wishlist1 fast (run in polynomial time)

2 universal (work for any instance)

3 optimal (find best solution)

Choose two.(unless P = NP)

Page 6: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Motivation

Algorithmic wishlist1 fast (run in polynomial time)

2 universal (work for any instance)

3 approximately optimal (find provably good solution)

⇓Approximation Algorithms

Page 7: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Approximation Algorithms

Definition An α-approximation algorithm for an optimizationproblem is an algorithm that

I runs in polynomial time andI computes for any instance of the problem a solution,I whose value is within a factor of α of the optimal solution.

ALG: value of solution computed by algorithmOPT: value of optimal solution

for maximization problems:

ALG ≥ α · OPT

(α ≤ 1)

for minimization problems:

ALG ≤ α · OPT

(α ≥ 1)

We call α approximation factor or performance guarantee.

Page 8: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Approximation Algorithms

Definition An α-approximation algorithm for an optimizationproblem is an algorithm that

I runs in polynomial time andI computes for any instance of the problem a solution,I whose value is within a factor of α of the optimal solution.

ALG: value of solution computed by algorithmOPT: value of optimal solution

for maximization problems:

ALG ≥ α · OPT

(α ≤ 1)

for minimization problems:

ALG ≤ α · OPT

(α ≥ 1)

We call α approximation factor or performance guarantee.

Page 9: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Approximation Algorithms

Definition An α-approximation algorithm for an optimizationproblem is an algorithm that

I runs in polynomial time andI computes for any instance of the problem a solution,I whose value is within a factor of α of the optimal solution.

ALG: value of solution computed by algorithmOPT: value of optimal solution

for maximization problems:

ALG ≥ α · OPT

(α ≤ 1)

for minimization problems:

ALG ≤ α · OPT

(α ≥ 1)

We call α approximation factor or performance guarantee.

Page 10: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Example: Set Cover

Page 11: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

The Set Cover problem

Input: elements E , sets S ⊆ 2E , weights w : S → R+

Task: find S ′ ⊆ S with⋃

S∈S′ S = Eminimizing

∑S∈S′ w(S)

32

8

4

Special case: Vertex Cover

Page 12: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

The Set Cover problem

Input: elements E , sets S ⊆ 2E , weights w : S → R+

Task: find S ′ ⊆ S with⋃

S∈S′ S = Eminimizing

∑S∈S′ w(S)

32

8

4

Special case: Vertex Cover

Page 13: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

The Set Cover problem

Input: elements E , sets S ⊆ 2E , weights w : S → R+

Task: find S ′ ⊆ S with⋃

S∈S′ S = Eminimizing

∑S∈S′ w(S)

32

8

4

Special case: Vertex Cover

Page 14: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

How to design an approximation algorithm?

We don’t know OPT,but we can get lower bounds.

Page 15: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

How to design an approximation algorithm?

We don’t know OPT,but we can get lower bounds.

Page 16: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

IP formulation

min∑S∈S

w(S)x(S)

s.t.∑

S:e∈Sx(S) ≥ 1 ∀ e ∈ E

x(S) ∈ {0, 1} ∀S ∈ S

Page 17: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP relaxation

Z ∗ :=

min∑S∈S

w(S)x(S)

s.t.∑

S:e∈Sx(S) ≥ 1 ∀ e ∈ E

x(S) ≥ 0 ∀S ∈ S

LP value is lower bound:

Z ∗ ≤ OPT

Page 18: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP relaxation

Z ∗ :=

min∑S∈S

w(S)x(S)

s.t.∑

S:e∈Sx(S) ≥ 1 ∀ e ∈ E

x(S) ≥ 0 ∀S ∈ S

LP value is lower bound:

Z ∗ ≤ OPT

Page 19: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP relaxation

Z ∗ := min∑S∈S

w(S)x(S)

s.t.∑

S:e∈Sx(S) ≥ 1 ∀ e ∈ E

x(S) ≥ 0 ∀S ∈ S

LP value is lower bound:

Z ∗ ≤ OPT

Page 20: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

(Deterministic) LP Rounding

Page 21: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 22: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 23: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}

I Is every element covered?∑S∈S:e∈S

x(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 24: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?

∑S∈S:e∈S

x(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 25: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 26: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?

∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 27: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S)

≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 28: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

LP rounding

Idea: Select S if x(S) ≥ 1f . f := maxe∈E |{S : e ∈ S}|

TheoremLP rounding is an f -approximation algorithm for Set Cover.

Proof. S ′ :={

S : x(S) ≥ 1f

}I Is every element covered?∑

S∈S:e∈Sx(S) ≥ 1 ⇒ ∃ S ∈ S : x(S) ≥ 1

f

I Is the approximation factor fulfilled?∑S∈S′

w(S) ≤∑

S∈S′

w(S)·f ·x(S) ≤ f ·∑S∈S

w(S)x(S) = f ·Z ∗

Page 29: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Consequences

A priori vs. a fortioriI The LP rounding analysis gives us an a priori guarantee:

ALG ≤ f · OPT for any instance of Set Cover.I For a concrete run of the algorithm, we get an a fortiori

guarantee: If ALG /Z ∗ ≤ α, we know that ALG ≤ αOPT.

Integrality gap

The integrality gap of an LP is the ratio Z ∗OPT.

The LP rounding algorithm implies that the integrality gap of theSet Cover LP is bounded by f .

Page 30: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Consequences

A priori vs. a fortioriI The LP rounding analysis gives us an a priori guarantee:

ALG ≤ f · OPT for any instance of Set Cover.I For a concrete run of the algorithm, we get an a fortiori

guarantee: If ALG /Z ∗ ≤ α, we know that ALG ≤ αOPT.

Integrality gap

The integrality gap of an LP is the ratio Z ∗OPT.

The LP rounding algorithm implies that the integrality gap of theSet Cover LP is bounded by f .

Page 31: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

The Primal-Dual Method

Page 32: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Primal-dual method

max∑e∈E

y(e)

s.t.∑e∈S

y(e) ≤ w(S) ∀ S ∈ S

y(e) ≥ 0 ∀e ∈ E

Algorithm:1 Initialize y(e) = 0 for all e ∈ E .2 while (∃ uncovered element e′)

Increase y(e) until a set S with e ∈ S becomes tight.Add S to S ′. (

∑e∈S y(e) = w(S))

3 Return S ′.

TheoremPrimal-dual is an f -approximation algorithm for Set Cover.

Page 33: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Primal-dual method

max∑e∈E

y(e)

s.t.∑e∈S

y(e) ≤ w(S) ∀ S ∈ S

y(e) ≥ 0 ∀e ∈ E

Algorithm:1 Initialize y(e) = 0 for all e ∈ E .2 while (∃ uncovered element e′)

Increase y(e) until a set S with e ∈ S becomes tight.Add S to S ′. (

∑e∈S y(e) = w(S))

3 Return S ′.

TheoremPrimal-dual is an f -approximation algorithm for Set Cover.

Page 34: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Primal-dual method

max∑e∈E

y(e)

s.t.∑e∈S

y(e) ≤ w(S) ∀ S ∈ S

y(e) ≥ 0 ∀e ∈ E

Algorithm:1 Initialize y(e) = 0 for all e ∈ E .2 while (∃ uncovered element e′)

Increase y(e) until a set S with e ∈ S becomes tight.Add S to S ′. (

∑e∈S y(e) = w(S))

3 Return S ′.

TheoremPrimal-dual is an f -approximation algorithm for Set Cover.

Page 35: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithm

Page 36: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithmAlgorithm:

1 while (∃ uncovered element)Choose S ′ minimizing w(S′)

|S′\⋃

S∈S′ S|Add S ′ to S ′.

2 Return S ′.

n := |E |, Hn :=∑n

i=11i

TheoremThe Greedy Algorithm is an Hn-approximation for Set Cover.

Si : set selected in iteration ini : uncovered elements at start of iteration i

Lemma

For every iteration i : w(Si) ≤ni − ni+1

niOPT .

Page 37: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithmAlgorithm:

1 while (∃ uncovered element)Choose S ′ minimizing w(S′)

|S′\⋃

S∈S′ S|Add S ′ to S ′.

2 Return S ′. n := |E |, Hn :=∑n

i=11i

TheoremThe Greedy Algorithm is an Hn-approximation for Set Cover.

Si : set selected in iteration ini : uncovered elements at start of iteration i

Lemma

For every iteration i : w(Si) ≤ni − ni+1

niOPT .

Page 38: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithmAlgorithm:

1 while (∃ uncovered element)Choose S ′ minimizing w(S′)

|S′\⋃

S∈S′ S|Add S ′ to S ′.

2 Return S ′. n := |E |, Hn :=∑n

i=11i

TheoremThe Greedy Algorithm is an Hn-approximation for Set Cover.

Si : set selected in iteration ini : uncovered elements at start of iteration i

Lemma

For every iteration i : w(Si) ≤ni − ni+1

niOPT .

Page 39: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithmAlgorithm:

1 while (∃ uncovered element)Choose S ′ minimizing w(S′)

|S′\⋃

S∈S′ S|Add S ′ to S ′.

2 Return S ′. n := |E |, Hn :=∑n

i=11i

TheoremThe Greedy Algorithm is an Hn-approximation for Set Cover.

Si : set selected in iteration ini : uncovered elements at start of iteration i

Lemma

For every iteration i : w(Si) ≤ni − ni+1

niOPT .

Page 40: Lecture: ApproximationAlgorithms · Basicinformation Lectures: Mondays,12:15-13:45 Exercisesessions: Tuesdays(bi-weekly)16:00-18:00 (givenbyMarcusKaiser) Book: The Design of Approximation

Greedy algorithmAlgorithm:

1 while (∃ uncovered element)Choose S ′ minimizing w(S′)

|S′\⋃

S∈S′ S|Add S ′ to S ′.

2 Return S ′.

Theorem∑S∈S′ w(S) ≤ Hg · Z ∗, where g := maxS∈S |S|.