Local Search Yields a PTAS for k-Means in Doubling Metrics

Zachary Friggstad, Mohsen Rezapour, Mohammad R. Salavatipour

Introduction

With advances in obtaining and storing data, one of the emerging challenges of our age is data analysis. It is hard to find a scientific research project which does not involve some form of methodology to process, understand, and summarize data. A large portion of data analysis is concerned with predicting patterns in data after being trained with some training data set (machine learning). Two problems often encounterd in data analysis are classification and clustering. Classification (which is an instance of supervised learning) is the task of predicting the label of a new data point after being trained with a set of labeled data points (called a training set). Basically, after given a training set of correctly labeled data points the program has to identify the label of a given new (unlabeled) data point. Clustering (which is an instance of unsupervised learning) is the task of grouping a given set of objects or data points into clusters/groups such that the data points that are more similar fall into the same cluster while data points (objects) that do not seem similar are in different clusters. Some of the main purposes of clustering are to understand the underlying structure and relation between objects and find a compact representation of data points.

This value is called the cost of the clustering. Typically, the centres cic_{i} are selected to be the centroid (mean) of the cluster CiC_{i}. In other situations the centres must be from the data points themselves (i.e. ci∈Cic_{i}\in C_{i}) or from a given set C{\mathcal{C}}. This latter version is referred to as discrete kk-means clustering. Although in most application of kk-means the data points are in some Euclidean space, the discrete variant can be defined in general metrics. The kk-means clustering problem is known to be an NP-hard problem even for k=2k=2 or when d=2d=2 .

Clustering, in particular the kk-means clustering problem as the most popular model for it, has found numerous applications in very different areas. The following is a (short) list of applications of clustering that have been addressed by Jain : image segmentation, information access, grouping customers into different types for efficient marketing, grouping delivery services for workforce management and planning, and grouping genome data in biology. For instance, clustering is used to identify groups of genes with related expression patterns in a key step of the analysis of gene functions and cellular processes. It is also extensively used to group patients based on their genetic, pathological, and cellular features which is proven useful in analyzing human genetics diseases (e.g., see ).

The most widely used algorithm for kk-means (which is also sometimes referred to as “the” kk-means algorithm) is a simple heuristic introduced by Lloyd in 1957 . This algorithm starts from an initial partition of the points into kk clusters and it repeats the following two steps as long as it improves the quality of the clustering: pick the centroids of the clusters as centres, and then re-compute a new clustering by assigning each point to the nearest centre. Although this algorithm works well in practice it is known that the ratio of the cost of the solution computed by this algorithm vs the optimum solution cost (known as the “approximation ratio”) can be arbitrarily large (see ). Various modifications and extensions of this algorithm have been produced and studied, e.g. ISODATA, FORGY, Fuzzy C-means, kk-means++, filtering using kd-trees (see ), but none of them are known to have a bounded approximation ratio in the general setting. Arthur and Vassilvitskii show that Lloyd’s method with properly chosen initial centres will be an O(log⁡k)O(\log k)-approximation. Ostrovsky et al. show that under some assumptions about the data points the approximation ratio is bounded by a constant. The problem of finding an efficient algorithm for kk-means with a proven theoretical bound on the cost of the solution returned is probably one of the most well studied problems in the whole field of clustering with hundreds of research papers devoted to this.

Arthur and Vassilvitskii , Dastupta and Gupta , and Har-Peled and Sadri study convergence rate of Lloyd’s algorithm. In particular show that it can be super-polynomial. More recently, Vattani shows that it can take exponential time even in two dimensions. Arthur et al. proved that Lloyd’s algorithm has polynomial-time smoothed complexity. Kumar and Kannan , Ostrovsky et al. , and Awasthi et al. gave empirical and theoretical evidence for when and why the known heuristics work well in practice. For instance show that when the size of an optimum (k−1)(k-1)-means is sufficiently larger than the cost of kk-means then one can get a near optimum solution to kk-means using a variant of Lloyd’s algorithm.

The kk-means problem is known to be NP-hard . In fact, the kk-means problem is NP-hard if dd is arbitrary even for k=2k=2 . Also, if kk is arbitrary the problem is NP-hard even for d=2d=2 . However, the kk-means problem can be solved in polynomial time by the algorithm of when both kk and dd are constant.

kk-median Another very well studied problem that is also closely related to kk-means is kk-median. The only difference is that the goal (objective function) in kk-median is to minimize the sum of distances, instead of sum of square of distances as in kk-means, i.e. minimize ∑i=1k∑x∈Ciδ(x,ci)\sum_{i=1}^{k}\sum_{x\in C_{i}}\delta(x,c_{i}) where δ(x,ci)\delta(x,c_{i}) is the distance between xx and cic_{i}. This problem occurs in operations research settings.

There are constant factor approximation algorithms for kk-median in general metrics. The simple local search (which swaps in and out a constant number of centres in each iteration) is known to give a 3+ϵ3+\epsilon approximation by Arya et al. . The current best approximation uses different techniques and has an approximation ratio of 2.611+ϵ2.611+\epsilon . The local search (9+ϵ)(9+\epsilon)-approximation (for kk-means) in can be seen as an extension of the analysis in for kk-median. One reason that analysis of kk-means is more difficult is that the squares of distances do not necessarily satisfy the triangle inequality. For instances of kk-median on Euclidean metrics, Arora et al. , building on the framework of Arora , gave the first PTAS. Kolliopoulos and Rao improved the time complexity and presented a PTAS for Euclidean kk-median with time complexity O(2O((1+log⁡1ϵ)/ϵ)d−1nlog⁡nlog⁡k)O(2^{O((1+\log\frac{1}{\epsilon})/\epsilon)^{d-1}}n\log n\log k). Such an approximation is also known as an efficient PTAS: the running time of the (1+ϵ)(1+{\epsilon})-approximation is of the form f(ϵ)⋅poly(n)f({\epsilon})\cdot{\rm poly}(n) (in fixed-dimension metrics).

Uncapacitated facility location The uncapacitated facility location problem is the same as kk-median except instead of a cardinality constraint bounding the number of open facilities, we are instead given opening costs fif_{i} for each i∈Ci\in{\mathcal{C}}. The goal is to find a set of centers S⊆C{\mathcal{S}}\subseteq{\mathcal{C}} that minimizes ∑x∈Xδ(x,S)+∑i∈Sfi\sum_{x\in{\mathcal{X}}}\delta(x,{\mathcal{S}})+\sum_{i\in{\mathcal{S}}}f_{i}. Currently the best approximation for uncapacitated facility location in general metrics is a 1.488-approximation . As with kk-median, a PTAS is known for uncapacitated facility location in constant-dimensional Euclidean metrics , with the latter giving an efficient PTAS.

A precise description of the algorithm is given in Section 2. At a high level, we start with any set of kk centres S⊆C{\mathcal{S}}\subseteq{\mathcal{C}}. Then, while there is some other set of kk centres S′⊆C{\mathcal{S}}^{\prime}\subseteq{\mathcal{C}} with ∣S−S′∣≤ρ|{\mathcal{S}}-{\mathcal{S}}^{\prime}|\leq\rho for some constant ρ\rho such that S′{\mathcal{S}}^{\prime} is a cheaper solution than S{\mathcal{S}}, we set S←S′{\mathcal{S}}\leftarrow{\mathcal{S}}^{\prime}. Repeat until S{\mathcal{S}} cannot be improved any further. Each iteration takes ∣C∣O(ρ)|{\mathcal{C}}|^{O(\rho)} time, which is polynomial when ρ\rho is a constant. Such a solution is called a local optimum solution with respect to the ρ\rho-swap heuristic. We still have to ensure that the algorithm only iterates a polynomial number of times; a standard modification discussed in Section 2 ensures this.

Let ρ(ϵ,d):=dO(d)⋅ϵO(−d/ϵ)\rho({\epsilon},d):=d^{O(d)}\cdot{\epsilon}^{O(-d/{\epsilon})}. We will articulate the absolute constants suppressed by the O(⋅)O(\cdot) notation later on in our analysis.

The local search algorithm that swaps up to ρ(ϵ,d)\rho({\epsilon},d) centres at a time is a (1+ϵ)(1+\epsilon)-approximation for kk-means in metrics with doubling dimension dd.

Note that even for the case of kk-median, this is the first PTAS for metrics with constant doubling dimension. Also, while a PTAS was known for kk-median for constant-dimensional Euclidean metrics, determining if local search provided such a PTAS was an open problem. For example, shows that local search can be used to get a 1+ϵ1+{\epsilon} approximation for kk-median that uses up to (1+ϵ)⋅k(1+{\epsilon})\cdot k centres.

As mentioned earlier, Awasthi et al. proved that kk-means is APX-hard for d=Ω(log⁡n)d=\Omega(\log n) and they left the approximability of kk-means for lower dimensions as an open problem. A consequence of our algorithm is that one can get a (1+ϵ)(1+\epsilon)-approximation for kk-means that runs in sub-exponential time for values of dd up to O(log⁡n/log⁡log⁡n)O(\log n/\log\log n). More specifically, for any given 0<ϵ<10<\epsilon<1 and d=σlog⁡n/log⁡log⁡nd=\sigma\log n/\log\log n for sufficiently small absolute constant σ\sigma we get a (1+ϵ)(1+\epsilon)-approximation for kk-means that runs in time O(2nκ)O(2^{n^{\kappa}}), for some constant κ=κ(σ)<1\kappa=\kappa(\sigma)<1; for d=O(log⁡log⁡n/log⁡log⁡log⁡n)d=O(\log\log n/\log\log\log n) we get a quasi-polytime approximation scheme (QPTAS). Therefore, our result in a sense shows that the requirement of of d=Ω(log⁡n)d=\Omega(\log n) to prove APX-hardness of kk-means is almost tight unless NP⊆DTIME(2nσ){\rm NP}\subseteq DTIME(2^{n^{\sigma}}).

The notion of coresets and using them for finding faster algorithms for kk-means has been studied extensively (e.g. and references there). A coreset is a small subset of data points (possibly with weights associated to them) such that running the clustering algorithm on them (instead of the whole data set) generates a clustering of the whole data set with approximately good cost. In order to do this, one can go to the discrete case. To use coresets, we need to be able to solve (discrete) kk-means in the more general setting where each centre i∈Ci\in{\mathcal{C}} has an associated weight w(i)w(i), and the cost of assigning a point jj to ii (if ii is selected to be a centre) is w(i)⋅δ(i,j)2w(i)\cdot\delta(i,j)^{2}. Our local search algorithm works for this weighted setting as well. We will show how to use these ideas to improve the running time of the local search algorithm.

Finally, we observe that our techniques easily extend to show a natural local-search heuristic for uncapacitated facility location is a PTAS. In particular, for the same constant ρ\rho as in Theorem 1 (in fact, it can be slightly smaller) we consider the natural local search algorithm that returns a solution S⊆C{\mathcal{S}}\subseteq{\mathcal{C}} such that cost(S)≤cost(S′){\rm cost}({\mathcal{S}})\leq{\rm cost}({\mathcal{S}}^{\prime}) for all S′⊆C{\mathcal{S}}^{\prime}\subseteq{\mathcal{C}} with both ∣S−S′∣≤ρ|{\mathcal{S}}-{\mathcal{S}}^{\prime}|\leq\rho and ∣S′−S∣≤ρ|{\mathcal{S}}^{\prime}-{\mathcal{S}}|\leq\rho (i.e. add and/or drop up to ρ\rho centres in C{\mathcal{C}}).

The local search algorithm that adds and/or drops up to ρ(ϵ,d)\rho({\epsilon},d) centres at a time is a (1+ϵ)(1+\epsilon)-approximation for uncapacitated facility location in metrics with doubling dimension dd.

This seems to be the first explicit record of a PTAS for uncapacitated facility location in doubling metrics, but one was known in constant-dimensional Euclidean metrics . Prior to this work, local search was only known to provide a PTAS for uncapacitated facility location in constant-dimensional Euclidean metrics if all opening costs are the same . The basic idea why this works is our analysis in Theorem 1 considers test swaps that, overall, swap in each local optimum centre exactly once and swap out each global optimum centre exactly once (i.e. the swaps come from a full partitioning of the local and global optimum). The partitioning we use to obtain these swaps only uses the assumption that precisely kk centres are open in a feasible solution at one point, and this step can be safely ignored in the case of uncapacitated facility location.

Lastly, we consider the common generalization of kk-median and uncapacitated facility location where all centres have costs and at most kk centres may be chosen (sometimes called the generalized kk-median or kk-uncapacitated facility location problem). We consider the local search operation that tries to add and/or drop up to ρ\rho centres at a time as long as the candidate solution being tested includes at most kk centres. We get a PTAS in this case as well. To the best of our knowledge, the previous best approximation was a 5-approximation in general metrics, also obtained by local search .

The local search algorithm that adds and/or drops up to ρ(ϵ,d)\rho({\epsilon},d) centres at a time (provided the resulting solution has at most kk facilities) is a a (1+ϵ)(1+\epsilon)-approximation for generalized kk-median in metrics with doubling dimension dd.

Note: Shortly after we announced our result , Cohen-Addad, Klein, and Mathieu announced similar results for kk-means on Euclidean and minor-free metrics using the local search method. Specifically, they prove that the same local search algorithm yields a PTAS for kk-means on Euclidean and minor-free metrics. These results are obtained independently.

2 Proof Outline

The general framework for analysis of local search algorithms for kk-median and kk-means in is as follows. Let S{\mathcal{S}} and O{\mathcal{O}} be a local optimum and a global optimum solution, respectively. They carefully identify a set QQ of potential swaps between local and global optimum. In each such swap, the cost of assigning a data point xx to the nearest centre after a swap is bounded with respect to the local and global cost assignment. In other words, if B(S){\mathcal{B}}({\mathcal{S}}) is the set of solutions obtained by performing swaps from QQ, the main task is to show that ∑S′∈B(S)(cost(S′)−cost(S))≤α⋅cost(O)−cost(S)\sum_{{\mathcal{S}}^{\prime}\in{\mathcal{B}}({\mathcal{S}})}({\rm cost}({\mathcal{S}}^{\prime})-{\rm cost}({\mathcal{S}}))\leq\alpha\cdot{\rm cost}({\mathcal{O}})-{\rm cost}({\mathcal{S}}) for some constant α\alpha. Given that 0≤cost(S′)−cost(S)0\leq{\rm cost}({\mathcal{S}}^{\prime})-{\rm cost}({\mathcal{S}}) for all S′∈B(S){\mathcal{S}}^{\prime}\in{\mathcal{B}}({\mathcal{S}}) (because S{\mathcal{S}} is a local optimum), cost(S)≤α⋅cost(O){\rm cost}({\mathcal{S}})\leq\alpha\cdot{\rm cost}({\mathcal{O}}).

Our analysis has the same structure but has many more ingredients and several intermediate steps to get us what we want. Note that the following only describes steps used in the analysis of the local search algorithm; we do not perform any of the steps described below in the algorithm itself.

Let us define S{\mathcal{S}} and O{\mathcal{O}} as before. First, we do a filtering over S{\mathcal{S}} and O{\mathcal{O}} to obtain subsets S‾⊆S\overline{{\mathcal{S}}}\subseteq{\mathcal{S}} and O‾⊆O\overline{{\mathcal{O}}}\subseteq{\mathcal{O}} such that every centre in S−S‾{\mathcal{S}}-\overline{{\mathcal{S}}} (in O−O‾{\mathcal{O}}-\overline{{\mathcal{O}}}) is “close” to a centre in S‾\overline{{\mathcal{S}}} (in O‾\overline{{\mathcal{O}}}) while these filtered centres are far apart. We define a “net” around each centre i∈S‾i\in\overline{{\mathcal{S}}} which captures a collection of other filtered centres in O‾\overline{{\mathcal{O}}} that are relatively close to ii. The idea of the net is that if we choose to close ii (in a test swap) then the data points that were to be assigned to ii will be assigned to a nearby centre in the net of ii. Since the metric is a constant-dimensional Euclidean metric (or, more generally, a doubling metric), we can choose these nets to have constant size.

For each jj assigned to ii in S{\mathcal{S}}, if the centre i∗i^{*} that jj is assigned to in the optimum solution lies somewhat close to ii then we can reassign jj to a facility in the net around ii that is close to i∗i^{*}. In this case, the reassignment cost for jj will be close to cj∗−cjc^{*}_{j}-c_{j}. Otherwise, if i∗i^{*} lies far from ii then we can reassign jj to a facility near ii in the net around ii and the reassignment cost will only be O(ϵ)⋅(cj∗+cj)O({\epsilon})\cdot(c^{*}_{j}+c_{j}) and we will generate the cj∗−cjc^{*}_{j}-c_{j} term for the local search analysis when i∗i^{*} is opened in another different swap.

Of course, there are some complications in that we need to do something else with jj if the net around ii is not open. This will happen infrequently, but we need a somewhat reasonable bound when it does happen. Also, for reasons that will become apparent in the analysis we do something different in the case that i∗i^{*} is somewhat close to ii but i∗i^{*} is much closer to a different facility in S{\mathcal{S}} than it is to ii.

Notation and Preliminaries

We usually refer to a potential centre in C{\mathcal{C}} by a simple index ii and a point in X{\mathcal{X}} by a simple index jj (or slight variants like i∗i^{*} or i′‾\overline{i^{\prime}}). This is to emphasize that we do not need to talk about specific coordinates of points in Euclidean space. In fact, only once in our proof do we rely on the particular embedding of the points in Euclidean space. This argument will also be replaced by a more general argument when discussing doubling metrics in Section 5.1. So, for any set S⊆CS\subseteq{\mathcal{C}} and any j∈Xj\in{\mathcal{X}}, let δ(j,S)=min⁡i∈Sδ(j,i)\delta(j,S)=\min_{i\in S}\delta(j,i). We also define cost(S)=∑j∈Xδ(j,S)2{\rm cost}(S)=\sum_{j\in{\mathcal{X}}}\delta(j,S)^{2}.

Our goal in (discrete) kk-means is to find a set of centres S⊆CS\subseteq{\mathcal{C}} of size kk to minimize cost(S){\rm cost}(S). Note that once we fix the set of centres we can find a partitioning of X{\mathcal{X}} that realizes ∑j∈Xδ(j,S)2\sum_{j\in{\mathcal{X}}}\delta(j,S)^{2} by assigning each j∈Xj\in{\mathcal{X}} to the nearest centre in SS, breaking ties arbitrarily.

The simple ρ\rho-swap local search heuristic shown in Algorithm 1 is essentially the same one considered in .

Recall that we defined ρ(ϵ,d)=dO(d)⋅ϵO(d/ϵ)\rho({\epsilon},d)=d^{O(d)}\cdot{\epsilon}^{O(d/{\epsilon})}, where the constants will be specified later and consider the local search algorithm with ρ=ρ(ϵ,d)\rho=\rho({\epsilon},d) swaps. By a standard argument (as in ) one can show that replacing the condition of the while loop with cost((S−Q)∪P)≤(1−ϵk)⋅cost(S){\rm cost}(({\mathcal{S}}-Q)\cup P)\leq(1-\frac{{\epsilon}}{k})\cdot{\rm cost}({\mathcal{S}}), the algorithm terminates in polynomial time. Furthermore, if α\alpha is such that any locally optimum solution returned by Algorithm 1 has cost at most α⋅cost(O)\alpha\cdot{\rm cost}({\mathcal{O}}) where O{\mathcal{O}} denotes a global optimum solution, then any S{\mathcal{S}} such that cost((S−Q)∪P)<(1−ϵk)⋅cost(S){\rm cost}(({\mathcal{S}}-Q)\cup P)<(1-\frac{{\epsilon}}{k})\cdot{\rm cost}({\mathcal{S}}) for any possible swap P,QP,Q satisfies cost(S)≤α1−ϵcost(O){\rm cost}({\mathcal{S}})\leq\frac{\alpha}{1-{\epsilon}}{\rm cost}({\mathcal{O}}). This follows by arguments in and the fact that our local search analysis uses at most kk “test swaps”.

For ease of exposition, we ignore this factor 1+ϵ1+\epsilon loss, and consider the solution S{\mathcal{S}} returned by Algorithm 1. Recall that we use O{\mathcal{O}} to denote the global optimum solution. For j∈Xj\in{\mathcal{X}}, let cj∗=δ(j,O)2c^{*}_{j}=\delta(j,{\mathcal{O}})^{2} and cj=δ(j,S)2c_{j}=\delta(j,{\mathcal{S}})^{2}, so cost(O)=∑j∈Xcj∗{\rm cost}({\mathcal{O}})=\sum_{j\in{\mathcal{X}}}c^{*}_{j} and cost(S)=∑j∈Xcj{\rm cost}({\mathcal{S}})=\sum_{j\in{\mathcal{X}}}c_{j}. We also denote the centre in O{\mathcal{O}} nearest to jj by σ∗(j)\sigma^{*}(j) and the centre in S{\mathcal{S}} nearest to jj by σ(j)\sigma(j). Define ϕ:O∪S→O∪S\phi:{\mathcal{O}}\cup{\mathcal{S}}\rightarrow{\mathcal{O}}\cup{\mathcal{S}} to be the function that assigns i∗∈Oi^{*}\in{\mathcal{O}} to its nearest centre in S{\mathcal{S}} and assigns i∈Si\in{\mathcal{S}} to its nearest centre in O{\mathcal{O}}. For any two sets S,T⊆O∪SS,T\subseteq{\mathcal{O}}\cup{\mathcal{S}}, we let S△T=(S∪T)−(S∩T)S\triangle T=(S\cup T)-(S\cap T).

We assume O∩S=∅{\mathcal{O}}\cap{\mathcal{S}}=\emptyset. This is without loss of generality because we could duplicate each location in C{\mathcal{C}} and say O{\mathcal{O}} uses the originals and S{\mathcal{S}} the duplicates. It is easy to check that S{\mathcal{S}} would still be a locally optimum solution in this instance. We can also assume that these are the only possible colocated facilities, so δ(i,i′)>0\delta(i,i^{\prime})>0 for distinct i,i′∈Oi,i^{\prime}\in{\mathcal{O}} or distinct i,i′∈Si,i^{\prime}\in{\mathcal{S}}. Finally, we will assume ϵ{\epsilon} is sufficiently small (independent of all other parameters, including dd) so that all of our bounds hold.

To prove this, we will construct a set of test swaps that yield various inequalities which, when combined, provide the desired bound on cost(S){\rm cost}({\mathcal{S}}). That is, we will partition O∪S{\mathcal{O}}\cup{\mathcal{S}} into sets where ∣P∩O∣=∣P∩S∣≤ρ(ϵ,d)|P\cap{\mathcal{O}}|=|P\cap{\mathcal{S}}|\leq\rho({\epsilon},d) for each part PP. For each such set PP, 0≤cost(S△P)−cost(S)0\leq{\rm cost}({\mathcal{S}}\triangle P)-{\rm cost}({\mathcal{S}}) because S{\mathcal{S}} is a locally optimum solution. We will provide an explicit upper bound on this cost change that will reveal enough information to easily conclude cost(S)≤(1+O(ϵ))⋅cost(O){\rm cost}({\mathcal{S}})\leq(1+O({\epsilon}))\cdot{\rm cost}({\mathcal{O}}). For example, for a point j∈Xj\in{\mathcal{X}} if σ∗(j)∈P\sigma^{*}(j)\in P then the change in jj’s assignment cost is at most cj∗−cjc^{*}_{j}-c_{j} because we could assign jj from σ(j)\sigma(j) to σ∗(j)\sigma^{*}(j). The problem is that points jj with σ(j)∈P\sigma(j)\in P but σ∗(j)∉P\sigma^{*}(j)\not\in P must go somewhere else; most of our effort is ensuring that the test swaps are carefully chosen so such reassignment cost increases are very small.

First we need to describe the partition of O∪S{\mathcal{O}}\cup{\mathcal{S}}. This is a fairly elaborate scheme that involves several steps. As mentioned earlier, the actual algorithm for kk-means is the simple local search we described and the algorithms we describe below to get this partitioning scheme are only for the purpose of proof and analysis of the local search algorithm.

For i∗∈Oi^{*}\in{\mathcal{O}} let Di∗:=δ(i∗,S)=δ(i∗,ϕ(i∗))D_{i^{*}}:=\delta(i^{*},{\mathcal{S}})=\delta(i^{*},\phi(i^{*})). For i∈Si\in{\mathcal{S}} let Di:=δ(i,O)=δ(i,ϕ(i))D_{i}:=\delta(i,{\mathcal{O}})=\delta(i,\phi(i)).

The first thing is to sparsify O{\mathcal{O}} and S{\mathcal{S}} using a simple filtering step. Algorithm 2 filters O{\mathcal{O}} to a set that is appropriately sparse for our analysis.

Think of η(i∗)\eta(i^{*}) as a proxy for i∗i^{*} that is very close to i∗i^{*}. Using a similar process, we filter S{\mathcal{S}} to get S‾\overline{{\mathcal{S}}} and proxy centres η(i)∈S‾\eta(i)\in\overline{{\mathcal{S}}} for each i∈Si\in{\mathcal{S}}. The idea is that the set of centres left in O‾\overline{{\mathcal{O}}} and S‾\overline{{\mathcal{S}}} are somewhat far apart yet any point that was assigned to a centre in O−O‾{\mathcal{O}}-\overline{{\mathcal{O}}} (or in S−S‾{\mathcal{S}}-\overline{{\mathcal{S}}}) can be “cheaply” reassigned to a proxy.

For each i∈O∪Si\in{\mathcal{O}}\cup{\mathcal{S}} we have δ(i,η(i))≤ϵ⋅Di\delta(i,\eta(i))\leq{\epsilon}\cdot D_{i}. For any distinct i,i′∈O‾∪S‾i,i^{\prime}\in\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}} we have δ(i,i′)≥ϵ⋅max⁡{Di,Di′}\delta(i,i^{\prime})\geq{\epsilon}\cdot\max\{D_{i},D_{i^{\prime}}\}.

Proof. That δ(i,η(i))≤ϵ⋅Di\delta(i,\eta(i))\leq{\epsilon}\cdot D_{i} follows immediately by construction. If i∈O‾,i′∈S‾i\in\overline{{\mathcal{O}}},i^{\prime}\in\overline{{\mathcal{S}}} or vice-versa, then in fact δ(i,i′)≥max⁡{Di,Di′}\delta(i,i^{\prime})\geq\max\{D_{i},D_{i^{\prime}}\} simply by definition of Di,Di′D_{i},D_{i^{\prime}}.

Now suppose i,i′∈O‾i,i^{\prime}\in\overline{{\mathcal{O}}} and that i′i^{\prime} was considered after ii in Algorithm 2 (so Di′≥DiD_{i^{\prime}}\geq D_{i}). The fact that i′i^{\prime} was added to O‾\overline{{\mathcal{O}}} even though ii was already in O‾\overline{{\mathcal{O}}} means δ(i,i′)≥ϵ⋅Di′\delta(i,i^{\prime})\geq{\epsilon}\cdot D_{i^{\prime}}. The same argument works if i,i′∈S‾i,i^{\prime}\in\overline{{\mathcal{S}}}.

Next we define mappings similar to ϕ,σ,σ∗\phi,\sigma,\sigma^{*} except they only concern centres that were not filtered out.

ϕ‾:O‾∪S‾→O‾∪S‾{\overline{\phi}}:\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}}\rightarrow\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}} maps each i∈O‾i\in\overline{{\mathcal{O}}} to its nearest location in S‾\overline{{\mathcal{S}}} and vice versa.

σ‾∗:X→O‾{\overline{\sigma}}^{*}:{\mathcal{X}}\rightarrow\overline{{\mathcal{O}}} defined by σ‾∗(j)=η(σ∗(j)){\overline{\sigma}}^{*}(j)=\eta(\sigma^{*}(j)).

σ‾:X→S‾{\overline{\sigma}}:{\mathcal{X}}\rightarrow\overline{{\mathcal{S}}} defined by σ‾(j)=η(σ(j)){\overline{\sigma}}(j)=\eta(\sigma(j)).

Finally, for each i∈ϕ‾(O‾)i\in{\overline{\phi}}(\overline{{\mathcal{O}}}), let cent(i){\rm cent}(i) be the centre in ϕ‾−1(i){\overline{\phi}}^{-1}(i) that is closest to ii, breaking ties arbitrarily.

Note σ‾(j){\overline{\sigma}}(j) may not necessarily be the centre in S‾\overline{{\mathcal{S}}} that is closest to jj. Also note that if one considers a bipartite graph with parts O‾\overline{{\mathcal{O}}} and S‾\overline{{\mathcal{S}}}, then ϕ‾{\overline{\phi}} maps centres from one side to the other.

For each i′∈O‾∪S‾i^{\prime}\in\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}}, Di′≤δ(i′,ϕ‾(i′))≤(1+ϵ)⋅Di′D_{i^{\prime}}\leq\delta(i^{\prime},{\overline{\phi}}(i^{\prime}))\leq(1+{\epsilon})\cdot D_{i^{\prime}}.

Proof. Suppose i′∈O‾i^{\prime}\in\overline{{\mathcal{O}}}, the proof is essentially the same for i′∈S‾i^{\prime}\in\overline{{\mathcal{S}}}. On one hand, we know

because S‾⊆S\overline{{\mathcal{S}}}\subseteq{\mathcal{S}}. On the other hand,

Conclude by observing Dϕ(i′)≤δ(i′,ϕ(i′))=Di′D_{\phi(i^{\prime})}\leq\delta(i^{\prime},\phi(i^{\prime}))=D_{i^{\prime}}.

Figure 1 depicts many of the concepts covered above. Finally, the last definition in this section identifies pairs of centres that we would like to have in the same part of the partition we construct.

T:={(cent(i),i):i∈ϕ‾(O‾) and ϵ⋅δ(cent(i),i)≤Di}{\mathcal{T}}:=\{({\rm cent}(i),i):i\in{\overline{\phi}}(\overline{{\mathcal{O}}}){\rm~{}and~{}}{\epsilon}\cdot\delta({\rm cent}(i),i)\leq D_{i}\}

N:={(i∗,i)∈O‾×S‾:δ(i,i∗)≤ϵ−1⋅Di and Di∗≥ϵ⋅Di}{\mathcal{N}}:=\{(i^{*},i)\in\overline{{\mathcal{O}}}\times\overline{{\mathcal{S}}}:\delta(i,i^{*})\leq{\epsilon}^{-1}\cdot D_{i}{\rm~{}and~{}}D_{i^{*}}\geq{\epsilon}\cdot D_{i}\}

For each i∈S‾i\in\overline{{\mathcal{S}}}, the set {i∗:(i∗,i)∈N}\{i^{*}:(i^{*},i)\in{\mathcal{N}}\} is the “net” for centre ii that was discussed in the proof outline in Section 1.2.

Ultimately we will require that pairs in T{\mathcal{T}} are not separated by the partition. Our requirement for N{\mathcal{N}} is not quite as strong. The partition is constructed randomly and it will be sufficient to have each pair in N{\mathcal{N}} being separated by the partition with probability at most ϵ{\epsilon}.

The following says that if at least one centre of each pair in T{\mathcal{T}} is open after a swap, then every centre in O‾∪S‾\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}} is somewhat close to some open centre. The bound is a bit big, but it will be multiplied by O(ϵ)O({\epsilon}) whenever it is used in the local search analysis.

Let A⊆O‾∪S‾A\subseteq\overline{{\mathcal{O}}}\cup\overline{{\mathcal{S}}} be such that A∩{cent(i),i}≠∅A\cap\{{\rm cent}(i),i\}\neq\emptyset for each (cent(i),i)∈T({\rm cent}(i),i)\in{\mathcal{T}}. Then δ(i′,A)≤5⋅Di′\delta(i^{\prime},A)\leq 5\cdot D_{i^{\prime}} for any i′∈O∪Si^{\prime}\in{\mathcal{O}}\cup{\mathcal{S}}.

Proof. We first prove the statement for i′∈Oi^{\prime}\in{\mathcal{O}}, the other case is similar but requires one additional step so we will discuss it below. Consider the following sequence of centres. Initially, set i0:=i′i_{0}:=i^{\prime}, i1:=η(i0)i_{1}:=\eta(i_{0}), and i2:=ϕ‾(i1)i_{2}:={\overline{\phi}}(i_{1}). We build the rest inductively, noting that we guarantee ia∈ϕ‾(O‾)i_{a}\in{\overline{\phi}}(\overline{{\mathcal{O}}}) for even indices a≥2a\geq 2 (so cent(ia){\rm cent}(i_{a}) is defined).

Inductively, for even a≥2a\geq 2 we do the following. If ia∈Ai_{a}\in A then we stop. Otherwise, if (cent(ia),ia)∈T({\rm cent}(i_{a}),i_{a})\in{\mathcal{T}} then by assumption it must be that cent(ia)∈A{\rm cent}(i_{a})\in A so we let ia+1:=cent(ia)i_{a+1}:={\rm cent}(i_{a}) and stop. Finally, if (cent(ia),ia)∉T({\rm cent}(i_{a}),i_{a})\not\in{\mathcal{T}} then we set ia+1:=ϕ‾(ia)i_{a+1}:={\overline{\phi}}(i_{a}) and ia+2:=ϕ‾(ia+1)i_{a+2}:={\overline{\phi}}(i_{a+1}) and iterate with a′=a+2a^{\prime}=a+2. This walk is depicted in Figure 2.

We will soon show the walk terminates. For now, we observe that, apart from the first step, the steps decrease in length geometrically. In particular, consider some a≥2a\geq 2 such that the walk did not stop at iai_{a}. If ia+1=ϕ‾(ia)i_{a+1}={\overline{\phi}}(i_{a}) then

If ia+1≠ϕ‾(ia)i_{a+1}\neq{\overline{\phi}}(i_{a}) then it must be ia=cent(ia−1)i_{a}={\rm cent}(i_{a-1}). In this case, it must be ia=ϕ‾(ia−1)i_{a}={\overline{\phi}}(i_{a-1}), so because cent(ia){\rm cent}(i_{a}) is the closest centre in ϕ‾−1(ia){\overline{\phi}}^{-1}(i_{a}) to iai_{a} (by definition), we have

We prove that the lengths of the edges traversed decrease geometrically with every other step. This, along with the fact that the lengths of the steps of the walk are nonincreasing (except, perhaps, the first two steps), will show that this process eventually terminates and also bounds the cost of the path.

For every even a≥2a\geq 2 such that the walk did not end at iai_{a} or ia+1i_{a+1}, we have δ(ia,ia+1)≤2ϵ⋅δ(ia−1,ia)\delta(i_{a},i_{a+1})\leq 2{\epsilon}\cdot\delta(i_{a-1},i_{a}).

Proof. Because the walk did not end at iai_{a} or ia+1i_{a+1}, (cent(ia),ia)∉T({\rm cent}(i_{a}),i_{a})\not\in{\mathcal{T}} meaning Dia<ϵ⋅δ(cent(ia),ia)≤ϵ⋅δ(ia−1,ia)D_{i_{a}}<{\epsilon}\cdot\delta({\rm cent}(i_{a}),i_{a})\leq{\epsilon}\cdot\delta(i_{a-1},i_{a}). Using this and Lemma 2 in the first bound below, we see

Let mm be the index of the last centre in the walk. Thus, δ(ia,ia+1)≤δ(ia−1,ia)\delta(i_{a},i_{a+1})\leq\delta(i_{a-1},i_{a}) for all 2≤a≤m−12\leq a\leq m-1. From this and Claim 1 we have

The second last step uses Lemma 2 and the last step uses the fact that Dη(i′)≤Di′D_{\eta(i^{\prime})}\leq D_{i^{\prime}} (either i′=η(i′)i^{\prime}=\eta(i^{\prime}) or else i′i^{\prime} was filtered out by η(i′)\eta(i^{\prime}), in which case it has a larger DD-value) and the assumption that ϵ{\epsilon} is small enough.

Now suppose i′∈Si^{\prime}\in{\mathcal{S}}. We bound δ(i′,A)\delta(i^{\prime},A) mostly using what we have done already. That is, we have

Note Dϕ(i′)≤δ(i′,ϕ(i′))=Di′D_{\phi(i^{\prime})}\leq\delta(i^{\prime},\phi(i^{\prime}))=D_{i^{\prime}} again by Lemma 2. So,

2 Good Partitioning of 𝒪∪𝒮𝒪𝒮{\mathcal{O}}\cup{\mathcal{S}} and Proof of Theorem 4

The main tool used in our analysis is the existence of the following randomized partitioning scheme.

There is a randomized algorithm that samples a partitioning π\pi of O∪S{\mathcal{O}}\cup{\mathcal{S}} such that:

For each part P∈πP\in\pi, ∣P∩O∣=∣P∩S∣≤ρ(ϵ,d)|P\cap{\mathcal{O}}|=|P\cap{\mathcal{S}}|\leq\rho({\epsilon},d).

For each part P∈πP\in\pi, S△P{\mathcal{S}}\triangle P includes at least one centre from every pair in T{\mathcal{T}}.

For each (i∗,i)∈N(i^{*},i)\in{\mathcal{N}}, Pr⁡[i,i∗ lie in different parts of π]≤ϵ\Pr[i,i^{*}{\rm~{}lie~{}in~{}different~{}parts~{}of~{}}\pi]\leq{\epsilon}.

The following gives a way to handle the fact that the triangle inequality does not hold with squares of the distances.

For any real numbers x,yx,y we have (x+y)2≤2(x2+y2)(x+y)^{2}\leq 2(x^{2}+y^{2}).

Proof. (x+y)2≤(x+y)2+(x−y)2=2x2+2y2.(x+y)^{2}\leq(x+y)^{2}+(x-y)^{2}=2x^{2}+2y^{2}.

For each point j∈Xj\in{\mathcal{X}}, Dσ‾(j)≤Dσ(j)≤δ(j,σ(j))+δ(j,σ∗(j))D_{{\overline{\sigma}}(j)}\leq D_{\sigma(j)}\leq\delta(j,\sigma(j))+\delta(j,\sigma^{*}(j)). Similarly, Dσ‾∗(j)≤Dσ∗(j)≤δ(j,σ(j))+δ(j,σ∗(j))D_{{\overline{\sigma}}^{*}(j)}\leq D_{\sigma^{*}(j)}\leq\delta(j,\sigma(j))+\delta(j,\sigma^{*}(j)).

Proof. As usual, we only prove the first statement since the second is nearly identical. If σ‾(j)=σ(j){\overline{\sigma}}(j)=\sigma(j) then Dσ‾(j)=Dσ(j)D_{{\overline{\sigma}}(j)}=D_{\sigma(j)} is trivially true. Otherwise, σ‾(j)=η(σ(j)){\overline{\sigma}}(j)=\eta(\sigma(j)) was already in S‾\overline{{\mathcal{S}}} when σ(j)\sigma(j) was considered by the filtering algorithm meaning Dσ‾(j)≤Dσ(j)D_{{\overline{\sigma}}(j)}\leq D_{\sigma(j)}.

Proof of Theorem 4. Let π\pi be a partition sampled by the algorithm from Theorem 5. For each point j∈Xj\in{\mathcal{X}} and each part PP of π\pi, let ΔjP:=δ(j,S△P)2−δ(j,S)2\Delta^{P}_{j}:=\delta(j,{\mathcal{S}}\triangle P)^{2}-\delta(j,{\mathcal{S}})^{2} denote the change in assignment cost for the point after swapping in the centers in P∩OP\cap{\mathcal{O}} and swapping out P∩SP\cap{\mathcal{S}}. Local optimality of S{\mathcal{S}} and ∣P∩S∣=∣P∩O∣≤ρ(ϵ,d)|P\cap{\mathcal{S}}|=|P\cap{\mathcal{O}}|\leq\rho({\epsilon},d) means 0≤∑jΔjP0\leq\sum_{j}\Delta^{P}_{j} for any part PP.

Classify each point j∈Xj\in{\mathcal{X}} in one of the following ways:

Lucky: σ(j)\sigma(j) and σ‾(j){\overline{\sigma}}(j) do not lie in the same part of π\pi.

Long: jj is not lucky but δ(σ‾(j),σ‾∗(j))>ϵ−1⋅Dσ‾(j)\delta({\overline{\sigma}}(j),{\overline{\sigma}}^{*}(j))>{\epsilon}^{-1}\cdot D_{{\overline{\sigma}}(j)}.

Bad: jj is not lucky or long and (σ‾∗(j),σ‾(j))∈N({\overline{\sigma}}^{*}(j),{\overline{\sigma}}(j))\in{\mathcal{N}} yet σ‾(j),σ‾∗(j){\overline{\sigma}}(j),{\overline{\sigma}}^{*}(j) lie in different parts of π\pi.

Good: jj is neither lucky, long, nor bad.

We now place an upper bound on ∑P∈πΔjP\sum_{P\in\pi}\Delta^{P}_{j} for each point j∈Xj\in{\mathcal{X}}. Note that each centre in S{\mathcal{S}} is swapped out exactly once over all swaps PP and each centre in O{\mathcal{O}} is swapped in exactly once. With this in mind, consider the following cases for a point j∈Xj\in{\mathcal{X}}. In the coming arguments, we let δj:=δ(j,σ(j))\delta_{j}:=\delta(j,\sigma(j)) and δj∗:=δ(j,σ∗(j))\delta^{*}_{j}:=\delta(j,\sigma^{*}(j)) for brevity. Note cj=δj2c_{j}=\delta_{j}^{2} and cj∗=δj∗2c^{*}_{j}=\delta^{*2}_{j}.

In all cases for jj except when jj is bad, the main idea is that we can bound the distance from jj to some point in S△P{\mathcal{S}}\triangle P by first moving it to either σ(j)\sigma(j) or σ∗(j)\sigma^{*}(j) and then moving it a distance of O(ϵ)⋅(δj+δj∗)O({\epsilon})\cdot(\delta_{j}+\delta^{*}_{j}) to reach an open facility. Considering that we reassigned jj from σ(j)\sigma(j), the reassignment cost will be

Case: jj is lucky For the part P∈πP\in\pi with σ∗(j)∈P\sigma^{*}(j)\in P, we have ΔjP≤cj∗−cj\Delta^{P}_{j}\leq c^{*}_{j}-c_{j} as we could move jj from σ(j)\sigma(j) to σ∗(j)\sigma^{*}(j). If σ(j)\sigma(j) is swapped out in a different swap P′P^{\prime}, we move jj to σ‾(j){\overline{\sigma}}(j) (which remains open because jj is lucky) and bound ΔjP′\Delta^{P^{\prime}}_{j} by:

again using the assumption that ϵ{\epsilon} is sufficiently small. For every other swap P′′P^{\prime\prime}, we have that σ(j)\sigma(j) remains open after the swap so ΔjP′′≤0\Delta^{P^{\prime\prime}}_{j}\leq 0 as we could just leave jj at σ(j\sigma(j). In total, we have

Case: jj is long Again, for P∈πP\in\pi with σ∗(j)∈P\sigma^{*}(j)\in P we get ΔjP≤cj∗−cj\Delta^{P}_{j}\leq c^{*}_{j}-c_{j}. If σ(j)\sigma(j) is swapped out in a different swap P′P^{\prime}, then we bound ΔjP′\Delta^{P^{\prime}}_{j} by moving jj from σ(j)\sigma(j) to the open centre nearest to σ(j)\sigma(j). Note that S△P′{\mathcal{S}}\triangle P^{\prime} contains at least one centre from every pair in T{\mathcal{T}}, so we bound this distance using Lemma 3. This case is depicted in Figure 3. We have

Using this, we bound ΔjP′\Delta^{P^{\prime}}_{j} as follows.

In every other swap we could leave jj at σ(j)\sigma(j). Thus, for a long point jj we have

Case: jj is bad We only move jj in the swap PP when σ(j)\sigma(j) is closed. In this case, we assign jj in the same way as if it was long. Our bound is weaker here and introduces significant positive dependence on cjc_{j}. This will eventually be compensated by the fact that jj is bad with probability at most ϵ{\epsilon} over the random choice of π\pi. For now, we just provide the reassignment cost bound for bad jj.

Case: jj is good This breaks into two subcases. We know δ(σ‾∗(j),σ‾(j))≤ϵ−1⋅Dσ‾(j)\delta({\overline{\sigma}}^{*}(j),{\overline{\sigma}}(j))\leq{\epsilon}^{-1}\cdot D_{{\overline{\sigma}}(j)} because jj is not long. In one subcase, Dσ‾∗(j)≥ϵ⋅Dσ‾(j)D_{{\overline{\sigma}}^{*}(j)}\geq{\epsilon}\cdot D_{{\overline{\sigma}}(j)} so (σ‾∗(j),σ‾(j))∈N({\overline{\sigma}}^{*}(j),{\overline{\sigma}}(j))\in{\mathcal{N}}. Since jj is not bad and not lucky, we have σ(j),σ‾(j),σ‾∗(j)∈P\sigma(j),{\overline{\sigma}}(j),{\overline{\sigma}}^{*}(j)\in P for some common part P∈πP\in\pi. In the other subcase, Dσ‾∗(j)<ϵ⋅Dσ‾(j)D_{{\overline{\sigma}}^{*}(j)}<{\epsilon}\cdot D_{{\overline{\sigma}}(j)}. Note in this case we still have σ(j),σ‾(j)∈P\sigma(j),{\overline{\sigma}}(j)\in P for some common part PP because jj is not lucky.

Subcase: Dσ‾∗(j)≥ϵ⋅Dσ‾(j)D_{{\overline{\sigma}}^{*}(j)}\geq{\epsilon}\cdot D_{{\overline{\sigma}}(j)} The only time we move jj is when σ(j)\sigma(j) is closed. As observed in the previous paragraph, this happens in the same swap when σ‾∗(j){\overline{\sigma}}^{*}(j) is opened, so send jj to σ‾∗(j){\overline{\sigma}}^{*}(j). This is illustrated in Figure 4.

Subcase: Dσ‾∗(j)<ϵ⋅Dσ‾(j)D_{{\overline{\sigma}}^{*}(j)}<{\epsilon}\cdot D_{{\overline{\sigma}}(j)} Again, the only time we move jj is when σ(j)\sigma(j) is closed. We reassign jj by first moving it to σ∗(j)\sigma^{*}(j) and then using Lemma 3 to further bound the cost. Figure 5 depicts this reassignment.

We bound the cost change for this reassignment as follows. Recall that δ(σ∗(j),σ‾∗(j))≤ϵDσ∗(j)\delta(\sigma^{*}(j),{\overline{\sigma}}^{*}(j))\leq{\epsilon}D_{\sigma^{*}(j)} by our filtering. This implies that Dσ∗(j)≤Dσ‾∗(j)+ϵDσ∗(j)D_{\sigma^{*}(j)}\leq D_{{\overline{\sigma}}^{*}(j)}+{\epsilon}D_{\sigma^{*}(j)} which in turn implies Dσ∗(j)≤11−ϵDσ‾∗(j)D_{\sigma^{*}(j)}\leq\frac{1}{1-{\epsilon}}D_{{\overline{\sigma}}^{*}(j)}; thus Dσ∗(j)≤(1+2ϵ)Dσ‾∗(j)D_{\sigma^{*}(j)}\leq(1+2{\epsilon})D_{{\overline{\sigma}}^{*}(j)} which in turn is bounded by ϵ(1+ϵ)Dσ‾(j){\epsilon}(1+{\epsilon})D_{{\overline{\sigma}}(j)} in this subcase (by the assumption of subcase). Thus,

Considering both subcases we can say that for any good point jj that

Aggregating these bounds and remembering 0≤∑j∈XΔjP0\leq\sum_{j\in{\mathcal{X}}}\Delta^{P}_{j} for each P∈πP\in\pi because S{\mathcal{S}} is a locally optimum solution, we have

The last step is to average this inequality over the random choice of π\pi. Note that any point j∈Xj\in{\mathcal{X}} is bad with probability at most ϵ{\epsilon} by the guarantee in Theorem 5 and the definition of bad. Thus, we see

3 Running Time Analysis

Recall that we can go to the discrete case by finding a set C{\mathcal{C}} of size O(nϵ−dlog⁡(1/ϵ)O(n\epsilon^{-d}\log(1/\epsilon). The analysis of Arya et al. shows that the number of local search steps is at most log⁡(cost(S0)/cost(O))/log⁡11−ϵ/k\log(cost(S_{0})/cost({\mathcal{O}}))/\log\frac{1}{1-{\epsilon}/k}, where S0S_{0} is the initial solution. This is polynomial in the total bit complexity of the input (i.e. the input size). So we focus on bounding the time complexity of each local search step. Since the number of swaps in each step is bounded by ρ=ρ(ϵ,d)\rho=\rho({\epsilon},d), a crude upper bound on the time complexity of each step is O((nϵ−dlog⁡(1/ϵ))ρ)O((n{\epsilon}^{-d}\log(1/{\epsilon}))^{\rho}).

We can speed up this algorithm by using the idea of coresets. First observe that our local search algorithm extends to the weighted setting where each point j∈Xj\in{\mathcal{X}} has a weight w(j)w(j) and the cost of a clustering with centres CC is ∑j∈Xw(j)⋅δ2(j,C)\sum_{j\in{\mathcal{X}}}w(j)\cdot\delta^{2}(j,C).

Earlier works on coresets for kk-means imply the existence of a (k,ϵ)(k,{\epsilon})-coresets of small size. For example, show existence of (k,ϵ)(k,{\epsilon})-coresets of size O(k3/ϵd+1)O(k^{3}/{\epsilon}^{d+1}). Applying the result of , we get a (k,ϵ)(k,{\epsilon})-centroid set of size O(log⁡(1/ϵ)k3/ϵ2d+1)O(\log(1/{\epsilon})k^{3}/{\epsilon}^{2d+1}) over a (k,ϵ)(k,{\epsilon})-coreset of size O(k3/ϵd+1)O(k^{3}/{\epsilon}^{d+1}). Thus running our local search ρ\rho-swap algorithm takes O((k/ϵ)ζ)O((k/{\epsilon})^{\zeta}) time per iteration where ζ=dO(d)⋅ϵ−O(d/ϵ)\zeta=d^{O(d)}\cdot{\epsilon}^{-O(d/{\epsilon})}.

The Partitioning Scheme: Proof of Theorem 5

We treat G−∞G_{-\infty} differently in our partitioning algorithm. It is important to note that no pair in T{\mathcal{T}} or N{\mathcal{N}} has precisely one point in G−∞G_{-\infty}, as the following shows.

For each pair of centres (i∗,i)∈T∪N(i^{*},i)\in{\mathcal{T}}\cup{\mathcal{N}}, ∣{i,i∗}∩G−∞∣≠1|\{i,i^{*}\}\cap G_{-\infty}|\neq 1.

Proof. Consider some colocated pair (i∗,i)∈S×O(i^{*},i)\in{\mathcal{S}}\times{\mathcal{O}}. As Di=Di∗=0D_{i}=D_{i^{*}}=0 and because no other centre in S∪O{\mathcal{S}}\cup{\mathcal{O}} is colocated with ii and i∗i^{*}, then i∈S‾i\in\overline{{\mathcal{S}}} and i∗∈O‾i^{*}\in\overline{{\mathcal{O}}}. Thus, ϕ‾(i∗)=i{\overline{\phi}}(i^{*})=i and it is the unique closest facility in O‾\overline{{\mathcal{O}}} to ii so i∗=cent(i)i^{*}={\rm cent}(i). This shows every pair (i∗,i)∈T(i^{*},i)\in{\mathcal{T}} with either Di=0D_{i}=0 or Di∗=0D_{i^{*}}=0 must have both Di=Di∗=0D_{i}=D_{i^{*}}=0 so i∗,i∈G−∞i^{*},i\in G_{-\infty}.

Next consider some (i∗,i)∈N(i^{*},i)\in{\mathcal{N}}. We know ϵ⋅Di≤Di∗{\epsilon}\cdot D_{i}\leq D_{i^{*}} by definition of N{\mathcal{N}}. Thus, if i∗∈G−∞i^{*}\in G_{-\infty} then i∈G−∞i\in G_{-\infty} as well. Conversely, suppose i∈G−∞i\in G_{-\infty}. Since (i∗,i)∈N(i^{*},i)\in{\mathcal{N}} then δ(i,i∗)≤ϵ−1⋅Di=0\delta(i,i^{*})\leq{\epsilon}^{-1}\cdot D_{i}=0. So, Di∗=0D_{i^{*}}=0 meaning i∗∈G−∞i^{*}\in G_{-\infty} as well.

2 Properties of the Partitioning Scheme

We will show the parts formed in the partitioning scheme so far have constant size (depending only on ϵ{\epsilon} and dd) and also that each pair in N{\mathcal{N}} is cut with low probability. Figure 6 illustrates some key concepts in these proofs.

The last bound follows for sufficiently small ϵ\epsilon and because bb is the smallest integer at least 4/ϵ4/{\epsilon}.

For each (i∗,i)∈N(i^{*},i)\in{\mathcal{N}} with i,i∗∉G−∞i,i^{*}\not\in G_{-\infty} we have Pr⁡[i,i∗ lie in different parts]≤ϵ\Pr[i,i^{*}{\rm~{}lie~{}in~{}different~{}parts}]\leq{\epsilon}.

The probability that ii and i∗i^{*} are cut by the random offset along one of the dd-dimensions is then at most ϵ4d\frac{{\epsilon}}{4d}. Taking the union bound over all dimensions, the probability that ii and i∗i^{*} lie in different cells is at most ϵ4\frac{{\epsilon}}{4}.

Finally, we bound the probability that i∗i^{*} will be moved to a different part when fixing T{\mathcal{T}}. If (i∗,ϕ‾(i∗))∉T(i^{*},{\overline{\phi}}(i^{*}))\not\in{\mathcal{T}} or if i∗∉Ii^{*}\not\in\mathcal{I} then this will not happen. So, we will bound Pr⁡[i∗∈I]\Pr[i^{*}\in\mathcal{I}] if (i∗,ϕ‾(i∗))∈T(i^{*},{\overline{\phi}}(i^{*}))\in{\mathcal{T}}. That is, we bound the probability that i′,i∗i^{\prime},i^{*} lie in different parts where i′i^{\prime} is such that i∗=cent(i′)i^{*}={\rm cent}(i^{\prime}) and (i∗,i′)∈T(i^{*},i^{\prime})\in{\mathcal{T}}. Note that Di′≤δ(i′,i∗)≤(1+ϵ)⋅Di∗≤ϵ−1⋅Di∗D_{i^{\prime}}\leq\delta(i^{\prime},i^{*})\leq(1+{\epsilon})\cdot D_{i^{*}}\leq{\epsilon}^{-1}\cdot D_{i^{*}} by Lemma 2 and Di′≥ϵ⋅δ(i′,i∗)=ϵ⋅Di∗D_{i^{\prime}}\geq{\epsilon}\cdot\delta(i^{\prime},i^{*})={\epsilon}\cdot D_{i^{*}} by definition of T{\mathcal{T}}. So i′i^{\prime} and i∗i^{*} lie in different bands with probability at most ϵ4\frac{{\epsilon}}{4} by the same argument as with (i,i∗)(i,i^{*}). Similarly, conditioned on i′,i∗i^{\prime},i^{*} lying in the same band, the probability they lie in different cells is at most ϵ4\frac{{\epsilon}}{4} again by the same arguments as with (i,i∗)(i,i^{*}).

Note that if i,i∗i,i^{*} lie in different parts then they were cut by the random band or by the random box, or else i′,i∗i^{\prime},i^{*} were cut by the random band or the random box (the latter may not apply if i∗i^{*} is not involved in a pair in T{\mathcal{T}}). Thus, by the union bound we have

3 Balancing the Parts

The proof of Lemma 6 shows that G−∞G_{-\infty} partitions naturally into colocated centres. So let P−∞\mathcal{P}_{-\infty} denote the partition of G−∞G_{-\infty} into these pairs. Finally let P′\mathcal{P}^{\prime} denote the partition of (O−O‾)∪(S−S‾)({\mathcal{O}}-\overline{{\mathcal{O}}})\cup({\mathcal{S}}-\overline{{\mathcal{S}}}) into singleton sets.

We summarize important properties of P∪P−∞∪P′\mathcal{P}\cup\mathcal{P}_{-\infty}\cup\mathcal{P}^{\prime}.

P∪P−∞∪P′\mathcal{P}\cup\mathcal{P}_{-\infty}\cup\mathcal{P}^{\prime} is itself a partitioning of O∪S{\mathcal{O}}\cup{\mathcal{S}} into parts with size at most 2⋅(2d)2d⋅ϵ−9d/ϵ2\cdot(2d)^{2d}\cdot{\epsilon}^{-9d/{\epsilon}} (Lemma 7).

Over the randomized formation of P\mathcal{P}, each (i∗,i)∈N(i^{*},i)\in{\mathcal{N}} has endpoints in different parts with probability at most ϵ{\epsilon}. For i,i∗i,i^{*} lying in P\mathcal{P} this follows from Lemma 8. For i,i∗i,i^{*} lying in P−∞\mathcal{P}_{-\infty} this follows because they must then be colocated pairs so they always form a part by themselves.

From now on, we simply let P‾=P∪P−∞∪P′\overline{\mathcal{P}}=\mathcal{P}\cup\mathcal{P}_{-\infty}\cup\mathcal{P}^{\prime}. We show how to combine parts of P‾\overline{\mathcal{P}} into constant-size parts that are also balanced between O{\mathcal{O}} and S{\mathcal{S}}. Since merging parts does not destroy the property of two centres lying together, we will still have that pairs of centres in T{\mathcal{T}} appear together and any pair of centres in N{\mathcal{N}} lie in different parts with probability at most ϵ{\epsilon}.

For any subset A⊆O∪SA\subseteq{\mathcal{O}}\cup{\mathcal{S}}, let μ(A)=∣A∩O∣−∣A∩S∣\mu(A)=|A\cap{\mathcal{O}}|-|A\cap{\mathcal{S}}| denote the imbalance of AA.

Let Y≥1Y\geq 1 be an integer and A\mathcal{A} a collection of disjoint, nonempty subsets of O∪S{\mathcal{O}}\cup{\mathcal{S}} such that ∑A∈Aμ(A)=0\sum_{A\in\mathcal{A}}\mu(A)=0. If ∣A∣≤Y|A|\leq Y for each AA then there is some nonempty B⊆A\mathcal{B}\subseteq\mathcal{A} where ∣B∣≤2Y3|\mathcal{B}|\leq 2Y^{3} such that ∑B∈Bμ(B)=0\sum_{B\in\mathcal{B}}\mu(B)=0.

Proof. If μ(A)=0\mu(A)=0 for some A∈AA\in\mathcal{A} then simply let B={A}\mathcal{B}=\{A\}. Otherwise, note ∣μ(A)∣≤∣A∣≤Y|\mu(A)|\leq|A|\leq Y for each A∈AA\in\mathcal{A} and partition A\mathcal{A} into sets Ax:={A∈A:μ(A)=x}\mathcal{A}_{x}:=\{A\in\mathcal{A}:\mu(A)=x\} for x∈{1,…,Y}∪{−1,…,−Y}x\in\{1,\ldots,Y\}\cup\{-1,\ldots,-Y\}. We have

so if ∑x=1Y∣Ax∣≤Y2\sum_{x=1}^{Y}|A_{x}|\leq Y^{2} then ∣A∣≤2Y3|\mathcal{A}|\leq 2Y^{3} and we can take B=A\mathcal{B}=\mathcal{A}. Similarly if ∑x=1Y∣A−x∣≤Y2\sum_{x=1}^{Y}|\mathcal{A}_{-x}|\leq Y^{2} then we can take B=A\mathcal{B}=\mathcal{A}.

Finally, we are left with the case that ∑x=1Y∣Ax∣\sum_{x=1}^{Y}|\mathcal{A}_{x}| and ∑x=1Y∣A−x∣\sum_{x=1}^{Y}|\mathcal{A}_{-x}| both exceed Y2Y^{2}. By the pigeonhole principle, there are values 1≤x,y≤Y1\leq x,y\leq Y such that ∣Ax∣≥Y|\mathcal{A}_{x}|\geq Y and ∣A−y∣≥Y|\mathcal{A}_{-y}|\geq Y. In this case, we take B\mathcal{B} to be any yy sets from Ax\mathcal{A}_{x} plus any xx sets from A−y\mathcal{A}_{-y}. Then ∣B∣=x+y≤2Y|\mathcal{B}|=x+y\leq 2Y and B\mathcal{B} is balanced, which is what we needed to show.

To complete the partitioning we iteratively apply Lemma 9 to P‾\overline{\mathcal{P}} with Y=2⋅(2d)2d⋅ϵ−9d/ϵY=2\cdot(2d)^{2d}\cdot{\epsilon}^{-9d/{\epsilon}} where we note ∣P∣≤Y|P|\leq Y by Lemma 7. Each iteration, we find some nonempty Q⊆P‾\mathcal{Q}\subseteq\overline{\mathcal{P}} such that ∑Q∈Qμ(Q)=0\sum_{Q\in\mathcal{Q}}\mu(Q)=0. Remove Q\mathcal{Q} from P‾\overline{\mathcal{P}} and repeat until all sets from P‾\overline{\mathcal{P}} have been removed. Each balanced part obtained is the union of at most 2⋅(2⋅(2d)2d⋅ϵ−9d/ϵ)32\cdot\left(2\cdot(2d)^{2d}\cdot{\epsilon}^{-9d/{\epsilon}}\right)^{3} different parts in P‾\overline{\mathcal{P}}, meaning each part has size at most 2⋅(2⋅(2d)2d⋅ϵ−9d/ϵ)4=32⋅(2d)8d⋅ϵ−36⋅d/ϵ2\cdot\left(2\cdot(2d)^{2d}\cdot{\epsilon}^{-9d/{\epsilon}}\right)^{4}=32\cdot(2d)^{8d}\cdot{\epsilon}^{-36\cdot d/{\epsilon}}.

Given a metric (V,δ)(V,\delta), the aspect ratio, denoted by Δ\Delta, is the ratio of the largest distance to the smallest non-zero distance in the metric: Δ=max⁡u,v∈Vδ(u,v)min⁡u,v∈V,u≠vδ(u,v)\Delta=\frac{\max_{u,v\in V}\delta(u,v)}{\min_{u,v\in V,u\neq v}\delta(u,v)}. Talwar gave a hierarchical decomposition of a doubling metric using an algorithm similar to one by Fakcharoenphol et al. . It assumes min⁡u,v∈V,u≠vδ(u,v)=1\min_{u,v\in V,u\neq v}\delta(u,v)=1, which can be accomplished by scaling the distances. So, Δ\Delta is the maximum distance between two points in the metric.

Suppose min⁡u,v∈V:u≠vδ(u,v)=1\min_{u,v\in V:u\neq v}\delta(u,v)=1. There is a randomized hierarchical decomposition of VV, which is a sequence of partitions P0{\cal P}_{0}, P1{\cal P}_{1}, …,Ph\dots,{\cal P}_{h}, where Pi−1{\cal P}_{i-1} is a refinement of Pi{\cal P}_{i}, Ph={V}{\cal P}_{h}=\{V\}, and P0={{v}}v∈V{\cal P}_{0}=\{\{v\}\}_{v\in V}. The decomposition has the following properties:

P0{\cal P}_{0} corresponds to the leaves and Ph{\cal P}_{h} corresponds to the root of the split-tree TT, and the height of TT is h=φ+2h=\varphi+2, where φ=log⁡Δ\varphi=\log\Delta and Δ\Delta is the aspect ratio of metric.

For each level ii and each S∈PiS\in{\cal P}_{i}, SS has diameter at most 2i+12^{i+1}.

The branching factor bb of TT is at most 12d12^{d}.

For any u,v∈Vu,v\in V, the probability that they are in different sets corresponding to nodes in level ii of TT is at most 5d⋅2−i⋅δ(u,v)5d\cdot 2^{-i}\cdot\delta(u,v).

The rest of the proof of Theorem 5 remains the same as in Subsection 4.3.

Extending to the uncapacitated facility location and generalized k𝑘k-median problems

Recall that the setting of uncapacitated facility location is similar to kk-median except we are given opening costs for each i∈Ci\in{\mathcal{C}} instead of a cardinality bound kk. A feasible solution is any nonempty S⊆C{\mathcal{S}}\subseteq{\mathcal{C}} and its cost is

The standard local search algorithm is the following. Let ρ\rho be defined as before.

We will show every locally optimum solution has cost at most (1+O(ϵ))⋅OPT(1+O({\epsilon}))\cdot OPT using at most 2⋅∣C∣2\cdot|{\mathcal{C}}| test swaps. Thus, replacing the cost condition in Algorithm 1 with costufl(S′)≤(1−ϵ2⋅∣C∣)⋅costufl(S){\rm cost}_{\bf ufl}({\mathcal{S}}^{\prime})\leq\left(1-\frac{{\epsilon}}{2\cdot|{\mathcal{C}}|}\right)\cdot{\rm cost}_{\bf ufl}({\mathcal{S}}) is a polynomial-time variant that is also a PTAS.

Let S{\mathcal{S}} be a locally optimum solution and O{\mathcal{O}} a global optimum. We may assume, by duplicating points if necessary (for the analysis only), that S∩O=∅{\mathcal{S}}\cap{\mathcal{O}}=\emptyset, thus ∣S∣+∣O∣≤2⋅∣C∣|{\mathcal{S}}|+|{\mathcal{O}}|\leq 2\cdot|{\mathcal{C}}| (where ∣C∣|{\mathcal{C}}| refers to the size of the original set of facilities before duplication). Our analysis proceeds in a manner that is nearly identical to our approach for kk-means.

In particular, we prove the following. It is identical to Theorem 5 in every way except the first point does not require P∩OP\cap{\mathcal{O}} and P∩SP\cap{\mathcal{S}} to have equal size.

There is a randomized algorithm that samples a partitioning π\pi of O∪S{\mathcal{O}}\cup{\mathcal{S}} such that:

For each part P∈πP\in\pi, ∣P∩O∣,∣P∩S∣≤ρ(ϵ,d)|P\cap{\mathcal{O}}|,|P\cap{\mathcal{S}}|\leq\rho({\epsilon},d).

For each part P∈πP\in\pi, S△P{\mathcal{S}}\triangle P includes at least one centre from every pair in T{\mathcal{T}}.

For each (i∗,i)∈N(i^{*},i)\in{\mathcal{N}}, Pr⁡[i,i∗ lie in different parts of π]≤ϵ\Pr[i,i^{*}{\rm~{}lie~{}in~{}different~{}parts~{}of~{}}\pi]\leq{\epsilon}.

The proof is identical to Theorem 5, except we do not to the “balancing” step in Section 4.3. Indeed this was the only step in the proof of Theorem 5 that required ∣S∣=∣O∣|{\mathcal{S}}|=|{\mathcal{O}}|.

We now complete the proof of Theorem 2. Proof. Let cj=δ(j,S)c_{j}=\delta(j,{\mathcal{S}}) and cj∗=δ(j,O)c^{*}_{j}=\delta(j,{\mathcal{O}}) for each j∈Xj\in{\mathcal{X}}. Sample a partition π\pi of S∪O{\mathcal{S}}\cup{\mathcal{O}} as per Theorem 7. For each part P∈πP\in\pi and each j∈Xj\in{\mathcal{X}} we let ΔjP\Delta^{P}_{j} denote δ(j,S△P)−δ(j,S)\delta(j,{\mathcal{S}}\triangle P)-\delta(j,{\mathcal{S}}). Using the same bounds considered in the proof of Theorem 4 we have

As each i∈Si\in{\mathcal{S}} is closed exactly once and each i∗∈Oi^{*}\in{\mathcal{O}} is opened exactly once, the fact that S{\mathcal{S}} is locally optimal and fact that each P∈πP\in\pi has ∣P∩S∣,∣P∩O∣≤ρ|P\cap{\mathcal{S}}|,|P\cap{\mathcal{O}}|\leq\rho shows

Rearranging shows costufl(S)≤(1+O(ϵ))costufl(O){\rm cost}_{\bf ufl}({\mathcal{S}})\leq(1+O({\epsilon})){\rm cost}_{\bf ufl}({\mathcal{O}}).

Finally we conclude by analyzing a local search algorithm for generalized kk-median. Here we are given both a cardinality bound kk and opening costs for each i∈Ci\in{\mathcal{C}}. The goal is to open some S⊆C{\mathcal{S}}\subseteq{\mathcal{C}} with 1≤∣S∣≤k1\leq|{\mathcal{S}}|\leq k to minimize

Note this is the same as costufl{\rm cost}_{\bf ufl}, we use this slightly different notation to avoid confusion as we are discussing a different problem now.

Proof. Let S{\mathcal{S}} and O{\mathcal{O}} denote a local optimum and a global optimum (respectively). By adding artificial points ii with fi=0f_{i}=0 that are extremely far away from X{\mathcal{X}}, we may assume S=O{\mathcal{S}}={\mathcal{O}}. Then we simply use our original partitioning result, Theorem 5, to define test swaps. Noting that each i∈Si\in{\mathcal{S}} is closed exactly once and each i∗∈Oi^{*}\in{\mathcal{O}} is opened exactly once over the swaps induced by a partition π\pi, we proceed in the same way as above in the proof of Theorem 2 and see

Conclusion

The running time of a single step of the local search algorithm is O(kρ)O(k^{\rho}) where ρ=dO(d)⋅ϵ−O(d/ϵ)\rho=d^{O(d)}\cdot{\epsilon}^{-O(d/{\epsilon})} for the case of kk-means when the metric has doubling dimension dd. We have not tried to optimize the constants in the O(⋅)O(\cdot) notations in ρ\rho. The dependence on dd cannot be improved much under the Exponential Time Hypothesis (ETH). For example, if the running time of a single iteration was only O(kexp(d1−δ)⋅f(ϵ))O(k^{{\rm exp}(d^{1-\delta})\cdot f({\epsilon})}) for some constant δ\delta then we would have a sub-exponential time (1+ϵ)(1+{\epsilon})-approximation when d=O(log⁡n)d=O(\log n). Recall that kk-means is APX-hard when d=Θ(log⁡n)d=\Theta(\log n) , so this would refute the ETH.

It may still be possible to obtain an EPTAS for any constant dimension dd. That is, there could be a PTAS with running time of the form O(g(ϵ)⋅nexp(d))O(g({\epsilon})\cdot n^{{\rm exp}(d)}) for some function g(ϵ)g({\epsilon}) (perhaps depending also on dd). Finally, what is the fastest PTAS we can obtain in the special case of the Euclidean plane (i.e. d=2d=2)? It would be interesting to see if there is an EPTAS whose running time is linear or near linear in nn for any fixed constant ϵ{\epsilon}.

References