Abstract
The problem of Hospitals/Residents with Ties (HRT) broadens the traditional many-to-one matching model by permitting non-strict preference rankings. In this study, we investigate the MAX-HRT variant, whose objective is to identify the largest weakly stable allocation, a problem that has been proven to be NP-hard. To cope with this computational challenge, we design a stochastic optimization scheme that initializes with a random feasible matching and progressively refines it through iterative stability adjustments. During refinement, the method strategically eliminates unstable pair configurations, giving higher priority to unfilled hospitals and unmatched residents to improve convergence efficiency. Experimental results conducted on reference datasets of substantial scale demonstrate that our algorithm reliably yields larger weakly stable matchings while significantly reducing runtime when compared with advanced adaptive-search and hospital-oriented techniques.
Introduction
The Stable Marriage Problem (SMP) (Gale & Shapley, 1962) provides a foundational model for two-sided matching and has been widely applied to tasks such as college admissions and medical resident allocation. A practical extension, the Hospitals/Residents problem with Ties (HRT) (Irving et al., 2000; Roth, 1984), allows hospitals to accept multiple residents and permits indifference in preference lists. While this better reflects real matching markets, it also increases computational complexity. Within this framework, the MAX-HRT (Irving & Manlove, 2009; Manlove, 2008) variant seeks a weakly stable matching of maximum cardinality. Because finding such a matching is NP-hard, exact optimization is generally impractical for large-scale programs. A variety of algorithms, most notably Adaptive Search (AS) and Hospital-Proposing (HP), have been developed to address MAX-HRT (Manlove et al., 2002). Although these methods provide valuable baselines, they often exhibit long runtimes or reduced matching size when preference lists contain extensive ties or when the market involves thousands of participants. Other heuristics aim to improve stability but require heavy parameter tuning or show inconsistent performance on tie-rich instances (Irving & Manlove, 2009). To overcome these limitations, this study proposes a Heuristic Search (HS) algorithm. HS starts from a feasible random assignment and iteratively enlarges the matching while maintaining weak stability. At each step, it eliminates undominated blocking pairs and prioritizes hospitals with unfilled positions and unmatched residents, a refinement strategy absent from existing approaches. This targeted mechanism enables HS to increase the matching size and accelerate convergence simultaneously. Extensive experiments on synthetic HRT instances demonstrate that HS consistently outperforms AS, HP, and other state-of-the-art methods in terms of matching size and runtime. These results highlight the practical effectiveness of the proposed heuristic framework for large-scale MAX-HRT problems. The remainder of this paper is organized as follows. Section 2 surveys relevant research; Section 3 outlines the basic definitions and preliminary notions; Section 4 elaborates on the proposed HS algorithm and analyzes its computational properties; Section 5 presents the experimental methodology and comparison results; and Section 6 concludes the paper with remarks on future extensions.
Related Work
The Hospitals/Residents problem with Ties (HRT) involves two main entities: hospitals and residents. Each hospital has a limited capacity and, similar to residents, provides a preference list that may contain ties. Such indifferences give rise to three commonly recognized notions of stability (Irving et al., 2000). Among them, weak stability is considered the most practical, as a weakly stable matching always exists for any HRT instance and its size may vary (Gelain et al., 2010; Irving et al., 2008; Manlove, 2008). The MAX-HRT problem aims to identify the largest weakly stable matching; however, this optimization has been proven to be NP-hard (Manlove et al., 2002), motivating the development of more efficient approximation techniques. Early studies laid the groundwork by defining key theoretical limits and algorithmic approaches. Manlove et al. (2002) demonstrated that, for any HRT instance, the maximum stable matching can be no more than twice the size of the minimal one. In a simplified scenario where ties appear solely within hospital preference lists, Irving and Manlove (2009) introduced two heuristic-based techniques. Kwanashie and Manlove (2013) later developed a mixed-integer programming formulation that filters out infeasible pairs through the hospitals-offer and residents-apply strategy (Irving & Manlove, 2009), subsequently optimized using CPLEX. Munera et al. (2015) presented the Adaptive Search (AS) framework, converting HRT instances into SMTI representations (Iwama & Miyazaki, 2008; Iwama et al., 1999; Manlove et al., 2002) and employing a dynamic search heuristic (Gelain et al., 2013; Munera et al., 2015). Király (2013) proposed a 3/2-approximation Hospital-Proposing (HP) algorithm operating in linear time, capable of resolving ties in both hospitals’ and residents’ rankings. Recent research on the Hospitals/Residents problem with Ties (HRT) has advanced both theoretical and algorithmic perspectives, including approximation guarantees, model extensions, and preprocessing techniques for large and tie-intensive instances (Balasundaram et al., 2025; Csáji et al., 2025; Pettersson et al., 2021; Ranjan et al., 2025). In parallel, several heuristic and local-search-based approaches have been proposed to address the NP-hard MAX-HRT problem with a focus on practical scalability and convergence (Qiu, 2024). More broadly, adaptive and learning-based optimization frameworks have also been explored for complex large-scale allocation problems, highlighting the growing importance of heuristic strategies in practice (Uyen et al., 2020).
While these algorithms form important baselines, they tend to face scalability challenges when dealing with large or tie-intensive datasets and often demand significant parameter tuning. To overcome such drawbacks, this study introduces a Heuristic Search (HS) framework that aims to: (i) minimize computation time on large MAX-HRT instances by concentrating on residents that can generate blocking pairs and selecting the most promising candidates at each iteration; and (ii) expand the resulting matching by reallocating unpaired residents to hospitals still below capacity under tied preferences, all without restarting the overall matching process.
Preliminaries
Consider an instance
An assignment
A pair
Given two blocking pairs
A matching
Proposed Algorithm
HS Algorithm
We propose a heuristic search approach, denoted by
The main loop iterates up to a fixed limit
If active residents exist, one is chosen, say
Algorithm 2 identifies an
Each iteration proceeds as follows. The algorithm first chooses a hospital
The repair procedure is defined through Cases (i) and (ii), which selectively update matched pairs under tie-consistent and counter-based conditions. Such updates are permitted only when the corresponding rank relationships and
In the worst case, detecting blocking pairs in HRT may require
Example
This subsection demonstrates the step-by-step execution of the
An HRT Instance.
An
The algorithm begins with the random initial matching
At each iteration,
Key Iterations of HS on the Instance in Table 1.
The detailed logic is as follows in Table 3. Residents
Full Execution Trace of
In this section, we evaluate the proposed
Datasets
To generate test instances, we adapted the random
Comparison with AS
In this section, we present a series of experiments conducted to evaluate and compare both the average execution time and the quality of solutions obtained by our
Experiment 1
We generated

Figure 1(a) shows the proportion of perfect matchings when
Figure 1(b) reports the average number of unmatched residents. When
Figure 1(c) compares average execution times. As
Finally, Figure 1(d) presents the average number of iterations. For
This experiment follows the parameter settings of Experiment 1 but introduces heterogeneous hospital capacities to model more realistic and constrained allocation environments. For each instance, the capacity of every hospital
Figure 2 summarizes the results. Across all metrics proportion of perfect matchings, number of unmatched residents, execution time, and iteration count of

This experiment evaluates how the number of hospitals influences algorithmic performance while keeping the resident population fixed. We set
Figure 3(a) shows that

In this section, we conduct experiments to compare the percentage of perfect matchings and the average execution time achieved by our
Experiment 4
This experiment compares the proposed
Figures 4(a) and (c) show that

This experiment evaluates the scalability of
Figures 5(a) and (c) show that the proportion of perfect matchings declines as

Overall,
This experiment examines the impact of increasing the number of hospitals on the relative performance of
Figure 6(a) shows that the proportion of perfect matchings rises steadily as

This paper introduces
Comprehensive experiments across diverse parameter settings demonstrate that
Future work could extend
Footnotes
Funding
The author(s) received no financial support for the research, authorship and/or publication of this article.
Declaration of Conflicting Interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
