pres

advertisement
Stable Matchings
a.k.a. the Stable Marriage Problem
Samia Qader
252a-az
CSC 254
The Stable Marriage Problem
Overview
• Real - life application
• The stable marriage problem
• Theorems
• Termination
• Correctness of algorithm
• Open problems
Real-life application
• Residency: after medical school
• “The Match” was developed to assign prospective
students to residency programs
• The students submit a rank-order list (ROL) to the
National Residency Match Program (NRMP)
• Hospitals rank-order their students
• NRMP finds a match.
Simple Problem
• We’ve got n boys and n girls.
• Each boy submits an ROL of all n girls and the girls
do the same
• A matching is unstable if a boy A and a girl a, not
married to each other, mutually prefer each other to
their spouses.
• A marriage is a bijection between the boys and girls
Example 1: 4 boys (A,B,C,D) married to 4 girls
(a,b,c,d)
• Men
A
B
C
D
• Women
a
b
c
d
Preference
c b d a
b a c d
c a d b
c a d b
Matching (Aa, Bb, Cc, Dd) Is it stable?
Look at Aa and Bb:
A(4) + a(1) = 5
B(1) + b(4) = 5
total
= 10
Preference
A B D C
C A D B
C B D A
B A C D
Ex 1: 4 boys (A,B,C,D) married to 4 girls (a,b,c,d)
• Men
A
B
C
D
Preference
c b d a
b a c d
c a d b
c a d b
Check Ab and Ba:
• Women
a
b
c
d
A(2) + a(2) = 4
B(2) + b(2) = 4
total
=8
Preference
A B D C
C A D B
C B D A
B A C D
Marriage Algorithm – in words
• The boys are all single and free to propose
Marriage Algorithm – in words
• The girls
are all
engaged
temporarily
to  (the
ugly man)
Ugly man
Marriage Algorithm – in words
• The boys propose to the best girl on their list (who
hasn’t rejected them yet). The girls accept tentatively.
• If the girl gets a better offer from a boy that she
prefers to her fiancé, she will break off the
engagement.
• STOP when all the boys are engaged
ROL
Results
3 happy couples:
ROL
Brown man wants blonde girl – But she doesn’t want
him
ROL
Scratch off blonde from brown’s list
New Results
3 different couples:
More detail….
while (k<n) do
begin X = (k+1)st man;
while (X ! = ) do {
x= best remaining choice on X’s list
if (x prefers X to her fiancé)
{
engage X and x
X = former fiancé of
} // end if
}// end while
if (X != )
withdraw x from X’s list
end
k = k+1;
} // end while
n= no.of men &
women
k = no. of
couples formed
X = man suitor
x = woman
 = ugly man
Some Theorems
• The order in which the boys propose
does not matter
• The final matching is stable
• The boys get to marry the best girl the
could possibly get in a stable marriage
Termination: the algorithm has to
end
• In what situation would the algorithm run forever - if a
boy B keeps getting rejected by all girls
• This can never happen:
a boy in only rejected by all girls if all the girls are
engaged to someone better
Impossible - since there are n girls and n-1 boys that
are better than B
Correctness of the Algorithm
• Is the final marriage stable?
• Proof by contradiction:
• There exists some pair (b,g) that mutually
prefer each other to whomever they are
matched to.
• Since b proposed in the order of his ROL, he
must have proposed to g already
Correctness continued...
• But if g is not engaged to b, she must have rejected
him
• g would only reject b if she is already engaged to
someone she prefers
• Therefore, g’s fiancé must be ranked more highly
than b
• CONTRADICTION
Boy Optimality
• The marriage returned by this algorithm
assigns every boy to his favorite stable
partner.
• Consider matching each girl to her least
favorite choice. The matching produced is
stable and is the same as the matching
returned by the algorithm described.
Residency Problem
• Who gets to play the boy?
• Answer : the hospitals
Bipartite matching
• In a complete
bipartite graph, each
node would have an
ROL of the nodes
that it prefers.
1
1
a
2
2
b
3
3
c
4
4
d
Open Problems…
• Maximum number of stable matches grows
exponentially with n. What is the instance of size n
with the largest possible number of stable
matchings?
• Sex-equal matching: where the sum of the male
scores is equal to the sum of the female scores.
• Is it possible to test the stability of every matching in
a set of matchings faster (significantly) than by
checking each of the matchings from scratch?
References
•
•
•
•
•
Asratian A.S, Denley T.M.J, Bipartite Graphs and their Applications,
Cambridge University Press, N.Y. (1998).
Gusfield, D., Irving R.W., The Stable Marriage Problem :Structure and
Algorithms, The MIT Press, Cambridge (1989).
Knuth D.E., Stable Marriage and its Relation to Other Combinatorial
Problems, American Mathematical Society, Providence (1997).
Littman M.L., http://www.cs.duke.edu/education/courses/cps130/fall98
lectures/lect13/lect13.html, (1998).
Lovasz L., Plummer M.D., Matching Theory, North-Holland, NorthHolland (1986).
Download