Local Search Heuristics for k-Median and Facility Location Problems I: Single-Swap Local Search for k-Median Has Locality Gap 5Research Paper
Motivation
The k-median problem asks where to open facilities so that the total distance from a set of clients to their nearest open facility is as small as possible. It is a basic model of facility location in operations research (placing depots, warehouses or servers) and of clustering with representative centres, and it is NP-hard, so the question of interest is how close a polynomial-time method can come to the optimum.
Local search is among the most widely used heuristics for it: start from any facilities and repeatedly exchange one open facility for a closed one while the cost decreases. Arya, Garg, Khandekar, Meyerson, Munagala and Pandit (SIAM J. Comput. 33(3), 2004) gave the first constant-factor guarantee for this heuristic on metric instances: every local optimum of the single-swap local search costs at most five times any solution with facilities. This mission formalizes that result.
Timeline of the relevant bounds:
- Korupolu, Plaxton and Rajaraman (SODA 1998) analysed a local search for k-median that opens facilities and costs at most times the optimum with facilities.
- Charikar, Guha, Tardos and Shmoys (STOC 1999) gave the first constant-factor approximation for metric k-median, by LP rounding ().
- Jain and Vazirani (J. ACM 2001) and Charikar and Guha (FOCS 1999) improved the constant with primal–dual methods to 6 and 4.
- Arya et al. (STOC 2001; SIAM J. Comput. 2004) proved the locality gap 5 for single swaps and for swaps of facilities at a time, with matching examples.
Setting
A metric instance consists of a finite set of clients, a finite set of facilities and a distance on that is nonnegative, symmetric and satisfies the triangle inequality. Write for the cost of serving client by facility .
For a nonempty set of open facilities every client is served by its nearest open facility, and the cost of is
The k-median problem asks for a set of at most facilities of minimum cost.
A swap closes a facility and opens a facility , giving . The neighbourhood of is
and is locally optimum if for every . The local search starts from an arbitrary set of facilities and applies improving swaps until none exists; swaps preserve the number of facilities, so it stops at a locally optimum set of exactly facilities. The locality gap is the supremum, over instances, of the ratio between the cost of a worst local optimum and the optimal cost.
The analysis uses the following notation. For a solution , let assign each client to a nearest facility of , let be the service cost of client , and let be the set of clients served by . For two solutions and put . A facility captures if ; is bad if it captures some and good otherwise.
Formalization targets
Goal: Theorem 3.2
For every metric instance, every , every locally optimum set of exactly facilities and every nonempty set of at most facilities,
The comparison solution is arbitrary, not an optimum; the statement is the locality gap bound in the form the proof gives.
Milestones, in the order the proof uses them
- A facility is captured by at most one facility of (remark after Definition 3.1).
- Property 3.1: for each there is a bijection of with whenever does not capture .
- When there are swaps , one for each , such that no facility capturing two or more facilities of is used, every good facility is used at most twice, and a used captures no .
- Inequality (2): for a locally optimum and such a swap ,
Significance
Theorem 3.2 shows that the simplest exchange heuristic for k-median is a constant-factor approximation on every metric instance, and the paper states that the analysis is tight: its example of §3.5, given for swaps of two facilities, is said to generalize to swaps of facilities, where the bound is 5 for . Combined with the standard device of accepting only swaps that improve the cost by a factor , it yields a polynomial-time -approximation (p. 548). The same capture-and-reassignment argument is reused for multi-swap k-median, for uncapacitated and capacitated facility location in the same paper, and in later work on k-means and on local search for clustering; its milestones (the capture graph and the mapping ) are the reusable part.
The result has been proved since 2001 and is textbook material (Williamson and Shmoys, The Design of Approximation Algorithms, 2011, Chapter 9). No machine-checked proof of it is known; Mathlib has no k-median problem and no locality-gap result for any clustering objective. The work remaining is to formalize the known proof.
Difficulty
The obvious argument adds up the inequalities over a pairing of with , rerouting the clients of the closed facility to the nearest remaining facility. This fails when a single facility of serves most clients of several facilities of : closing it leaves those clients with no nearby open facility, and no bound in terms of follows. The analysis must choose which swaps to consider so that such facilities are never closed, and must reroute the displaced clients of the facilities it does close to a facility other than the closed one while paying only a constant multiple of their own service costs. Both choices must work for arbitrary ties in the nearest-facility assignments and when and share facilities.
Formalization scope
Namespace LocalSearchFL.KMedian. Clients and facilities are types Cl, Fa with Fintype and DecidableEq; the distance is a real-valued function on Cl ⊕ Fa with fields for nonnegativity, symmetry and the triangle inequality, and is not assumed. Solutions are Finset Fa. The cost is defined only for nonempty sets, from a nonemptiness proof, so no value is assigned to the empty solution; the goal takes nonempty with S.card = k, which is the paper's . Local optimality quantifies over every swap with and , exactly the neighbourhood of Theorem 3.2, and not only over the swaps with that the proof uses. The inequality is stated multiplied out, , so it is meaningful when .
The milestones quantify over nearest-facility assignments , with arbitrary ties. Capture is stated in integers as . The bijection of is a permutation of all clients fixing every client outside ; in inequality (2) it is a single permutation preserving every . Milestones 1–3 are purely combinatorial and are stated for arbitrary assignments, which contains the paper's case.
A formalization in which local optimality ranges over the swaps , , only, or in which or optimal is assumed, or in which the cost of the empty set is , is a different statement and is ruled out.
A complete development needs the finite-sum and Finset.inf' API of Mathlib, permutations (Equiv.Perm) and finite counting. The capture machinery and the mapping are reusable for the multi-swap and facility location missions of this series. Proofs of individual milestones are welcome independently of the goal.
Selected references
- V. Arya, N. Garg, R. Khandekar, A. Meyerson, K. Munagala, V. Pandit, Local Search Heuristics for k-Median and Facility Location Problems, SIAM J. Comput. 33(3):544–562, 2004. https://doi.org/10.1137/S0097539702416402
- M. Charikar, S. Guha, É. Tardos, D. B. Shmoys, A Constant-Factor Approximation Algorithm for the k-Median Problem, J. Comput. System Sci. 65(1):129–149, 2002. https://doi.org/10.1006/jcss.2002.1882
- K. Jain, V. V. Vazirani, Approximation Algorithms for Metric Facility Location and k-Median Problems Using the Primal-Dual Schema and Lagrangian Relaxation, J. ACM 48(2):274–296, 2001. https://doi.org/10.1145/375827.375845
- M. R. Korupolu, C. G. Plaxton, R. Rajaraman, Analysis of a Local Search Heuristic for Facility Location Problems, J. Algorithms 37(1):146–188, 2000. https://doi.org/10.1006/jagm.2000.1100
- D. P. Williamson, D. B. Shmoys, The Design of Approximation Algorithms, Cambridge University Press, 2011. https://doi.org/10.1017/CBO9780511921735