stable marriage problem introductory talk 2 yosuke kikuchi dept comp. and info. eng. tsuyama...
TRANSCRIPT
Stable Marriage Problem Introductory talk 2
Yosuke KIKUCHIDept Comp. and Info. Eng.Tsuyama College of Tech
OKAYAMA, JAPAN
Contents
• Original stable marriage problem (conntinued)• Experimental study• Scored stable marriage
Review of previous talk
• Introduction of background • Original stable marriage problem
– Setting– Definition of stable– application– Gale-Shapley algorithm– Features of the algorithm– Proof of correctness of the algorithm– Number of proposals (worst case and mean value)
My lab. member
Stable marriage problem
• There are N -women and N-men. Each parson has a preference list of opposite sex. Then decide N-matching between women and men.
A 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.
Blocking pair
• Men {A,B}, Women {α,β}
Preference list
Men’s Women’s
A α Bβ
Man A
Man B
Woman α
Woman β
1 2A β αB β α
1 2
α B Aβ A B
Blocking pair
• Men {A,B}, Women {α,β}
Preference list
Men’s Women’s
A α Bβ
Man A
Man B
Woman α
Woman β
1 2A β αB β α
1 2
α B Aβ B A
It is not a blocking pair.
Blocking pair
• Men {A,B}, Women {α,β}
Preference list
Men’s Women’s
A α Bβ
Man A
Man B
Woman α
Woman β
1 2A β αB β α
1 2
α B Aβ A B
Example of stable and unstable
1 2 3 4
A γ β δ α
B β α γ δ
C β δ α γ
D γ α δ β
1 2 3 4α A B D Cβ C A D Bγ C B D Aδ B A C D
Men’s preference list Women’s preference list
(Aα, Bβ, Cγ, Dδ)
A and β are a blocking pair.
(Aδ, Bα, Cβ, Dγ)
This is a stable matching.
Applications of stable matching
• Distribution of students among laboratory• Distribution interns into hospitals[1]
- reference -[1] 医師臨床研修マッチング協議会 (JAPAN INTERNS MATCHING CONFERENCE(?))
URL) http://www.jrmp.jp/ 2008/3/26
Gale-Shapley algorithm
• 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.
Pseudo code of Gale-Shapley algorithm Variables and constants n: number of women = number of men k: number of couples X: suitor χ: woman toward whom the suitor makes advances Ω: (undesirable) imaginary man
k=0; all the women are engaged to Ω; while(k < n){ X=(k+1)-st man; while(X != Ω){ x=the best choice remaining on X’s list; if(χ prefers X to her current partner){ engage X and χ; X=preceding partner of χ;} if(X != Ω) withdraw χ from X’s list; } k = k+1;}Output matching ;
γ β
Gale-Shapley algorithm
Men’s list Women’s list
A B C βα D γδ
1 2 3 4
A γ β δ α
B β α γ δ
C β δ α γ
D γ α δ β
1 2 3 4
α A B D C
β C A D B
γ C B D A
δ B A C D
Ω α Ω β Ω γ Ω δ
Gale-Shapley algorithm
• Features ・ The algorithm always finds a stable matching.・ The matching is optimal solution for men (women).・ The matching is independent from the order of proposals.
Number 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 man’s 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.
γ β
When the algorithm is end?
Men’s list Women’s list
A B C βα D γδ
1 2 3 4
A γ β δ α
B β α γ δ
C β δ α γ
D γ α δ β
1 2 3 4
α A B D C
β C A D B
γ C B D A
δ B A C D
Ωα Ωβ Ωγ Ωδ
We address the order of proposals
When the algorithm ends?
Woman’s list
1 2 3 4
α A B D C
β C A D B
γ C B D A
δ C A B D
When all women appear in this sequence, we obtain a stable matching.
δ, β, δ, β, γ, γ, β, δ, α, γ, δδ αβδ βγ β δ
1 2 3 4
A δ β
B β γ
C δ
D γ β δ α
γ
coupon collector’s 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?
C B C A C B D D
Case n=4 { A,B,C,D }
→we stop to buy boxes, when we obtain 4 kinds of coupon.
Capsuled toy vending machine
mean value qk : the probability that at least k boxes are necessary m: number of coupons that we have. n : number of kinds of coupons
)/13/12/11(
)}1(/{)2/()1/()0/(
nn
nnnnnnnnn
Mean number of boxesone must buy to obtain new coupons when he already have m coupons.
The mean value of boxes one must buy to obtain all n coupons.
q1=1, q2=m/n, q3=(m/n)2,…
q1+q2+q3+...=1+(m/n)+(m/n)2+...
mean value
nnH
nn
nnnnnnnnn
)/13/12/11(
)}1(/{)2/()1/()0/(
where Hn is the sum of the first n terms of the harmonic series 1+1/2+1/3+ ・・・ . Hn=ln n+γ+1/(2n)-1/(12n2)+ε where 0 < ε < 1/(120n4), γ is Euler’s constant.An upper bound for the mean number E(N) of proposals to obtain a stable matching by Gale-Shapley algorithm is nHn=nln n+O(n).
mean value
An upper bound for the mean number E(N) of proposals to obtain a stable matching by Gale-Shapley algorithm is nHn=nln n+O(n).
Man can marry with a woman who is ranked ln n in his list on the average.
Experimental study ( 1/2 )
• Implementing the Gale-Shapley algorithmwindow.exe
Experimental study ( 2/2 )
• Measurement of the mean of solution of the Gale-Shapley algorithm・ Pentium D:2.66GHz ・ Memory: 1 Gbyte ・ OS:Windows XPRandom number generator : Random Streamer RPG102
1000times measurements for n=5,50,75,100– result
n Measured value
log n 100(Measured value - log n)/log n
5 1.7812 1.6094 10.675
50 4.21056 3.91202 7.631
75 4.605440 4.317488 6.669
100 5.007670 4.605170 8.740
Structure of stable matchings
All stable matchings : (A α, B β, C γ, D δ), (A α, B β, C δ, C γ), (A β, B α, C γ, D δ), (A β, B α, C δ, C γ), (A β, B δ, C α, D γ),(A γ, B α, C δ, D β), (A γ, B δ, C α, D β)
1 2 3 4α C D B Aβ D C A Bγ A B D Cδ B A C D
1 2 3 4A α β γ δB β α δ γC γ δ α βD δ γ β α
Men’s list Women’s list
Structure of stable matchings
1 2 3 4α C D B Aβ D C A Bγ A B D Cδ B A C D
1 2 3 4A α β γ δB β α δ γC γ δ α βD δ γ β α
Men’s list Women’s list
All stable matchings : (α, β, γ, δ), (α, β, δ, γ), (β, α, γ, δ), (β, α, δ, γ), (β, δ, α, γ), (γ, α, δ, β), (γ, δ, α, β)
All stable matchings : (A α, B β, C γ, D δ), (A α, B β, C δ, C γ), (A β, B α, C γ, D δ), (A β, B α, C δ, C γ), (A β, B δ, C α, D γ),(A γ, B α, C δ, D β), (A γ, B δ, C α, D β)
Structure of stable matchings
1 2 3 4α C D B Aβ D C A Bγ A B D Cδ B A C D
1 2 3 4A α β γ δB β α δ γC γ δ α βD δ γ β α
Men’s list Women’s list
All stable matchings : (α, β, γ, δ), (α, β, δ, γ), (β, α, γ, δ), (β, α, δ, γ), (β, δ, α, γ), (γ, α, δ, β), (γ, δ, α, β)
1 1 1 1(α, β, γ, δ)
1 1 2 2(α, β, δ, γ)
2 2 1 1(β, α, γ, δ)
2 2 2 2(β, α, δ, γ)
2 3 3 2(β, δ, α, γ)
3 2 2 3(γ, α, δ, β)
3 3 3 3(γ, δ, α, β)
Structure of stable matchings 1 1 1 1(α, β, γ, δ)
1 1 2 2(α, β, δ, γ)
2 2 1 1(β, α, γ, δ)
2 2 2 2(β, α, δ, γ)
2 3 3 2(β, δ, α, γ)
3 2 2 3(γ, α, δ, β)
3 3 3 3(γ, δ, α, β)
• Distributive lattice
Scored stable marriage problem Men’s preference list Woman’s preference list
Aγ : 40 + 5 = 45
How to calculate score
Aδ,Bα,Cβ,Dγ :65 + 40 + 90 + 45 = 240
1 2 3 4A γ
40β30
δ20
α10
B β85
α10
γ5
δ0
C β50
δ45
α5
γ0
D γ40
α30
δ20
β10
1 2 3 4α A
40B30
D20
C10
β C40
A30
D20
B10
γ C60
B30
D5
A5
δ B50
A45
C5
D0
How to calculate score of matching
1 2 3 4
α A40
B30
D20
C10
β C40
A30
D20
B10
γ C60
B30
D5
A5
δ B50
A45
C5
D0
1 2 3 4
A γ40
β30
δ20
α10
B β85
α10
γ5
δ0
C β50
δ45
α5
γ0
D γ40
α30
δ20
β10
Find optimal matchingMen’s preference list
Woman’s preference list
α β γ δ
A 50 60 45 65
B 40 95 35 50
C 15 90 60 50
D 50 30 45 20
30 + 20
Assignment problem using Hungarian method
Assignment problem using Hungarian method
Maximum score
What is Hungarian method ?• This method can find n matching such that
total amount is minimum in n×n matrix.
α β γ δ
A 50 60 45 65
B 40 95 35 50
C 15 90 60 50
D 50 30 45 20
α β γ δ
A 150
140
155
135
B 160
105
165
150
C 185
110
140
150
D 150
170
155
180
Maximum score 200-score in matrix
Maximum score 200-score in matrix
α β γ δ
A 150
140
155
135
B 160
105
165
150
C 185
110
140
150
D 150
170
155
180
Finding optimal matching
The matching that be found by Hungarian method
α β γ δ
A 50 60 45 65
B 40 95 35 50
C 15 90 60 50
D 50 30 45 20
Aδ Bβ Cγ Dα
65 + 95 + 60 + 50 = 270
Case: score is inclined.Men’s preference list Woman’s preference list
1 2 3 4A α
100β0
δ0
γ0
B α100
β0
γ0
δ0
C α100
δ0
β0
c0
D α100
γ0
δ0
β0
1 2 3 4α A
100B0
D0
C0
β A100
C0
D0
B0
γ A100
B0
D0
C0
δ A100
B0
C0
D0
α β γ δ
A 200 100 100 100
B 100 0 0 0
C 100 0 0 0
D 100 0 0 0
More than one solution by using Hungarian methodAα,Bδ,Cβ,Dγ : 200Aβ,Bα,Cδ,Dγ : 200Aγ,Bδ,Cα,Dβ : 200 ・ ・ ・
Use Gale-Shapley algorithm
Aα,Bβ,Cδ,Dγ : 200
Scored stable marriage problemApply Hungarian method
Apply Gale-Shapley algorithmfind stable matching
compare the score of Gale-Shapley and the core of Hungarian method.
If the score of Gale-Shapley = the core of Hungarian method, then we choose the score of Gale-Shapley
C言語プログラムの実行結果
Further work
• If the preference list is incomplete and includes tie, finding the maximum stable matching is NP-hard [ Halldorsson et al, 2003].
• 1.875-approximation algorithm is developed by Iwama et al, 2007.
Can we improve the approximation ratio?It is known that lower bound 1.105 unless P=NP .
Further work
• Stable roommates problem This problem does not have solution for any preference list. This problem is a generalization of stable marriage problem.
Further work
• Stable roommates problem 1 2 3
A B D C
B D A C
C A B D
D A B C
Further work • Stable roommates problem 1 2 3
A B D CB D A CC A B DD A B C
AB, CDAC, BDAD, BC
B and D are a blocking pair.A and D are a blocking pair.A and B are a blocking pair.This is no solution for this list.
Gap between original and scored
• When the solution of Gale-Shapley algorithm and the solution of Hungarian method?
Men’s preference list Woman’s preference listδ
1 2 3 4A γ
90β5
δ4
α1
B β40
α30
γ20
δ10
C β51
δ49
α1
γ0
D γ40
α39
δ20
β1
1 2 3 4α A B D C
β C A D B
γ C B D A
δ B A C D
Gap between original and scoredMen’s preference list Woman’s preference list
1 2 3 4A γ
90β5
δ4
α1
B β40
α30
γ20
δ10
C β51
δ49
α1
γ0
D γ40
α39
δ20
β1
1 2 3 4α A B D C
β C A D B
γ C B D A
δ B A C D
Stable matching is (Aδ, Bα, Cβ Dγ) and the score is 4+30+51+40=125
The maximum score is 218 and the matching is (Aγ, Bβ , Cδ, Dα), (90+40+49+39).But this matching is unstable, because C and β is a blocking pair.
Which is better for men ?
Further reading
Please consult Google.
•Edward G. Thurber, Concerning the maximum number of stable matchings in the stable marriage problem, Discrete Mathematics 248 (2002) 195–219.•Jan Eeckhout, On the uniqueness of stable marriage matchings, Economics Letters 69 (2000) 1–8
About the women sequence
Suppose a sequence S=α1 α2 α3 ... αn is obtained by Gale-Shapley algorithm.The partial sequence of S, Each alphabet αk is containd at most min the partial sequence A of S, A=α1 α2 α3 ... αm(m+1)/2 where m is a positive integer.
mean 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 boxesone must buy to obtain new coupons when he already have m coupons.
q1=1, q2=m/n, q3=(m/n)2,… q1+q2+q3+ ・・・ +qm+1=1+(m/n)+(m/n)2+ ・・・ +(m/n)m
Can we obtain more strict upper bound of the number of proposals?