Better Guarantees for k-Means and Euclidean k-Median by Primal-Dual Algorithms
Sara Ahmadian, Ashkan Norouzi-Fard, Ola Svensson, Justin Ward
Introduction
A commonly used heuristic for -means is Lloyd’s algorithm , which is based on iterative improvement. However, despite its ubiquity in practice, Lloyd’s algorithm has, in general, no worst-case guarantee and may not even converge in polynomial time . To overcome some of these limitations, Arthur and Vassilvitskii proposed a randomized initialization procedure for Lloyd’s algorithm, called -means, that leads to a expected approximation guarantee in the worst case. Under additional assumptions about the clusterability of the input dataset, Ostrovsky et al. showed that this adaptation of Lloyd’s algorithm gives a PTAS for -means clustering. However, under no such assumptions, the best approximation algorithm in the general case has for some time remained a -approximation algorithm based on local search, due to Kanungo et al. . Their analysis also shows that no natural local search algorithm performing a fixed number of swaps can improve upon this ratio. This leads to a barrier for these techniques that are rather far away from the best-known inapproximability result which only says that it is NP-hard to approximate this problem to within a factor better than .
In summary, while -means is perhaps the most widely used clustering problem in computer science, the only constant-factor approximation algorithm for the general case is based on simple local search heuristics that, for inherent reasons, give guarantees that are rather far from known hardness results. This is in contrast to many other well-studied clustering problems, such as facility location and -median. Over the past several decades, a toolbox of core algorithmic techniques such as dual fitting, primal-dual and LP-rounding, has been refined and applied to these problems leading to improved approximation guarantees . In particular, the current best approximation guarantees for both facility location (a 1.488-approximation due to Li ) and -median (a 2.675-approximation due to Byrka et al. ) are LP-based and give significantly better results than previous local search algorithms . However, such LP-based techniques have not yet been able to attain similar improvements for -means. One reason for this is that they have relied heavily on the triangle inequality, which does not hold in the case of -means.
For any , there is a -approximation algorithm for the -means problem, where . Moreover, the integrality gap of the standard LP is at most .
Using Lagrangian relaxation, we can then consider the resulting discrete problem using the standard linear programming formulation for facility location. This general approach was pioneered in this context by Jain and Vazirani who gave primal-dual algorithms for the -median problem. In their paper, they first present a Lagrangian Multiplier Preserving () -approximation algorithm for the facility location problem. Then they run binary search over the opening cost of the facilities and use the aforementioned algorithm to get two solutions: one that opens more than facilities and one that opens fewer than , such that the opening cost of facilities in these solutions are close to each other. These solutions are then combined to obtain a solution that opens exactly facilities. This step results in losing another factor in the approximation guarantee, which results in a -approximation algorithm for -median. The factor was later improved by Jain, Mahdian, and Saberi who obtained a -approximation algorithm for -median by developing an -approximation algorithm for facility location.
One can see that the same approach gives a much larger constant factor for the -means problem since one cannot anymore rely on the triangle inequality. We use two main ideas to overcome this obstacle: (1) we exploit the geometric structure of -means to obtain an improved -approximation, and (2) we develop a new primal-dual algorithm that opens exactly facilities while losing only an arbitrarily small factor.
For our first contribution, we modify the primal-dual algorithm of Jain and Vazirani into a parameterized version which allows us to regulate the “aggressiveness” of the opening strategy of facilities. By using properties of Euclidean metrics we show that this leads to improved approximation algorithms for -means.
By the virtue of , these results already imply upper bounds on the integrality gaps of the standard LP relaxations, albeit with an exponential time rounding algorithm. Our second and more technical contribution is a new primal-dual algorithm that accomplishes the same task in polynomial time. In other words, we are able to turn an approximation algorithm into an algorithm that opens at most facilities without deteriorating the approximation guarantee. We believe that this contribution is of independent interest. Indeed, all recent progress on the approximation of -median beyond long-standing local search approaches has involved reducing the factor that is lost by Jain and Vazirani when two solutions are combined to open exactly facilities (i.e. in the rounding of a so-called bipoint solution) . Here, we show that it is possible to reduce this loss all the way to by fundamentally changing the way in which dual solutions are constructed and maintained.
Instead of finding two solutions by binary search as in the framework of , we consider a sequence of solutions such that the opening costs and also the dual values of any two consecutive solutions are close in -norm. We show that this latter property allows us to combine two appropriate, consecutive solutions in the sequence into a single solution that opens exactly facilities while losing only a factor of (rather than 2) in the approximation guarantee. Unfortunately, the dual solutions produced by the standard primal-dual algorithm approach are unstable, in the sense that a small change in opening price may result in drastic changes in the value of the dual variables. Thus, we introduce a new primal-dual procedure which instead iteratively transforms a dual solution for one price into a dual solution for another price. By carefully constraining the way in which the dual variables are altered, we show that we can obtain a sequence of “close” solutions that can be combined as desired.
We believe that this technique may be applicable in other settings, as well. An especially interesting open question is whether it is possible combine stronger approximation algorithms, such as the one by Jain, Mahdian, Saberi , with our lossless rounding to obtain an improved -approximation algorithm for -median.
For any , there is a -approximation algorithm for the Euclidean -median problem, where . Moreover, the integrality gap of the standard LP is at most .
In the second extension, we consider a variant of the -means problem in which each corresponds to the squared distance in an arbitrary (possibly non-Euclidean) metric on . For this problem, the best-known approximation algorithm is a 16-approximation due to Gupta and Tangwongsan . In this paper, we obtain the following improvement:
For any , there is a -approximation algorithm for the -means problem in general metrics. Moreover, the integrality gap of the standard LP is at most .
We remark that the same hardness reduction as used for -median immediately yields a much stronger hardness result for the above generalization than what is known for the standard -means problem: it is hard to approximate the -means problem in general metrics within a factor for any .
In Section 2 we review the standard LP formulation that we use, as well as its Lagrangian relaxation. We then in Section 3 show how to exploit the geometric structure of -means and Euclidean -median to give improved guarantees. In Section 4 we show the main ideas behind our new rounding approach by giving an algorithm that runs in quasi-polynomial time. These results are then generalized in Sections 5, 6, and 7 to obtain an algorithm that runs in polynomial time.
The standard LP relaxation and its Lagrangian relaxation
Here and in the remainder of the paper, we shall consider the discrete -means problem, where we are given a discrete set of facilities (corresponding to candidate centers).As discussed in the introduction, it is well-known that a -approximation algorithm for this case can be turned into a -approximation algorithm for the standard -means problem, for any constant (see e.g., ). Henceforth, we will simply refer to the discrete -means problem as the -means problem.
Given an instance of the -means problem or the -median problem, let denote the connection cost of client if connected to facility . That is, in the case of -median and in the case of -means. Let and .
The standard linear programming (LP) relaxation of these problems has two sets of variables: a variable for each facility and a variable for each facility-client pair . The intuition of these variables is that should indicate whether facility is opened and should indicate whether client is connected to facility . The standard LP relaxation can now be formulated as follows.
A main difficulty for approximating the -median and the -means problems is the hard constraint that at most facilities can be selected, i.e., constraint (2.3) in the above relaxation. A popular way of overcoming this difficulty, pioneered in this context by Jain and Vazirani , is to consider the Lagrangian relaxation where we multiply the constraint (2.3) times a Lagrange multiplier and move it to the objective. This results, for every , in the following relaxation and its dual that we denote by LP and DUAL, respectively.
LP s.t. (2.1), (2.2), and (2.4). DUAL s.t. (2.5)
If we disregard the constant term in the objective functions, LP and DUAL become the standard LP formulation and its dual for the facility location problem where the opening cost of each facility equals and the connection costs are defined by . Recall that the facility location problem (with uniform opening costs) is defined as the problem of selecting a set of facilities to open so as to minimize the opening cost plus the connection cost . Jain and Vazirani introduced the following method for addressing the -median problem motivated by simple economics. On the one hand, if is selected to be very small, i.e., it is cheap to open facilities, then a good algorithm for the facility location problem will open many facilities. On the other hand, if is selected to be very large, then a good algorithm for the facility location problem will open few facilities. Ideally, we want to use this intuition to find an opening price that leads to the opening of exactly facilities and thus a solution to the original, constrained problem.
To make this intuition work, we need the notion of Lagrangian Multiplier Preserving () approximations: we say that a -approximation algorithm is for the facility location problem with opening costs if it returns a solution satisfying
Exploiting Euclidean metrics via primal-dual algorithms
In this section we show how to exploit the structure of Euclidean metrics to achieve better approximation guarantees. Our approximation algorithm builds upon the primal-dual algorithm for the facility location problem by Jain and Vazirani . We refer to their algorithm as the JV algorithm. The main modification to their algorithm is that we allow for a more “aggressive” opening strategy of facilities. The amount of aggressiveness is measured by the parameter : we devise an algorithm JV for each parameter , where a smaller results in a more aggressive opening strategy. We first describe JV and we then optimize for the considered objectives to obtain the claimed approximation guarantees.
We remark that the result in (non-constructively) upper bounds the integrality gap of the standard LP relaxation of -median in terms of the approximation guarantee of JV. This readily generalizes to the -means problem and JV. Consequently, our guarantees presented here upper bound the integrality gaps as the theorems state in the introduction.
As alluded to above, the algorithm is a modification of JV, and Remark 3.2 below highlights the difference. The algorithm consists of two phases: the dual-growth phase and the pruning phase.
In this stage, we construct a feasible dual solution to DUAL. Initially, we set and let denote the set of active clients (which is all clients at first). We then repeat the following until there are no active clients, i.e., : increase the dual-variables corresponding to the active clients at a uniform rate until one of the following events occur (if several events happen at the same time, break ties arbitrarily):
A dual constraint becomes tight for a facility . In this case we say that facility is tight or temporarily opened. We update by removing the active clients with a tight edge to , that is, a client is removed if . For future reference, we say that facility is the witness of these removed clients.
An active client gets a tight edge, i.e., , to some already tight facility . In this case, we remove from and let be its witness.
This completes the description of the dual-growth phase. Before proceeding to the pruning phase, let us remark that the constructed is indeed a feasible solution to DUAL by design. It is clear that is non-negative. Now consider a facility and its corresponding dual constraint . On the one hand, the constraint is clearly satisfied if it never becomes tight during the dual-growth phase. On other hand, if it becomes tight, then all clients with a tight edge to it are removed from the active set of clients by Event 1. Moreover, if any client gets a tight edge to in subsequent iterations it gets immediately removed from the set of active clients by Event 2. Therefore the left-hand-side of the constraint will never increase (nor decrease) after it becomes tight so the constraint remains satisfied. Having proved that is a feasible solution to DUAL, let us now describe the pruning phase.
After the dual-growth phase (too) many facilities are temporarily opened. The pruning phase will select a subset of these facilities to open. In order to formally describe this process, we need the following notation. For a client , let denote the facilities to which client contributes to the opening cost. Similarly, for , let denote the clients with a positive contribution toward ’s opening cost. For a temporarily opened facility , let
and by convention let if (this convention will be useful in future sections and will only be used when the opening cost of facilities are set to ). Note that, if , then equals the “time” that facility was temporarily opened in the dual-growth phase. A crucial property of that follows from the construction of is the following.
For a client and its witness , . Moreover, for any we have .
For the pruning phase, it will be convenient to define the client-facility graph and the conflict graph . The vertex set of consist of all the clients and all the facilities such that (i.e., the tight or temporarily open facilities). There is an edge between facility and client if . The conflict graph is defined based on the client-facility graph and as follows:
The vertex set consists of all facilities in .
There is an edge between two facilities and if some client is adjacent to both of them in and .
The pruning phase now finds a (inclusion-wise) maximal independent set of and opens those facilities; clients are connected to the closest facility in .
The difference between the original algorithm JV and our modified JV is the additional condition in the definition of the conflict graph. Notice that if we select a smaller we will have fewer edges in . Therefore a maximal independent set will likely grow in size, which results in a more “aggressive” opening strategy. Adjusting will allow us to achieve better approximation guarantees.
2 Analysis of JV(δ)𝛿(\delta) for the considered objectives
In the following subsections, we optimize and analyze the guarantees obtained by the algorithm JV for the objective functions: k-means objective in general metrics, standard -means objective (in Euclidean metrics), and k-median objective in Euclidean metrics. The first analysis is very similar to the original JV analysis and also serves as a motivation for the possible improvements in Euclidean metrics.
We consider the case when and forms a general metric. We let so JV becomes simply the JV algorithm. We prove the following.
Let be any metric on and suppose that for every and . Then, for any , Algorithm JV constructs a solution to DUAL and returns a set of opened facilities such that
Consider any client . We shall prove that
The statement then follows by summing up over all clients and noting that any facility was temporarily opened and thus we have .
To prove (3.1), we first note that . Indeed, consider . Then and are edges in the client-facility graph and as , and are adjacent in the conflict graph . Hence, the temporarily opened facilities in form a clique in and at most one of them can be selected in the maximal independent set . We complete the analysis by considering the two cases and .
Let be the unique facility in . Then
Notice the amount of slack in the above analysis (specifically, the first inequality). In the Euclidean case, we exploit this slack for a more aggressive opening and to improve the approximation guarantee.
Let be ’s witness. First, if then by the same arguments as above we have the desired inequality; specifically, since has a tight edge to but we must have . Now consider the more interesting case when . As is a maximal independent set in , there must be a facility that is adjacent to in . By definition of , there is a client such that and are edges in the client-facility graph , i.e., . By the definition of witness and , we have
and by the description of the algorithm (see Claim 3.1 in Section 3) we have . Hence, using the triangle inequality and that ,
As , this completes the proof of this case and thus the theorem.
2.2 k𝑘k-Means objective in Euclidean metrics
We start with some intuition that illustrates our approach. From the standard analysis of JV (and our analysis of -means in general metrics), it is clear that the bottleneck for the approximation guarantee comes from the connection-cost analysis of clients that need to do a “-hop” as illustrated in the left part of Figure 1: client is connected to open facility and the squared-distance is bounded by the path . Moreover, this analysis is tight when considering \textsf{\small JV}=\textsf{\small JV(\infty)}. Our strategy will now be as follows: Select to be a constant smaller than . This means that in the configurations of Figure 1, we will also open if the distance between and is close to . Therefore, if we do not open , the distance between and is less than (as in the right part of Figure 1) which allows us to get an approximation guarantee better than . However, this might result in a client contributing to the opening cost of many facilities in . Nonetheless, by using the properties of Euclidean metrics, we show that even in this case, we are able to achieve an approximation guarantee with ratio better than .
Specifically, define to be the constant larger than that minimizes
Let be a Euclidean metric on and suppose that for every and . Then, for any , Algorithm JV constructs a solution to DUAL and returns a set of opened facilities such that
To simplify notation, we use instead of throughout the proof. Consider any client . We shall prove that
Similarly to the proof of Theorem 3.3, the statement then follows by summing up over all clients. A difference compared to the standard analysis of JV is that in our algorithm we may open several facilities in , i.e., client may contribute to the opening of several facilities. We divide our analysis into the three cases , , and . For brevity, let denote and .
If we let be the unique facility in ,
In this case, there are multiple facilities in that is contributing to. We need to show that .
The sum is the sum of square distances from to facilities in which is at least the sum of square distances of these facilities from their centroid , i.e., . Moreover, by the identity, , we get
As there is no edge between any pair of distinct facilities and in , we must have
where the last inequality follows because is contributing to both and and hence . By the above,
Now, since the above upper bound is a non-increasing function of . Therefore, since we always have
We also know that for any . Therefore, and, since :
We conclude the analysis of this case by rearranging the above inequality and recalling that .
Here, we claim that there exists a tight facility such that
To see that such a facility exists, consider the witness of . By Claim 3.1, we have and since has a tight edge to its witness , ; or, equivalently, and which implies that there is a tight facility, namely , satisfying (3.4).
Since is a maximal independent set of , either , in which case , or there is an such that the edge is in , in which case
where the second inequality follows from by the definition of . In any case, we have by (3.4)
Squaring both sides and recalling that completes the last case and the proof of the theorem.
2.3 k𝑘k-Median objective in Euclidean metrics
We use a very similar approach as the one for -means (in Euclidean metrics) to address the -median objective in Euclidean metrics. In this section, we have , i.e., the distances are not squared. Define,
We have and .
Let be a Euclidean metric on and suppose that for every and . Then, for any , Algorithm JV constructs a solution to DUAL and returns a set of opened facilities such that
To simplify notation, we use instead of throughout the proof. Similar to the proof of the previous theorem, we proceed by considering a single client and prove
Let denote and . We again proceed by case distinction on . We first bound the number of cases.
Using the centroid property of squared distances in Euclidean space,
where the last inequality follows from the fact that each pair of facilities are not adjacent in so and since . Since the left-hand-side is upper bounded by , we get . Therefore . ∎
We now proceed by considering the cases .
Consider the witness of . We have by Claim 3.1 and also . Since is a maximal independent set of , either , in which case , or there is an such that the edge is in , in which case
In any case, we have as required.
If we let be the unique facility in ,
where we used the triangle inequality and that since both and are in and hence and are not adjacent in . Rearranging the above inequality noting that , we have
and the case follows because .
using the triangle inequality. Rearranging the above inequality noting that , we have
and the lemma follows because .
Quasi-polynomial time algorithm
In this section, we present a quasi-polynomial time approach that turns the approximation algorithms presented in the previous section into approximation algorithms for the original problems (-means and -median), i.e., into algorithms that find solutions satisfying the strict constraint that at most facilities are opened. This is achieved by only deteriorating the approximation guarantee by an arbitrarily small factor regulated by . We also introduce several of the ideas used in the polynomial time approach. Although the results obtained in this section are weaker (quasi-polynomial instead of polynomial), we believe that the easier quasi-polynomial algorithm serves as a good starting point before reading the more complex polynomial time algorithm. From now on, we concentrate on the -means problem and we let denote the approximation guarantee and denote the parameter to our algorithm, where and are defined as in Section 3.2.2 (it will be clear that the techniques presented here are easily applicable to the other considered objectives, as well). Throughout this section we fix to be a small constant, and we assume for notational convenience and without loss of generality that . We shall also assume that the distances satisfy the following:
By losing a factor in the approximation guarantee, we can assume that the squared-distance between any client and any facility satisfies: , where .
The proof follows by standard discretization techniques and is presented in Appendix C.
Our algorithm will produce a -approximate solution. In the algorithm, we consider separately the two phases of the primal-dual algorithm from Section 3.2.2. Suppose that the first phase produces a set of values satisfying the following definition:
A feasible solution of DUAL is good if for every there exists a tight facility such that .
Recall that for a dual solution , is defined to be the largest -value out of all clients that are contributing to a facility : where .
Two solutions and are close if for all .
We first describe our procedure for generating a close sequence of good solutions. Select the following parameters
We also use the notion of buckets that partition the real line:
We say that is the index of the bucket containing .
The buckets will be used to partition the -values of the clients. As, in every constructed solution , each client will have a tight edge to a facility, Lemma 4.1 implies that will always be at least . Therefore, the definition gives the property that the -values of any two clients and in the same bucket differ by at most a factor of . In other words, the buckets will be used to classify the clients according to similar -values.
Note that this implies that each solution in our sequence is good. Indeed, consider a dual solution that satisfies Invariant 1. Then, for any client , we have some () such that (since has a tight edge to ) and where we used that implies . Hence,
and so is good (here, for the first inequality we have used that and ). We observe that our initial solution has for all , and so Invariant 1 holds trivially. In our following analysis, we will show that each call to Sweep preserves Invariant 1.
We now formally describe the procedure QuasiSweep that, given the last previously generated solution in our sequences produces the solution returned next.
We initialize the algorithm by setting for each and by increasing the opening prices of each facility from to . At this point, no facility is tight and therefore the solution is not a good solution of DUAL. We now describe how to modify to obtain a solution satisfying Invariant 1 (and hence into a good solution). The algorithm will maintain a current set of active clients and a current threshold . Initially, , and . We slowly increase and whenever for some client , we add to . While , we increase at the same rate as . We remove a client from , whenever the following occurs:
has a tight edge to some tight facility with . In this case, we say that is the witness of .
Note that if a client satisfies this condition when it is added to , then we remove from immediately after it is added. In this case, is not increased.
Increasing the -values for clients in , may cause the contributions to some facility to exceed the opening cost . To prevent this from happening, we also decrease every value with at a rate of times the rate that is increasing. Observe that while there exists any such , the total contribution of the clients toward opening this cannot increase, and so cannot become tight. It follows that once any facility becomes tight, for every and so is presently a witness for all clients . At this moment all such clients in will be removed from and their -values will not subsequently be changed. Thus, remains tight until the end of QuasiSweep. Moreover, observe any other client that is added to later will immediately be removed from as soon as it has a tight edge to . Thus, neither nor the total contribution to change throughout the remainder of QuasiSweep. In particular, remains a witness for all such clients for the remainder of QuasiSweep.
We stop increasing once every client has been added and removed from . The procedure QuasiSweep then terminates and outputs . As we have just argued, the contributions to any tight facility can never increase, and every client that is removed from will have a witness through the rest of QuasiSweep (in particular, in ). Thus, is a feasible solution of DUAL in which every client has a witness , i.e., has a tight edge to the tight facility and . Hence, the output of Sweep always satisfies Invariant 1.
This completes the description of QuasiSweep. For a small example of its execution see Figure 2. We now show that the produced sequence of solutions is close and to analyze the running time.
1.2 Closeness and running time
We begin by showing that QuasiSweep produces a close sequence of solutions.
For each client , we have .
We first note that the largest -value at any time is at most . This follows from the feasibility of because, by Lemma 4.1, no squared-distance is larger than and the opening cost of any facility is at most . Hence, for any client and dual solution .
Any can increase by at most while .
The proof is by induction on .
This case is trivially true because there are no clients with , and so no clients can have been added to while . Indeed, any client had a tight edge to some facility in , which by Lemma 4.1 implies , and a client’s -value can decrease only while some smaller -value is increasing.
Now, we suppose some is increasing while . Note that we then must have . Let be the witness of in , and let be the set of clients contributing to in . We further suppose that is increased by at least while ; otherwise the claim follows immediately, since for all .
First, suppose that and so was previously decreased by QuasiSweep. Moreover, since has increased by at least while , we must have previously decreased while . In particular, at the last moment was decreased, we must have had , and since was decreasing at this moment, we also had . Then, was decreased only while . Moreover, during this time, ’s -value was decreased at a rate of , and so was decreased (in total) at most times the largest amount that any other was increased. By the induction hypothesis, any was increased at most while , and so was decreased at most . Thus, after increases by at most we will again have .
Now, we consider how much may increase while (and still ). For each we must have initially had since is a witness for in . Additionally, by our assumptions in this case, . Thus, the -value of any was decreased by QuasiSweep only while and so by the same argument as above the -value of any can decrease at most throughout QuasiSweep. Thus, the total contribution to from all can decrease at most . After increasing at most , will again be tight. Moreover, at this moment, any client contributing to was either already added to (and potentially also removed) in which case or it was not already added to in which case since has not been increased yet. In either case, so is a witness for , and will be removed from .
Altogether, the total amount can increase while is then the sum of these two increases, which is , as required. ∎
The claim immediately bounds the increase by as required (recall that )). Moreover, as shown in the proof of the claim above, the -value of every client decreases by no more than times the maximum increase in the -value of any client. Then, the desired bound on follows as well. ∎
For the sake of clarity, we have presented the QuasiSweep procedure in a continuous fashion. We show in Appendix A how to implement QuasiSweep as a discrete algorithm running in polynomial time. We conclude the analysis of this section by noting that, as Sweep is repeated times, the total running time for producing the sequence is .
2 Finding a solution of size k𝑘k
2.2 Analysis
The total running time is since the number of steps (and the number of dual solutions in our sequence) is and each step runs in polynomial time since it involves the construction of at most conflict graphs and maximal independent sets.
For any , .
Consider some and first suppose that . Then, if we let , just as in “Case ” of Theorem 3.4. Next, suppose that . In other words, is contributing to multiple facilities in . By construction we have for any two facilities . Thus, by the exact same arguments as in “Case ” of Theorem 3.4. ∎
Next, we bound the total service cost of all those clients that do not contribute to any facility in . The proof is very similar to “Case ” in the proof of Theorem 3.4.
For every , .
Note the similarity of this inequality with that of (3.4) and the proof is now identical to “Case ” of Theorem 3.4.
Indeed, since is a maximal independent set of , either , in which case , or there is a such that the edge is in , in which case
where the inequality follows from by the definition of . In any case, we have (using )
Squaring both sides and recalling that and that is a small constant so completes the proof of the lemma. ∎
One difference compared to the analysis in Section 3.2.2 is that not all opened facilities are fully paid for. However, they are almost paid for:
For any , .
By Lemma 4.8 (note that by definition, ),
We have thus proved that our quasi-polynomial algorithm produces a -approximate solution which implies Theorem 1.1. The quasi-polynomial algorithms for the other considered problems are the same except for the selection of and , and that in the -median problem the connection costs are the (non-squared) distances.
Polynomial time algorithm
We now show how to obtain a polynomial-time algorithm, building on the ideas presented in the previous section. As in Section 4, we focus exclusively on the -means problem, and let and , and assume that the squared-distances between clients and facilities are in by Lemma 4.1. Additionally, we choose and to be suitably small constants with , and for notational convenience we assume without loss of generality that .
Similarly to Section 4.1, we give an algorithm for generating a close sequence of feasible solutions to DUAL, and then show how to use this sequence to generate a sequence of integral solutions that must contain some solution of size exactly . Here, however, we ensure that our sequence of feasible solutions is of polynomial length. In order to accomplish this, we must relax some of the requirements in our definition of a good solution (Definition 4.2).
Second, we shall designate a set of special facilities that we shall open, even if they are not tight. To each special facility we assign a set of special clients that are allowed to pay for . Then, for each , we define the time , while for each we set . Again, we adopt the convention that if for or for . Although a facility in is not necessarily tight, we shall require that the total of all payments to such facilities by special clients is almost equal to (Condition 3 of Definition 5.1). That is, on average, each facility of is almost tight.
Finally, given the times , we shall not require that every client has some tight or special facility such that . Specifically, we shall allow some small set of bad clients to instead satisfy a weaker inequality for some tight or special facility . Such clients will have a higher service cost, so we require that their total contribution to the cost of an optimal solution is small (Condition 2 of Definition 5.1).
Combining the above, we have the following definition.
For all , .
There exists a subset of clients so that for all there is a facility that is either tight or in and:
for all .
Observe that any -roundable solution with , and is essentially a good solution for DUAL (as defined for the quasi-polynomial algorithm in Section 4) except that the opening costs of the facilities are allowed to vary slightly. We shall also say that is roundable if is roundable.
Initially, we set and then initialize by setting for all and (observe that is then an empty function), and constructing as follows. We set for all and then increase all at a uniform rate. We stop increasing a value whenever gains a tight edge to some facility or for some (the rationale behind this choice will be made clear in Section 7). Finally, we initialize our current integral solution .
Algorithm 1 executes base price increases, each of which performs calls to RaisePrice. In order to show that Algorithm 1 runs it polynomial time, it is sufficient to show that each call to RaisePrice and GraphUpdate produces a polynomial length sequence in polynomial time. In the next sections, we describe these procedures in more detail and show that they run in polynomial time. In addition, we show that RaisePrice produces a sequence of roundable solutions (Proposition 8.18) that are close (Proposition 8.10). In Section 6, we show that given these solutions, GraphUpdate finds a -approximate solution (Theorem 6.4).We remark that we have chosen to first describe GraphUpdate as that procedure is very similar to QuasiGraphUpdate in the quasi-polynomial algorithm whereas RaisePrices is more complex. This implies our main theorem:
For any , there is a -approximation algorithm for -means.
Opening a set of exactly k𝑘k facilities in a close, roundable sequence
We define the client-facility graph of a roundable solution as in Section 3.1 with the following two changes: First, recall that we now consider a facility tight if and only if . Second, we shall additionally add every facility to , but place an edge between each and only if . Intuitively, we treat special facilities essentially the same as tight facilities, except only those clients in are considered to be paying for .
Formally, let denote the set of all tight facilities or special facilities with respect to . Then, is a bipartite graph on and that contains an edge if and only if and or and . As before, we assign an opening time to each . For , , and for , . In other words, equals the maximum over all clients such that is an edge in (in the case that there is no such edge, we adopt the convention that ). Note that for any facility .
1 Analysis
GraphUpdate clearly runs in polynomial time since the number of steps is polynomial and each step requires only the construction of a conflict graph and greedily maintaining a maximal independent set.
For any , .
Next, we bound the total service cost of all those clients that do not contribute to any facility in . The proof is very similar to that of Lemma 4.7 except that we also need to handle the bad clients in .
We now bound the contributions to the opened facilities as in Lemma 4.8 except that we also need to handle the special facilities.
and the lemma follows since . ∎
For any produced by GraphUpdate with ,
We conclude the proof by substituting this bound in (6.2):
The algorithm RaisePrice
In this section, we give the details of the algorithm RaisePrice, which is responsible for raising facility prices and generating sequences of roundable solutions in Algorithm 1. It is based on similar insights as used in the quasi-polynomial algorithm described in Section 4. Let us first provide a high-level overview of our approach. Recall that in our analysis of that procedure, changing the values in some bucket by roughly required changing the values in bucket by up to . Because there were buckets, the total change in the last bucket was potentially , and so to obtain a close sequence of -values, we required in that section. Here, we reduce the dependence on by changing the way in which we increase the opening price . As in the quasi-polynomial procedure, our algorithm repeatedly increases the opening cost of every facility from to , for some appropriate small increment . However, instead of performing each such increase for every facility at once, we instead increase only a single facility’s price at a time. Each such increase will still cause some clients to become unsatisfied (or undecided as we shall call them), and so we must repair the solution. In contrast to the quasi-polynomial procedure, RaisePrice repairs the solution over a series of stages. We show this will result in a polynomial length sequence of close, roundable solutions.
Notation: Throughout this section, we let denote the current price for a facility , where always . We shall now say that is tight if , where as before for a solution , we use as a shorthand for . It will also be convenient to denote by . Note that , if and only if . As in the quasi-polynomial procedure, we shall divide the range of possible values for into buckets: we define for any and , for all .
To control the number of undecided (unsatisfied) clients, it will be important to control the way clients may be increased and decreased throughout our algorithm. To accomplish this, we shall not insist that every client has some tight witness in every vector that we produce (in contrast to Invariant 1 in the quasi-polynomial algorithm). Rather, we shall consider several different types of clients:
witnessed clients have a tight edge to some tight facility with . In this case, we say that is a witness for . Note that if is a witness for we necessarily have .Here, we use that all -values will be at least one and two values in the same bucket differs thus by at most a factor . We also remark that this is the same concept as in Invariant 1 of the quasi-polynomial algorithm.
for some other client . In this case, we say that stops . Note that if stops , we necessarily have and so .
undecided clients are neither witnessed nor stopped.
Let us additionally call any client that is witnessed or stopped decided. Note that the sets of witnessed and stopped clients are not necessarily disjoint. However, we have the following lemma, which follows directly from the triangle inequality and our definitions:
Suppose that is stopped. Then must be stopped by some that is not stopped.
We proceed by induction over clients in non-decreasing order of . First, note that the client with smallest value cannot be stopped. For the general case, suppose that is stopped by some . Then, . If is stopped, then by the induction hypothesis it must be stopped by some that is not stopped. Then, we have , and . It follows that
Thus is stopped by , as well. ∎
Intuitively, the stopping criterion will ensure that no grows too large compared to the -values of nearby clients. At the same time it is designed so that all decided clients will have a good approximation guarantee.
Finally, we shall require that the following invariants hold throughout the execution of Algorithm 1.
For all , and for all , .
We remark that for dual feasibility is sufficient but the stronger assumption which is implied by Lemma 4.1 will be convenient.
For any two clients ,
Note that the above invariant says that the ball centered at of radius does not strictly contain the ball centered at of radius . For future reference, we refer to the ball centered at client of radius as the -ball of that client.
Every client is decided in .
Invariant 4 will be maintained as follows (as we show formally in Lemma 8.1): The initial solution satisfies the invariant. Then, given an initial solution in which all clients are decided, RaisePrice will output a close, roundable sequence , where is a roundable solution in which all clients are decided. As the next call to RaisePrice will use as the initial solution, the invariant is maintained.
RaisePrice is described in detail in Algorithm 2. Initially, we suppose that we are given a -roundable and completely decided dual solution (i.e., satisfying Invariant 4) where for all . Additionally, let be the independent set of the conflict graph associated to the roundable solution , produced at the end of the previous call to GraphUpdate as described in Algorithm 1. We shall assume that , as otherwise, Algorithm 1 would have already terminated. For a specified facility , RaisePrice sets . This may result in some clients using as a witness becoming undecided; specifically, those clients that are not stopped and have no witness except in . We let to be the set of all these initially undecided clients. Throughout RaisePrice, we maintain a set of currently undecided clients, and repair the solution over a series of multiple stages, by calling an auxiliary procedure, Sweep. Each repair stage will be associated with a threshold , and will make multiple calls to the procedure Sweep, each producing a new solution . The algorithm RaisePrice constructs a roundable solution from each such , and returns the sequence of all such roundable solutions, in the order they were constructed. RaisePrice terminates once it constructs some solution in which all clients are decided. In Section 8, we shall show that this must happen after at most stages, and that each stage requires only a polynomial number of calls to Sweep. In addition, we show that the produced sequence is close and roundable.
where is an integer parameter and is a integer “shift” parameter chosen uniformly at randomWe shall show that it is in fact easy to select an appropriate deterministically (see Remark 8.16). from . Our selection of thresholds ensures that each stage updates only those in a constant number of buckets. Thus, the total change in any -value will be at most , which will allow us to obtain a polynomial running time. This comes at the price of some clients remaining undecided after each stage, and some such clients may have service cost much higher than . We let denote the set of all such “bad” clients. Using that the -values are relatively well-behaved throughout RaisePrice, we show that only those clients with relatively near to the threshold can be added to in stage . Then, the random shift in choosing our definition of thresholds will allow us to show that only an fraction of clients can be bad throughout RaisePrice. Moreover, we can bound the cost of each client by . Intuitively, then, if at least a constant fraction of each is contributing to the service cost , then we can bound the effect of these bad clients by setting to be a sufficiently large constant, then using Theorem 6.4 to conclude that:
Unfortunately, it may happen that many clients have . That is, some clients may be using almost all of their -values to pay for the opening costs of facilities. In this case, we could have arbitrarily larger than . In order to cope with this situation, we introduce a notion of dense clients and facilities in Section 8.5. These troublesome clients and facilities are handled by carefully constructing the remaining components and of the roundable solution in line 2. We defer the formal details to Section 8.5, but the intuition is if enough bad clients are paying mostly for the opening cost of a facility, then we can afford to open this facility even if it is not tight. This is precisely the role of special facilities in Definition 5.1.
2 The Sweep Procedure
It remains to describe our last procedure, Sweep in more detail. Sweep operates in some stage , with corresponding threshold value , takes as input the previous produced by the algorithm, and produces a new . Note that in every call to Sweep, we let denote the roundable solution passed to RaisePrice, and is the set of undecided clients immediately before Sweep was called. Just like QuasiSweep, the procedure Sweep, maintains a current set of active clients and a current threshold , where initially, , and . We slowly increase and whenever for some client , we add to . While , we increase at the same rate as . However, in contrast to QuasiSweep, Sweep removes a client from , whenever one of the following five events occurs:
is stopped by some client .
and is larger than its value at the start of Sweep.
and .
There is a client that has already been removed from such that .
We remark that Rule says that is removed from as soon as its -ball contains the -ball of another client that is not currently in . This rule is designed so that the algorithm maintains Invariant 3. Also note that if a client satisfies one of these conditions when it is added to , then we remove from immediately after it is added. In this case, is not increased.
As in QuasiSweep, increasing the values for clients in may cause to exceed for some facility . We again handle this by decreasing some other values . However, here we are more careful in our choice of clients to decrease. Let us call a facility potentially tight if one of the following conditions hold:
There is some with .
For all , .
We now decrease if and only if and additionally: for some potentially tight facility with and , we have . We decrease each such at a rate of times the rate that is increasing. To see that this maintains feasibility we observe that at any time there are clients whose contribution to facility is increasing, and these contributions are increasing at the same rate as . Suppose that is tight at some moment with some . Then, since , there must be either at least one client with or we have for all . In either case, must be potentially tight. Consider some client with and note that , since otherwise we would remove from by Rule 1. The value of is currently decreasing at a rate of times the rate that is increasing. Thus, the total contribution to any tight facility is never increased.
As in QuasiSweep, we stop increasing once every client has been added and removed from , and then output the resulting . Note that Sweep never changes any . In particular, once some has been removed from it is not subsequently changed. Additionally, observe that once , Sweep will not decrease .
Analysis of the polynomial-time algorithm
In contrast to the quasi-polynomial time procedure, here our analysis is quite involved. Let us first provide a high-level overview of our overall approach. Note that any solution that does not contain any undecided clients is roundable with , and . Indeed, for any witnessed client there is a tight facility with and and so
Similarly, any stopped client in such a solution must be stopped by some witnessed (using Lemma 7.1 and the assumption that all clients are decided). Let be the witness of . Then,
since . As for any facility , the required inequalities from Definition 5.1 hold for any decided client . In the following our main goal will then be to bound the cost in the general case in which some clients in a solution are undecided.
We start by showing that Invariants 2, 3, and 4 hold.
Invariants 2, 3, and 4 hold throughout Algorithm 1.
We begin by proving Invariant 2, i.e., that the algorithm maintains a feasible dual solution with the additional property that for all . Recall our construction of the initial solution for Algorithm 1: we set for all and then increase all at a uniform rate. We stop increasing a value whenever gains a tight edge to some facility or for some . Note that no is increased after for some facility . Thus, we have for all and , and so is feasible. Now, we show that . Consider the client that first stops increasing in our greedy initialization process. At the time stops increasing, we have for all and so cannot hold for any pair of clients. Thus, must have stopped increasing because for some facility . By our preprocessing (Lemma 4.1) we have , and so . Moreover, , and so indeed for all . Now, we show that Algorithm 1 preserves Invariant 2. Note that is altered only by subroutine Sweep, and by construction, Sweep ensures that always . Moreover, Sweep decreases any only while there is some for some facility . By our preprocessing (Lemma 4.1) for any such . Thus, no is ever decreased below 1.
Next, we prove Invariant 3, i.e., that no client’s -ball is strictly contained in the -ball of another client. First, let us show that the initially constructed solution satisfies Invariant 3. Note that is equal to the value of at the time that our initialization procedure stopped increasing . Consider any pair of clients and . If then clearly . Thus, suppose that , so stopped increasing before in our initialization procedure. If stopped increasing because gained a tight edge to a facility , then once , will have a tight edge to and stop increasing. If stopped increasing because for some client , then when we will have
and so must stop increasing. In any case, we must have . Having shown that the invariant is true for the first constructed in Algorithm 1, let us now prove that it is maintained. First, we show that the inequality will not be violated by increasing . Suppose that and so is increasing. As long as , as well, we have , and so . On the other hand, if , then as soon as , will be removed from by Rule 5 and will no longer increase. Now we show that also will not be violated by decreasing . Suppose that is decreasing. Then, there must be some potentially tight facility with and . Let be any such facility. If at some point we have , then we must also have at this moment and . Thus, is also decreasing and in fact (since also ). Then, and are decreasing at same rate and so as long as continues to decrease.
Finally, we prove Invariant 4, i.e., that the input solution to RaisePrice is always completely decided. Every client is either stopped by some client or has a tight edge to some facility in our initially constructed solution . Moreover, the initialization process ensures that for all (since for all and ). Thus, in the latter case and so is in fact a witness for , and so every client is indeed either stopped or witnessed in this initial solution . To show that Invariant 4 holds throughout the rest of the Algorithm 1, we note that is always updated (in line 1 of Algorithm 1 where ) with the -values corresponding to the last solution produced in a call to RaisePrice. Due to the condition in the main loop of RaisePrice, every client is decided in this solution. ∎
The next lemma makes some basic observations about the way in which Sweep alters the -values.
The procedure Sweep satisfies the following properties:
Any client that becomes decided after being added to remains decided until the end of the same call to Sweep.
If the -ball of a client contains the -ball of a decided client, then is decided.
Consider the solution at the beginning of Sweep, and let . Then, no is increased by Sweep, and no with is decreased by Sweep.
For Property 1, suppose first that had a witness at some point after being added to . Consider any at this moment. At this moment, we must have and so cannot be decreased for the remainder of Sweep. In particular, retains a tight edge to until the end of Sweep and remains tight until the end of Sweep. Additionally, any client with will be removed from as soon as it gains a tight edge to (by Rule 1 since would then be a witness for ). Thus, cannot increase and so remains a witness for until the end of Sweep. Next, suppose that was stopped by some after being added to . Then, at this moment, . Hence, for the remainder of Sweep, neither or are changed and so remains stopped by .
For Property 2 suppose that the -ball of client contains the -ball of a decided client . Then if has a witness , then is also a witness for , since and . Similarly if is stopped by some client then
and so is also stopped by .
Finally, for Property 3, consider the first client whose value is increased by Sweep. Note that must not be decided before calling Sweep: otherwise, since no other -value has yet been changed, this would hold at the moment was added to , as well, and so would immediately be removed by Rule 1 or 2. Thus, the first that is increased by Sweep must correspond to some , and at the moment this occurs, . Furthermore, by the definition of Sweep, no can then be decreased unless . ∎
2 Characterizing currently undecided clients
The next observations follow rather directly from the properties given in Lemma 8.2 and the invariants. These facts will help us bound the number of clients that can become bad throughout the algorithm, and also the total number of calls to Sweep that must be executed in each call to RaisePrice. Throughout this section, we consider a single call to RaisePrice and let be its input.
In stage 1, Sweep is executed only a single time. After this call, for every , we have and is decided.
Consider any client . Then was ’s witness in , and must not have been stopped or have had any other witness . Observe that our choice of ensures that , so any will be removed from by Rule 3 once . Thus we must have at the end of Sweep for every .
This also implies that no such is removed from by Rule 4. We now show that when is removed from by any other rule, it must be decided. By Property 1, is then decided at the end of Sweep, as well. First, we observe that if is removed from by Rules 1 or 2, then it is decided by definition. Next, suppose that was removed by Rule 3, and let . Since was a witness for every , we must have for all . Thus, by Property 3 of Sweep, for every . Then, since , at the time was removed from , must have been tight and also a witness for . By Property 1, then remains decided until the end of Sweep. Finally, we consider the case in which was removed by Rule 5. We show the following:
Suppose that some client is removed from by Rule 5 and that is undecided at this time. Then, .
Consider the first time that any client that is undecided is removed from by Rule 5. By Property 2, the -ball of this client must contain the -ball of some undecided client that was previously removed from . By Property 1 and our choice of time, must have been removed from by Rule 3 or 4. However, if was removed by Rule 3, we must have and so, as we have previously shown, must be decided. Thus, was removed by Rule 4, and so presently . To complete the proof, we observe that any client that is removed from after must have an -value at least . ∎
It follows by the above Claim that no can be undecided when it is removed by Rule 5, since, as we have shown, for all such . By the above cases, every client is decided with at the end of Sweep.
It remains to show that RaisePrice continues to stage 2 after one call to Sweep. Consider some client that is undecided at the end of Sweep. By Property 1 must not have been removed from by Rule 1 or Rule 2. Moreover, we must have and so was not removed from by Rule 3. Thus, was removed from by Rule 4 or 5. In either case (by the definition of Rule 4 or the above Claim), we have at this moment (and so also at the end of Sweep, since no is changed after is removed from ). Thus, after the first call to Sweep in stage 1, every undecided client has and so RaisePrice immediately continues to stage 2. ∎
Consider any solution produced by RaisePrice. If is undecided in , then .
Suppose toward contradiction that the statement is false. Consider the first call to Sweep that produces a solution violating it and for this call let be the first client (in the order of removal from ) such that when is removed from but is undecidedBy Property 1, any client violating the statement must be undecided when removed from and have at the time of its removal from since Sweep does not change ’s -value thereafter.. Then since, is undecided it was removed by Rule 3, 4, or 5. If was removed by Rule 4, then at this moment . Suppose then that was removed by Rule 3. Then, . By Lemma 8.3, no client before the first call to Sweep is undecided after this call, so must have been undecided at the end of some preceding call to Sweep. By assumption, we must have had at the moment was removed from in this preceding call (and so also immediately before the present call). But, has increased by , so still . Finally, suppose was removed by Rule 5. Then, the -ball of must contain the -ball of a client that has already been removed . If is decided, then by Property 2 is decided as well. Suppose that is undecided. Then, since we picked the first client that violated the condition of the lemma, and was already removed from , we have that . But then, if , we have and violates Invariant 3. In all cases we showed that we must have at the moment that was removed from , and so also at the end of Sweep, contradicting our assumption that for some undecided client . ∎
In every stage , no is changed by Sweep until . In particular, every client with is decided for every solution produced by RaisePrice in stage .
By Property 3 of Sweep, no is changed until . Thus to prove the first part of the claim, it suffices to show that in every stage , if then . Note that the second part of the claim then follows as well for every solution except the one produced by the final call to Sweep in RaisePrice, and this last solution has no undecided clients by Invariant 4.
Let us now prove that in every stage . We proceed by induction on the number of calls to Sweep made in stage . Before the first call to Sweep in stage , we must have for every , since otherwise stage would have continued. So, consider some later call to Sweep in stage , and consider any before this call. Then, we must have had undecided after the preceding call to Sweep in stage . Moreover, by Property 1, must have been undecided when it was removed from in this preceding call. Consider the first client that was undecided upon removal from in this preceding call. Then, cannot have been removed by Rules 1 or 2. Moreover, since every client that has been removed from before is decided, Property 2 implies that must not have been removed by Rule 5. If was removed by Rule 3, then we must have had already in this preceding call to Sweep, and so by the induction hypothesis, . Then, since was removed from by Rule 3, we had . Finally, if was removed by Rule 4, then we must have by definition. Thus, throughout every stage , if , then , as desired. ∎
Suppose that in , is not stopped and has only as a witness, i.e., . Then, we have that is decided with in every solution produced by .
We have and so by Lemma 8.3, is decided with in the first solution produced by RaisePrice. Moreover, by Lemma 8.5, remains unchanged and remains decided in all later stages. ∎
3 Bounding the cost of clients
In this section we derive inequalities that are used to bound the service cost of each produced during the algorithm. Consider some solution produced by the algorithm, and define
The set is defined to contain those clients that are (potentially) bad, i.e., have worse connection cost than our target guarantee. Specifically, we now show that all clients , satisfy the first inequality of Property 2 in Definition 5.1 (with replaced by ), while all clients (in particular those in ) satisfy a slightly weaker inequality.
Consider any produced by RaisePrice. For every client the following holds:
If , then there exists a tight facility such that .
There exists a tight facility such that .
The proof is by induction on the well-ordered set (with respect to the natural order )
Specifically, we prove the following induction hypothesis: for ,
each client with has a tight facility such that ;
each client with has a tight facility such that .
The statement then follows from the above with .
For the base case (when ), the claim is vacuous since there is no client such that or (because every -value is at least by Invariant 2). For the induction step, we assume that each client with satisfies (a) and each client with satisfies (b). We need to prove that any client with (respectively, with ) satisfies (a) (respectively, (b)). We divide the proof into two cases.
We prove that in this case satisfies (a). Since , either has a witness, is currently stopped, or there is another client such that .
Suppose first that has a witness . Then, is a tight facility and, since has a tight edge to , . Moreover, which implies that . Therefore, using that ,
Now suppose that is stopped by another client . Then . On the one hand, if , we have for some tight facility by the induction hypothesis (a). On the other hand, if then is undecided so by Lemma 8.4, . This in turn implies that . We can thus apply the induction hypothesis (b) to , to conclude that there is a tight facility such that . From above we have that, whether is in or not, there is a tight facility such that
where the penultimate inequality uses the fact that is stopped by and thus .
Finally, suppose that is not stopped or witnessed. Then, is currently undecided and, as , there is a client such that . This implies that . We can thus apply the induction hypothesis (b) to to conclude, that there is a tight facility such that . Now, we have:
where the second inequality follows from and by Invariant 2. We can thus again apply the induction hypothesis (a) to conclude that there is a tight facility satisfying . Thus, from now on, we assume that and that . We divide the remaining part of the analysis into two sub-cases depending on whether was stopped in .
First, suppose that was stopped in by another client . Then and so by the induction hypothesis (b), there is a tight facility satisfying . Hence,
Finally, suppose that was not stopped in . Then since every client is decided in (Invariant 4) had a witness in . Moreover, as , we may assume that and so . By the definition of a witness, for all . If for all , then, since , our feasibility invariant (Invariant 2) implies that in fact for all and so . Therefore, in this case is still a witness for and . It remains to consider the case when for some (note that , since by assumption). Since , must be decided (by Lemma 8.4) and so . Moreover, , and so we can apply the induction hypothesis (a) to conclude that there is a tight facility satisfying . Then,
as required. ∎ Lemma 8.7 shows that the clients in satisfy the first inequality of Property 2 in Definition 5.1 while the potentially bad clients satisfy a slightly weaker inequality. It remains to prove that the potentially bad clients will have a small contribution towards the total cost of our solution.
4 Showing that α𝛼\alpha-values are stable
The key to our remaining analysis is showing that the -values are relatively well-behaved throughout the algorithm. The following lemma implies that Sweep decreases an only because it is increasing an which is at most a constant factor smaller. This will imply the required stability properties.
At any time during Algorithm 1: if a client has a tight edge to some facility, then for every other client with a tight edge to this facility.
We prove the following stronger statement: at any time during Algorithm 1, we have
for any pair of clients. To see that this implies the lemma consider two clients and that both have tight edges to . Then
which implies that .
Inequality (8.2) is clearly satisfied by the initial solution constructed at the beginning of Algorithm 1, since we stop increasing any as soon as for any client , and neither nor are later changed. We now show that (8.2) continues to hold throughout the execution of Algorithm 1. The only procedure that updates the dual solution is Sweep, so let us analyze its behavior.
First note that the inequality cannot become violated by increasing , because as soon as , will be removed from by Rule of Sweep. It remains to prove that the inequality does not become violated because is decreasing. To this end, consider a time when is decreasing. Then, by the definition of Sweep, there must be some potentially tight facility , such that with . Since has the largest -value in and is potentially tight, there is some client (note that possibly ) such that . We show the following:
There exists some facility such that was tight in and also:
By Invariant 4, every client must be decided in . Consider client . If was witnessed in , then there was a tight facility such that and for every . If was stopped by a client in (i.e., ), then we may assume that is witnessed by Lemma 7.1. In this case, let be the witness of . Then,
for all . In either case, the claim holds. ∎
Now, let be the facility guaranteed to exist by the Claim. Consider the dual solution at the last time that was previously increased. Then, we must have . Additionally, since Algorithm 1 never decreases any facility’s price, and the current call to RaisePrice has increased any facility’s price by at most , we have . Let . We claim that:
Indeed, otherwise by the Claim, we would have for every . Then, since is tight in we would have:
We shall now show that (8.3) and the claim imply (8.2). Since was increasing when was maintained, Rule 2 of Sweep implies that:
and thus (8.2) remains satisfied when is decreasing. ∎
Using Lemma 8.8, we can now prove that RaisePrice produces a close sequence of solutions, and also bound the total number of clients in for any solution produced by RaisePrice. For both of these tasks, we make use of the following auxiliary lemma, which is a consequence of Lemma 8.8.
Throughout stage , for all with , we have , and for all with or , we have .
For the first claim, we show that any client with can continue to increase in stage only while . Indeed, if then once , will immediately be removed from by Rule .
For the remaining claim, suppose first that . Then, as we have just shown, throughout stage . Suppose towards contradiction that in fact at some moment in stage or earlier, and let be the value of at this time. Then, at some moment in stage or earlier, we must have had , and but decreasing. Since is being decreased by Sweep at this moment, we must have for a potentially tight facility . Since we must also have . However, Lemma 8.8 implies that for every other at this moment we have Thus, by the first claim, for all . This contradicts the fact that is potentially tight, since with .
Finally, suppose that . Then, by the first claim, we must have and so also . Then, as we have just shown, . ∎
In the preceding section, we showed that all of the -values are relatively stable throughout the algorithm. Using those observations, we can now prove that RaisePrice indeed produces a close sequence of -values. To that end, let us select the remaining parameters , , and used in RaisePrice.
Recall that the thresholds used by RaisePrice are defined by:
Therefore, the ratio of two consecutive thresholds is . We select to be the smallest integer satisfying
Note that . Given , we select an integer “shift” uniformly at random from the interval .
Finally, we set the price increment to:
Using these parameters, we can show that the sequence of solutions produced by RaisePrice is indeed close. Because each successive -value in this sequence is produced by calling Sweep on the previous value, it suffices to show the following.
Each call to Sweep changes every by at most .
Consider a call to Sweep performed in stage . By the definition of Sweep, it suffices to bound how much has changed at the moment it is removed from , since it is not subsequently changed. Let us begin by bounding how much any may be increased. As in our analysis of QuasiSweep, it will then be possible to bound how much any -value is decreased. Let and be the values of and before this call to Sweep, and let . We first show the following:
Any can increase by at most while .
The proof is by induction on .
Initially we have and, by Invariant 2, . Thus, at the start of any call to Sweep, we must have and . Now, note that while we must have . Then, by Property 3 of Sweep no -value has yet been altered, and so the claim holds trivially.
Now suppose that some is increased by at least while . Otherwise, the claim is immediate since . Note that while this is increasing we must also have and so .
First, suppose that . Then, was previously decreased. Moreover, since was increased by at least while , we must have previously decreased while . In particular, at the last moment was decreased, we must have had , and since was decreasing at this moment, we also had . Therefore, was decreased only while . Moreover, during this time, ’s -value was decreased at most times the maximum amount that any other client’s -value was increased. By the induction hypothesis, any client’s -value can increase at most while . Thus, has decreased at most , and after increasing by at most this amount, we will again have .
Next, let us bound how much ’s -value may increase while (and still ). We now consider three cases, based on the initial status of in .
If is undecided initially, then and can increase by at most (since ) before it is removed by Rule 3.
Next, suppose that had some witness in , and let be the set of clients paying for in . For each we must have , and so is decreased by Sweep only while . By the same argument given above (when considering the case that ), the -value of any such can decrease at most during Sweep. Thus, the total contribution to can decrease at most during Sweep. After increasing by at most this amount, will again be tight. Moreover, at this moment any client contributing to was either already added to (and potentially also removed), in which case , or it was not already added to , in which case . Thus, at this moment is a witness for , and so will be removed from by Rule 1.
Finally, suppose that was initially stopped by some client . Then, by Lemma 7.1, we may assume that was not stopped. Let be the amount that has been increased by Sweep. Then, once , we will have:
where in the last inequality we have used the fact that stopped in . Thus, can increase by at most , before will again be stopped by and removed from by Rule 2. It remains to bound the corresponding increases in and . We have:
Now, let us bound the right hand side. Since is not stopped, the previous cases show that . Then, we have:
where the last inequality follows from Invariant 2, which implies . Combining the above bounds, in this case we have
where the penultimate inequality follows from the feasibility invariant (Invariant 2) and the preprocessing of Lemma 4.1 (that all squared-distances are at most ) which together imply that for all .
Combining all of the above cases, can increase at most , until and then at most an additional . Thus, the total increase in while is at most , as required. ∎
We now complete the proof of Proposition 8.10. By Lemma 8.9, no is changed by Sweep in any stage , and so once no -values are changed. By the Claim, we then have that in any call to Sweep in stage , each client’s -value is increased at most where
We now bound the above value for every stage .
In stage , we execute only a single call to Sweep (as shown in Lemma 8.3) and in this call, . Since every must have a tight edge to the facility in , Lemma 8.8 implies that . Then, recall that
where we have used that (by Invariant 2), and . Finally, recalling that , we have:
In stage , we have by Lemma 8.5. Then, recall that Then, we have:
In any case, the maximum increase in any client’s -value is at most (recalling that by definition ). As we have already observed above in the proof of the Claim, each -value can decrease at most times this amount. Thus, no -value can decrease more than . ∎
4.2 Bounding the number of clients in \cB\cB\cB
We bound the number of clients in by showing that such clients need to have an -value close to a threshold . We then select the thresholds so that only a tiny fraction of the clients can be in .
Suppose that for some produced by RaisePrice. Then, we must have for some .
and so the induction hypothesis holds for as well (using and ).
We complete this section by formally showing that a client is unlikely to become potentially bad over the randomness of the shift-parameter . For any given integer , let
Note that by the above lemma, any client that is in in any solution produced during the considered call to RaisePrice, is in .To argue , the bounds for some would be sufficient in the definition of . However, the more relaxed bounds will be useful when analyzing dense clients in the next section. Note that each value is fixed at the beginning of RaisePrice, and there are only a (relatively) small number of choices for such that any given is in . Thus, if we choose uniformly at random, the probability that any given is small. The following corollary formalizes this intuition.
If we select the shift-parameter uniformly at random from ,
Suppose that we select an integer uniformly at random from . Then, note that by definition and so if and only if:
for some , where and . In other words, needs to satisfy
Notice that the difference between the upper bound and the lower bound is which by selection of is at most . Moreover, as there is at most one value of that can satisfy the above inequalities. It follows that there are at most distinct values of so that . Thus, with probability at most . ∎
5 Handling dense clients
To cope with this difficulty, we introduce the notion dense facilities and clients, as follows. Recall that is a small constant. We define the -close neighborhood of a facility as
Then, we say that a facility is dense if
We let be the set of all dense facilities, and then define the set of dense clients as . Note that the -close neighborhoods, dense facilities, and dense clients are all determined only by the input solution and the integral solution passed to RaisePrice.
Recall that in Definition 5.1, we have for any facility and for all other facilities. Note that as by Invariant 4 is a completely decided solution, by our choice of and , we have in the roundable solution . Therefore, the conflict graph of does not contain any special facilities, and so for each facility . Moreover, recall that was the maximal independent set of computed in the previous call to GraphUpdate. In particular, and does not contain any special facilities.
The following simple lemma is now a direct consequence of our definitions.
Suppose that for some . Then, for all other . Moreover, for every client , .
We start by proving that if for some , then for all other . Consider some facility , and suppose that . Further, suppose that for some other facility we have . Note that this implies (since no facility is special) that is adjacent to both and in the client-facility graph that generated . We shall show that . Indeed, we must have:
Thus, there is an edge between and in the conflict graph , and since , we have .
We shall now prove that for any client . Again using that no facility is special, we have that ’s neighborhood in the client-facility graph that generated is equal to the set of tight facilities that is paying for. Therefore, we have that (which implies ) by the exact same arguments as “Case ” and “Case ” in the proof of Theorem 3.4. ∎
We partition the clients in into two sets:
To bound the remaining clients consider the following fractional token argument: each client distributes tokens to each facility . Lemma 8.13 says that for every client , and so the total number of tokens distributed is at most .
Now note that every is in for some . By Lemma 8.13 we thus have for every in . Moreover, must not be dense, since otherwise would be in . Hence, we have
Moreover, there must be at least tokens assigned to , because it is a tight facility with respect to and by Lemma 8.13, every client must have . That is,
where the first inequality follows from (8.7), and the last inequality from the fact that each facility received at least tokens and the total amount of distributed tokens was at most .
where the penultimate inequality follows from (8.6) and the last inequality from Theorem 6.4, as . ∎
If we select the shift-parameter uniformly at random from ,
In particular, if we set for the value that minimizes then, we have
where the first inequality follows from by Corollary 8.12 and the last inequality follows from Lemma 8.14. The second claim now follows since the minimum of left-hand side over all is at most its expected value over a randomly chosen . ∎
Now, we show how to obtain a better bound than that given by Lemma 8.7 for dense clients . Specifically, we show how to bound the cost of all clients in using the facilities of . This will allow us to eventually obtain a roundable solution.
For any , either:
There exists a tight facility such that .
There exists a special facility such that .
Consider a client . Since there must be some such that . Moreover, since , is undecided and so by Lemma 8.4 we must have .
Suppose first that . Then . Since we have for all . We claim that . Indeed, otherwise there is a client such that and so
contradicting Invariant 3, since the -ball of would then strictly contain the -ball of . Hence, . Furthermore, and therefore
On the other hand, if then (by the definition of ) there must be some with . By Lemma 8.4, must be decided. Then, and so by Lemma 8.7 there exists some tight facility such that . Moreover, applying the same argument as above, we must have , since otherwise in , the -ball of would strictly contain the -ball of , contradicting Invariant 3. Then, we have:
where for the final inequality we used that is undecided and so by Lemma 8.4 we have . ∎
6 Showing that each solution is roundable and completing the analysis
We start by showing that each solution produced by Algorithm 1 satisfies the properties of Definition 5.1.
Every solution produced by Algorithm 1 is roundable.
By construction, each solution produced by Algorithm 1 is feasible with respect to DUAL and . In addition, we have for all . It remains to show that Properties 2 and 3 of Definition 5.1 are satisfied. Recall the definitions of and , and define and as in (8.5). Further let .
Now we show that Property 2 holds for with respect to the set . By Lemma 8.11 (which shows that a client only if for some stage ) we have . Thus . Now, by Lemma 8.7 for all there exists some tight facility such that
Similarly, by Lemma 8.17, for all , there exists either some tight facility or some special facility such that
Finally, we consider the remaining clients in . Lemma 8.7 shows that for every client there is some tight facility such that
For each client , let be this specified tight facility . Then,
where the last inequality follows from Corollary 8.15.
Finally, we show that Property 3 must hold. Consider some . By definition of , we must have for some . Then, by Lemma 8.11 we must have for some . By Lemma 8.8 (which bounds the ratio to be at most between and for any pair of clients that share a tight edge to some common facility ), we must have for any . Moreover, by Lemma 8.13 (which shows that each dense client pays for at most one dense facility in ), we have for all . Altogether, then we have and and so
where the first inequality follows from the definition of , which requires that for any , for all . By Invariant 4, every client is decided in and so, in particular, and contains no special facilities. Then, by Lemma 8.13, for all . Summing (8.8) over all we thus have
where the final inequality follows from Corollary 8.15. ∎
The following theorem completes the analysis.
RaisePrice runs in polynomial time and produces a polynomial number of close roundable solutions.
That the produced solutions are close follows from Proposition 8.10 and the produced solutions are roundable follows from Proposition 8.18. We continue to bound the running time and the number of produced solutions. RaisePrice produces one solution for each call to Sweep. In Appendix B we argue (similarly as we did for QuasiSweep) that Sweep can be implemented in polynomial time, and it is clear that the remaining operations in RaisePrice can be implemented in polynomial time. Thus, to prove both claims, it suffices bound the number of calls to Sweep in RaisePrice. For that purpose, define:
Using our preprocessing (Lemma 4.1), we note that at all times during any call to RaisePrice, we have , since otherwise would be infeasible (contradicting Invariant 2).
Let us now bound the number of calls to Sweep in each stage. In stage 1, we make only 1 call to Sweep, as shown in Lemma 8.3. In each stage , RaisePrice calls Sweep only until and for every undecided client . Consider a call to Sweep in stage and let be the produced solution. Let be the undecided client with the smallest -value in (breaking ties in the order of removal from the set ). If was removed by Rule , we have and and so every undecided client has an -value of at least which implies the termination of stage . Otherwise, as has the smallest -value of undecided clients it cannot be removed by Rule (by Property 2) and so it must have been removed by Rule . Therefore, by the definition of that rule, was undecided in the previous iteration and its -value has increased by in the considered call to Sweep. By the above, we have that either stage terminates or the smallest -value of the undecided clients increases by at least . Therefore, the stage must terminate after at most calls to Sweep since no -value is larger than .
Finally, let us bound the number of stages executed in RaisePrice. By Lemma 8.5 after stage , all clients with are decided. Then, for we have and so all clients must be decided. ∎
References
Appendix A Implementation of QuasiSweep
In Section 4.1, we presented the procedure QuasiSweep in a continuous fashion. We now describe a discrete, polynomial time implementation of QuasiSweep. As presented, QuasiSweep maintains only the -values of each client, the value of , and the set of active clients. We suppose we are increasing at the speed of , so that the value of corresponds to the current time. Then, QuasiSweep changes each -value at the speed of either 0, 1, or . Moreover, this speed does not change until one of the following events happens:
Client joins : this can happen only if .
changes buckets: this can only happen when has reached the border of a bucket.
Facility becomes tight: this can happen if no client with a tight edge to is decreasing, and some client in has a tight edge to .
Client gains a tight edge to facility : this can happen only if .
Client changes buckets and enters the same bucket as : this can happen only if is being decreased.
Note that we remove a client from either immediately after it is added to , at the time that some facility becomes tight, or at the time that it gains a tight edge to some (tight) facility. Therefore, we do not need to add an event for removing a client from , since it only happens if one of the above events happen.
The polynomial time QuasiSweep now works as follows: In each step, we find the next time that any one of the above events happens, then increase/decrease each -value according to its current speed to obtain a new set of values at this time. Then, we update , , and our set of speeds and continue. We need to show how we can efficiently compute the next event that happens, and also we need to prove that the number of such events is polynomial. In what follows, we compute the time until each event above happens, assuming that it is the next event that happens. Then the next event that actually happens is the event with the minimum such time (breaking ties arbitrarily).
We now consider each of the above events in turn:
The time until the Event 1 may happen next is . Also we have exactly occurrences of this event.
The time until Event 2 may happen next is the difference between and the border of the next bucket, i.e., , where . We have at most such events.
For Event 3, if some client with a tight edge to is decreasing then (non-tight) facility cannot become tight (due to the choice of the speed of decrease). If no decreasing client has a tight edge to facility , then the time that may become tight is
Notice that the numerator is the current slack of facility and the denominator is the speed at which this slack decreases. Moreover, there are at most such events, since if a facility becomes tight, it will stay tight (as we discussed in our description of QuasiSweep).
The time until Event 4 may happen for some edge is if , and there are at most such events, since if an edge becomes tight, it remains tight afterwards.
Finally, Event 5 may happen only for those clients with . For any such , the time until Event 5 happens is . This event can happen also at most times, since once , is no longer decreased. Note that when is decreasing, we consider it to change buckets at the moment that it lies on the lower border of its current bucket (i.e., at the moment that ). It is easy to verify that still for any and placed in the same bucket by this rule.
From the above, it is clear that the number of events are polynomial, and also that the next event can be computed in polynomial time.
Appendix B Implementation of Sweep
In this section, we present a polynomial time implementation of the Sweep procedure. Our general approach is the same as described QuasiSweep in Appendix A, besides the set of events. Recall that the polynomial time algorithm for QuasiSweep is as follows: repeatedly find the next event that happens, then update the -values. We increase at a rate 1, so that corresponds naturally to our notion of time. Let denote the value of at the time that the preceding event happened.
We now focus on the events, explain them in detail, show the number of times that each can occur, and discuss the way that we can find each one of them. Let be the set of active clients (as in Sweep) and let denote the set of all clients whose value is being decreased. Then, is changed at a rate of 1 for every , for every , and 0 for all other clients. We now consider the events that can cause and to change. For each such event, we show how to compute (in polynomial time) the time at which it would occur, assuming that and have not yet changed. The next time that the behavior of Sweep can change (and the next time that an event actually occurs) is then the minimum over all of these event times.
Given this next time , we first update all -values according to their current rate of change. Then, we compute the set of active clients, as follows. We first add to all clients with . Next, we remove clients from according to Rules 1-5 in Sweep. Using the updated -values and the updated set , we then compute the set of decreasing clients as in Sweep. Note that until has increased neither the set nor any -values will change. Thus, we can assume without loss of generality that the next event occurs when . For any (after we update ) we therefore consider to be strictly greater than its present value when computing the set of potentially tight facilities (and hence decreasing clients): i.e. if , we consider if and we consider if . After computing the set of decreasing clients, we finally set and continue.
Let us now describe how to compute the events that may cause or to change, and argue that they occur at most a polynomial number of times. We consider the following basic events:
changes bucket or some client enters the same bucket as . The time at which changes bucket can be computed exactly as described in Event 2 in our discussion of the running time of QuasiSweep, and this happens at most once for each bucket. Similarly, we can compute the next time that some client enters the same bucket as as described in Event 5 in our discussion of QuasiSweep (using the fact that here also, all clients of are decreasing at a rate of ). Just as in QuasiSweep, here also no client is decreased after entering the same bucket as , and so this event can happen at most once per client.
becomes equal to some constant . This can occur only for a client with or with . Since no value is decreased by Sweep once it has been increased, this event can happen at most twice for any and : once when and once when . Moreover, while and (and so the rate at which is changing) remain constant, the time at which this event will occur is the satisfying .
for some that has not yet been added to . This event occurs only if and so is not presently decreasing or increasing. Once we place and so this event can occur at most once for each . The time at which this event occurs is then, by definition, .
for some constants and and some client that has already been removed from . Once a client has been removed from , it is not subsequently changed by Sweep and so is a constant. Thus, this event can happen at most once for each , , and .
A facility becomes tight and a witness for some . As discussed in our analysis of Sweep, once is a tight and a witness for some it will remain so until the end of Sweep. Thus, this event occurs at most once for each and . This event can occur only if the contributions to are increasing, in which case we must have . The time that becomes tight is then the value satisfying:
Now, let us show how these events capture the potential changes in and , in turn. First, suppose that changes. If some client is added to , we must have and so Event 3 occurs. Now suppose that some client is removed from . We consider the rules for removing clients from one by one:
Rule 1: In this case, either gains a tight edge to some tight facility or a new facility becomes tight and a witness for . In the first case, , and so Event 2 occurs with and . In the second case, Event 5 occurs.
Rule 2: In this case, is stopped by some client . Any such must have already been removed from . Also, we have . Then, Event 4 occurs with and .
Rule 3: In this case, we had at the start of Sweep and . Then, Event 2 occurs with and .
Rule 4: In this case, we have that and . When this first happens, Event 2 occurs with and either or .
Rule 5: In this case, there is a client that has already been removed from such that . Then, Event 4 occurs with , and .
From the above discussion, the events that can potentially cause to change will occur at most a polynomial number of times.Here, and later we implicitly use that all , , are all constant throughout Sweep, and there are at most a polynomial number of distinct such values. That is, we consider Event 2 and Event 4 with only a polynomial number of values for , , and .
Let us now consider how the set may change while the set remains constant. We first consider the case in which some client is removed from . Since presently, we must have that and for some potentially tight facility with . Then, will stop decreasing only if one of the following happen:
Client enters the same bucket as . Then, Event 1 occurs.
Client is removed from . Then, Event 2 occurs with and .
Facility becomes no longer potentially tight. For this case, we first claim that there must in fact be some with . Suppose otherwise; then we must have for all and so . Since , there must be some . Moreover, since is potentially tight . But then, since we would then consider for the purpose of computing this event, as described in our initial discussion. In summary, as long as is decreasing due to some potentially tight facility , we must have some client with . Then, remains potentially tight until decreases to . When this happens, Event 2 occurs with and .
From the above discussion, the number of events that may cause a client to be removed from can occur at most a polynomial number of times for each value of . In particular, any client can be removed from at most a polynomial number of times in total.
Finally, let us consider the case in which a client is added to . Note that if we have and so cannot decrease. Thus, we must have . Then can begin decreasing only in the following cases:
Some such that with and becomes potentially tight. Similar to the discussion above, in this case, we must have that for some . Then, Event 2 occurs with and .
A client is added to for some already potentially tight facility such that with . In this case, we must have . Then, Event 2 occurs with and .
The value becomes equal to for some already potentially tight facility . In this case, let be any client with presently. Then either is removed from , in which case Event 2 occurs with and , or is decreased until it is equal to . This last case occurs at the time satisfying . We now argue that this event occurs at most a polynomial number of times. Indeed, whenever this event occurs we add some to the set , and we have previously shown that any client can be removed from (and hence added back to) at most a polynomial number of times.
The above shows that we can calculate the next event in polynomial time and that there are in total at most polynomially many events. It follows that Sweep can be implemented to run in time that is polynomial in the number of clients and facilities.
Appendix C Bounding the Distances
By losing a factor in the approximation guarantee, we can assume that the squared-distance between any client and any facility is in , where .
We prove that for a given instance of the -means problem, , we can in polynomial time output an instance such that:
The squared distance between any client and any facility is in in , i.e., for any , we have .
For any constant , any -approximate solution for is a -approximate solution for .
In what follows, we first prove the lemma for the case that can be any metric distance function, then we prove it for the case in which must be a Euclidean metric function.
It is easy to see that our clusters have the following properties.
for any two clients in the same cluster. This is because when we add any client to a cluster, the maximum distance in the cluster increases by less than and so at the end of the process.
for any client and facility in the same cluster. Indeed, by the triangle inequality we have that where is the client such that . We have by the previous property.
for any two facilities in the same cluster. Similarly to the previous case, let be the closest client in this cluster to respectively. By the triangle inequality we have that .
We remove all the facilities that are not part of any cluster, since no client can be connected to them in any solution with approximation guarantee better than (this follows from the above property 4). From above properties 1, 2, and 3 it is clear that the squared-distance between any two points in the same cluster is at most . Then, the squared-distance between any point (whether corresponding to a client or a facility ) in some cluster and the centroid of that cluster is also at most .
Clearly, the running time of this procedure is . ∎