54
Approximation Algorithms Chapter 5: k-center

Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Embed Size (px)

Citation preview

Page 1: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Approximation AlgorithmsChapter 5: k-center

Page 2: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Overview

Main issue: Parametric pruning– Technique for approximation algorithms

2-approx. algorithm for k-center 3-approx. algorithm for weighted k-center Proof of inapproximabilities of k-center

– Under the assumption that P ≠ NP.• No (2-)-approx. algorithm for k-center

• No (n)-approx. algorithm for k-center– Where the triangle inequality does not necessarily hold on weights

of edges.

Page 3: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

k-center

Task:– Choose k vertices that minimize the distances (costs)

between any vertex and the chosen vertices.

Page 4: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

k-center

Task:– Choose k vertices that minimize the distances (costs)

between any vertex and the chosen vertices.– In the example below, k = 2.

Page 5: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Applications of k-center (1/2)

Find appropriate location of branch offices.– It could be cost-effective if the branch offices place as

close as possible to any offices.

Page 6: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Applications of k-center (2/2)

Clustering by center points – In this application, the sum of the distances among

vertices in a cluster is not considered.– In this clustering, the longest distance in each cluster

should be minimized.

Page 7: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Definition of k-center (1/2)

Input:– Undirected complete graph with n vertices G=(V, E).

• The triangle inequality holds on costs of edges.

– Positive integer k.• # vertices selected as centers.

5 4

69 8

6

k =2

a b

c d

Page 8: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Definition of k-center (2/2)

Output: S ⊆V that minimizes the cost of S (|S|=k). – The cost of S: the maximum value of costs of edges

e=(v,s) between v ∈ V and s ∈ S.

5 4

69 8

6

k =2

5 4

69 8

6a b

c d

5 4

69 8

6a b

c d

a b

c d

Cost: 5 Cost: 6

)},{cost(minmax svSsVv

: vertex chosen

Page 9: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Parametric pruning (1/3)

Technique to search for optimal solution. [Basic idea]

– Suppose the cost of the optimal solution is known.– This assumption makes an input simpler by removing

irrelevant parts (edges).– However, how do we know the cost in advance?

Cost: 5Pruning

5 4

69 8

6a b

c d

5 4

a b

c d

Page 10: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Parametric pruning (2/3)

Case of a minimization problem I(t): pruned input of input I without its irrelevant

parts– irrelevant parts are what will not be used in any

solution of cost < t.

Parametric pruning1. Let T={t1,…,tk}.2. Find a lower bound of the optimal cost OPT from I(t).

Let I(t*) be a pruned input for finding the lower bound.3. Choose appropriate positive a, and find the solution of I(at*).

Page 11: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Parametric pruning (3/3)

Prune parts of an input based on cost.– In case of k-center, pruning is done on weights of

edges.

pruning

5 4

6

9 8

6a b

c d

4

a b

c d

5 4

a b

c d

5 46a b

c d

5 4

6

6a b

c d

5 4

68

6a b

c d

5 4

6

98

6a b

c d

G1 G2 G3

G4 G5 G6

G

Page 12: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Overview

Main issue: Parametric pruning– Technique for approximation algorithms

2-approx. algorithm for k-center 3-approx. algorithm for weighted k-center Proof of inapproximabilities of k-center

– Under the assumption that P ≠ NP.• No (2-)-approx. algorithm for k-center

• No (n)-approx. algorithm for k-center– Where the triangle inequality does not necessarily hold on weights

of edges.

Page 13: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

2-approximation algorithm

2-approx. algorithm for k-center

Theorem 5.5

Lower bound of theoptimal cost OPT

Lemma 5.4Parametric pruning

based on the maximalindependent set

Algorithm 5.3

Square of a graph

Relation between thedominating set and the

maximal independent set

Lemma 5.2

Equivalence between k-centerand the dominating set

The dominating set k-center

Page 14: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Dominating set

A set of chosen vertices s.t. any vertex is adjacent to a chosen vertex.

a

b c

d e

a

b c

d e

a

b c

d e

a

b c

d e

a

b c

d e

Input

Page 15: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Equivalence between… k-center

– Any weight of edge between a vertex and some chosen vertex is not more than OPT.

Dominating set of Gi

– Any vertex is connected to some chosen vertex by a edge with weight less than OPT.

4 5

5 4

6

7

9 8

86

a

b c

d e

4

5 4

a

b c

d e

cost (ei*) = OPT.

Page 16: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

2-approximation algorithm

2-approx. algorithm for k-center

Theorem 5.5

Lower bound of theoptimal cost OPT

Lemma 5.4Parametric pruning

based on the maximalindependent set

Algorithm 5.3

Square of a graph

Relation between thedominating set and the

maximal independent set

Lemma 5.2

Equivalence between k-centerand the dominating set

The dominating set k-center

Page 17: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Square of a graph

G2: Any pair of vertices are adjacent if the path length between the vertices in G is at most two.

G G2

G’ G’2

G’’ G’’2

Page 18: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Stars and cliques

Star: K1,p

Stars: A set of stars that cover all the vertices.K1,6

G

Stars in G

K1,3

K1,32

Clique

Page 19: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Independent set

Independent set S ⊆V in H – Chosen vertices s, s’∈ S are not adjacent.

G

G’

G’’

Independent set

G

G’

G’’

Non-independent set

Page 20: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.3

Input: graph G, positive integer k. 1. Construct G1

2, …, Gm2.

2. Compute a maximal independent set, Mi , in each graph Gi

2.

3. Find the smallest index i s.t. |Mi| ≦ k, say j.

4. Return Mj.

Page 21: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Overview of Algorithm 5.3

Find a maximal independent

set in Gi2.

There is at mostone chosen vertexin a clique in Gi

2.Construct Gi

2

from Gi.

There is at most one chosen vertex

in a star in Gi.

Any vertex isconnected to achosen vertexwith a path of

length 2

Page 22: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.3 Input: graph G, pos. int. k. 1. Construct G1

2, …, Gm2.

2. Find a maximal indep-endent set Mi for each Gi

2. 3. Find the smallest index

j s.t. |Mi| ≦ k.

4. Return Mj.

G

5

46

7

8 9

777

5

46 8 95

46 8

5

46

5

46

5

44

k=2

Page 23: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.3 Input: graph G, pos. int. k. 1. Construct G1

2, …, Gm2.

2. Find a maximal indep-endent set Mi for each Gi

2. 3. Find the smallest index

j s.t. |Mj| ≦ k.

4. Return Mj.

G

5

46

7

8 9

777

5

46 8 95

46 8

5

46

5

46

5

44

k=2

Page 24: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.2 (1/3)

|I| |≦ D| holds in H.– I : independent set of H2 (used in Algorithm 5.3), – D: a minimal dominating set of H (k-center).

|I| # cliques in≦ H2 = # stars in H = |D|.

Page 25: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.2 (2/3)

|I| |≦ D| holds in H,– where I is the independent set in H2 and D is the

minimum dominating set in H.

|I| ≦ # cliques in H2 = # stars in H = |D|.

Only one vertex is availablein a clique for an element of

an independent set.

H H2

Page 26: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.2 (3/3)

I| |≦ D| holds in H,– where I is the independent set in H2 and D is the

minimum dominating set in H.

Example of such case where |I| < # cliques in H.

H H2 A clique in H2

|I| ≦ # cliques in H2 = # stars in H = |D|.

Page 27: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.4 (1/2)

Algorithm 5.3 finds j s.t. cost(ej) OPT.≦

k

1 2 j-1 j index i

| Mi |

dom(Gi)

i*

1

2

Page 28: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.4 (2/2)

Algorithm 5.3 finds j s.t. cost(ej) OPT.≦

k

1 2 j index i

| Mi |

dom(Gi)

i*

1

2

j is not the minimumvalue s.t. | Mi | ≦ k.

Page 29: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.5 (1/3)

Algorithm 5.3 is a 2-approximation algorithm for k-center.– A maximal independent set S is also a dominating set.

• To show this property, suppose that a set S is not a dominating set, but a maximal independent set.

Maximal independentset S.

Suppose a non-dominating

vertex exists.

This must bein the maximalindependent set.

This fact contradicts with“S is a maximal independent set.”

Any of its adjacent verticesare not chosen.

Page 30: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.5 (2/3)

The maximal dominating set Mi Algorithm 5.3 finds is also a dominating set.– Dominating set = set of centers of stars in Gi

2.

Gi2 Gi

Some edgesdoes not

appear in Gi.

= Its weight ismore thancost(ej).

The edgeexists in Gi

2.

In Gi, these twovertices are

connected with a path length=2.

Page 31: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.5 (3/3)

Algorithm 5.3 is a 2-approximation algorithm for k-center.– Weight of any edge in Gi

2 , but not in Gi is at most 2cost (ei).

– The triangle inequalities are assumed on the weights.

Edge in Gi2

but not in Gi.

a

b 2 cost(ei)≦ 2 OPT.Less than cost(ei)

Less than cost(ei)

Page 32: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

A tight example

2

2 211

1

k = 1

OPT = 1.

2 211

1

Gi2

Gi

Cost: 2

2

Page 33: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Overview

Main issue: Parametric pruning– Technique for approximation algorithms

2-approx. algorithm for k-center 3-approx. algorithm for weighted k-center Proof of inapproximabilities of k-center

– Under the assumption that P ≠ NP.• No (2-)-approx. algorithm for k-center

• No (n)-approx. algorithm for k-center– Where the triangle inequality does not necessarily hold on weights

of edges.

Page 34: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Idea of Theorem 5.7

Assumption: P ≠ NP.

P

NP

NP-hard problemcannot be solved

in polynomial time.

Input of dominatingset (NP-complete

problem)

(2-) approx. poly.algorithm for

k-center

Answer forits input

Such algorithmdoes not exist.

Inconsistent

Page 35: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

NP-hardness of dominating set (1/3)

Poly. time reduction from Vertex Cover.– http://www.cs.umd.edu/~samir/451/red.ps– Vertex Cover is known as an NP-hard problem

Input of vertex cover

a

b c

d e

a

b c

d e

Input of dominating set

ab ac

bd cd ce

de

bc

k=3k=3

Page 36: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

NP-hardness of dominating set

Solution of Vertex Cover → Solution of dominating set.

Input of vertex cover

a

b c

d e

b c

d e

Input of dominating set

bd cd ce

deAt least one ofvertices for each edge

must be chosen. Any vertex is adjacent toa chosen vertex.

aab acbc

Page 37: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

NP-hardness of dominating set

Solution of Vertex Cover ← Solution of dominating set

Input ofVertex Cover

a

b c

d e

b c

d e

Input of dominating set

bd cd ce

de

b c

d e

Input of dominating set’

bd cd ce

de

aab acbc

aab acbc

Page 38: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.7

Poly. time reduction from dominating set to k-center.

a

b c

d e

Dominating set

a

b c

d e

k -center

weight 1

weight 2

The triangleInequality holds

on weights of edges.

Page 39: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.7

Reduction from dominating set to k-center.

a

b c

d e

Dominating seta

b c

d e

k -center

Cost of sol. = 1

[# vertices ina dominatingset in G] ≦ k

> k Cost of sol. = 2

For any input, cost of the solution is alwaysless than (2-)OPT.

In this case, edges with weight2 are unavailable.

(2-)-approx.algorithm

exists.

Page 40: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Corollary

Suppose G does not satisfy the triangle inequality.

No (n)-approx. algorithm for k-center in G. a

b c

d e

Dominating seta

b c

d e

k -center

Cost: 1

[# vertices in a dominatingset in G] ≦ k

> k Cost: (n) +

For any input, the costmust be less than (n)OPT.

Edges with (n) + are unavailable.

Page 41: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Overview

Main issue: Parametric pruning– Technique for approximation algorithms

2-approx. algorithm for k-center 3-approx. algorithm for weighted k-center Proof of inapproximabilities of k-center

– Under the assumption that P ≠ NP.• No (2-)-approx. algorithm for k-center

• No (n)-approx. algorithm for k-center– Where the triangle inequality does not necessarily hold on weights

of edges.

Page 42: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Weighted k-center

k =25 4

69 8

6a b

c d

5 4

69 8

6a b

c d

5 4

69 8

6a b

c d 5 4

69 8

6a b

c d

10 20

10 105 4

69 8

6a b

c d

5 4

6

9 8

6a b

c d

W = 30.

k-center Weighted k-center

Weightson vertices

Page 43: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Weighted k-center

Weighted k-center is a generalization of k-center.

k =25 4

69 8

6a b

c d

5 4

69 8

6a b

c d

5 4

69 8

6a b

c d5 4

69 8

6a b

c d

1 1

1 15 4

69 8

6a b

c dW = 2.

5 4

69 8

6a b

c d

k-center Weighted k-center

Page 44: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.2 in weighted k-center

k-center– # vertices in an independent set in H2 # vertices in a ≦

minimal dominating set of H Weighted k-center

– Sum of weights of vertices in an independent set in H2 Sum of weights of vertices in a minimal dominating ≦

set of H

?

HH2

10 10

20 30

10

30

10

20

Counter example

Page 45: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Adjacent vertices with min. weight

s(u): vertex adjacent to u in H with the minimum weight.– u can be s(u).– Not in H2.

a b

c d

15 20

10 25

s(a)=a,s(b)=a,s(c)=c,s(d)=c.

H

a b

c d

15 20

10 25

H2

Page 46: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.9 (1/2)

w(S) ≦w(D) = wdom(H).– Consider stars whose centers are in a minimal weight

dominating set.

H

Page 47: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lemma 5.9 (2/2)

w(S) ≦w(D) = wdom(H).– S ={s(u)|u I} (a set of vertices that is adjacent to a

vertex in I).– D: A minimum weight dominating set of H.– wdom(H): weight of a minimum weight dominating

set of H.

At most one vertex canbe chosen from a

clique as an elementof an independent set.

HH2

Choosea vertexwith lessweight.

Weight of the vertex in S is less than weight in D.

Vertex in a minimal weight

dominating set D.

Page 48: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.10

Input: graph G, positive integer k. 1. Construct G1

2, …, Gm2.

2. Compute a maximal independent set, Mi , in each graph Gi

2.

3. Si={si(u): u ∈ Mi}

4. Find the minimum index j s.t. w(Si) ≦ W.

5. Return Sj.

Page 49: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.10 Input: graph G, pos. int. k. 1. Construct G1

2, …, Gm2.

2. Compute a max. indep-endent set, Mi, in each Gi

2. 3. Find the min. index j

s.t. |Mj| ≦ k.

4. Return Mj.

G

5

46

7

8 9

5

46

7

8 9

5

46

7

8

5

46

7

5

46

5

44

10 10

20 30

Page 50: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Algorithm 5.10 Input: graph G, pos. int. k. 1. Construct G1

2, …, Gm2.

2. Compute a max. indep-endent set, Mi, in each Gi

2. 3. Find the min. index j

s.t. |Mj| ≦ k.

4. Return Mj.

G

5

46

7

8 9

5

46

7

8 9

5

46

7

8

5

46

7

5

46

5

44

10 10

20 30

W=30W=40 W=20

W=10

W=30

Page 51: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Lower bound for OPT

cost(ej) ≦ OPT where j was obtained by Algorithm 5.10.

W

1 2 j-1 j index i

w(Si)

wdom(Gi)

i*

Page 52: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Theorem 5.11

Like Theorem 5.5, the cost (length of path) between any vertex and the closest vertex in a weighted min. independent set is at most 2cost(ej).

The cost between any vertex and the closest vertex in s(u) is at most 3cost(ej).

Moving to a vertexwith less weight.

Weight is at most2cost(ej) in G.

Weight is at most3cost(ej) in G.

Page 53: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Example 5.12 ( A tight example )

11+ 1 1

1 2 2 2∞

2 2

3

2+ 3+4+

G3

1 1 1

1 2 2 2∞

Sum of weights of vertices: ∞

G41 1 1

Cost: 3

1+

W=3 G42

1 1 11+Sum of weights of vertices: 1

A maximalindependent

set

A maximalind. set

Moving to avertex withless weight

Minimum cost: 1+

Page 54: Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm

Conclusion

Parametric pruning was introduced.– Technique for approximation algorithms– 2-approx. algorithm for k-center– 3-approx. algorithm for weighted k-center– Proof of inapproximabilities of k-center

• Under the assumption that P ≠ NP.