Introduction
Clustering is a fundamental task in data science, yet real-world applications often involve capacity constraints. In logistics or public service planning—such as locating vaccination centers or disaster relief hubs—points cannot simply be grouped by proximity; each center has a finite capacity. This defines the Capacitated Clustering Problem (CCP), an NP-hard task.
Traditional methods like k-means ignore these limits, while state-of-the-art math-heuristics are computationally intensive and lack the ability to learn from previous problem instances. Neural Capacitated Clustering (NCC) addresses these challenges by distilling the logic of complex mathematical solvers into a fast neural scoring function, achieving competitive results up to 10 times faster than existing heuristics.
Methodology
The NCC framework consists of a neural scoring function and an iterative assignment algorithm.
Neural Scoring Function ($f_\theta$)
The core of NCC is a hybrid architecture designed to capture both local and global dependencies:
- Spatial Encoding: A Graph Neural Network (GNN) processes local spatial relationships between points.
- Global Context: A Self-Attention (SA) layer models the interdependence between cluster centers. This is vital because the assignment of a point to one cluster impacts the remaining capacity for all others.
- Supervised Learning: The model is trained to predict cluster membership probabilities using labels from high-quality math-heuristics.
The NCC Algorithm
The algorithm proceeds through three main stages:
- Weight-Adapted Initialization: An enhanced k-means++ variant (ckm++) that accounts for point weights during initial center selection.
- Iterative Assignment: Points are assigned based on neural scores using a priority queue. To maintain feasibility, a "dummy cluster" is used for points that temporarily cannot fit, allowing the algorithm to refine centers until a feasible solution emerges.
- Edge Case Handling: A "re-prioritization" strategy manages the assignment of the final, most difficult points.
Experimental Evaluation
The model was evaluated on artificial Gaussian Mixture Model (GMM) data and real-world datasets, including Shanghai Telecom (ST) and Telecom Italia Milan (TIM) internet usage data.
Performance and Efficiency
NCC demonstrated high solution quality with significantly lower variance than traditional heuristics. Most notably, it achieved these results while being 5x to 10x faster than top-tier mathematical solvers. For example, on certain instances, NCC reached a solution in approximately 90 seconds compared to over 900 seconds for traditional solvers.
Application to Vehicle Routing
In the context of the Capacitated Vehicle Routing Problem (CVRP), NCC outperformed classical "cluster-first-route-second" approaches and remained competitive with specialized reinforcement learning models, particularly on larger-scale instances.
Conclusion and Future Work
NCC represents a significant step toward "learning to cluster" under constraints. By leveraging GNNs and Self-Attention, it captures the global reasoning of mathematical solvers in a fraction of the time. Future research will focus on removing the dependency on fixed cluster counts ($K$), extending the model to non-Euclidean spaces, and reducing the reliance on supervised labels.
Summary updated