stable marriage - computer scienceresearch.cs.rutgers.edu/~troyjlee/marriage.pdfsuppose that alice...

Post on 25-Mar-2018

221 Views

Category:

Documents

7 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Stable MarriageThe mathematics of 1950’s dating

Dating ScenarioA romantic candlelit dinner...

Dating ScenarioA romantic candlelit dinner... with n boys and n girls.

Dating ScenarioA romantic candlelit dinner... with n boys and n girls.

Boys want to pair with girls, and vice versa.

Dating ScenarioA romantic candlelit dinner... with n boys and n girls.

Boys want to pair with girls, and vice versa.

(This assumption will be crucial)

Dating ScenarioA romantic candlelit dinner... with n boys and n girls.

Boys want to pair with girls, and vice versa.

Each boy makes a (mental) ranking of all the girls.

(This assumption will be crucial)

Dating ScenarioA romantic candlelit dinner... with n boys and n girls.

Boys want to pair with girls, and vice versa.

Each boy makes a (mental) ranking of all the girls.

(This assumption will be crucial)

Each girl makes a ranking of all the boys.

1,3,2

2,1,3

1,2,3

2,1,3

2,3,1

3,2,1

1

2

3

1

2

3

Boys Girls

Happily ever after...What matching metric should be used to maximize the happiness of the couples?

Happily ever after...What matching metric should be used to maximize the happiness of the couples?

On this we remain agnostic...

Happily ever after...What matching metric should be used to maximize the happiness of the couples?

On this we remain agnostic...

However, there is one situation which will clearly cause trouble...

Rogue CouplesSuppose that Alice prefers Bob to her current husband,and Bob prefers Alice to his current wife.

Rogue CouplesSuppose that Alice prefers Bob to her current husband,and Bob prefers Alice to his current wife.

Rogue CouplesSuppose that Alice prefers Bob to her current husband,and Bob prefers Alice to his current wife.

Call Alice and Bob a rogue couple.

Rogue CouplesSuppose that Alice prefers Bob to her current husband,and Bob prefers Alice to his current wife.

Call Alice and Bob a rogue couple.

Can we match everyone without any rogue couples?

Stable PairingA pairing is called stable if it contains no rogue couples.

1,3,2

2,1,3

1,2,3

2,1,3

2,3,1

3,2,1

1

2

3

1

2

3

Stable PairingA pairing is called stable if it contains no rogue couples.

3,2,1

1,2,3

3,2,1

3,2,1

2,1,3

3,1,2

1

2

3

1

2

3

Troubling Questions

• Does a stable pairing exist no matter what the rankings of the parties?

• Even it exists, can it be efficiently found?

• Are we doomed to inhabit a world with rogue couples?

Bisexual dating

1 2

2

4

2,3,4 3,1,4

3

1,2,4 *,*,*

Bisexual dating

1 2

4

2,3,4 3,1,4

3

1,2,4 *,*,*

Bisexual dating

1 2

4

2,3,4 3,1,4

3

1,2,4 *,*,*

Bisexual dating

1 2

4

2,3,4 3,1,4

3

1,2,4 *,*,*

Bisexual dating

1 2

4

2,3,4 3,1,4

3

1,2,4 *,*,*

No stable pairing!

InsightAny proof a stable pairing always exists will have to use the difference between boys and girls.

If our proof does not break down in the bisexual case, it will not work.

“Traditional” Marriage Algorithm

“Traditional” Marriage Algorithm

For every day that some boy is rejected:

Morning: Every girl stands on her balcony

Every boy proposes under the balcony of the top girl remaining on his list.

“Traditional” Marriage Algorithm

Afternoon: Girls to today’s best suitor “Maybe come back tomorrow.”

To any others “I will never marry you.”

For every day that some boy is rejected:

Say has boy “on a string.”

“Traditional” Marriage Algorithm

Afternoon: Girls to today’s best suitor “Maybe come back tomorrow.”

To any others “I will never marry you.”

For every day that some boy is rejected:

Say has boy “on a string.”

“Traditional” Marriage Algorithm

Afternoon: Girls to today’s best suitor “Maybe come back tomorrow.”

To any others “I will never marry you.”

For every day that some boy is rejected:

Say has boy “on a string.”

“Traditional” Marriage Algorithm

Afternoon: Girls to today’s best suitor “Maybe come back tomorrow.”

To any others “I will never marry you.”

For every day that some boy is rejected:

Say has boy “on a string.”

“Traditional” Marriage Algorithm

Evening: Rejected boys cross girl off their list.

For every day that some boy is rejected:

If no boy was rejected, each girl marries boy on her string.

“Traditional” Marriage Algorithm

Does this algorithm always produce a stable pairing?

“Traditional” Marriage Algorithm

Does this algorithm always produce a stable pairing?

Would it work for the bisexual variation?

“Traditional” Marriage Algorithm

Does this algorithm always produce a stable pairing?

Would it work for the bisexual variation?

Wait! Even more basic question...Will it always terminate?

“Traditional” Marriage Algorithm

Does this algorithm always produce a stable pairing?

Would it work for the bisexual variation?

Wait! Even more basic question...Will it always terminate?

What can go wrong? Might run for infinite number of days...Might encounter a situation where next move is not specified.

Try It!

Improvement LemmaIf a girl gets a boy b “on a string,” then in all laterdays she will have a boy at least as preferable as bon a string (or for a husband).

Improvement LemmaIf a girl gets a boy b “on a string,” then in all laterdays she will have a boy at least as preferable as bon a string (or for a husband).

If girl does not ever reject b, he will stay on her string.

Improvement LemmaIf a girl gets a boy b “on a string,” then in all laterdays she will have a boy at least as preferable as bon a string (or for a husband).

If girl does not ever reject b, he will stay on her string.

A girl will only reject b if a preferable boy b* proposes.

Improvement LemmaIf a girl gets a boy b “on a string,” then in all laterdays she will have a boy at least as preferable as bon a string (or for a husband).

If girl does not ever reject b, he will stay on her string.

A girl will only reject b if a preferable boy b* proposes.

A girl will only reject b* if a preferable boy b** proposes.

Improvement LemmaIf a girl gets a boy b “on a string,” then in all laterdays she will have a boy at least as preferable as bon a string (or for a husband).

If girl does not ever reject b, he will stay on her string.

A girl will only reject b if a preferable boy b* proposes.

A girl will only reject b* if a preferable boy b** proposes.

And so on...Formally, can show lemma by induction.

Improvement lemmaA corollary of the improvement lemma:

Each girl marries her absolute favorite of the boys who visit her during the algorithm.

What about the boys?

What about the boys?Lemma: No boy is rejected by all the girls.

What about the boys?Lemma: No boy is rejected by all the girls.

Proof by contradiction: Suppose b is rejected by all the girls.

What about the boys?Lemma: No boy is rejected by all the girls.

Proof by contradiction: Suppose b is rejected by all the girls.

At that point each girl will have a suitor. This follows from the improvement lemma: any boyis preferable to no boy.

What about the boys?Lemma: No boy is rejected by all the girls.

Proof by contradiction: Suppose b is rejected by all the girls.

At that point each girl will have a suitor. This follows from the improvement lemma: any boyis preferable to no boy.

As there are n girls, this gives n boys with b not among them. Contradiction!

TMA will terminateAnd it will take at most n2 days!

TMA will terminateAnd it will take at most n2 days!

Consider the master list of all boys preferences.

TMA will terminateAnd it will take at most n2 days!

Consider the master list of all boys preferences.

This has n2 entries.

TMA will terminateAnd it will take at most n2 days!

Consider the master list of all boys preferences.

This has n2 entries.

If no boy is rejected, algorithm terminates. Otherwise,some boy is rejected and number of entries goes down.

TMA will terminateAnd it will take at most n2 days!

Consider the master list of all boys preferences.

This has n2 entries.

If no boy is rejected, algorithm terminates. Otherwise,some boy is rejected and number of entries goes down.

Note that once boy has just one girl on his list, she musteventually marry him.

Recap

• We are now a long way towards our goal.

• We know that algorithm will halt and produce a pairing.

• We even know the running time of the algorithm!

• Now, will it produce a stable pairing?

The pairing is stable

g g*b

If boy b prefers g* to g, then he proposed to her first, and was at some point rejected.

b*

Thus g* prefers b* to b, and (b,g*) is not a rogue couple.

The pairing is stableg*, you are my true love

g g*b

If boy b prefers g* to g, then he proposed to her first, and was at some point rejected.

b*

Thus g* prefers b* to b, and (b,g*) is not a rogue couple.

The pairing is stable

g g*b

If boy b prefers g* to g, then he proposed to her first, and was at some point rejected.

b*

Thus g* prefers b* to b, and (b,g*) is not a rogue couple.

The pairing is stableI already rejected you!

g g*b

If boy b prefers g* to g, then he proposed to her first, and was at some point rejected.

b*

Thus g* prefers b* to b, and (b,g*) is not a rogue couple.

Opinion PollWho is better off in traditional dating?

Opinion PollWho is better off in traditional dating?

The boys?

Opinion PollWho is better off in traditional dating?

The boys? The girls?

My best girlForget about TMA for a minute...

How can we define “the optimal girl” for a boy b?

My best girlForget about TMA for a minute...

How can we define “the optimal girl” for a boy b?

First attempt: b’s favorite girl.

My best girlForget about TMA for a minute...

How can we define “the optimal girl” for a boy b?

First attempt: b’s favorite girl.

This is unrealistic...in general b cannot hope to get his favorite girl in a stable world.

The optimal girlLook at all possible stable pairings. Call a girl optimalfor a boy if she is the highest ranked girl he is paired with in some stable pairing.

The optimal girlLook at all possible stable pairings. Call a girl optimalfor a boy if she is the highest ranked girl he is paired with in some stable pairing.

This is the best girl he can hope to get in a stable world.

The optimal girlLook at all possible stable pairings. Call a girl optimalfor a boy if she is the highest ranked girl he is paired with in some stable pairing.

This is the best girl he can hope to get in a stable world.

Similarly, call the lowest ranked girl a boy can get in a stable pairing his pessimal girl.

Dating ups and downs

Call a pairing male-optimal if all males simultaneously are paired with their optimal girl.

The best stable world for all males.

Call a pairing male-pessimal if all males simultaneously are paired with their pessimal girl.

Dating ups and downs

Call a pairing female-optimal if all females simultaneously are paired with their optimal boy.

The best stable world for all females.

Call a pairing female-pessimal if all females simultaneously are paired with their pessimal boy.

The Mathematical Truth

The traditional marriage algorithm always produces a male-optimal female-pessimal pairing.

Male OptimalProof by contradiction: Suppose the pairing produced isnot male optimal. Let t be the earliest a boy b is rejected by his optimal girl g.

Male OptimalProof by contradiction: Suppose the pairing produced isnot male optimal. Let t be the earliest a boy b is rejected by his optimal girl g.

At time t girl g rejects b for a preferable boy b*. By definition of t, boy b* has not been rejected by his optimal girl.

Male OptimalProof by contradiction: Suppose the pairing produced isnot male optimal. Let t be the earliest a boy b is rejected by his optimal girl g.

At time t girl g rejects b for a preferable boy b*. By definition of t, boy b* has not been rejected by his optimal girl.

Thus b* likes g at least as much as his optimal girl.

Male OptimalBy assumption that g is optimal for b, there is a stable pairing matching them together.

b g

b* g*...

...

But g prefers b* to b, and b* prefers g to g*.

b* and g form a rogue couple! Contradiction.

Female-Pessimal

Female-PessimalUnfortunately, male-optimal implies female pessimal!

Female-PessimalUnfortunately, male-optimal implies female pessimal!

Again we prove by contradiction.

Female-PessimalUnfortunately, male-optimal implies female pessimal!

Suppose in a male-optimal pairing boy b is with girl g, yet there is some stable pairing S in which g is with less preferable b*.

Again we prove by contradiction.

Female-PessimalUnfortunately, male-optimal implies female pessimal!

Suppose in a male-optimal pairing boy b is with girl g, yet there is some stable pairing S in which g is with less preferable b*.

Again we prove by contradiction.

b g

b* g*S

Female-PessimalUnfortunately, male-optimal implies female pessimal!

Suppose in a male-optimal pairing boy b is with girl g, yet there is some stable pairing S in which g is with less preferable b*.

Again we prove by contradiction.

b g

b* g*S

But then b prefers g to g* (she is his optimal girl) andg prefers b to b*. Contradiction to stability of S.

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

?

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

?

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

?

?

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

? ?

?

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

? ?

No! By the National Residency Matching Program.

?

The MatchTMA is the algorithm used by one of the largest most successful dating services in the world.

? ?

No! By the National Residency Matching Program.

This service pairs graduating medical students with hospitals.

The Match

• Since 1952 residency matches have been made by a centralized service.

• Medical students rank hospitals.

• Hospitals rank graduating students

• They run the TMA (polygamous version).

• Until recently, pairings were hospital optimal.

History and BeyondThis algorithm was developed by Gale and Shapley back in 1962 in a paper “College Admissions and the stability of marriage.”

Math has much more to say about marriage!You can also check out the Marriage theorem,a.k.a Hall’s theorem.

top related