Motivation
MIN-SUM MULTICENTER from Garey & Johnson, A2 ND51. A classical NP-complete facility location problem, also known as the p-median problem. Given a graph with vertex weights and edge lengths, the goal is to place K service centers so as to minimize the total weighted distance from all vertices to their nearest centers. Arises in optimal placement of warehouses, hospitals, schools, and other service facilities. Unlike the min-max variant (p-center), which minimizes the worst-case distance, the p-median minimizes average/total service cost.
Associated reduction rules:
- As target: R71 (DOMINATING SET -> MIN-SUM MULTICENTER)
Definition
Name: MinimumSumMulticenter
Canonical name: p-Median Problem; also: Min-Sum Multicenter, Uncapacitated Facility Location (variant)
Reference: Garey & Johnson, Computers and Intractability, A2 ND51
Mathematical definition:
INSTANCE: Graph G = (V,E), weight w(v) ∈ Z_0^+ for each v ∈ V, length l(e) ∈ Z_0^+ for each e ∈ E, positive integer K ≤ |V|, positive rational number B.
QUESTION: Is there a set P of K "points on G" such that if d(v) is the length of the shortest path from v to the closest point in P, then Sigma_{v in V} d(v)·w(v) ≤ B?
The optimization version asks: find K points on G minimizing the total weighted distance Sigma_{v in V} d(v)·w(v).
Variables
- Count: n = |V| binary variables (one per vertex). As noted by GJ, there is no loss of generality in restricting centers to vertices.
- Per-variable domain: binary {0, 1} — whether vertex v is selected as a center
- Meaning: variable x_v = 1 if vertex v is chosen as a center location. Exactly K variables must be set to 1. The configuration is valid if Sigma_{v in V} d(v)·w(v) ≤ B, where d(v) is the shortest weighted-path distance from v to the nearest selected center.
dims() spec: vec![2; num_vertices] — n binary variables, one per vertex.
Schema (data type)
Type name: MinimumSumMulticenter
Variants: graph topology, weight type
| Field |
Type |
Description |
graph |
SimpleGraph |
The underlying graph G = (V, E) |
vertex_weights |
Vec<W> |
Non-negative weight w(v) for each vertex v |
edge_lengths |
Vec<W> |
Non-negative length l(e) for each edge e (used to compute shortest-path distances) |
k |
usize |
Number of centers to place (K) |
bound |
W |
Upper bound B on total weighted distance (for decision variant) |
Size fields (getter methods for overhead expressions):
num_vertices() → |V|
num_edges() → |E|
num_centers() → K
Notes:
- This is a satisfaction (decision) problem matching the GJ formulation:
Metric = bool, implementing SatisfactionProblem.
- A configuration is satisfying if exactly K centers are selected and the total weighted distance Sigma_{v in V} d(v)·w(v) ≤ B.
- Per GJ comment: restricting P to a subset of V (vertex-restricted variant) does not lose generality for p-median.
declare_variants! guidance:
- Complexity string:
"2^num_vertices" (brute-force enumeration of C(n, K) subsets; no specialized exact exponential algorithm improves on this for general p-median beyond ILP approaches).
- Note: This is the trivial enumeration bound. No faster specialized exact algorithm is known for general p-median.
Complexity
- Decision complexity: NP-complete (Kariv and Hakimi, 1979; transformation from DOMINATING SET). Remains NP-complete even with unit weights and unit edge lengths.
- Best known exact algorithm: O*(2^n) via brute-force enumeration of all C(n, K) vertex subsets with shortest-path distance computation. The p-median problem is typically solved in practice via integer linear programming with branch-and-bound. No specialized exact exponential algorithm is known that improves on the trivial bound for general p-median.
- Polynomial cases: Solvable in polynomial time for fixed K and for arbitrary K on trees (Kariv and Hakimi, 1979).
- Approximation: Constant-factor approximation by Charikar et al. (1999, 2002); best known ratio is (2+ε) by Cohen-Addad et al. (STOC 2022).
- References:
- O. Kariv, S. L. Hakimi (1979). "An Algorithmic Approach to Network Location Problems. II: The p-Medians." SIAM J. Appl. Math., 37(3):539-560.
- M. Charikar, S. Guha, E. Tardos, D. B. Shmoys (1999). "A Constant-Factor Approximation Algorithm for the k-Median Problem." Proc. 31st ACM STOC, pp. 1-10.
Specialization
- This is a special case of: General facility location / median location problems
- Known special cases:
- Vertex p-median: centers restricted to vertices (no loss of generality per GJ)
- Unweighted unit-length variant: w(v)=1, l(e)=1 (still NP-complete)
- Tree graphs: polynomial-time solvable (Kariv and Hakimi, 1979)
- Fixed K: polynomial-time solvable
- Related problems: MIN-MAX MULTICENTER (p-center, ND50) uses bottleneck objective instead of sum
Extra Remark
Full book text:
INSTANCE: Graph G = (V,E), weight w(v) ∈ Z_0^+ for each v ∈ V, length l(e) ∈ Z_0^+ for each e ∈ E, positive integer K ≤ |V|, positive rational number B.
QUESTION: Is there a set P of K "points on G" such that if d(v) is the length of the shortest path from v to the closest point in P, then Sigma_{v in V} d(v)·w(v) ≤ B?
Reference: [Kariv and Hakimi, 1976b]. Transformation from DOMINATING SET.
Comment: Also known as the "p-median" problem. It can be shown that there is no loss of generality in restricting P to being a subset of V. Remains NP-complete if w(v) = 1 for all v ∈ V and l(e) = 1 for all e ∈ E. Solvable in polynomial time for any fixed K and for arbitrary K if G is a tree.
How to solve
Example Instance
Graph G with 7 vertices {0, 1, 2, 3, 4, 5, 6} and 8 edges, unit weights and lengths:
- Edges: {0,1}, {1,2}, {2,3}, {3,4}, {4,5}, {5,6}, {0,6}, {2,5}
- K = 2, B = 6
All-pairs shortest distances (unit edge lengths), all w(v) = 1, l(e) = 1.
Optimal 2-median: Place centers at vertices {2, 5}.
- d(0) = dist(0, {2,5}) = min(dist(0,2), dist(0,5)) = min(2, 2) = 2
- d(1) = dist(1, {2,5}) = min(1, 2) = 1
- d(2) = 0 (center)
- d(3) = dist(3, {2,5}) = min(1, 2) = 1
- d(4) = dist(4, {2,5}) = min(2, 1) = 1
- d(5) = 0 (center)
- d(6) = dist(6, {2,5}) = min(dist(6,2), dist(6,5)) = min(2, 1) = 1
Total weighted distance = 2 + 1 + 0 + 1 + 1 + 0 + 1 = 6 ≤ 6 = B. Answer: YES.
For K = 2, B = 5: the minimum achievable total is 6 (verified by checking all C(7,2)=21 pairs). Answer: NO.
Prerequisite: Implementing this model requires MinimumDominatingSet to already exist in the codebase (for the planned reduction R71: DOMINATING SET -> MIN-SUM MULTICENTER). MinimumDominatingSet is already implemented.
Motivation
MIN-SUM MULTICENTER from Garey & Johnson, A2 ND51. A classical NP-complete facility location problem, also known as the p-median problem. Given a graph with vertex weights and edge lengths, the goal is to place K service centers so as to minimize the total weighted distance from all vertices to their nearest centers. Arises in optimal placement of warehouses, hospitals, schools, and other service facilities. Unlike the min-max variant (p-center), which minimizes the worst-case distance, the p-median minimizes average/total service cost.
Associated reduction rules:
Definition
Name:
MinimumSumMulticenterCanonical name: p-Median Problem; also: Min-Sum Multicenter, Uncapacitated Facility Location (variant)
Reference: Garey & Johnson, Computers and Intractability, A2 ND51
Mathematical definition:
INSTANCE: Graph G = (V,E), weight w(v) ∈ Z_0^+ for each v ∈ V, length l(e) ∈ Z_0^+ for each e ∈ E, positive integer K ≤ |V|, positive rational number B.
QUESTION: Is there a set P of K "points on G" such that if d(v) is the length of the shortest path from v to the closest point in P, then Sigma_{v in V} d(v)·w(v) ≤ B?
The optimization version asks: find K points on G minimizing the total weighted distance Sigma_{v in V} d(v)·w(v).
Variables
dims()spec:vec![2; num_vertices]— n binary variables, one per vertex.Schema (data type)
Type name:
MinimumSumMulticenterVariants: graph topology, weight type
graphSimpleGraphvertex_weightsVec<W>edge_lengthsVec<W>kusizeboundWSize fields (getter methods for overhead expressions):
num_vertices()→ |V|num_edges()→ |E|num_centers()→ KNotes:
Metric = bool, implementingSatisfactionProblem.declare_variants!guidance:"2^num_vertices"(brute-force enumeration of C(n, K) subsets; no specialized exact exponential algorithm improves on this for general p-median beyond ILP approaches).Complexity
Specialization
Extra Remark
Full book text:
INSTANCE: Graph G = (V,E), weight w(v) ∈ Z_0^+ for each v ∈ V, length l(e) ∈ Z_0^+ for each e ∈ E, positive integer K ≤ |V|, positive rational number B.
QUESTION: Is there a set P of K "points on G" such that if d(v) is the length of the shortest path from v to the closest point in P, then Sigma_{v in V} d(v)·w(v) ≤ B?
Reference: [Kariv and Hakimi, 1976b]. Transformation from DOMINATING SET.
Comment: Also known as the "p-median" problem. It can be shown that there is no loss of generality in restricting P to being a subset of V. Remains NP-complete if w(v) = 1 for all v ∈ V and l(e) = 1 for all e ∈ E. Solvable in polynomial time for any fixed K and for arbitrary K if G is a tree.
How to solve
Example Instance
Graph G with 7 vertices {0, 1, 2, 3, 4, 5, 6} and 8 edges, unit weights and lengths:
All-pairs shortest distances (unit edge lengths), all w(v) = 1, l(e) = 1.
Optimal 2-median: Place centers at vertices {2, 5}.
Total weighted distance = 2 + 1 + 0 + 1 + 1 + 0 + 1 = 6 ≤ 6 = B. Answer: YES.
For K = 2, B = 5: the minimum achievable total is 6 (verified by checking all C(7,2)=21 pairs). Answer: NO.
Prerequisite: Implementing this model requires
MinimumDominatingSetto already exist in the codebase (for the planned reduction R71: DOMINATING SET -> MIN-SUM MULTICENTER). MinimumDominatingSet is already implemented.