Neural Capacitated Clustering

Jonas K. Falkner, Lars Schmidt-Thieme · DOI

Abstract

The Capacitated Clustering Problem (CCP) is a fundamental NP-hard task in combinatorial optimization with wide-ranging applications in logistics and resource allocation. Traditional approaches typically face a trade-off between the speed of meta-heuristics and the accuracy of computationally expensive math-heuristics. This paper presents Neural Capacitated Clustering (NCC), a hybrid deep learning framework that combines a Graph Neural Network (GNN) scoring function with an iterative assignment procedure. NCC effectively distills the logic of high-quality mathematical solvers into a fast neural model. Our results demonstrate that NCC outperforms state-of-the-art solvers in both solution quality and speed—achieving up to a 10x reduction in runtime while maintaining a 100% feasibility rate across synthetic and real-world benchmarks.

Introduction

Clustering is a cornerstone of data science, yet real-world scenarios often impose rigid constraints on cluster composition. The Capacitated Clustering Problem (CCP) requires grouping a set of weighted points into clusters such that the total weight of each cluster does not exceed a predefined capacity. This problem is critical for logistics (hub placement), disaster relief (vaccination center location), and industrial planning.

Historically, solvers have been divided into two categories: fast meta-heuristics that often settle for local optima, and math-heuristics (e.g., Gurobi-based methods) that provide near-optimal solutions at a high computational cost. NCC addresses this gap by introducing the first deep learning-based approach capable of handling these rigid, cluster-level capacity constraints efficiently.

Methodology

Neural Capacitated Clustering (NCC) utilizes a two-component architecture designed to balance global interdependence with local constraints.

1. Neural Scoring Function ($f_\theta$)

The problem is represented as a graph where nodes (points) are connected to their $K$-nearest neighbors. A Graph Neural Network (GNN) encodes spatial relationships and node weights, while a Self-Attention (SA) layer models the competition between different cluster centers. The network outputs a priority score, $\hat{\omega}_{ik}$, representing the probability of node $i$ belonging to cluster $k$.

2. Iterative NCC Algorithm

The assignment process follows a refined iterative loop:

  • Weight-Adapted Initialization (ckm++): A novel initialization strategy ensures cluster centers are spread effectively based on spatial distribution and capacity requirements.
  • Neural-Guided Assignment: Instead of simple distance-based metrics, the algorithm uses neural scores to guide assignments while strictly adhering to capacity limits.
  • Re-prioritization: To address the "hard tail" of the problem—where the final 20-25% of assignments become difficult due to dwindling capacity—NCC employs "Greedy" and "Sampling" strategies to ensure all points are assigned without violating constraints.

Experimental Evaluation

NCC was evaluated against several benchmarks, including synthetic Gaussian Mixture Model (GMM) data and real-world datasets such as Shanghai Telecom (ST) and Telecom Italia Milan (TIM). It was also tested as a "cluster-first, route-second" heuristic for the Capacitated Vehicle Routing Problem (CVRP) using the Uchoa benchmark.

Key Results

  • Performance and Speed: NCC achieved lower total squared distance (inertia) than established math-heuristics like GB21 and PACK, while operating 5x to 10x faster.
  • Feasibility: While traditional heuristics often struggled with feasibility (up to 8.7% failure rate in some instances), NCC maintained a 100% feasibility rate across nearly all tests.
  • Generalization: A model trained on small, sub-sampled datasets ($n=200$) demonstrated successful zero-shot generalization to much larger instances ($n > 2000$) without retraining.
  • CVRP Integration: In routing tasks, NCC proved competitive with and occasionally outperformed state-of-the-art Reinforcement Learning methods like POMO, particularly on larger problem instances.

Discussion and Future Work

The success of NCC highlights the potential of using supervised learning to distill the logic of slow, exact solvers into efficient neural architectures. By considering the interdependence of cluster centers through self-attention, the model moves beyond isolated point-to-center calculations.

Currently, the model's performance is capped by the quality of its "teacher" solver and requires a fixed number of clusters ($K$) as an input. Future research will explore Reinforcement Learning (RL) to train NCC without pre-computed labels, potentially allowing the model to discover strategies that surpass current mathematical solvers and autonomously determine optimal cluster counts.

Summary updated

BibTeX
@inproceedings{falkner2023neural,
  author = {Jonas K. Falkner and Lars Schmidt-Thieme},
  title = {{Neural Capacitated Clustering}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/410},
}
Figure