SAT Is an Effective and Complete Method for Solving Stable Matching Problems with Couples

Joanna Drummond, Andrew Perrault, Fahiem Bacchus

Abstract

The Stable Matching Problem (SMP) with couples is a cornerstone of market design, most notably in medical residency matching. While the classic problem is solvable in polynomial time, the inclusion of couples makes it NP-complete. This paper introduces SAT-E, a novel Boolean Satisfiability (SAT) encoding that provides a complete solution. Unlike existing heuristics like Roth-Peranson (RP99) and Kojima-Pathak-Roth (KPR), SAT-E is guaranteed to find a stable match if one exists or prove its absence. Experimental results demonstrate that SAT-E significantly outperforms Integer Programming (IP) approaches and reveals substantial gaps in the success rates of popular heuristic algorithms.

Introduction

Matching medical residents to hospital programs is a classic application of stable matching. In a stable match, no pair (resident, hospital) would both prefer each other over their assigned partners. While the Gale-Shapley algorithm efficiently solves this for individuals, the presence of couples—whose preferences are interdependent—transforms the problem into an NP-complete challenge. Current market mechanisms, such as those used by the National Resident Matching Program, rely on heuristics that lack formal guarantees of completeness; they may fail to find a match even when one exists and cannot prove a match is mathematically impossible.

Methods

The authors propose SAT-E, which encodes stability constraints into Boolean Satisfiability. The key innovation is the use of variables representing the remaining capacity of a program at specific preference levels, allowing for a more compact encoding than previous attempts. This approach was compared against an Integer Programming model (IP-E) and two popular heuristics: RP99 (Roth-Peranson) and KPR (Kojima-Pathak-Roth). Testing was conducted on synthetic datasets ranging from 250 to 100,000 residents under both one-to-one and many-to-one matching scenarios.

The Cost of Incompleteness

A primary finding of this research is the significant "cost of incompleteness" inherent in existing heuristics. As the complexity of the market increases—specifically as the percentage of couples grows—the gap between the existence of a stable match and a heuristic's ability to find it widens significantly. In many-to-one tests, the KPR heuristic failed to find a match in roughly 13% to 23% of cases where a stable match actually existed.

Heuristic performance gap as the percentage of couples increases.

Performance and Scalability

SAT-E demonstrated superior scalability compared to the IP-E encoding, which struggled even with relatively small problem instances. While heuristic algorithms like KPR remain the fastest for finding solutions in seconds, SAT-E serves as a viable "heavy-duty" alternative. It successfully solved one-to-one instances up to 20,000 residents and provided definitive proofs of unsatisfiability (UNSAT) for larger instances where no match was possible.

Runtime comparison (in seconds) for one-to-one matching instances across different solvers.

Conclusion

SAT-E offers a powerful, modular tool for market designers. Its ability to provide definitive proofs of impossibility and its flexibility in incorporating additional constraints (e.g., regional quotas) make it a significant advancement over current heuristic and IP-based methods. Future work includes exploring MAXSAT to identify "almost stable" matches when a perfectly stable one does not exist and improving performance for extremely large-scale markets exceeding 100,000 residents.

Summary updated

BibTeX
@inproceedings{drummond2015sat,
  author = {Joanna Drummond and Andrew Perrault and Fahiem Bacchus},
  title = {{SAT Is an Effective and Complete Method for Solving Stable Matching Problems with Couples}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2015},
}
Figure