Docsity

Stable Matching Algorithm: An Example with Preference Lists, Slides of Introduction to Computers

Toggle sidebar
bg1
COMS21103: Stable Matching
Raphaël Clifford
Bristol University,Department of Computer Science
Bristol BS8 1UB,UK
November 5, 2009
RaphaëlClifford
COMS21103:Stable Matching Slide1
Stable Matching
RaphaëlClifford
COMS21103:Stable Matching Slide2
The problem
Imagine a set of students applying for Summer internships.
IEach student lists employers in order of preference.
IEach employer lists students in order of preference.
IEmployers extendoffers to students.
IStudents accept or decline.
Can we assign applicants to employers so that forevery employer E, and
every applicant A who is not scheduled to work for E, at least one of the
following is true.
IE prefers every one of its accepted applicants to A or
IA prefers her current situation over working foremployer E
If these hold we have a stable matching.
RaphaëlClifford
COMS21103:Stable Matching Slide3
The problem
Imagine a set of students applying for Summer internships.
IEach student lists employers in order of preference.
IEach employer lists students in order of preference.
IEmployers extendoffers to students.
IStudents accept or decline.
Can we assign applicants to employers so that forevery employer E, and
every applicant A who is not scheduled to work for E, at least one of the
following is true.
IE prefers every one of its accepted applicants to A or
IA prefers her current situation over working foremployer E
If these hold we have a stable matching.
RaphaëlClifford
COMS21103:Stable Matching Slide3
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Stable Matching Algorithm: An Example with Preference Lists and more Slides Introduction to Computers in PDF only on Docsity!

COMS21103: Stable Matching Raphaël Clifford

Bristol University, Department of Computer Science^ [email protected] BS8 1UB, UK

November 5, 2009

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 1

Stable Matching

The problem^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 2

Imagine a set of students applying for Summer internships. I I Each student lists employers in order of preference.Each employer lists students in order of preference.

Can we assign applicants to employers so that for every employer E, andevery applicant A who is not scheduled to work for E, at least one of the^ I^ I^ Employers extend offers to students.Students accept or decline.

following is true. I I E prefers every one of its accepted applicants to A orA prefers her current situation over working for employer E

If these hold we have a stable matching.

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 3

The problem Imagine a set of students applying for Summer internships.

I I I Each student lists employers in order of preference.Each employer lists students in order of preference.Employers extend offers to students.

Can we assign applicants to employers so that for every employer E, andevery applicant A who is not scheduled to work for E, at least one of thefollowing is true.^ I^ Students accept or decline.

If these hold we have a^ I^ I^ E prefers every one of its accepted applicants to A orA prefers her current situation over working for employer E stable matching.

The problem - formulation Gale and Shapley considered this problem in 1962 but before that the USNational Resident Matching Program used something similar to match

residents (similar to registrars in the UK) to hospitals in the US. Thissystem is still in use today. Consider a society of and I nA matching is a one to one correspondence between the men and the “men” (m 1 ,... , mn). n “women” (w 1 ,... , wn)

I I women (we assume a purely monogamous, heterosexual society).Each female has a (strict) preference list for the males and each malehas a (strict) preference list for the females.The matching is unstable if there exists wi and mj such that

I If matching is not unstable, it is said to be stable.^ I^ I^ I^ wwmi^ i^ j^ andprefersprefers^ mj^ are not matched to each other.mwj^ i^ to her match.to his match.

[email protected] COMS21103: Stable MatchingDoes a stable matching always exist? How quickly can we find one?^ Raphaël Clifford Slide 4

The problem - formulation Gale and Shapley considered this problem in 1962 but before that the USNational Resident Matching Program used something similar to match

residents (similar to registrars in the UK) to hospitals in the US. Thissystem is still in use today. Consider a society of and I nA matching is a one to one correspondence between the men and the “men” (m 1 ,... , mn). n “women” (w 1 ,... , wn)

I I women (we assume a purely monogamous, heterosexual society).Each female has a (strict) preference list for the males and each malehas a (strict) preference list for the females.The matching is unstable if there exists wi and mj such that

I If matching is not unstable, it is said to be stable.^ I^ I^ I^ wwmii^ j^ andprefersprefers^ mj^ are not matched to each other.^ mwji^ to her match.to his match.

COMS21103: Stable Matching^ [email protected] a stable matching always exist? How quickly can we find one?^ Raphaël Clifford Slide 4

The Gale-Shapley “Proposal” Algorithm

I I I Letmhasn’t already rejected him.She accepts if either a) she is currently unmatched, or b) she findsi proposes to the most desirable woman (according to his list) thati be the smallest value such that mi is unmatched. m

I more desirable than her current match (in which case her currentmatch becomes unmatched.)Repeat until there are no unmatched men left. i

Does the algorithm terminate? Is the resulting matching stable? Thefollowing example is taken from http://bit.ly/26MnHW.

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 5

The Gale-Shapley “Proposal” Algorithm

I I I Letmhasn’t already rejected him.She accepts if either a) she is currently unmatched, or b) she findsi proposes to the most desirable woman (according to his list) thati be the smallest value such that mi is unmatched. m

I more desirable than her current match (in which case her currentmatch becomes unmatched.)Repeat until there are no unmatched men left. i

Does the algorithm terminate? Is the resulting matching stable? Thefollowing example is taken from http://bit.ly/26MnHW.

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Victor proposes to Bertha. Victor

Bertha

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 7

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Victor proposes to Bertha. - Bertha accepts since previously unmatched. Victor

Bertha

Stable matching example^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 8

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Wyatt proposes to Diane. Victor

BerthaDiane

Wyatt [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 9

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Wyatt proposes to Diane. - Diane accepts since previously unmatched. Victor

BerthaDiane

Wyatt

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Xavier proposes to Bertha. Victor

BerthaDiane

Wyatt

Bertha Xavier [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 11

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Xavier proposes to Bertha. - Bertha dumps Victor and accepts Xavier. Victor

Bertha Diane

Wyatt

Bertha Xavier

Stable matching example^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 12

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Diane Wyatt

Bertha Xavier

Victor proposes to Amy.

Amy Victor Victor

Bertha

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 13

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Diane Wyatt

Bertha Xavier

Amy Victor

Victor proposes to Amy.- Amy accepts sincepreviously unmatched. Victor

Bertha

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Bertha Wyatt proposes to Bertha. Wyatt

Diane Wyatt

Amy Yancey Victor

Bertha

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 19

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey Victor^3 rd^ Xavier^4 th

Bertha Diane

Wyatt

Bertha Xavier

Amy Victor

Amy Yancey

Diane Yancey

Bertha Wyatt

Wyatt proposes to Bertha. - Bertha rejects since she prefers Xavier.

Stable matching example^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 20

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Amy Wyatt proposes to Amy. Wyatt Victor

Bertha Diane

Wyatt

Amy Yancey

Bertha Wyatt [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 21

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Wyatt proposes to Amy.- Amy rejects since sheprefers Victor. Victor

Bertha Diane

Wyatt

Amy Yancey

Bertha Wyatt

Amy Wyatt

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey Victor^3 rd^ Xavier^4 th

Bertha Diane

Wyatt

Bertha Xavier

Amy Victor

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Clare Wyatt proposes to Clare. Wyatt [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 23

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Clare Wyatt

Wyatt proposes to Clare.- Clare accepts sincepreviously unmatched. Victor

Bertha Diane

Wyatt

Amy Yancey

Bertha Wyatt

Amy Wyatt

Stable matching example^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 24

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Clare Wyatt

Bertha Zeus proposes to Bertha. Victor Zeus

Bertha Diane

Wyatt

Amy Yancey

Bertha Wyatt

Amy Wyatt [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 25

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Diane Yancey

Clare Wyatt

Zeus proposes to Bertha.- Bertha rejects sinceshe prefers Xavier. Victor

Bertha Diane

Wyatt

Amy Yancey

Bertha Wyatt

Amy Wyatt

Bertha

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Clare Wyatt

Diane Zeus

Bertha Yancey proposes to Bertha. Yancey Victor

Bertha Diane

Wyatt

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Bertha Zeus

Clare Yancey [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 31

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey Victor^3 rd^ Xavier^4 th

Bertha Diane

Wyatt

Bertha Xavier

Amy Victor

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Clare Wyatt

Bertha Zeus

Diane Zeus

Clare Yancey

Bertha Yancey

Yancey proposes to Bertha. - Bertha rejects since she prefers Xavier.

Stable matching example^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 32

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Clare Wyatt

Diane Zeus

Erika Yancey proposes to Erika. Yancey^ Victor

Bertha Diane

Wyatt

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Bertha Zeus

Clare Yancey

Bertha Yancey [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 33

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika AmyClareClareAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Erika Diane Clare YanceyWyattXavierVictor XavierWyattWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) VictorWyattVictorZeus

Amy Zeus^0 th^ Women’s Preference List Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Clare Wyatt

Diane Zeus

Erika Yancey

Yancey proposes to Erika.- Erika accepts sincepreviously unmatched. Victor

Bertha Diane

Wyatt

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Bertha Zeus

Clare Yancey

Bertha Yancey

Stable matching example

Yancey^ Xavier^ WyattZeus BerthaBerthaDianeAmy BerthaDianeDianeErika^ ClareClareAmyAmyBerthaErikaDianeClare ClareErikaErikaAmy

Victor Bertha^0 th^ Men’s Preference List Amy^1 st^ Diane^2 nd^ Erika^3 rd^ Clare^4 th

Bertha Diane Erika Clare YanceyVictorWyattXavier (^) WyattXavierWyattZeus YanceyYanceyYanceyZeusXavierXavierVictorZeus (^) WyattVictorVictorZeus

Amy Zeus^0 th^ Women’s Preference List^ Victor^1 st^ Wyatt^2 nd^ Yancey^3 rd^ Xavier^4 th

Bertha Xavier

Amy Victor

Clare Wyatt

Diane Zeus

Erika Yancey

STOP- Everyone matched.- Stable matching! Victor

Bertha Diane

Wyatt

Amy Yancey

Diane Yancey

Bertha Wyatt

Amy Wyatt

Bertha Zeus

Clare Yancey

Bertha Yancey [email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 35

Stable matching - perfection

Lemma All men and women are matched when G-S terminates. Proof: (By contradiction)

Suppose, for sake of contradiction, that Zeus is not matched ontermination of algorithm. I Some woman, say Amy, must therefore also not be matched upontermination.

I I But every woman remains matched once they have been matched thefirst time, so no one must have proposed to Amy.But, Zeus proposes to everyone since he ends up unmatched. Thisgives the contradiction.

Stable matching - perfection^ COMS21103: Stable Matching^ [email protected]^ Raphaël Clifford^ Slide 36

Lemma All men and women are matched when G-S terminates. Proof: (By contradiction)

Suppose, for sake of contradiction, that Zeus is not matched ontermination of algorithm. I Some woman, say Amy, must therefore also not be matched upontermination.

I I But every woman remains matched once they have been matched thefirst time, so no one must have proposed to Amy.But, Zeus proposes to everyone since he ends up unmatched. Thisgives the contradiction.

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 36

Stable matching - stability Lemma

Any matching found by G-S is stable. Proof: pair. Say Amy prefers Victor but is engaged to another man (e.g. Wyatt) (By contradiction) Suppose the matching has at least one unstable

and Victor prefers Amy but is engaged to another woman (e.g. Diane).Victor must have proposed to Amy earlier than Diane. I Case 1: Amy was free when Victor proposed to her. Amy would nothave swapped Victor for Wyatt..

I Case 2: When Victor proposed to Amy, she rejected him because shewas already engaged to another man she preferred. Then the onlyway Amy can be matched with Wyatt is if she preferred him to theprevious man. Then Wyatt must be preferred over Victor also, giving

[email protected]^ Raphaël Cliffordthe contradiction.

COMS21103: Stable Matching Slide 37

Stable matchings are not unique There can be many stable matchings for a given set of preferences.

Consider the following: I I Bob prefers Alice to HyacinthCharlie prefers Hyacinth to Alice

G-S will make Bob engaged to Alice and Charlie engaged to Hyacinth^ I^ I^ Alice prefers Charlie to BobHyacinth prefers Bob to Charlie

(maybe in the other order) and stop. However, pairing Charlie with Aliceand Bob with Hyacinth is also stable and preferable for the women. Fact

All executions of G-S result in the same set of matched pairs.

[email protected] COMS21103: Stable Matching^ Raphaël Clifford Slide 39

Fairness A woman is acontains that pairing. valid partner of a man if there is stable matching that

Theorem Every execution of G-S results gives the best possible valid partner foreach man.

Proof: his best valid partner. Consider the first such case and the first rejection this man mpaired. receives from a valid partner (By contradiction). Assume some man is paired with a woman who is not w. Let S be a stable matching where m and w are

I I I Whenwhom she prefers toLetZ has not been rejected by any valid partner at the point when B bem is rejected,Z ’s partner in the stable matching wm .forms (or reaffirms) engagement with a man, say S. m is rejected Z ,

How could we get the best solution for women? If women propose instead of men. Raphaël Clifford^ I^ byThus the pairing^ w. Thus,^ Z^ prefers^ (w,^ m^ w)^ is unstable into^ B.^ S.

Fairness^ COMS21103: Stable Matching^ [email protected]^ Slide 40

A woman is acontains that pairing. Theorem valid partner of a man if there is stable matching that

Every execution of G-S results gives the best possible valid partner foreach man. Proof: his best valid partner. Consider the first such case and the first rejection this man (By contradiction). Assume some man is paired with a woman who is not

mpaired. receives from a valid partner I Whenwhom she prefers to m is rejected, w m forms (or reaffirms) engagement with a man, say. w. Let S be a stable matching where m and w Z are ,

I I I LetZbyThus the pairing has not been rejected by any valid partner at the point when w B. Thus, be Z ’s partner in the stable matching Z prefers (w, m w) is unstable into B. S. S. m is rejected

[email protected] COMS21103: Stable MatchingHow could we get the best solution for women? If women propose instead of men.^ Raphaël Clifford Slide 40

Further reading

I Algorithm DesignJ. Kleinberg and E. Tardos.Pearson Education, ISBN: 0321372913 I Section 1.1 – A First Problem: Stable Matching

Stable matching picture from^ I^ Online notes^ I^ Princeton - Theory of Algorithms ’08. http://bit.ly/1FY56L^ http://bit.ly/26MnHW.