Matching in Practice:
Junior Doctor Allocation
in Scotland
David Manlove
Joint work with
Rob Irving, Augustine Kwanashie,
and Iain McBride
Centralised matching schemes
Intending junior doctors must undergo training in hospitals
Applicants rank hospitals in order of preference
Hospitals do likewise with their applicants
Centralised matching schemes (clearinghouses) produce a
matching in several countries
–
US (National Resident Matching Program)
– Canada (Canadian Resident Matching Service)
– Japan (Japan Residency Matching Program)
– Scotland (Scottish Foundation Allocation Scheme)
• typically around 750 applicants and 50 hospitals
Stability is the key property of a matching
–
[Roth, 1984]
1
Hospitals / Residents problem (HR)
Underlying theoretical model: Hospitals / Residents problem (HR)
We have n1 residents r1, r2, …, rn1 and n2 hospitals h1, h2, …, hn2
Each hospital has a capacity
Residents rank hospitals in order of preference, hospitals do
likewise
r finds h acceptable if h is on r’s preference list, and
unacceptable otherwise (and vice versa)
A matching M is a set of resident-hospital pairs such that:
1. (r,h)M r, h find each other acceptable
2. No resident appears in more than one pair
3. No hospital appears in more pairs than its capacity
2
HR: example instance
r1: h2 h1
r2: h1 h2
Each hospital has capacity 2
r3: h1 h3
r4: h2 h3
h1: r1 r3 r2 r5 r6
r5: h2 h1
h2: r2 r6 r1 r4 r5
r6: h1 h2
h3: r4 r3
Resident preferences
Hospital preferences
3
HR: stability
Matching M is stable if M admits no blocking pair
– (r,h) is a blocking pair of matching M if:
1. r, h find each other acceptable
and
2. either r is unmatched in M
or r prefers h to his/her assigned hospital in M
and
3. either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
4
HR: stable matching
r1: h2 h1
r2: h1 h2
Each hospital has capacity 2
r3: h1 h3
r4: h2 h3
h1: r1 r3 r2 r5 r6
r5: h2 h1
h2: r2 r6 r1 r4 r5
r6: h1 h2
h3: r4 r3
Resident preferences
Hospital preferences
M = {(r1, h2), (r2, h1), (r3, h1), (r4, h3), (r6, h2)} (size 5)
r5 is unmatched
h3 is undersubscribed
5
HR: classical results
A stable matching always exists and can be found in linear time
[Gale and Shapley, 1962]
There are resident-optimal and hospital-optimal stable
matchings
Stable matchings form a distributive lattice [Conway, 1976;
Gusfield and Irving, 1989]
“Rural Hospitals Theorem”: for a given instance of HR:
the same residents are assigned in all stable matchings;
2. each hospital is assigned the same number of residents in all
stable matchings;
3. any hospital that is undersubscribed in one stable matching is
assigned exactly the same set of residents in all stable matchings.
1.
– [Roth,
1984; Gale and Sotomayor, 1985; Roth, 1986]
6
Hospitals / Residents problem with Ties
In practice, residents’ preference lists are short
Hospitals’ lists are generally long, so ties may be used –
Hospitals / Residents problem with Ties (HRT)
A hospital may be indifferent among several residents
E.g., h1: (r1 r3) r2 (r5 r6 r8)
Matching M is stable if there is no pair (r,h) such that:
1. r, h find each other acceptable
2. either r is unmatched in M
or r prefers h to his/her assigned hospital in M
3. either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
A matching M is stable in an HRT instance I if and only if M is
stable in some instance I of HR obtained from I by breaking the
ties [M et al, 1999]
7
HRT: stable matching (1)
r1: h1 h2
r2: h1 h2
Each hospital has capacity 2
r3: h1 h3
r4: h2 h3
h1: r1 r2 r3 r5 r6
r5: h2 h1
h2: r2 r1 r6(r4 r5)
r6: h1 h2
h3: r4 r3
Resident preferences
Hospital preferences
8
HRT: stable matching (1)
r1: h1 h2
r2: h1 h2
Each hospital has capacity 2
r3: h1 h3
r4: h2 h3
h1: r1 r2 r3 r5 r6
r5: h2 h1
h2: r2 r1 r6(r4 r5)
r6: h1 h2
h3: r4 r3
Resident preferences
Hospital preferences
M = {(r1, h1), (r2, h1), (r3, h3), (r4, h2), (r6, h2)} (size 5)
9
HRT: stable matching (2)
r1: h1 h2
r2: h1 h2
Each hospital has capacity 2
r3: h1 h3
r4: h2 h3
h1: r1 r2 r3 r5 r6
r5: h2 h1
h2: r2 r1 r6(r4 r5)
r6: h1 h2
h3: r4 r3
Resident preferences
Hospital preferences
M = {(r1, h1), (r2, h1), (r3, h3), (r4, h3), (r5, h2), (r6, h2)} (size 6)
10
Maximum stable matchings
Stable matchings can have different sizes
A maximum stable matching can be (at most) twice the size of a
minimum stable matching
Problem of finding a maximum stable matching (MAX HRT) is
NP-hard [Iwama, M et al, 1999], even if (simultaneously):
–
each hospital has capacity 1 (Stable Marriage problem with Ties and
Incomplete Lists)
– the ties occur on one side only
– each preference list is either strictly ordered or is a single tie
– and
• either each tie is of length 2 [M et al, 2002]
• or each preference list is of length 3 [Irving, M, O’Malley, 2009]
Minimization problem is NP-hard too, for similar restrictions!
[M et al, 2002]
11
MAX HRT: approximability
MAX HRT is not approximable within 33/29 unless P=NP, even if
each hospital has capacity 1 [Yanagisawa, 2007]
UGC-hard to approximate MAX HRT within 4/3- [Yanagisawa,
2007]
Trivial upper bound of 2 for MAX HRT
Succession of papers gave improvements, culminating in:
–
MAX HRT is approximable within 3/2 [McDermid, 2009; Király, 2013;
Paluch 2012] and within 19/13 (~1.4615) for ties on one side only [Dean
and Jalasutram, 2014]
Experimental comparison of approximation algorithms and
heuristics for MAX HRT [Irving and M, 2009]
Integer programming models for MAX HRT [Kwanashie and M,
2014]
12
Couples in HR
Pairs of residents who wish to be matched to geographically close
hospitals form couples
Each couple (ri,rj) ranks in order of preference a set of pairs of
hospitals (hp,hq) representing the assignment of ri to hp and rj to hq
Stability definition may be extended to this case [Roth, 1984;
McDermid and M, 2010; Biró et al, 2011]
Gives the Hospitals / Residents problem with Couples (HRC)
A stable matching need not exist:
(r1,r2): (h1,h1)
r3:
h1:2: r1 r3 r2
h1
13
Couples in HR
Pairs of residents who wish to be matched to geographically close
hospitals form couples
Each couple (ri,rj) ranks in order of preference a set of pairs of
hospitals (hp,hq) representing the assignment of ri to hp and rj to hq
Stability definition may be extended to this case [Roth, 1984;
McDermid and M, 2010; Biró et al, 2011]
Gives the Hospitals / Residents problem with Couples (HRC)
A stable matching need not exist:
(r1,r2): (h1,h1)
r3:
h1:2: r1 r3 r2
h1
Stable matchings can have different sizes
14
Couples in HR
The problem of determining whether a stable matching exists in a
given HRC instance is NP-complete, even if each hospital has
capacity 1 and:
–
there are no single residents
[Ng and Hirschberg, 1988; Ronn, 1990]
–
there are no single residents
each couple has a preference list of length ≤2
each hospital has a preference list of length ≤2
[Biró, M and McBride, 2014]
Heuristic (Algorithm C) described in [Biró et al, 2011]
Integer programming models for HRC [Biró, M and McBride, 2014]
15
Scottish Foundation Allocation Scheme
Set of applicants and programmes (residents and
hospitals)
Each applicant:
– ranked 10 programmes in strict order of preference
– had a score in the range 40..100
– from 2009, two applicants could link their applications
Each programme:
– had a capacity indicating its number of posts
– had a preference list derived from the above scoring function
– so ties were possible
16
Empirical results for SFAS instances (1)
SFAS datasets from the 2006-2008 matching runs were modelled
and solved [Kwanashie and M, 2014]
–
no couples; ties exist only on hospitals’ preference lists
–
sizes (|M|) were compared against those obtained from
approximation algorithms and heuristics due to
[Irving and M, 2009] (|M|)
Year
Residents Hospitals
|M|
|M|
SFAS
Time
(sec)
2008
748
52
709
705
705
75.5
2007
781
53
746
744
736
21.8
2006
759
53
758
754
745
93.0
17
Empirical results for SFAS instances (2)
For SFAS datasets from the 2010-2012 matching runs
–
approx. 5% of applicants involved in a couple – IP model
extended to HRC [Biró, M and McBride, 2014]
–
maximum stable matching sizes (|M|) were compared against
those obtained from heuristics due to [Biró et al, 2011] (|M|)
Year
Residents Couples Hospitals Posts
|M|
|M| SFAS Time
(sec)
2012
710
17
52
720
683
681
683
9.6
2011
736
12
52
736
?
688
684
?
2010
734
20
52
735
681
681
681
33.9
18
Open problems
Approximation algorithm for MAX HRT with performance
guarantee < 3/2?
– consider special cases:
• ties on one side only (< 19/13?)
• master lists
To make an HRC instance solvable, try to find “perturbation” of
the hospital capacities. A solvable instance can be found by:
– varying the capacity of each hospital by at most 4
– increasing the total number of posts by at most 9
[Nguyen and Vohra, 2014]
– is it sufficient to vary the capacity of each hospital by a smaller
number?
19
Book on Matching Under Preferences
20
References
Abraham, D.J., Blum, A. and Sandholm, T. (2007). Clearing algorithms for barter
exchange markets: enabling nationwide kidney exchanges, in Proceedings of EC ’07: the
8th ACM Conference on Electronic Commerce (ACM), pp. 295–304.
Ashlagi, I. and Roth, A. (2012). New challenges in multihospital kidney exchange,
American Economic Review 102, 3, pp. 354–359.
Biró, P., Irving, R.W. and Schlotter, I. (2011). Stable matching with couples: an empirical
study, ACM Journal of Experimental Algorithmics 16, section 1, article 2, 27 pages.
Biró, P., Manlove, D.F. and McBride, I. (2014). The Hospitals / Residents problem with
Couples: Complexity and Integer Programming models. In Proceedings of SEA 2014: the
13th International Symposium on Experimental Algorithms, volume 8504 of Lecture Notes
in Computer Science, pages 10-21, Springer, 2014.
Biró, P., Manlove, D.F. and Rizzi, R. (2009). Maximum weight cycle packing in directed
graphs, with application to kidney exchange, Discrete Mathematics, Algorithms and
Applications 1, 4, pp. 499–517.
Conway, J.H. (1976). Personal communication, reported in Knuth, D.E. (1976). Mariages
Stables (Les Presses de L’Université de Montréal). English translation in Stable Marriage
and its Relation to Other Combinatorial Problems, volume 10 of CRM Proceedings and
Lecture Notes, American Mathematical Society, 1997.
21
References
Dean, B.C. and Jalasutram, R. (2014). Factor Revealing LPs and Stable Matching with
Ties and Incomplete Lists. Unpublished manuscript.
Gale, D. and Shapley, L.S. (1962). College admissions and the stability of marriage,
American Mathematical Monthly 69, pp. 9–15.
Gale, D. and Sotomayor, M. (1985). Some remarks on the stable matching problem,
Discrete Applied Mathematics 11, pp. 223–232.
Glorie, K. and van de Klundert, J. (2014). Kidney exchange with long chains: An
efficient pricing algorithm for clearing barter exchange markets with branch-and-price,
Manufacturing & Service Operations Management, 16, 4, pp. 498-512.
Gusfield, D. and Irving, R.W. (1989). The Stable Marriage Problem: Structure and
Algorithms (MIT Press).
Irving, R.W. and Manlove, D.F. (2009). Finding large stable matchings, ACM Journal of
Experimental Algorithmics 14, section 1, article 2, 30 pages.
Irving, R.W., Manlove, D.F. and O’Malley, G. (2009). Stable marriage with ties and
bounded length preference lists, Journal of Discrete Algorithms 7, 2, pp. 213–219.
22
References
Iwama, K., Manlove, D., Miyazaki, S. and Morita, Y. (1999). Stable marriage with
incomplete lists and ties, in Proceedings of ICALP ’99: the 26th International
Colloquium on Automata, Languages, and Programming, Lecture Notes in Computer
Science, Vol. 1644 (Springer), pp. 443–452.
Keizer, K., de Klerk, M., Haase-Kromwijk, B., and Weimar, W. (2005). The Dutch
algorithm for allocation in living donor kidney exchange. Transplantation Proceedings
37 : 589–591.
Király, Z. (2013). Linear Time Local Approximation Algorithm for Maximum Stable
Marriage. Algorithms 6, 3, pp. 471-484.
Kwanashie, A. and Manlove, D.F. (2014). An Integer Programming approach to the
Hospitals / Residents problem with Ties. In Proceedings of OR 2013: the International
Conference on Operations Research, pp. 263-269, Springer.
Manlove, D.F., Irving, R.W., Iwama, K., Miyazaki, S. and Morita, Y. (1999). Hard
variants of stable marriage, Tech. Rep. TR-1999-43, University of Glasgow, School of
Computing Science.
Manlove, D.F., Irving, R.W., Iwama, K., Miyazaki, S. and Morita, Y. (2002). Hard
variants of stable marriage, Theoretical Computer Science 276, 1-2, pp. 261–279.
23
References
Manlove, D.F. and O'Malley, G. (2012). Paired and altruistic kidney donation in the UK:
Algorithms and experimentation. In Proceedings of SEA 2012: the 11th International
Symposium on Experimental Algorithms, volume 7276 of Lecture Notes in Computer
Science, pages 271-282, Springer, 2012.
McDermid, E. (2009). A 3/2 approximation algorithm for general stable marriage, in
Proceedings of ICALP ’09: the 36th International Colloquium on Automata, Languages
and Programming, Lecture Notes in Computer Science, Vol. 5555 (Springer), pp. 689–
700.
McDermid, E.J. and Manlove, D.F. (2010). Keeping partners together: Algorithmic
results for the hospitals / residents problem with couples, Journal of Combinatorial
Optimization 19, 3, pp. 279–303.
Ng, C. and Hirschberg, D.S. (1988). Complexity of the stable marriage and stable
roommate problems in three dimensions, Tech. Rep. UCI-ICS 88-28, Department of
Information and Computer Science, University of California, Irvine.
Nguyen, T. and Vohra, R. (2014). Near Feasible Stable Matchings with
Complementarities. Unpublished manuscript.
24
References
NHS Blood and Transplant (2014). Transplant Activity Report 2013-14. Available from
http://www.organdonation.nhs.uk/statistics/transplant_activity_report/current_activity_re
ports/ukt/activity_report_2013_14.pdf.
Paluch, K. (2012). Faster and simpler approximation of stable matchings, in
Proceedings of WAOA ’11: 9th Workshop on Approximation and Online Algorithms,
Lecture Notes in Computer Science, Vol. 7164 (Springer), pp. 176–187.
Ronn, E. (1990). NP-complete stable matching problems, Journal of Algorithms 11 :
285–304.
Roth, A.E. (1984). The evolution of the labor market for medical interns and residents: a
case study in game theory, Journal of Political Economy 92 (6) : 991–1016
Roth, A.E. (1986). On the allocation of residents to rural hospitals: a general property of
two-sided matching markets, Econometrica 54 : 425–427
Roth, A., Sönmez, T., and Űnver, M.U. (2004). Kidney exchange. Quarterly Journal of
Economics 119 (2) : 457–488.
25
References
Roth, A., Sönmez, T., and Űnver, M.U. (2005). Pairwise kidney exchange. Journal of
Economic Theory 125 : 151–188.
Roth, A., Sönmez, T., and Űnver, M.U. (2007). Efficient kidney exchange: Coincidence
of wants in a market with compatibility-based preferences. American Economic Review
97 (3) : 828–851.
Yanagisawa, H. (2007). Approximation Algorithms for Stable Marriage Problems, Ph.D.
thesis, Kyoto University, School of Informatics.
26
Nobel prize in Economic Sciences, 2012
27
© Copyright 2026 Paperzz