Stable Marriage Problem Introductory talk Yosuke KIKUCHI Dept
Stable Marriage Problem Introductory talk Yosuke KIKUCHI Dept Comp. and Info. Eng. Tsuyama College of Tech OKAYAMA, JAPAN
Contents • Original stable marriage problem • Experimental study • Scored stable marriage
My lab. member
Stable 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.
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 {a, b} Man A Preference list Men’s A B Woman a Women’s 1 2 b a a b Aa Bb 1 2 B A A B Man B Woman b
Setting of stable marriage problem • Case N=4(Men {A, B, C, D}, Women {a, b, c, d}) Men’s preference list A B C D 1 c b b c 2 b a d a Women’s preference list 3 d c a d 4 a d c b a b c d 1 A C C B 2 B A 3 D D D C 4 C B A D
Simple approach Men’s preference list A B C D 1 c b b c 2 b a d a Women’s preference list 3 d c a d 4 a d c b a b c d 1 A C C B 2 B A 3 D D D C 4 C B A D (Aa, Ba, (Ac, Bb, Cc, Dd) c. A and Db are a blocking pair. (Ad, Dc) (Ab, Ba, Cb, Cc, Dd) This stable matching. b andis. Ca are a blocking pair. Is this approach valid for any preference list ?
Simple approach • Case N= 3(Men {A, B, C}, Women {a, b, c}) Men’s preference list A B C 1 b c a 2 a a b Women’s preference list 3 c b c a b c 1 A C C 2 C A B 3 B B A This(Ac, approach does not end. a andis. Cbinitial are a blocking pair. A (Aa, Bb, Cb) Cc) This matching! But (Ab, Bc, Ca) and (Aa, Bc, Cb) are stable matcihg. b and Ca are a blocking pair. A (Ac, (Ab, Ba, Ca) Cc) Thus this approach can not obtain stable matching for any lists.
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
Distribution n interns into m hospitals nk: capacity of k-th hospital n 1+n 2+・・・+nm=n The number of interns > 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 < the capacities of hospitals ⇒fictitious interns (the worst choice for hospitals) (the number of fictitious interns = The capacities of hospitals - the number of interns )
Distribution n interns into m hospitals Interns I 1 I 2. . . In Hospitals H 1 (capacity n 1) H 2 (capacity n 2). . . Hm (capacity nm
… Distribution n interns into m hospitals Hospitals Interns H 11 (capacity 1) I 1 Same H 12 (capacity 1) I 2 list. H 1 n 1 (capacity 1) H 21 (capacity 1). Same H 22 (capacity 1). list In H 2 n (capacity 1) … 2 … Then we modify this model to original stable marriage model.
Incomplete lists Men’s preference list A B C 1 a c c Women’s preference list 2 3 a b a a b c 1 C B B 2 A A C 3 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.
Incomplete lists Men’s preference list A B C 1 a c c 2 ω a a Women’s preference list 3 ω b ω a b c 1 C B B 2 A A C 3 Ω C Ω We add new man Ω and new woman ω. Ω is the worst choice for women. ω is the worst choice for men.
Gale-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.
Pseudo 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 Ω: (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(x prefers X to her current partner){ engage X and x; X=preceding partner of x; } if(X != Ω) withdraw x from X’s list; } k = k+1; } Output matching ;
Gale-Shapley algorithm Ωa Ωb Ω c Ωd Ad c B ab Dc Cb Men’s list A B C D 1 c b b c 2 b a d a Women’s list 3 d c a d 4 a d c b a b c d 1 A C C B 2 B A 3 D D D C 4 C B A D
Gale-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.
The algorithm can find a stable matching Man A Man Woman a Suppose A is not married to a and if A prefers a to his partner in the matching obtained. Then a has rejected A’s proposal and is married to someone she prefers to A. Then A and a is not blocking pair. Thus the matching is stable.
The 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.
Man A Woman a Man A Man B Woman a 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.
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.
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.
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: b. Aa ⇒ A prefers b to a. Aa. B ⇒ a prefers A to B.
A=X 0, a=x 0, b=x 1 , and suppose b. Aa then x 1 X 0 x 0. The matching (Aa, …) is a worse choice for X 0, x 1 marries with X 1 and X 1 x 1 X 0. The matching is better choice for x 1. The matching (Ab, Ba, …) is a worse choice for x 1. X 1 marries with x 2 and x 2 X 1 x 1.
We obtain the sequence X 0 x 0 X 1 x 1 X 2 x 2 … in the matching (Aa, …), X 0 x 1 X 1 x 2 X 2 x 3 … in the matching (Ab, Ba, …) where xk+1 Xkxk and Xk+1 xk+1 Xk for all k ≧ 0. Since the number of person is finite, there exist integers j and k, j <k, 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 k>j. Then xj= xk.
If j=0 since otherwise Xk-1 xk=Xk-1 xj would appear in the matching (Ab, Ba, …) as well as Xj-1 xj, from which Xj-1=Xk-1 , contradicting the fact that j is the smallest integer with Xj=Xk. Thus Xk-1 x 0 appears in the matching (Ab, Ba, …). But x 0=a. Thus Xk-1=B. Given that Xkxk. Xk-1, we have proved Aa. B.
Number of proposals Worst case O(n 2) times (The maximum number of rejection is n(n-1)/2. ) The complexity of the algorithm is O(n 2). 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.
When the algorithm is end? Ωa Ωb Ω c Ωd Ad c B ab Dc Cb Men’s list A B C D 1 c b b c 2 b a d a Women’s list 3 d c a d 4 a d c b a b c d 1 A C C B 2 B A 3 D D D C 4 C B A D
When the algorithm ends? We address the order of proposals Woman’s list 1 2 3 4 d, b, c, c, b, d, a, c, d d b db cc b d a A B C D 1 2 3 4 When d b all women appear in this sequence, we obtain b c a stable matching. d c b d a a b c d A C C C B A D D D B C B A 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? Case n=4 {A, B, C, D} C B C A C B D D →we stop to buy boxes, when we obtain 4 kinds of coupon.
mean value qk : the probability that at least k boxes are necessary Mean number of boxes m: number of coupons that we have. one must buy to obtain n : number of kinds of coupons q 1=1, q 2=m/n, q 3=(m/n)2, … new coupons when he already have m coupons. q 1+q 2+q 3+. . . =1+(m/n)2+. . . The mean value of boxes one must buy to obtain all n coupons.
mean value where Hn is the sum of the first n terms of the harmonic series 1+1/2+1/3+・・・. Hn=ln n+γ+1/(2 n)-1/(12 n 2)+ε where 0 < ε < 1/(120 n 4), γ 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 n. Hn=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 n. Hn=nln n+O(n). Man can marry with a woman who is ranked ln n in his list on the average.
- Slides: 35