Abstract
Spatial Matching (SPM) addresses the challenge of matching customers to service providers based on proximity while respecting strict capacity constraints. Traditional solutions like the Gale-Shapley algorithm suffer from high computational complexity ($O(N^2)$) when applied to large-scale spatial data. This paper introduces the Chain algorithm, which leverages the geometric concept of "bichromatic mutual nearest neighbors" to settle these matches in linear time. By exploiting spatial geometry and indexing, the Chain algorithm provides a fair and efficient solution that outperforms traditional stable marriage adaptations by orders of magnitude.
Introduction: The Spatial Matching Problem
Consider the task of assigning residents to polling stations. While every resident naturally prefers the nearest station, these facilities have finite capacities. If assignments are made solely on individual proximity, popular stations may overflow while others remain underutilized.
In spatial database terms, this is a "capacitated" version of the Bichromatic Reverse Nearest Neighbor (BRNN) problem. The goal is to find a fair assignment: a state where no customer and provider exist who would both prefer each other over their current assigned partners. This is analogous to the classic "Stable Marriage" problem but set within a metric space where preferences are strictly dictated by distance.
Methodology: The Chain Algorithm
The authors propose the Chain algorithm for 1-to-1 matching and Weighted-Chain for scenarios with varying capacities and populations. The core innovation lies in identifying Bichromatic Mutual Nearest Neighbors (MNN). If a provider $P$ is the nearest neighbor of customer $O$, and $O$ is also the nearest neighbor of $P$, they are guaranteed to be part of a fair assignment.
The algorithm operates by building a "chain" of nearest neighbor queries:
- Chain Construction: Starting from an arbitrary point, the algorithm iteratively finds the nearest neighbor in the opposite set.
- Cycle Detection: When the chain cycles (e.g., $A \to B \to A$), a mutual nearest neighbor pair is identified and matched.
- Information Reuse: Once a pair is matched and removed from the dataset, the preceding part of the chain remains valid, allowing the algorithm to continue without restarting from scratch.
- Index Integration: The method is index-agnostic and can leverage structures like R*-trees to resolve nearest neighbor queries in logarithmic time.
Crucially, the algorithm's efficiency stems from its ability to prune the search space. In a general stable marriage problem, preferences can be arbitrary, requiring exhaustive comparisons. In SPM, the triangle inequality ensures that if an object is far from a provider, it is unlikely to be that provider's nearest neighbor, allowing spatial indices to skip large portions of the dataset.
Experimental Evaluation
The authors evaluated the Chain algorithm against real-world and synthetic datasets:
- Real-world Data: 2D locations from California (CA), Long Beach (LB), Greece (GR), and Germany (GM), with cardinalities ranging from ~23k to ~62k points.
- Synthetic Data: Gaussian and Zipfian distributions used to test scalability up to 100k points and higher dimensionality (up to 5D).
Key Results
- Speedup: On unweighted datasets, the Chain algorithm was approximately 7x faster than the standard Gale-Shapley algorithm and 150x faster than repetitive closest-pair retrieval methods.
- Scalability: Execution time scales linearly with the number of objects. For a dataset of 50k points, Chain completes in seconds, whereas alternative methods often fail to scale or take minutes.
- Memory Efficiency: By avoiding the pre-calculation of a massive $O(N^2)$ preference matrix, the Chain algorithm uses significantly less memory than traditional stable marriage approaches.
Conclusion
The Chain algorithm demonstrates that the geometric structure of spatial matching problems—governed by the triangle inequality—allows for significantly more efficient pruning than general stable marriage problems. While the current work focuses on static datasets with sufficient total capacity, it lays the groundwork for future research into dynamic spatial matching and scenarios with resource shortages.
Summary updated