More Approximation Algorithms Based On Linear Programming: Exercise 1. Show That M
More Approximation Algorithms Based On Linear Programming: Exercise 1. Show That M
More Approximation Algorithms Based On Linear Programming: Exercise 1. Show That M
Multicut in trees
In the M ULTICUT problem, we are given a graph G = (V, E) with edge capacity function c : E Z+ ,
and m pairs of vertices (si , ti ), i [m]. The pairs are different, but the vertices in different pairs do not
have to be distinct. A multicut is a set of edges whose removal disconnects si and ti , for all i [m]. The
problem is to find a multicut with minimum capacity.
Exercise 1. Show that M ULTICUT is NP-hard even when G is a tree by a reduction from V ERTEX
C OVER.
Throughout this section, we assume G is a tree, so that there is a unique path Pi from si to ti in
G. This can be viewed as a S ET C OVER problem in which an edge e covers all si , ti -paths that contain
e. We will show that the algorithm P RIMAL -D UAL WITH REVERSE DELETION gives an approximation
ratio 2 for this problem.
The LP-relaxation of the IP for this problem is
X
min
ce xe
eE
X
(1)
subject to
xe 1 i [m],
ePi
xe 0, e E.
The dual program is
max
subject to
m
X
yi
i=1
X
yi ce
e e,
(2)
i: ePi
yi 0, i [m].
In the context of this problem, we need to be very specific on choosing an uncovered sk , tk -path at
each iteration. Fix a vertex r of G as the root of the tree. For each pair (si , ti ), let LCA(si , ti ) denote the
least common ancestor of si and ti , which is the vertex at the intersection of the paths from si to r and
from ti to r. Note that LCA(si , ti ) could be si or ti . Let d(si , ti ) denote the depth of LCA(si , ti ), which
is the distance between r and LCA(si , ti ). Our primal-dual based algorithm is as follows.
P RIMAL - DUAL FOR MULTICUT IN TREES
1: C , y 0, j 0
2: while C is not a multicut do
3:
Choose an uncovered path Pk with largest d(sk , tk )
1
FACILITY L OCATION is a fundamental optimization problem appearing in various context. In the uncapacitated version of the problem, we are given a complete bipartite graph G = (F, C; E) where F
represents a set of facilities and C a set of cities. The cost of opening facility i is fi , and the cost of
assigning city j to facility i is cij . The problem is to find a subset I F of facilities to be open and an
assignment a : C I assigning every city j to some facility a(j) to minimize the cost function
X
X
fi +
ca(j),j .
iI
jC
In the metric version of the problem, the cost cij satisfies the triangle inequality.
Designate a variable xi indicating if facility i is open and yij indicating if city j is assigned to facility
X
iF
X
fi xi +
cij yij
iF,jC
yij 1
j C,
(3)
iF
xi yij 0
i F, j C,
xi , yij {0, 1}, i F, j C.
Relaxing this integer program gives the following linear program
X
X
min
fi xi +
cij yij
subject to
iF
X
iF,jC
yij 1
j C,
(4)
iF
xi yij 0 i F, j C,
xi , yij 0, i F, j C.
The dual linear program is
max
subject to
X
jC
X
sj
tij fi
i F,
(5)
jC
sj tij cij i F, j C,
sj , tij 0, i F, j C.
This primal-dual pair does not fit nicely into the covering primal-dual approximation framework we
discussed. In particular, there are negative coefficients. The general idea of applying the primal-dual
method to this problem is still to find some sort of maximal dual-feasible solution, and then set to 1
the primal variables corresponding to saturated primal constraints.
P RIMAL - DUAL FOR M ETRIC U NCAPACITATED FACILITY L OCATION
Phase 1.
1: O ; // set of temporarily open facilities
2: J ; // set of connected cities thus far
3: s 0; t 0
4: while J 6= C do
5:
Increase uniformly all sj , j C J
6:
After a while, if for some edge ij, we reach sj tij = cij , then increase uniformly tij also.
7:
// Edges with sj tij = cij are called tight Edges with tij > 0 are called special
8:
As soon as an edge ij becomes tight, if i O then add j into J and declare i the connection
witness for j
X
9:
After a while, there is some i such that fi =
tij .
jC
10:
11:
12:
13:
14:
15:
end while
Phase 2.
1: Let H = (O, C) be the bipartite graph containing only special edges
2: Let I be a maximal subset of O such that there is no path of length 2 in H between any two vertices
in I
3: for each j C do
4:
if i I such that ij is special then
5:
a(j) i // call j directly connected to i
6:
else
7:
Let i be the connection witness for j
8:
if i I then
9:
a(j) i call j directly connected to i // note that ij is tight but not special
10:
else
11:
There must be some i0 I within H-distance 2 from i
12:
a(j) i0 call j indirectly connected to i0
13:
end if
14:
end if
15: end for
We shall use (s, t) to denote the returned dual-feasible solution (s, t).
16:
jC
jC
sj = sfj
sj .
iI j:ij special
jC
jC
jC
Exercise 4. The vector s found by the algorithm above is maximal in the sense that, if we increase any
sj and keep other sj the same, then there is no way to adjust the tij so that (s, t) is still dual-feasible. Is
every maximal solution s within 3 times the optimal solution to the dual linear program?
Hint: consider n facilities with opening cost of 1 each, n cities connected to distinct facilities with
cost each. In addition, there is another city that is connected to each facility with an edge of cost 1.
Exercise 5. Suppose the cost of connecting city i to facility j is c2ij , where the costs cij still satisfy the
triangle inequality (but their squares may not). Show that our algorithm gives performance ratio 9.
Exercise 6. Suppose we slightly change the problem in the following way. Each city j has a demand
dj . The cost of connecting j to an open facility i is now cij dj . (Previously, all dj are 1.) Modify our
algorithm to get a 3-approximation for this problem. (Hint: raise sj at rate dj .)
Metric k-median
The k- MEDIAN problem is very similar to the FACILITY LOCATION problem. The difference is that there
is no cost for opening facilities. On the other hand, there is an upper bound of k on the number of open
facilities.
Keeping xi and yij as in the previous section, we can obtain an integer program for the k- MEDIAN
problem. Its LP-relaxation is as follows.
X
min
cij yij
subject to
iF,jC
X
yij 1
j C,
iF
x
i F, j C,
i yij 0
X
(xi ) k
(6)
iF
xi , yij 0, i F, j C.
The dual linear program is
max
subject to
X
jF
X
sj ku
tij u
i F,
(7)
jC
sj tij cij i F, j C,
sj , tij , u 0, i F, j C.
This primal-dual pair looks strikingly similar to the primal-dual pair of the FACILITY LOCATION
problem. In fact, if we assign a cost of u to each facility in the FACILITY LOCATION problem and solve
for the primal optimal solution (x, y) and dual optimal solution (s, t), then by strong duality
X
X
X
uxi +
cij yij =
sj .
iF
iF,jC
jF
Consequently, if there
P is a value of u such that the primal optimal solution (x, y) opens exactly k facilities
(fractionally), i.e.
iF xi = k, then it is clear that (x, y) and (s, t, u) are optimal solutions to the
primal-dual pair of the k- MEDIAN problem.
On the same line of thought, suppose we can find a value of u for which the approximation algorithm
for FACILITY LOCATION returns an integral solution (x, y) and a dual-feasible solution (s, t) such that
exactly k facilities are open, then
X
X
X
X
3
uxi +
cij yij = 3
fi +
ca(j),j
iF
iF,jC
iI
jC
(sfj
+ scj )
jC
= 3
sj .
jC
This implies
cij yij =
iF,jC
ca(j),j 3
jC
sj ku ,
jC
and we would have gotten a 3-approximation algorithm for the k- MEDIAN problem. Unfortunately, it is
an open problem to find a u so that this happens. We will take a different path.
Let nc be the number of cities, nf number of facilities, n = nc + nf , and m = nc nf the number of
edges in the graph.
In the algorithm for FACILITY LOCATION, the larger u is the fewer number of facilities will be
opened. (More edges will become tight before the cost u is reached.) When u = 0, all facilities will
be opened. When u = nc cmax , where cmax is the maximum cij and n is the number of cities, only one
facility will be opened, because all edges are tight when this cost is reached. Assuming we break ties
canonically, it is easy to see that the number of opened facilities is inversely proportional to u.
Apply binary search on the interval [0, nc cmax ] to find two values u1 < u2 such that the corresponding number of opened facilities k1 , k2 satisfy k1 > k > k2 and that u2 u1 cmin /(12n2f ), where cmin
is the minimum value of cij . (If we can find a value of u for which the number of opened facilities is k,
then we are done.) Let the corresponding integral primal solutions be (x(1) , y(1) ) and (x(2) , y(2) ), and
the corresponding (fractional) dual solutions be (s(1) , t(1) ) and (s(2) , t(2) ), respectively.
First, the idea is to get a convex combination
(x, y) = (x(1) , y(1) ) + (x(2) , y(2) )
such that (x, y) opens k facilities fractionally. This means k1 + k2 = k and + = 1, which implies
k
2
= kkk
, and = kk11k
. Let
1 k2
2
(s, t) = (s(1) , t(1) ) + (s(2) , t(2) ).
Note that (s, t, u2 ) is a feasible solution to the dual program (7).
Let us estimate how good this fractional combination is. We have
X
X
(1)
(1)
cij yij 3
sj k1 u1
iF,jC
(8)
jC
(2)
cij yij
iF,jC
(2)
sj k2 u2 .
(9)
jC
We want to turn u1 in the first inequality into u2 with a small increase in the factor 3, and then take the
cmin
convex combination to estimate the cost of (x, y). Using the facts that u2 u1 12n
2 , k1 nf , and
f
cmin
(1)
iF,jC cij yij ,
we get
(1)
iF,jC
(1)
sj k1 u2 .
(10)
jC
iF,jC
sj ku2 .
jC
Thus, the fractional solution (x, y) is within (3 + 1/nf ) of the optimal. To turn the fractional solution
into an integral solution, we apply randomized rounding.
Let I1 and I2 be the set of facilities returned by the algorithm corresponding to u1 and u2 respectively.
We know |I1 | = k1 and |I2 | = k2 , and that k1 > k > k2 . The fractions and indicate how much the
solution should be leaning towards I1 and I2 . Hence, it is natural to use them as rounding probability.
The trouble is that I2 does not have enough elements, while I1 has too many elements.
We resolve this problem in the following way. For each i in I2 , let (i) be a facility in I1 nearest to
i. Let I be the set of these (i). Clearly |I | k2 < k1 . We arbitrarily pad I with elements from I1
until |I | = k2 . Our rounding procedure goes as follows.
Open all facilities in I2 with probability and all facilities in I with probability .
Pick uniformly a subset I3 of I1 I of size |I3 | = k k2 and open all facilities in I3 . Note that
each element in I1 I has a probability of
k1 k2 1
k k2
kk2 1
=
=
k1 k2
k
1 k2
kk
2
of being chosen.
Return the set I of k opened facilities.
The next thing to do is to assign cities to these opened facilities. Consider any city j. Let i1 and i2 be
the facilities that j was connected to in the solutions I1 and I2 . In the first case, suppose i1 I . Since
either i1 or i2 is open, we set a(j) to be the open facility. In the second case, suppose i1
/ I , in which
case we connect j to i1 if it is open (i.e. i1 I3 ), otherwise to i2 if it is open. If both i1 and i2 are not
open, we connect j to i3 = (i2 ).
We estimate the expected cost of connecting j to a(j). In the first case (i1 I ),
E[ca(j),j ] = ci1 j + ci2 j .
In the second case when i1 6 inI , there is a probability of that i1 is in I3 , a probability of (1) = 2
that i1
/ I3 but i2 is open, and a probability of (1 )(1 ) = that j will be connected to i3 . Thus,
in this case
E[ca(j),j ] = ci1 j + 2 ci2 j + ci3 j .
By the triangle inequality, we have
ci3 j ci3 i2 + ci2 j ci1 i2 + ci2 j ci1 j + 2ci2 j .
Consequently,
E[ca(j),j ] (1 + )ci1 j + (1 + )ci2 j (1 + max{, })[ci1 j + ci2 j ].
We have just shown the following theorem.
7
Theorem 3.1. The above rounding procedure gives expected cost at most (1 + max{, }) the cost of
(x, y).
Thus, in total the rounded solution is of cost at most (3+1/nf )(1+max{, }) of the optimal. Since
max{, } is at most nf /(nf + 1), and (3 + 1/nf )(1 + nf /(nf + 1)) 6, we obtain a 6-approximation.
The algorithm can be derandomized with the method of conditional expectation. Note that the expectations E[ca(j),j ] can be calculated explicitly and efficiently. To derandomize this algorithm, we compute
the expectations of the final cost given that we open I2 or I . We then follow the smaller expectation (in
the or weighted sense). To compute which I3 to open, we can compute the conditional expectations
of the cost given that elements i1 , . . . , ik2 k1 of I1 I2 are in I3 , then repeat this process.
Exercise 7 (Vaziranis book - Exercise 25.3). Use Lagrangian relaxation technique to give a constant factor approximation algorithm for the following common generalization of the FACILITY LOCATION and
k- MEDIAN problems. Consider the UNCAPACITATED FACILITY LOCATION problem with the additional
constraint that at most k facilities can be opened.
Exercise 8 (Jain and Vazirani [10]). Consider the l22 - CLUSTERING problem. Given a set of n points
S = {v1 , . . . , vn } in Rd and a positive integer k, the problem is to find a minimum cost k-clustering, i.e.,
to find k points, called centers, f1 , . . . , fk Rd , so as to minimize the sum of squares of distances from
each point vi to its closest center. This naturally defines a partitioning of the n points into k clusters.
Give a constant factor approximation algorithm for this problem.
(Hint: first show that restricting the centers to a subset of S increases the cost of the optimization
solution by a factor of at most 2.)
Historical Notes
The 2-approximation for multicut in trees was due to Garg, Vazirani, and Yannakakis [6]. Recent works
on integer multi-commodity flow can be found in [35, 7, 14]. For an example of multi-commodity flow
in networking, see [12].
For the UNCAPACITATED FACILITY LOCATION problem, Hochbaum [8] obtained ratio O(lg n),
Shmoys, Tardos, and Aardal [13] got 3.16 ratio with an LP-rounding based algorithm. The 3-approximation
algorithm we described was due to Jain and Vazirani [10]. Jain, Mahdian and Saberi [9] reduce the ratio
further to 1.61 with a greedy algorithm analyzed by the dual-fitting method.
For the METRIC k- MEDIAN problem, Bartal [] gave the first algorithm which achieved approximation
ratio O(lg n lg lg n). Charikar, Guha, Tardos, and Shmoys [2] achieved 6 23 using ideas from Lin and
Vitter [11]. The 6-approximation algorithm we described was due to Jain and Vazirani [10]. Arya, Garg,
Khandekar, Meyerson, Munagala, and Pandit [1] achieved ratio (3 + 2/p) with running time O(np ), for
any p using the local search method. Jain, Mahdian, and Saberi [9] gave a hardness ratio of 1 + 2/e for
approximating this problem.
References
[1] V. A RYA , N. G ARG , R. K HANDEKAR , A. M EYERSON , K. M UNAGALA , AND V. PANDIT, Local search heuristics for
k-median and facility location problems, SIAM J. Comput., 33 (2004), pp. 544562 (electronic).
TARDOS , AND D. B. S HMOYS, A constant-factor approximation algorithm for the k[2] M. C HARIKAR , S. G UHA , E.
median problem, J. Comput. System Sci., 65 (2002), pp. 129149. Special issue on STOC, 1999 (Atlanta, GA).
[3] C. C HEKURI AND S. K HANNA, Edge disjoint paths revisited, in Proceedings of the Fourteenth Annual ACM-SIAM
Symposium on Discrete Algorithms (Baltimore, MD, 2003), New York, 2003, ACM, pp. 628637.
[4] C. C HEKURI , S. K HANNA , AND F. B. S HEPHERD, The all-or-nothing multicommodity flow problem, in STOC 04:
Proceedings of the thirty-sixth annual ACM symposium on Theory of computing, New York, NY, USA, 2004, ACM
Press, pp. 156165.
[5] C. C HEKURI , S. K HANNA , AND F. B. S HEPHERD, Edge-disjoint paths in undirected planar graphs, in FOCS 04 (Rome,
Italy, ACM, New York, 2004, pp. ???? (electronic).
[6] N. G ARG , V. V. VAZIRANI , AND M. YANNAKAKIS, Primal-dual approximation algorithms for integral flow and multicut in trees, Algorithmica, 18 (1997), pp. 320.
[7] V. G URUSWAMI , S. K HANNA , R. R AJARAMAN , B. S HEPHERD , AND M. YANNAKAKIS, Near-optimal hardness results
and approximation algorithms for edge-disjoint paths and related problems, J. Comput. System Sci., 67 (2003), pp. 473
496.
[8] D. S. H OCHBAUM, Heuristics for the fixed cost median problem, Math. Programming, 22 (1982), pp. 148162.
[9] K. JAIN , M. M AHDIAN , AND A. S ABERI, A new greedy approach for facility location problems, in STOC 02: Proceedings of the thiry-fourth annual ACM Symposium on Theory of Computing, ACM Press, 2002, pp. 731740.
[10] K. JAIN AND V. V. VAZIRANI, Approximation algorithms for metric facility location and k-median problems using the
primal-dual schema and Lagrangian relaxation, J. ACM, 48 (2001), pp. 274296.
[11] J.-H. L IN AND J. S. V ITTER, Approximation algorithms for geometric median problems, Inform. Process. Lett., 44
(1992), pp. 245249.
[12] A. E. O ZDAGLAR AND D. P. B ERTSEKAS, Optimal solution of integer multicommodity flow problems with application
in optical networks, in Frontiers in global optimization, vol. 74 of Nonconvex Optim. Appl., Kluwer Acad. Publ., Boston,
MA, 2004, pp. 411435.
TARDOS , AND K. A ARDAL, Approximation algorithms for facility location problems (extended
[13] D. B. S HMOYS , E.
abstract), in STOC 97: Proceedings of the twenty-ninth annual ACM symposium on Theory of computing, ACM Press,
1997, pp. 265274.
[14] K. VARADARAJAN AND G. V ENKATARAMAN, Graph decomposition and a greedy algorithm for edge-disjoint paths, in
Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms (SODA04), Philadelphia, PA, USA,
2004, Society for Industrial and Applied Mathematics, pp. 379380.