Title: Stable Marriage Problem Introductory talk
1Stable Marriage Problem Introductory talk
- Yosuke KIKUCHI
- Dept Comp. and Info. Eng.
- Tsuyama College of Tech
- OKAYAMA, JAPAN
2Contents
- Original stable marriage problem
- Experimental study
- Scored stable marriage
3My lab. member
4Stable marriage problem
- Gale and Shapley studied the problem in 1962. And
they proposed efficient algorithm to solve it. - There are N-women and N-men. Each parson has a
preference list of opposite sex. Then decide
N-matching between women and men.
5A matching is stable
- A matching is unstable if a man A and a
- woman a, not married to each other ,
- but they mutually prefer each other to
- their partners. These pair A and a is called
- blocking pair.
- A matching is stable if it does not contain
- a blocking pair.
6Blocking pair
Man A
Woman a
Preference list
Mens
Womens
1 2
A b a
B b a
1 2
a B A
b A B
Man B
Woman b
Aa Bb
7Setting of stable marriage problem
- Case N4(Men A,B,C,D, Women a,b,c,d)
Mens preference list
Womens preference list
1 2 3 4
A c b d a
B b a c d
C b d a c
D c a d b
1 2 3 4
a A B D C
b C A D B
c C B D A
d B A C D
8Simple approach
Mens preference list
Womens preference list
1 2 3 4
A c b d a
B b a c d
C b d a c
D c a d b
1 2 3 4
a A B D C
b C A D B
c C B D A
d B A C D
(Aa, Bb, Cc, Dd)
(Ac, Ba, Cb, Dd)
A and b are a blocking pair.
c and D are a blocking pair.
(Ad, Ba, Cb, Dc)
This is a stable matching.
(Ab, Ba, Cc, Dd)
b and C are a blocking pair.
Is this approach valid for any preference list ?
9Simple approach
- Case N3(Men A,B,C, Women a,b,c)
Mens preference list
Womens preference list
1 2 3
A b a c
B c a b
C a b c
1 2 3
a A C B
b C A B
c C B A
This approach does not end. But (Ab, Bc, Ca)
and (Aa, Bc, Cb) are stable matcihg. Thus this
approach can not obtain stable matching for any
lists.
a and C are a blocking pair.
A and b are a blocking pair.
(Ac, Ba, Cb)
(Aa, Bb, Cc)
This is initial matching!
b and C are a blocking pair.
A and a are a blocking pair.
(Ab, Ba, Cc)
(Ac, Bb, Ca)
10Applications of stable matching
- Distribution of students among laboratory
- Distribution interns into hospitals1
-reference- 1 ??????????????(JAPAN INTERNS
MATCHING CONFERENCE(?)) URL) http//www.jrmp.jp/
2008/3/26
11Distribution n interns into m hospitals
nk capacity of k-th hospital n1n2nmn
The number of interns gt the capacities of
hospitals ?fictitious hospital (the worst choice
for inters) (the capacity of fictitious hospital
The number of interns - the capacities of
hospitals)
The number of interns lt the capacities of
hospitals ?fictitious interns (the worst choice
for hospitals) (the number of fictitious
interns The capacities of hospitals - the
number of interns )
12Distribution n interns into m hospitals
Interns I1 I2 . . . In
Hospitals H1 (capacity n1) H2 (capacity
n2) . . . Hm (capacity nm
13Distribution n interns into m hospitals
Interns I1 I2 . . . In
Hospitals H11 (capacity 1) H12 (capacity
1) H1n1 (capacity 1) H21
(capacity 1) H22 (capacity 1) H2n2
(capacity 1)
Same list
Same list
Then we modify this model to original stable
marriage model.
14Incomplete lists
Mens preference list
Womens preference list
1 2 3
A a
B c a b
C c a
1 2 3
a C A
b B A C
c B C
In these reference lists, only (Aa, Bb, Cc) is
matching. But this matching is not stable
matching. It is known that there exists a stable
matching for complete lists.
15Incomplete lists
Mens preference list
Womens preference list
1 2 3
A a ? ?
B c a b
C c a ?
1 2 3
a C A O
b B A C
c B C O
We add new man O and new woman ?. O is the worst
choice for women. ? is the worst choice for men.
16Gale-Shapley algorithm
- This algorithm can find a stable matching.
- The matching is optimal for men(women).
- The algorithm contains following four steps.
- 1. man proposes to his desirable woman one by
one. - 2. woman decides whether accept or reject.
- 3. If a man is refused, then he remove her name
from his preference list. - 4. Repeat the steps above, until every man is
accepted by a woman.
17Pseudo code of Gale-Shapley algorithm
Variables and constants n number of women
number of men k number of couples X suitor
x woman toward whom the suitor makes advances
O (undesirable) imaginary man
K0 all the women are engaged to O while(k lt
n) X(k1)-st man while(X ! O)
xthe best choice remaining on Xs list
if(x prefers X to her current
partner) engage X and x
Xpreceding partner of x
if(X ! O) withdraw x from Xs list
k k1 Output matching
18Gale-Shapley algorithm
O a O b O c O d
D
a
c
c
b
A
B
b
d
C
Mens list
Womens list
1 2 3 4
A c b d a
B b a c d
C b d a c
D c a d b
1 2 3 4
a A B D C
b C A D B
c C B D A
d B A C D
19Gale-Shapley algorithm
- Features The algorithm can find a stable
matching.The matching is optimal solution for
men (women).The matching is independent from
the order of proposals.
20The algorithm can find a stable matching
Man A
Woman
Suppose A is not married to a and if A prefers
a to his partner in the matching obtained.
Then a has rejected As proposal and is married
to someone she prefers to A. Then A and a is
not blocking pair . Thus the matching is stable.
Man
Woman a
21The matching is optimal solution for men (women)
- A man can not marry with a woman who ranks higher
in his list than his partner. - If the women make the advances, then the
matching obtained is optimal for women.
22Man A
Woman a
Man A
Woman a
Man B
Woman b
If one stable matching contains Aa, and another
contains Ab and Ba, then either A prefers b to a
and a prefers A to B or A prefers a to b and a
prefers B to A.
23Man A
Woman a
Man A
Woman a
Man B
Woman b
If one stable matching contains Aa, and another
contains Ab and Ba, then either A prefers b to a
and a prefers A to B or A prefers a to b and a
prefers B to A.
Every other stable matching is better for one of
the spouses and worse for the other.
24- There are two stbale matching. One is the (Aa,
), and another is the (Ab, Ba, ). - Then it is hold that either
- A prefers b to a and a prefers A to B,
- or
- A prefers a to b and a prefers B to A.
25- Proof. We prove the situations of A and a can not
both worsen in the second matching.
We prove that they can not improve for the two
at the same time.
Notation bAa ? A prefers b to a.
AaB ? a prefers A to B.
26AX0, ax0, bx1 , and suppose bAa then x1X0x0.
The matching (Aa, ) is a worse choice for X0,
x1 marries with X1 and X1x1X0 . The matching is
better choice for x1. The matching (Ab, Ba,
) is a worse choice for x1. X1 marries with x2
and x2X1x1.
27We obtain the sequence X0x0 X1x1 X2x2 in the
matching (Aa, ), X0x1 X1x2 X2x3 in the
matching (Ab, Ba, ) where xk1Xkxk and
Xk1xk1Xk for all k ?0. Since the number of
person is finite, there exist integers j and k, j
ltk, such that Xj Xk. Let j be the smallest
integer having this property and for this j, let
k be the smallest integer such that Xj Xk and
kgtj. Then xj xk .
28If j0 since otherwise Xk-1xkXk-1xj would
appear in the matching (Ab, Ba, ) as well as
Xj-1xj, from which Xj-1Xk-1 , contradicting the
fact that j is the smallest integer with XjXk .
Thus Xk-1x0 appears in the matching (Ab, Ba, ).
But x0a. Thus Xk-1B. Given that XkxkXk-1, we
have proved AaB.
29Number of proposals
- Worst case O(n2) times (The maximum number
of rejection is n(n-1)/2. ) - The complexity of the algorithm is O(n2).
- Best case n times (each man is not rejected
. Thus each mans partner is the really best
partner for him. ) - Then we estimate the mean number of proposals.
-
- We will find an upper bound for the mean number
of proposals.
30When the algorithm is end?
O a O b O c O d
D
a
c
c
b
A
B
b
d
C
Mens list
Womens list
1 2 3 4
A c b d a
B b a c d
C b d a c
D c a d b
1 2 3 4
a A B D C
b C A D B
c C B D A
d B A C D
31When the algorithm ends?
- We address the order of proposals
Womans list
1 2 3 4
a A B D C
b C A D B
c C B D A
d C A B D
b
d,b,d,b,c,c,b,d,a,c,d
d
a
d
b
c
c
b
d
1 2 3 4
A d b
B b c
C d
D c b d a
When all women appear in this sequence, we
obtain a stable matching.
A
32coupon collectors problem
- There are n distinct coupons and that each time
one buys a box of detergent one obtains a coupon
at random. How many boxes must be bought, on
average, to obtain all n coupons?
Case n4 A,B,C,D
C B C A C B D D
?we stop to buy boxes, when we obtain 4 kinds of
coupon.
33mean value
qk the probability that at least k boxes are
necessary m number of coupons
that we have. n number of kinds of coupons
Mean number of boxes one must buy to obtain new
coupons when he already have m coupons.
q11,
q2m/n,
q3(m/n)2,
q1q2q3...1(m/n)(m/n)2...
The mean value of boxes one must buy to obtain
all n coupons.
34mean value
where Hn is the sum of the first n terms of the
harmonic series 11/21/3. Hnln
n?1/(2n)-1/(12n2)e where 0 lt e lt 1/(120n4), ?
is Eulers constant.
An upper bound for the mean number E(N) of
proposals to obtain a stable matching by
Gale-Shapley algorithm is nHnnln nO(n).
35mean value
An upper bound for the mean number E(N) of
proposals to obtain a stable matching by
Gale-Shapley algorithm is nHnnln nO(n).
Man can marry with a woman who is ranked ln n in
his list on the average.