r 1 : h 3 h 1 h 2 h 1 - School of Computing Science

The Hospitals / Residents
Problem and Some Extensions
David Manlove
University of Glasgow
Department of Computing Science
Supported by EPSRC grant GR/M13329
and Nuffield Foundation award NUF-NAL-02
L3 #1
Medical matching: general situation
• Graduating medical students (US: residents;
formerly interns; UK: PRHOs) seek hospital
appointments
• Free-for-all markets are chaotic
– Danger of residents or hospitals trying to
improve their allocation
– Hospitals imposing unrealistic deadlines on
residents to decide on offers
• Centralised matching schemes are in operation:
– Residents form preferences over hospitals
– Hospitals form preferences over residents
– No resident receives more than one hospital
appointment
– No hospital exceeds its capacity
– Residents and hospitals agree to be bound by
the outcome of the matching algorithm
• Schemes not based on stability have failed
L3 #2
Hospitals/Residents problem (HR): definitions
• n residents r1, r2, …, rn
• m hospitals h1, h2, …, hm
• Hospital hi has capacity ci
• Each resident ranks a subset of the hospitals in
strict order of preference
• Each hospital ranks its applicants in strict
order of preference
• r finds h acceptable if h is on r’s preference list;
r finds h unacceptable otherwise (and vice
versa)
• A matching M in an instance of HR is an
allocation of residents to hospitals such that:
1) (r,h)M  r,h find each other acceptable
2) No resident receives more than one post
3) No hospital exceeds its capacity
L3 #3
Hospitals/Residents problem: example
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #4
Hospitals/Residents problem: matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
M = {(r1, h1), (r2, h2), (r3, h3), (r5, h2), (r6, h1)}
(size 5)
L3 #5
Hospitals/Residents problem: matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
• 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
L3 #6
HR: unstable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
• 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 allocated hospital in M
and
3) either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
Matching above is unstable as e.g. (r2,h1), (r4,h2)
and (r4,h3) are blocking pairs
L3 #7
HR: unstable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
• 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 allocated hospital in M
and
3) either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
Matching above is unstable as e.g. (r2,h1), (r4,h2)
and (r4,h3) are blocking pairs
L3 #8
HR: unstable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
• 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 allocated hospital in M
and
3) either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
Matching above is unstable as e.g. (r2,h1), (r4,h2)
and (r4,h3) are blocking pairs
L3 #9
HR: stable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
• 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 allocated hospital in M
and
3) either h is undersubscribed in M
or h prefers r to its worst resident assigned in M
Example shows that, in a given stable matching,
• one or more residents may be unmatched
• one or more hospitals may be undersubscribed
L3 #10
A special case of HR
• Suppose that all hospitals have capacity 1
– This is the stable marriage problem with
unacceptable partners
• Residents are referred to as men, hospitals are
referred to as women
• Input to the problem consists of:
– a set of n men {m1,m2,…,mn}
– a set of m women {w1,w2,…,wm}
– for each person q, a preference list in
which q ranks a subset of the members
of the opposite sex in strict order
• A matching M is a set of disjoint (man,woman)
pairs such that (m,w)M only if:
– m finds w acceptable
– w finds m acceptable
L3 #11
Unacceptable partners: example instance
m1:
m2:
m3:
m4 :
w4
w2
w2
w1
w1
w1
w4
w4
w3
w4
w3
w2
Men’s preferences
w1:
w2:
w3:
w4:
m4
m3
m1
m4
m1 m2
m2 m4
m3
m1 m3 m2
Women’s preferences
• A blocking pair of matching M is a
(man,woman) pair (m,w)M such that:
1. m and w find each other acceptable
2. m is unmatched in M or prefers w to his
partner in M
3. w is unmatched in M or prefers m to her
partner in M
• Matching M is stable if M admits no blocking
pair
L3 #12
Unacceptable partners: example instance
m1:
m2:
m3:
m4 :
w4
w2
w2
w1
w1
w1
w4
w4
w3
w4
w3
w2
Men's preferences
w1:
w2:
w3:
w4:
m4
m3
m1
m4
m1 m2
m2 m4
m3
m1 m3 m2
Women's preferences
• A blocking pair of matching M is a
(man,woman) pair (m,w)M such that:
1. m and w find each other acceptable
2. m is unmatched in M or prefers w to his
partner in M
3. w is unmatched in M or prefers m to her
partner in M
• Matching M is stable if M admits no blocking
pair
L3 #13
Unacceptable partners: example instance
m1:
m2:
m3:
m4 :
w4
w2
w2
w1
w1
w1
w4
w4
w3
w4
w3
w2
Men's preferences
w1:
w2:
w3:
w4:
m4
m3
m1
m4
m1 m2
m2 m4
m3
m1 m3 m2
Women's preferences
• A blocking pair of matching M is a
(man,woman) pair (m,w)M such that:
1. m and w find each other acceptable
2. m is unmatched in M or prefers w to his
partner in M
3. w is unmatched in M or prefers m to her
partner in M
• Matching M is stable if M admits no blocking
pair
• The matching above is not stable as (m3,w2) and
(m3,w3) are blocking pairs
L3 #14
Unacceptable partners: example instance
m1:
m2:
m3:
m4 :
w4
w2
w2
w1
w1
w1
w4
w4
w3
w4
w3
w2
Men's preferences
w1:
w2:
w3:
w4:
m4
m3
m1
m4
m1 m2
m2 m4
m3
m1 m3 m2
Women's preferences
• A blocking pair of matching M is a
(man,woman) pair (m,w)M such that:
1. m and w find each other acceptable
2. m is unmatched in M or prefers w to his
partner in M
3. w is unmatched in M or prefers m to her
partner in M
• Matching M is stable if M admits no blocking
pair
• The matching above is not stable as (m3,w2) and
(m3,w3) are blocking pairs
L3 #15
Unacceptable partners: example instance
m1:
m2:
m3:
m4 :
w4
w2
w2
w1
w1
w1
w4
w4
w3
w4
w3
w2
Men's preferences
w1:
w2:
w3:
w4:
m4
m3
m1
m4
m1 m2
m2 m4
m3
m1 m3 m2
Women's preferences
• A blocking pair of matching M is a
(man,woman) pair (m,w)M such that:
1. m and w find each other acceptable
2. m is unmatched in M or prefers w to his
partner in M
3. w is unmatched in M or prefers m to her
partner in M
• Matching M is stable if M admits no blocking
pair
• The matching above is stable
L3 #16
Revised Gale/Shapley (GS) algorithm
• A stable matching always exists for a stable
marriage instance with unacceptable partners
• A stable matching M may be found efficiently
using the revised Gale/Shapley algorithm
– the algorithm takes  cmn steps, for some
constant c
• Some people may be unmatched in M, but
– the same people are unmatched in all
stable matchings
– hence all stable matchings have the same size
• Each man matched in M has the best partner
he could obtain in any stable matching
• Each woman matched in M has the worst
partner she could obtain in any stable matching
• The revised Gale / Shapley algorithm can be
extended to HR
L3 #17
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
• Hospital-oriented GS algorithm:
– Gusfield and Irving (1989), Section 1.6.2
L3 #18
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #19
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #20
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #21
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #22
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #23
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #24
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #25
Hospital-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some hospital h is undersubscribed) and
(h’s list contains a resident r not provisionally
assigned to h)) {
r := first such resident on h’s list;
/* h proposes to r */
if (r is already assigned to some hospital h’)
break the provisional assignment of r to h’;
provisionally assign r to h ;
for (each successor h’ of h on r’s list)
delete the pair (r,h’) ;
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #26
Hospital-optimal stable matching
• Theorem: Given an arbitrary instance of HR:
– the hospital-oriented GS algorithm always
terminates with a stable matching M
– the algorithm takes  cmn steps, for some
constant c
– each hospital that is full in M is assigned the
best set of residents that it could obtain in
any stable matching
– each resident assigned in M is assigned to
the worst hospital that he could obtain in
any stable matching
• The matching output by the hospital-oriented
GS algorithm is called the hospital-optimal
stable matching
• Hospital-oriented GS algorithm used National
Resident Matching Program (US) since 1952
• Pressure from student bodies associated with
the NRMP led to the incorporation of the
resident-oriented GS algorithm!
L3
#27
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
• Resident-oriented GS algorithm:
–Gusfield and Irving (1989), Section 1.6.3
L3 #28
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #29
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #30
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #31
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #32
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #33
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #34
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #35
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #36
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #37
Resident-oriented GS algorithm for HR
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
while ((some resident r is free) and
(r has a nonempty list)) {
h := first hospital on r’s list;
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed) {
s’ := worst resident provisionally assigned to h ;
assign s’ to be free ;
delete the pair (s’,h) ;
}
if (h is full) {
s := worst resident provisionally assigned to h ;
for (each successor s’ of s on h’s list)
delete the pair (s’,h) ;
}
}
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3 #38
Resident-optimal stable matching
• Theorem: Given an arbitrary instance of HR:
– the resident-oriented GS algorithm always
terminates with a stable matching M
– the algorithm takes  cmn steps, for some
constant c
– each resident assigned in M is assigned to
the best hospital that he could be assigned
to in any stable matching
• The matching output by the resident-oriented
GS algorithm is called the resident-optimal
stable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
resident-optimal
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3
#39
Resident-optimal stable matching
• Theorem: Given an arbitrary instance of HR:
– the resident-oriented GS algorithm always
terminates with a stable matching M
– the algorithm takes  cmn steps, for some
constant c
– each resident assigned in M is assigned to
the best hospital that he could be assigned
to in any stable matching
• The matching output by the resident-oriented
GS algorithm is called the resident-optimal
stable matching
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
resident-optimal
hospital-optimal
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3
#40
The “Rural Hospitals Theorem”
• There may be more than one stable matching,
but:
– All stable matchings have the same size
– The same residents are assigned in all stable
matchings
– Any hospital that is undersubscribed in one
stable matching is assigned exactly the same
residents in all stable matchings
• This is called the “Rural Hospitals Theorem”
– Gusfield and Irving (1989), Section 1.6.4
r1:
r2:
r3:
r4:
r5:
r6:
h2
h1
h1
h2
h2
h1
h1
h2
h3
h3
h1
h2
Resident preferences
resident-optimal
hospital-optimal
h1: r1 r3 r2 r5 r6
h2: r2 r6 r1 r4 r5
h3: r4 r3
Hospital preferences
L3
#41
Summary
Hospitals / Residents problem:
• Hospital-oriented GS algorithm
• Resident-oriented GS algorithm
give hospital-optimal and resident-optimal
stable matchings, respectively
Centralised Matching Schemes
• National Resident Matching Program (US)
• Canadian Resident Matching Service
• Scottish PRHO Allocations scheme (SPA)
all generate resident-optimal stable matchings
Seminal paper:
• Gale and Shapley (1962): “College
admissions and the stability of marriage”,
American Mathematical Monthly, 69:9-15
But the NRMP’s hospital-oriented GS
algorithm predated Gale and Shapley’s
work by 10 years!
L3 #42
Hospitals/Residents problem with Ties (HRT)
• Participants may wish to express ties in their
preference lists
– Irving (1994): “Stable marriage and indifference”,
Discrete Applied Mathematics, 48:261-272
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r2
r1
r3
r3 r5
r6 (r4
r6
r5)
Hospital preferences
• A matching is weakly stable if it is stable for
some instance of HR obtained by breaking the
ties
• There is always a weakly stable matching in an
instance of HRT
• A weakly stable matching can be found using
the resident-oriented GS algorithm
L3 #43
Hospitals/Residents problem with Ties (HRT)
• Participants may wish to express ties in their
preference lists
– Irving (1994): “Stable marriage and indifference”,
Discrete Applied Mathematics, 48:261-272
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r2
r1
r3
r3
r6
r5
r4
r6
r5
Hospital preferences
• A matching is weakly stable if it is stable for
some instance of HR obtained by breaking the
ties
• There is always a weakly stable matching in an
instance of HRT
• A weakly stable matching can be found using
the resident-oriented GS algorithm
L3 #44
Hospitals/Residents problem with Ties (HRT)
• Participants may wish to express ties in their
preference lists
– Irving (1994): “Stable marriage and indifference”,
Discrete Applied Mathematics, 48:261-272
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r2
r1
r3
r3
r6
r5
r4
r6
r5
Hospital preferences
• A matching is weakly stable if it is stable for
some instance of HR obtained by breaking the
ties
• There is always a weakly stable matching in an
instance of HRT
• A weakly stable matching can be found using
the resident-oriented GS algorithm
L3 #45
Hospitals/Residents problem with Ties (HRT)
• Participants may wish to express ties in their
preference lists
– Irving (1994): “Stable marriage and indifference”,
Discrete Applied Mathematics, 48:261-272
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r2
r1
r3
r3 r5
r6 (r4
r6
r5)
Hospital preferences
• A matching is weakly stable if it is stable for
some instance of HR obtained by breaking the
ties
• There is always a weakly stable matching in an
instance of HRT
• A weakly stable matching can be found using
the resident-oriented GS algorithm
L3 #46
Weakly stable matchings in HRT
r1 :
r2 :
r3 :
r4 :
r5 :
r6 :
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r1 :
r2 :
r3:
r4 :
r5 :
r6 :
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
r2
r1
r3
r3
r6
r5
r4
r6
r5
Hospital preferences
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
Resident preferences
r2
r1
r3
r3
r6
r5
r5
r6
r4
Hospital preferences
• The weakly stable matchings may be of
different cardinalities
L3 #47
Maximum / minimum weakly stable matchings
Do efficient algorithms exist for finding
maximum or minimum cardinality weakly stable
matchings, given an instance of HRT?
Unfortunately, this is unlikely
Each of the problems of finding a maximum or
minimum weakly stable matching is “NP-hard”
and the result is true even if:
1. each hospital has capacity 1
2. the ties occur in the preference lists on one
side only
3. there is at most one tie per preference list, and
4. any tie is of length 2
• Iwama, Manlove, Miyazaki & Morita (1999): “Stable
marriage with incomplete lists and ties”, Proc. ICALP ’99
• Manlove, Irving, Iwama, Miyazaki & Morita (2002):
“Hard Variants of Stable Marriage”, Theoretical
Computer Science, 276 (1-2) : 261-279, 2002
L3 #48
Summary: weakly stable matchings
• Weakly stable matchings can be of different
sizes, and it is hard to find a maximum-sized
weakly stable matching
• Weakly stable matchings could be undermined
by a “bribery” situation
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Resident preferences
r1:
r2:
r3:
r4:
r5:
r6:
h1
h1
h1
h2
h2
h1
h2
h2
h3
h3
h1
h2
Resident preferences
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
r2
r1
r3
r3 r5
r6 (r4
r6
r5)
Hospital preferences
Each hospital has 2 posts
h1: r1
h2: r2
h3: r4
r2
r1
r3
r3 r5
r6 (r5
r6
r4)
Hospital preferences
• Define a stronger form of stability in HRT
L3 #49
Super-stable matchings in HRT
• A matching is super-stable if it is stable in every
instance of HR obtained by breaking the ties
• A super-stable matching is weakly stable
• Proposition: Let I be an instance of HRT. If I
admits a super-stable matching then all
weakly stable matchings have the same size
• Therefore a super-stable matching cannot
match fewer people than would be matched
by a weakly stable matching
• A super-stable matching also guards against
“bribery”
• But, a super-stable matching may not exist!
• Efficient algorithm to find a super-stable
matching, if one exists, given an HRT instance
– Irving, Manlove and Scott (2000): “The Hospitals /
Residents Problem with Ties”, Proc. SWAT 2000
L3 #50
Algorithm for HRT under super-stability
assign each resident to be free ;
assign each hospital to be totally unsubscribed ;
for (each hospital h)
full(h) := false ;
while ((some resident r is free) and
(r has a nonempty list)) {
for (each hospital h at the head of r’s list) {
/* r proposes to h */
provisionally assign r to h ;
if (h is oversubscribed)
for (each resident s’ at the tail of h’s list) {
if (s’ is provisionally assigned to h)
break the assignment ;
delete the pair (s’,h ) ; }
if (h is full) {
full(h) := true ;
s := worst resident provisionally assigned to h ;
for (each strict successor s’ of s on h’s list)
delete the pair (s’,h ) ; } }
}
if ((some resident is multiply assigned) or
(some hospital h is undersubscribed and full(h) )
no super-stable matching exists ;
else
the assignment relation is a super-stable matching ;
L3 #51
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #52
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #53
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #54
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #55
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #56
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #57
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #58
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #59
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #60
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
full
h 1:
h2:
h3:
Resident preferences
r3
r2
r4
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #61
Example execution of the algorithm
r1: h2
r2: h1
r3: h1
r4:(h2
r5: h1
r6: h2
h1
h2
h3
h3)
h2
h1
Each hospital has 2 posts
h1: r3
h2: r2
h3: r4
Resident preferences
r1
r1
r3
r2 r5
r6 (r4
r6
r5)
Hospital preferences
• During the proposal sequence, for any hospital h,
– If h is oversubscribed then all residents tied in
h’s last place are rejected
– If h is full then all residents strictly poorer than
h’s worst provisional assignee are prevented
from proposing to h
• At termination
– if some hospital is undersubscribed and was
previously full or
– some resident is multiply assigned
then no super-stable matching exists, otherwise
the assignment relation is a super-stable matching
L3 #62
Super-stable matchings in HRT
• Theorem: Given an arbitrary instance of HRT:
– the algorithm either finds a super-stable
matching M, or reports that none exists
– the algorithm takes  cmn steps, for some
constant c
– each resident assigned in M is assigned to
the best hospital that he could obtain in any
super-stable matching
• We can also formulate a hospital-oriented
algorithm
• Theorem: There may be more than one
super-stable matching, but:
– All super-stable matchings have the same size
– The same residents are assigned in all
super-stable matchings
– Any hospital that is undersubscribed in one
super-stable matching is assigned exactly the
same residents in all super-stable matchingsL3 #63
Super-stable vs. weakly stable matchings
• If a super-stable matching exists, it should be
chosen in favour of a weakly stable matching
start
Find a
weakly stable
matching
stop
No
Let I be an
HRT instance
Does I
admit a super-stable
matching?
Find a
super-stable
Yes matching
• Existence of a super-stable matching
• Structure of super-stable matchings in HRT
• Website for Stable Matching Algorithms
project:
http://www.dcs.gla.ac.uk/research/algorithms/stable
L3 #64
Strategic Issues
• Suppose that I is an instance of HR
• What if a set S of residents were to falsify their
true preferences in I, in the hope of achieving a
better hospital?
• Example (each hospital has 1 post):
r1:
r2 :
r3 :
r4 :
h1
h1
h1
h3
h2
h2
h2
h1
h3
h3
h3
h2
h4
h4
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferences
L3 #65
Strategic Issues
• Suppose that I is an instance of HR
• What if a set S of residents were to falsify their
true preferences in I, in the hope of achieving a
better hospital?
• Example (each hospital has 1 post):
r1:
r2 :
r3 :
r4 :
h1
h1
h1
h3
h2
h2
h2
h1
h3
h3
h3
h2
h4
h4
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferences
L3 #66
Strategic Issues
• Suppose that I is an instance of HR
• What if a set S of residents were to falsify their
true preferences in I, in the hope of achieving a
better hospital?
• Example (each hospital has 1 post):
r1:
r2 :
r3 :
r4 :
h1
h1
h1
h3
h2
h2
h2
h1
h3
h3
h3
h2
h4
h4
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferences
• Suppose now that residents 1 and 2 falsify their
preference lists
r1:
r2 :
r3 :
r4 :
h2
h2
h1
h3
h1
h4
h2
h1
h3
h1
h3
h2
h4
h3
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferencesL3
#67
Strategic Issues
• Suppose that I is an instance of HR
• What if a set S of residents were to falsify their
true preferences in I, in the hope of achieving a
better hospital?
• Example (each hospital has 1 post):
r1:
r2 :
r3 :
r4 :
h1
h1
h1
h3
h2
h2
h2
h1
h3
h3
h3
h2
h4
h4
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferences
• Suppose now that residents 1 and 2 falsify their
preference lists
r1:
r2 :
r3 :
r4 :
h2
h2
h1
h3
h4
h4
h2
h1
h1
h1
h3
h2
h3
h3
h4
h4
Resident preferences
h1:
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferencesL3
#68
Strategic Issues
• Suppose that I is an instance of HR
• What if a set S of residents were to falsify their
true preferences in I, in the hope of achieving a
better hospital?
• Example (each hospital has 1 post):
r1 :
r2 :
r3 :
r4 :
h1
h1
h1
h3
h2
h2
h2
h1
h3
h3
h3
h2
h4
h4
h4
h4
Resident preferences
h1 :
h2 :
h3 :
h4 :
r4
r3
r1
r1
r1
r1
r2
r2
r2
r2
r4
r3
r3
r4
r3
r4
Hospital preferences
• Residents r1, r3 and r4 have improved their
assigned hospitals
• But, S={r1 ,r2} was the set of liars
• Is it possible for all members of the set S to
obtain a better hospital?
L3 #69
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
L3 #70
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1 :
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r1 r2 r3 r4
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
L3 #71
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1 :
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r1 r2 r3 r4
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
L3 #72
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1 :
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r1 r2 r3 r4
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
• Now suppose that hospital h1 distorts its true
preferences in the hope of obtaining a better set
of residents
L3 #73
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1 :
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r2 r4 r1 r3
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
• Now suppose that hospital h1 distorts its true
preferences in the hope of obtaining a better set
of residents
L3 #74
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1 :
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r2 r4 r1 r3
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
• Now suppose that hospital h1 distorts its true
preferences in the hope of obtaining a better set
of residents
L3 #75
Strategic Issues
• Let P denote the true preferences in I, and let P’
denote the falsified preferences in I
• Theorem: There is no stable matching in P’
such that every resident in S obtains a better
partner than he obtains in the resident-optimal
stable matching in P
• However the same need not be true of hospitals!
• Example (h1 has 2 posts; h2, h3 have 1 post each)
r1:
r2 :
r3 :
r4 :
h3
h2
h1
h1
h1
h1
h3
h2
h2
h3
h2
h3
Resident preferences
h1: r1 r2 r3 r4
h2: r1 r2 r3 r4
h3: r3 r1 r2 r4
Hospital preferences
• Hospital h1 has gained a better set of residents
• Roth and Sotomayor (1990), “Two-Sided Matching:
A Study in Game-Theoretic Modeling and Analysis”,
Econometric Society Monographs, Cambridge Univ. Press
L3 #76
Summary
• Hospital / Residents problem (HR)
– All hospitals have capacity 1: stable marriage
problem with unacceptable partners
– Resident-oriented GS algorithm for HR
– Hospital-oriented GS algorithm for HR
• Hospitals / Residents problem with Ties (HRT)
– Weakly stable matchings
– Super-stable matchings
• Strategic issues in HR
• Open questions:
– Existence of super-stable matchings
– Structure of super-stable matchings
– Heuristics for finding large weakly stable
matchings
– Strategic issues for HRT
L3 #77