Improved Local Search Based Approximation Algorithm for Hard Uniform Capacitated k-Median Problem

In this paper, we study the hard uniform capacitated $k$- median problem using local search heuristic. Obtaining a constant factor approximation for the \ckm problem is open. All the existing solutions giving constant-factor approximation, violate at least one of the cardinality and the capacity constraints. All except Koruplou et al are based on LP-relaxation. We give $(3+\epsilon)$ factor approximation algorithm for the problem violating the cardinality by a factor of $8/3 \approx 2.67$. There is a trade-off between the approximation factor and the cardinality violation between our work and the existing work. Koruplou et al gave $(1 + \alpha)$ approximation factor with $(5 + 5/\alpha)$ factor loss in cardinality using local search paradigm. Though the approximation factor can be made arbitrarily small, cardinality loss is at least $5$. On the other hand, we improve upon the results in [capkmGijswijtL2013],[capkmshili2014], [Lisoda2016] in terms of factor-loss though the cardinality loss is more in our case. Also, these results are obtained using LP-rounding, some of them being strengthened, whereas local search techniques are simple to apply and have been shown to perform well in practice via empirical studies. We extend the result to hard uniform capacitated $k$-median with penalties. To the best of our knowledge, ours is the first result for the problem.


Introduction
k -median problem is one of the extensively studied problem in literature [1,3,4,5,9,11,12,20,21,27]. The problem is known to be NP-hard. The input instance consists of a set F of facilities, a set C of clients, a non-negative integer k and a non-negative cost function c defining cost to connect clients to the facilities. Metric version of the problem assumes that c is symmetric and satisfies triangle's inequality. The goal is to select a subset S ⊆ F as centers with |S| ≤ k (cardinality constraint) and to assign clients to them such that the total cost of serving the clients from centers is minimum. In capacitated version of the problem, we are also given a bound u i on the maximum number of clients that facility i can serve. The soft capacity version allows a facility to be opened any number of times whereas the hard capacity version restricts the facilities to be opened at most once. In k-median with penalties, each client j has an associated penalty p j and we are allowed not to serve some clients at the cost of paying penalties for them. In this paper, we address the hard-capacitated k median (CkM) problem and its penalty variant(CkMP), when the capacities are uniform i.e. u i = U for all i ∈ F. Our results are stated in Theorems 1 and 2. For the problems, we define an (a, b)-approximation algorithm as a polynomial-time algorithm that computes a solution using at most bk number of facilities with cost at most a times the cost of an optimal solution using at most k facilities. Theorem 1. There is a polynomial time local search heuristic that approximates hard uniform capacitated k median problem within (3 + ) factor of the optimal violating the cardinality by a factor of 8 3 . In contrast to the LP-based algorithms, local search technique is known to be straightforward , simple to apply and has been shown to perform well in practice via empirical studies [22,23]. Power of local search technique over the LP-based algorithms is well exhibited by the fact that there are constant factor approximation (3 for uniform and 5 for non-uniform) [2,6] for capacitated facility location problem whereas the natural LP is known to have an unbounded integrality gap. On the other hand, local search heuristics are notoriously hard to analyze. This is evident from the fact that the only work known, based on local search heuristics, for CkM, is due to Korupolu et al. [22] more than 15 years ago.
Our work provides a trade-off between the approximation factor and the cardinality violation with the existing work. Koruplou et al. [22] gave (1 + α) approximation factor with (5 + 5/α) factor loss in cardinality using local search paradigm. Though the approximation factor can be made arbitrarily small, cardinality loss is at least 5. Small approximation factor is obtained at a big loss in cardinality. For example, for α anything less than 1, cardinality violation is more than 10. To achieve 3 factor approximation using their heuristic, cardinality violation is 7.5. Thus, we improve upon their result in terms of cardinality. On the other hand, we improve upon the results in [1,25,26] in terms of factorloss though the cardinality loss is a little more in our case. Aardal et al. [1] gave (7 + ) factor approximation, with the violation of cardinality by a factor 2 using LP Rounding. O(1/ 2 ) factor approximation is given in [25,26] violating the cardinality by a factor of (1 + ) using sophisticated strengthened LPs. Theorem 2. There is a polynomial time local search heuristic that approximates hard uniform capacitated k median problem with penalties within (3 + ) factor of the optimal violating the cardinality by a factor of 8 3 . To the best of our knowledge, no result is known for CkMP.

Related Work
Both, LP-based algorithms as well as local search heuristics, have been used to obtain good approximate algorithms for the (uncapacitated) k-median problem. [1,3,4,5,9,11,12,20,21,27]. The best known factor of 2.611 + was given by Byrka et al. [9]. Obtaining a constant approximation factor for CkM is an open problem. Natural LP is known to have an unbounded integrality gap when one of the constraints (cardinality/capacity) is allowed to be violated by a factor of less than 2 without violating the other constraint, even for uniform capacities.
Several constant factor approximations are known [8,11,12,24,16] for the problem that violate the capacities by a factor of 2 or more. A (7 + ) algorithm was given by Aardal et al. [1] violating the cardinality constraint by a factor of 2. Koruplou et al. [22] gave (1 + α) approximation factor with (5 + 5/α) factor loss in cardinality. Very recently, Byrka et al. [10] broke the barrier of 2 in capacities and gave an O(1/ 2 ) approximation violating capacities by a factor of (1 + ) factor for uniform capacities. For non-uniform capacities, a similar result has been obtained by Demirci et al. in [14]. Li [25,26] strengthened the LP to break the barrier of 2 in cardinality and gave an (O(1/ 2 log(1/ ))) approximation using at most (1 + )k facilities. Though the algorithm violates the cardinality only by 1 + , it introduces a softness bounded by a factor of 2. The running time of the algorithm is n O(1/ ) .
The other commonly used technique for the problem is local search [4,11,22] with the best factor of 3 + given by Arya et al. [4]. Local search technique has been particularly useful to deal with capacities for the facility location problem [13,29,33,17,30,2,6].
Some results are known for the penalty variant of (uncapacitated) facility location problems, TSP and steiner network problems [28,19,31,32,15,7]. For the capacitated variant of facility location problem with penalties, 5.83 + factor approximation for uniform and 8.532+ factor for non-uniform capacities were given by Gupta and Gupta in [18]. This is the only result known for the problems with extension on capacities as well as penalties.

High Level Idea
Let S denote any feasible solution. The algorithm performs one of the following operations if it reduces the cost and it halts otherwise. The local search operations are swap(s, o); s ∈ S, o ∈ F\S and double-swap({s 1 , s 2 }, {o 1 , o 2 }); s 1 , s 2 ∈ S, o 1 , o 2 ∈ F \ S. Given a set of open facilities, min-cost flow problem is solved to obtain the optimal assignments of clients to opened facilities.
To define the swaps and the reassignments for the purpose of analysis, we extend the ideas of Arya et al. [4]. Swaps are defined so that every facility in optimal solution is swapped in at least once and at most thrice whereas facilities in our locally optimal solution is swapped out at most thrice. When a facility in our locally optimal solution is swapped out, some of its clients are reassigned to other facilities in our solution via a mapping similar to the one defined in [4]. However, for the capacitated case, mapping needs to be done a little carefully. An almost fully utilized facility may not be able to accommodate all the clients mapped to it and conversely a partially utilized facility may not be able to accommodate the load of an almost fully utilized facility. To address this concern, we partition the facilities of our locally optimal solution into heavy (denoted by S H ) and light (denoted by S L ). A facility is said to be heavy if it serves more than (3U/5) clients in our solution and is called light otherwise. Heavy facilities neither participate in swaps nor the mapping. Thus, mapping is defined between the clients of light facilities only. We allow to open ( 8 3 k) facilities in our solution so that we have at least k light facilities.
There are two situations in which we may not be able to define a feasible mapping between the clients of two light facilities. First situation is explained as follows: Let O denote some optimal solution, let M o be the number of clients, a facility o ∈ O shares with the light facilities of our solution. All the clients of a facility s ∈ S L cannot be mapped to clients of other facilities of our solution if s shares more than M o /2 clients with o. Second situation arises when s shares more than 2U/5 clients with o. In this case, mapping may be possible but it may not be feasible as the other facility s , to which its clients are mapped, may not have sufficient available capacity to accommodate the clients of s. We say that s dominates o in the first case and that s covers o in the second case.
Although a facility s ∈ S L may dominate several facilities in O, it can cover at most one facility in O. Whereas, a facility o ∈ O can be dominated by at most one facility in S L , it can be covered by at most two facilities in S L . The scenario in which a facility o ∈ O is covered by exactly 2 facilities, say s 1 and s 2 needs to be handled carefully. In this case, we say that s 1 as well as s 2 specially covers o. We denote the set of such facilities in O as O sp . Since mapping of clients of s 1 and s 2 cannot be done in o, we would like to swap s 1 and s 2 with o and, assign their clients to o, i.e. we would like to perform swap({s 1 , s 2 }, o). However since we do not have this operation, we look for one more facility o in O so that we can perform double-swap of {s 1 , s 2 } with {o, o }. First we look for o such that {s 1 , s 2 } together either dominate or cover o . Clearly neither s 1 nor s 2 , being light, can cover any facility other than o. Thus we look for o that is dominated by them. If {s 1 , s 2 } do not dominate any facility other than o, we form a triplet < s 1 , s 2 , o > and keep it aside. We call such triplets are nice triplets. They will be used to swap in some facilities of O which are not swapped in otherwise. If they dominate exactly one facility o , then we perform double-swap of {s 1 , s 2 } with {o, o }. If they dominate at least two facilities other than o, then we cannot swap them out at all. We call such a pair of facilities as a bad pair.
Remaining facilities in S L are classified as good, bad and nice. A facility that does not dominate any facility in O is termed as nice. A nice facility can be swapped in with any facility in O. A facility s that dominates exactly one facility o in O is termed as good. We perform (single) swap(s, o) in this case. A facility s that dominates more than one facilities in O is termed as bad. Bad facilities cannot participate in swaps. LetÔ denote the set of facilities of O that are either dominated by bad facilities or by bad pairs in S L . Facilities of O are swapped in using the triplets (using double-swap({., .}, {., .}) or the nice facilities (using swap(., .)). We show that the total number of triplets and the nice facilities is at least one thirds of |Ô| so that each facility of S L is swapped out most 3 times and each facility of O is swapped in at least once and at most 3 times (Note that in the process, the facilities of O which were there in the triplets also get swapped thrice). Swapping in a facility of O thrice contributes a factor of 3 and swapping out a facility of S L thrice contributes a factor of 6 making a total of 9 factor approximation.
Extending swap and double-swap to multi-swap, where upto p, (p > 2) facilities can be swapped simultaneously, we are able to ensure that every s ∈ S is swapped out at most 1 + 4/(p − 2) times, and every o ∈ O is swapped in at most 1 + 4/(p − 2) times thereby reducing the factor to (3 + ).
For CkMP, we start with an initial feasible solution with 8k/3 facilities from F. The clients are assigned by solving min cost flow problem over the facilities S ∪ {δ}, where u δ = |C| and ∀j ∈ C, c(δ, j) = p j . Clients assigned to δ pay penalty in the solution S. We bound the cost of the locally optimal solution, in the same manner as done for CkM.

Local Search Paradigm
Given a problem P, local search algorithm starts with a candidate feasible solution S. A set of operations are defined such that performing an operation results in a new solution S , called the neighbourhood solution of S. A solution S may have more than one neighbourhood solutions. An operation is performed if it results in improvement in the cost. We formally describe the steps of the algorithm for a minimization problem.
The paradigm: 1. Compute an arbitrary feasible solution S to P.
The algorithm terminates at a locally optimal solution S, i.e.cost(S ) > cost(S) for every neighborhood solution S In the above algorithm presented, we move to a new solution if it gives some improvement in the cost, however small that improvement may be. This may lead to an algorithm taking lot of time. To ensure that the algorithm terminates in polynomial time, a local search step is performed only when the cost of the current solution S is reduced by at least cost(S) p(n, ) , where n is the size of the problem instance and p(n, ) is an appropriate polynomial in n and 1/ for a fixed > 0. This modification in the algorithm incurs a cost of additive in the approximation factor.

Organization of the paper
For the sake of easy disposition of ideas, we first present a weaker result for CkM in Section 2. The algorithm uses two operations: a (single) swap and a double swap and provides an (9 + , 8/3) solution. The factor is subsequently improved to (3 + ) in Section 3 using multi-swap operation. The results are then extended to CkMP in Section 4.

(9+ , 8/3) algorithm for Capacitated k-Median Problem
In this section, we present a local search algorithm that computes a solution with cost at most 9 + times the cost of an optimal. We start with an initial feasible solution selected as an arbitrary set of 8k/3 facilities. Given a set of open facilities, optimal assignments of the clients is obtained by solving min-cost flow problem. For any feasible solution S, algorithm performs one of the following operations, if it reduces the cost and terminates when it is no longer possible to improve the cost using these operations.
Claim 1. For the locally optimal solution S, and optimal solution O we have, Proof. The claims follow trivially when S ∩ O = φ by the local optimality of S.
Clearly the cost of assignment to facilities in S \ {s 1 } can not be smaller than the cost of assignment to facilities in S. If All the other cases can be argued similarly. . For a client j, let π S (j) and π O (j) denote the facilities serving j in S and O respectively. Let S j and O j denote the service costs paid by j in S and O respectively. Facilities in S are partitioned into heavy (S H ) and light (S L ). A facility s ∈ S is said to be heavy if B S (s) > 3 5 U and light otherwise. When a facility in our locally optimal solution is swapped out, some of its clients are reassigned to other facilities in our solution via a mapping similar to the one defined in [4]. We may not be able to define a feasible mapping for the heavy facilities. Thus heavy facilities are never swapped out and no client is mapped onto them for reassignment.

Notations
. We introduce two concepts important to define the swaps and the mapping.
facility o ∈ O can be dominated by at most one facility in s ∈ S L where as a facility s ∈ S L can dominate any number of facilities. Extending the definition to set T , we say that a set In either case, we have a contradiction, and hence mapping τ satisfies the claim.
For (2)   We consider at-most k swaps, satisfying the following properties.
1. Each o ∈ O is considered in atleast one swap and at most three swaps.
2. If s ∈ S H , s is not considered in any swap operation.
3. Each s ∈ S L is considered in at most three swaps. The facilities inŜ will never participate in any swap. Facilities inÔ correspond to the facilities inŜ in some way which will become clear when we define the swaps. We also maintain a set of triplets denoted by B (will be defined shortly) and two sets S B and O B corresponding to B. All the three sets are empty initially. Throughout we maintain that S W , S B ,Ŝ are pairwise disjoint and Next, consider the following swaps in which the facilities inŌ are swapped with nice facilities or nice pairs in S L in a way that each nice facility or a facility in a nice pair is considered in at most 3 swaps and each facility in O B is also considered in at most 3 swaps. The swaps are summarized in Figure 4 and Figure 3.

Analysis: Bounding the Cost
Now we bound the cost of these swaps. Whenever we consider a swap of form double-swap({s 1 , s 2 }, {o 1 , o 2 }), the mapping τ as defined in claim 1 cannot be used to reassign the clients of s 1 and s 2 as it is possible that some client j of s 1 is mapped to a client of s 2 or vice versa. To address this, we define another mapping τ in a similar way as in claim (2)    Proof. τ can be defined as follows. Consider s 1 and s 2 as a single meta-facility, and define the mapping just as earlier. That is no j ∈ B(s 1 ,õ) get mapped to j ∈ B(s 2 ,õ) and vice versa. Note that this is possible to create such a τ as {s 1 , s 2 } together do not dominateõ.
For ( For j ∈ B S (s 1 ) \ B O (o 1 ), π S (τ (j)) = π S (j). Thus, since j was assigned to s and not to π S (τ (j)) (call it s ), c(j, s) ≤ c(j, s ) (since s , being a light facility, had sufficient room to accommodate j ). Thus, follows trivially in this case by triangle inequality. Thus we can write Also, by similar arguement as above, we have Now, a facility o ∈ O may be considered at max three times. Let O 1 , O 2 , O 3 denote the set of facilities in O that are considered in 1, 2 and 3 swaps respectively.A facility s ∈ S L may be swapped out at most 3 times. Thus, we can And as τ is a 1 − 1 and onto mapping, Thus we have

(+ , 8/3) algorithm using multi-swaps
In this section, we reduce the factor to (3 + ) using multi-swap operation. Let p = 2p + 2 for some integer p . Let p > 2. The algorithm performs the following operation if it reduces the cost of the solution and it terminates otherwise.  2. For 1 ≤ i ≤ (r − 1), the set A i has exactly one facility s from S b or exactly one bad pair < s 1 , s 2 > fromŜ.

Defining the swaps
3. The set A r contains facilities only from S B ∪ S n .
Next, we define the following swaps: , assign j to π S (τ (j)). Inequalities are assigned weight 1.

For the sets
we perform shrinking as follows: for every < s 1 , s 2 , o 1 >∈ B such that * denote a meta node corresponding to nodes s 1 , s 2 . Note that after shrinking we still have |A i | = |B i | = q ≥ q/2. Also as q > p = 2p +2, we have q > p + 1 = p/2. We consider the swaps as follows Algorithm 1 Partition Algorithm end while 10: (a) If s ∈ A i : s ∈ S b then we consider exactly q (q −1) swaps as follows: for all o ∈ B i , for all s ∈ A i \{s}, if s = s j * was created by shrinking of < s j1 , s j2 , o j1 >, then we perform double-swap({s j1 , s j2 }, {o j1 , o}). If s was not created by shrinking, then we perform swap(s , o). Each inequality is assigned weight 1/(q − 1). Then, each s ∈ A i participates in exactly (q )/(q − 1) = 1 + 1/(q − 1) ≤ 1 + 1/p = 1 + 2/(p − 2) swaps where as each o ∈ B i participate in exactly 1 swap except for facilities of the type o j1 which participates in as many swaps as s j1 , s j2 do, which is no more than 1 + 2/(p − 2).
(b) If s 1 , s 2 ∈ A i : {s 1 , s 2 } is a bad pair fromŜ then we consider exactly q (q − 2) swaps as follows: for all o ∈ B i , for all s ∈ A i \ {s 1 , s 2 }, if s = s j * was created by shrinking of < s j1 , s j2 , o j1 >, then we perform double-swap({s j1 , s j2 }, {o j1 , o}). If s was not created by shrinking, then we perform swap(s , o). Each inequality is assigned weight 1/(q −2). Then, each s ∈ A i participates in exactly (q )/(q − 2) = 1 + 2/(q − 2) ≤ 1 + 2/p = 1 + 4/(p − 2) swaps where as each o ∈ B i participate in exactly 1 swap except for facilities of the type o j1 which participates in as many swaps as s j1 , s j2 do, which is no more than 1 + 4/(p − 2).
The cost of the swaps can be analysed as follows. Every s ∈ S is swapped out at most 1 + 4/(p − 2) times and every o ∈ O is swapped in atleast once and at most 1 + 4/(p − 2) times. Thus we can now write which gives j∈C (S j ) < (1+4/(p−2))cost(O)+(1+4/(p−2))(2cost(O)) = (3+12/(p−2))cost(O) (12) 4 Capacitated k-Median with Penalties CkMP is a variation of CkM where we also have a fixed penalty cost p j associated with each client j ∈ C. For a solution S, let P(S) denote the set of clients that pay penalties in S. The clients C \P(S) are serviced by the facilities opened in S. We borrow the notations from Section 2. Then, cost(S) is s∈S j∈B S (s) S j + j∈P(S) p j . For easy disposition of ideas, we give (9 + , 8/3) algorithm and its analysis. The factor is reduced to (3 + ) in exactly the same manner as is done in Section 3.

(9 + , 8/3) Algorithm
We start with an initial feasible solution S 0 such that |S| = 8k/3. The clients are assigned by solving min cost flow problem over the facilities S 0 ∪ {δ}, where u δ = |C| and ∀j ∈ C, c(δ, j) = p j . Clients assigned to δ pay penalty in the solution S 0 . The operations available to the algorithm are swap(s, o) and doubleswap({s 1 , s 2 }, {o 1 , o 2 }) Let S be the locally optimal solution with cost(S) = s∈S j∈B S (s) S j + j∈P(S) p j .

Analysis
Let O be an optimal solution for the problem with cost(O) = o∈O j∈B O (o) O j + j∈P(O) p j . Swaps are defined exactly in the same manner as done in Section 2. However, there is a slight change in the re-assignment. Consider the swap(s, o) : s ∈ S L and o ∈ O; reassignments are done as follows: ∀j ∈ B O (o), assign j to o; ∀j ∈ B S (s) ∩ P(O), j pays penalty p j and ∀j ∈ B S (s) \ {B O (o) ∪ P(O)}, j is assigned to π S (τ (j)). As S is locally optimal, we have

Conclusion
In this paper, we presented ((3 + ), 8/3) factor algorithm for Capacitated k-Median Problem and its penalty version with uniform capacities, using local search heuristic. There is a trade-off between the approximation factor and the cardinality violation between our work and the existing work. Work in [22] is closest to our work as it is the only result for the problem based on local search. We improve upon the results in [22] in terms of cardinality violation. It would be interesting to see how these results extend to the problems with non-uniform capacities.