SlideShare a Scribd company logo
Please ask
questions!
CS269I
Lecture 2: Stable Matching
1
Please ask
questions!
Last time: Matching students to dorms
Sandra ‘50
Sally ‘73
Susan ‘86
Toyon Stern Branner
Key point:
Only Sandra knows* how
happy she would be in
each dorm. So we rely on
her to tell the algorithm.
* Does Sandra know that?
How do you measure happiness anyway? 2
Please ask
questions!
Last time: Matching students to dorms
Definition (mechanism):
Solicit inputs + algorithm + action
Definition (Strategyproof / Truthful):
A mechanism is strategyproof/truthful if misreporting preferences can never make a
participant better off.
Definition (Pareto-optimal):
An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵,
there is a participant that (strictly) prefers 𝐴 over 𝐵.
Theorem:
Serial Dictatorship is a truthful mechanism that makes Pareto-optimal assignments.
3
* any other assignment 𝐵 such that at least
one participant strictly prefers 𝐵 to 𝐴
Please ask
questions!
Today: the hospital residency problem
• After completing 4 years of undergrad and 4 years of med school,
med students are finally ready to start their internship (“residency”)
• Each applicant has a preference over different residency programs
• Each program has a preference over the applicants
How should you match applicants to residencies?
4
Simplifying assumption today:
Each program has 1 slot
Please ask
questions!
Today: the hospital residency problem
• After completing 4 years of undergrad and 4 years of med school,
med students are finally ready to start their internship (“residency”)
• Each doctor has a preference over different hospitals
• Each hospital has a preference over the doctors
How should you match doctors with hospitals?
5
Simplifying assumption today:
Each hospital has 1 slot
Please ask
questions!
Dorms vs Hospitals
6
Sandra ‘50
Sally ‘73 Stern
Branner
6
Please ask
questions!
Dorms vs Hospitals
Main difference: dorms don’t have preference over students.
Another important difference: centralized vs optionally centralized
7
Must be incentivized
to participate!
Please ask
questions!
Stable Matchings
8
Please ask
questions!
Unstable matching
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
9
n n
Stanford
wants
Doctor n
n really
wants
Stanford
Please ask
questions!
Stable Matching
10
n n
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
Def (stable matching):
M is a stable matching if there are no blocking pairs.
Please ask
questions!
Stable Matching
11
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
Def (stable matching):
M is a stable matching if there are no blocking pairs.
For every unmatched pair (i,j):
• Doctor i prefers Hospital M(i) over Hospital j, or;
• Hospital j prefers Doctor M(j) over Doctor i
equivalent
Please ask
questions!
Stable Matching
12
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
Def (stable matching):
M is a stable matching if there are no blocking pairs.
For every unmatched pair (i,j):
• Doctor i prefers Hospital M(i) over Hospital j, or;
• Hospital j prefers Doctor M(j) over Doctor i
equivalent
#mustknowthisdef!
Please ask
questions!
Stable Matching
13
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
Def (stable matching):
M is a stable matching if there are no blocking pairs.
13
13
In a stable matching,
hospitals can’t find better
doctors outside the match
Key point: centralized vs optionally centralized
Please ask
questions!
Stable Matching
14
Def (blocking pair):
Given Matching M, (Doctor i, Hospital j) are a blocking pair
if they prefer each other to their assignment in M
Def (stable matching):
M is a stable matching if there are no blocking pairs.
14
14
In a stable matching,
hospitals can’t find better
doctors outside the match
Key point: centralized vs optionally centralized
Stable matchings are important (because of )
But can we find them efficiently?
Please ask
questions!
Deferred Acceptance Algorithm
[Gale Shapley ‘62]
An algorithm that finds stable matchings!
Please ask
questions!
Main idea: try to match each doctor to most favorite choice;
if you discover a blocking pair, just switch the matching!
Deferred Acceptance Algorithm
Almost-pseudo-code*:
While there is an unmatched doctor i:
Try to match Doctor i to next-favorite hospital in her list;
If this hospital doesn’t have a doctor yet:
Both Doctor i and hospital are happy with this new match ☺
Else-if this hospital prefers its current match i’ over i:
Doctor i remains unmatched
Else-if this hospital prefers i over i’:
Unmatch i’; Match (i, hospital)
* there is a hidden slide with more
detailed pseudocode and runtime analysis
Please ask
questions!
17
freeDoctors ← Doctors
for all d in Doctors:
d.current ← 0
for all h in Hospitals:
h.D ← NIL
Deferred-Acceptance(Doctors,Hospitals):
// initialize
Deferred Acceptance Algorithm
while (exists d in freeDoctors)
h ← d.rank(d.current++)
if (h.free = true)
h.D ← d; h.free ← false
remove d from freeDoctors
else-if (h.rank(d) < h.rank(h.D))
add h.D to freeDoctors
h.D ← d
remove d from freeDoctors
return (h,h.D) for all h in Hospitals
// main loop
// h prefers d to
previous match
// h is d’s
next favorite
Running time:
Each iteration of
while loop = O(1)
Each iteration:
We +1 d.current
for some doctor
We always have:
d.current ≤ 𝑛
for every doctor
Therefore, total
run-time = 𝑂 𝑛2
Please ask
questions!
Example run-through
18
Please ask
questions!
DA Example Run 1
19
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
DA Example Run 1
20
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
DA Example Run 1
21
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
DA Example Run 1
22
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
DA Example Run 1
23
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
DA Example Run 1
24
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Please ask
questions!
Another example
25
Please ask
questions!
DA Example Run 2
26
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
27
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
28
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
29
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
30
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
31
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
DA Example Run 2
32
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Please ask
questions!
33
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
DA Example Run 2
Please ask
questions!
Main idea: try to match each doctor to most favorite choice;
if you discover a blocking pair, just switch the matching!
Deferred Acceptance Algorithm
Almost-pseudo-code:
While there is an unmatched doctor i:
Try to match i to next-favorite hospital;
If this hospital doesn’t have a doctor yet:
Match Doctor i and this hospital
Else-if this hospital prefers its current match i’ over i:
Doctor i remains unmatched
Else-if this hospital prefers i over i’:
Unmatch i’; Match (i, hospital)
Run-time analysis
• Each iteration: 𝑶(𝟏) time
• Every iteration, doctor “proposes” to
new hospital
• Never try to match same doctor and
hospital twice
• 𝑛2 possible (doctor,hospital) pairs
• Therefore, at most 𝒏𝟐 iterations
• Therefore, total 𝑶 𝒏𝟐
Please ask
questions!
Questions about DA before we analyze it?
35
Deferred Acceptance Almost-pseudo-code:
While there is an unmatched doctor i:
Try to match i to next-favorite hospital;
If this hospital doesn’t have a doctor yet:
Match Doctor i and this hospital
Else-if this hospital prefers its current match i’ over i:
Doctor i remains unmatched
Else-if this hospital prefers i over i’:
Unmatch i’; Match (i, hospital)
Main idea: try to match each
doctor to most favorite choice;
if you discover a blocking pair,
just switch the matching!
Def (blocking pair):
(Doctor i, Hospital j) are a
blocking pair if they prefer each
other to their assignment in M
#mustknowthisdef!
Please ask
questions!
Deferred Acceptance works!
Theorem: Given n doctors and n hospitals,
DA algorithm outputs a complete stable matching.
Corollary: A stable matching exists.
(This is not obvious!)
36
Please ask
questions!
Proof of Theorem
Theorem: Given n doctors and n hospitals,
DA algorithm outputs a complete stable matching.
Proof: Follows from Claims 1+3 below…
37
Claim 1: At every iteration, current match is stable
w.r.t. non-free doctors and hospitals.
Claim 2: Once a hospital is matched, it remains matched
(possibly to a different doctor) until end of algorithm.
Claim 3: At the end of algorithm, every doctor/hospital is matched.
Please ask
questions!
Proof of claims
38
Claim 1:
At every iteration, current match is stable
w.r.t. non-free doctors and hospitals.
Proof by contradiction:
Suppose (d,h) blocking pair.
→ d is currently matched worse than h.
→ d already tried to match to h.
→ h either refused d or left d later. Why?
→ h must be matched to better than d –
contradiction!
Think-pair-share:
Prove these!
Claim 3: At the end of algorithm, every
doctor/hospital is matched.
Proof by contradiction: Suppose (d,h) free.
End of algorithm → d already tried h.
→ after that step, h wasn’t free
→ by Claim 2, contradiction!
Claim 2: Once a hospital is matched,
it remains matched (possibly to a different
doctor) until end of algorithm.
“Proof”: obvious from algorithm
Please ask
questions!
Deferred Acceptance works!
Theorem: Given n doctors and n hospitals,
DA algorithm outputs a complete stable matching.
Proof: Follows from Claims 1+3 below…
39
Claim 1: At every iteration, current match is stable
w.r.t. non-free doctors and hospitals.
Claim 2: Once a hospital is matched, it remains matched
(possibly to a different doctor) until end of algorithm.
Claim 3: At the end of algorithm, every doctor/hospital is matched.
Please ask
questions!
Deferred Acceptance Algorithm recap
Blocking Pair: A doctor and hospital that prefer each other over their
respective matches.
Stable Matching: A matching without blocking pairs!
Deferred Acceptance Algorithm
“Tentatively match each free doctor to best interested hospital.
Allow the hospital to leave match when a better doctor arrives.”
Runs in time 𝑂 𝑛2 = linear in input size ☺
40
Please ask
questions!
Deferred Acceptance as a mechanism
We have an efficient algorithm!
41
Please ask
questions!
The optimal matching?
DA algorithm found a stable matching…
• Is it optimal?
• What does optimality mean?
42
Theorem: Every stable matching is Pareto-optimal
Reminder (Pareto-optimal):
An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵,
there is a participant (doctor or hospital) that prefers 𝐴 over 𝐵.
Please ask
questions!
The optimal matching?
Proof:
Suppose 𝐴 is stable, and let 𝐵 be any other matching.
Consider a doctor-hospital pair matched in 𝐵, and not matched in 𝐴:
By stability of 𝐴, either the doctor or the hospital must prefer their match in 𝐴.
43
Theorem: Every stable matching is Pareto-optimal
Reminder (Pareto-optimal):
An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵,
there is a participant (doctor or hospital) that prefers 𝐴 over 𝐵.
Please ask
questions!
The optimal stable matching?
Theorem: The matching returned by DA is doctor-optimal,
In other words, every doctor is matched
to favorite hospital possible in any stable matching.
Corollary: DA is doctor-strategyproof
I.e. doctors cannot gain from misreporting their preferences.
44
Please ask
questions!
The optimal stable matching?
Theorem: The matching returned by DA is hospital-worst,
In other words, every hospital is matched
to least favorite doctor possible in any stable matching.
Caution: DA is NOT hospital-strategyproof
45
Please ask
questions!
The optimal stable matching?
Caution: DA is NOT hospital-strategyproof
46
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, B, C
B, C, A
Example 1 (true preferences):
Hospital Y matched to 2nd choice doctor
Example 2 (Hospital Y misreporting):
Hospital Y matched to top choice doctor
Please ask
questions!
Recap: DA as a mechanism
Pareto optimality:
Every stable matching is Pareto-optimal.
Optimality-among stable matchings
DA’s matching is doctor-optimal + hospital-worst
Deferred Acceptance and strategic behavior
1. DA is doctor-strategyproof
2. DA is not hospital-strategyproof
3. Stable matching = no (doctor,hospital) prefer to match outside
47
Think-Pair-Share:
How would you change DA to
make it hospital-optimal (and
hospital-strategyproof*)?
Which one (doctor-optimal or
hospital-optimal) is better?
* Everything we discussed so far also applies to hospitals with >1 slot.
But with >1 slot, there are no stable hospital-strategyproof mechanisms.
Please ask
questions!
Deferred Acceptance in practice
48
Please ask
questions!
College admission
US system:
• Universities in a decentralized system
Q: How many students to admit?
A: Estimate based on historical data
• “Whole person review” -> application fees $$ -> limit # of apps/student
• Students strategize over where to apply (“safety choices”)
In many other countries:
• Admission mostly determined by standardized test scores
• DA-like mechanisms used in Brazil, China, Hungary,
49
Aka apply to some “safety” (less competitive) schools
instead of your favorite-but-competitive choices
Please ask
questions!
Doctors-hospitals
How do doctors rank hospitals?
• 1950’s: DA-like National Resident Match Program (NRMP)
• At the time, very few female doctors (not to mention openly gay doctors)
• 1960’s: more couples - want to be near each other (allegedly ;))
• Aka doctors no longer have a ranked preference over hospitals
• 1980’s: Negative theory results on stable matching with couples
• Stable matching may not exist 
• NP-complete computational problem 
• 1990’s: Practical successful extension of DA for accommodating couples ☺ 50
Please ask
questions!
Doctors-hospitals
How do hospitals rank doctors?
• Interviews
Costly process: strategize over which doctors to interview (“safety choices”)
• Standardized tests?
(Probably not anymore - USMLE switched to pass/fail in Jan 2022…)
• Letters of rec, med school eval, personal statement and CV
Hospitals also strategically use “safety choices” when ranking doctors post-interview.
DA is not hospital-strategyproof, but…
Theorem: In DA, using safety choices is never safer for hospitals! 51
Please ask
questions!
Doctors-hospitals
How do hospitals rank doctors?
DA is not hospital-strategyproof, but it’s generally not easy to game the match:
52
Alice
Bob
Charlie
X, Y, Z
Y, X, Z
Y, Z, X
X
Y
Z
B, A, C
A, C, B
B, C, A
Recall example:
Y switched B and C to match with A.
Needed detailed knowledge of
everyone’s preferences for this to work!
Please ask
questions!
Doctors-hospitals
How do hospitals rank doctors?
Theorem: In DA, using safety choices is never safer for hospitals!
Formally, manipulating true rank to move i-th doctor (“safety choice”)
to higher position cannot help matching with doctor of rank i-or-better.
Proof:
• Until Doctor i tries to match with hospital, manipulation has no effect.
• After Doctor i tries to match, they can only be replaced by a better doctor.
53
Please ask
questions!
Doctors-hospitals
How do hospitals rank doctors?
Theorem: In DA, using safety choices is never safer for hospitals!
Hospitals still strategically use “safety choices” when ranking doctors post-interview.
Why?!
Possible explanations:
1. They didn’t pay attention during CS269I lecture
2. Reputation/ego
54
Please ask
questions!
Doctors-hospitals
How do hospitals rank doctors?
Theorem: In DA, using safety choices is never safer for hospitals!
Hospitals still strategically use “safety choices” when ranking doctors post-interview.
Why?!
Possible explanations:
1. They didn’t pay attention during CS269I lecture
2. Reputation/ego - “number needed to fill” statistic
55
“Number needed to fill” –
the lowest rank in hospital’s list
of a doctor matched to hospital.
Please ask
questions!
Doctors vs Packets
56
Please ask
questions!
Doctors vs Packets
• Suppose that instead of doctors and hospitals, you
want to match packets to servers on the internet.
57
n n
Lecture2.pptx
Lecture2.pdf
Please ask
questions!
Doctors vs Packets
• Suppose that instead of doctors and hospitals, you
want to match packets to servers on the internet.
• When you own all the servers, you don’t have to worry
about them matching outside your algorithm...
• But it turns out that Deferred Acceptance is just very
fast in practice ☺
58
n n
Lecture2.pdf
Please ask
questions!
Doctors vs Packets
• Suppose that instead of doctors and hospitals, you
want to match packets to servers on the internet.
• When you own all the servers, you don’t have to worry
about them matching outside your algorithm...
• But it turns out that Deferred Acceptance is just very
fast in practice ☺
59
Please ask
questions!
Stanford Marriage Pact
60
Please ask
questions!
Stanford Marriage Pact
• Matches between Stanford students who want to make a pact:
“If we don’t get married by time X, we’ll marry each other.”
• Historically, Gale-Shapley’s original paper talked about Stable Marriage
• Men = doctors; women = hospitals.
• Original Marriage Pact used variant of Deferred Acceptance
• It doesn’t any more…
61
Please ask
questions!
DA Applications recap
Challenges:
• Costly evaluations (US colleges, medical interviews)
• Strategic choice of candidates/applications
• Preference assumption doesn’t always hold
• Couples want close assignments
• Reputation/ego (“number needed to fill”)
Theorem: In DA, “safety choices” are never “safer”.
Opportunities:
• Distributed implementation, short lists – fast in practice! 62
Please ask
questions!
Recap
63
Please ask
questions!
Pre-recap announcements
Next lecture: Top trading cycles
Housing for graduate students (+ saving lives!)
To-do:
• Week 1 short quiz!
64
Please ask
questions!
Stable Matching lecture recap (1/2)
Last lecture: 1-sided matching (dorms don’t have preferences!)
vs
Today: 2-sided matching (hospitals, colleges, etc have preferences!)
Blocking Pair: A pair that prefer each other over their respective matches.
Stable Matching: A matching without blocking pairs.
Deferred Acceptance Algorithm
“Tentatively match each free doctor to best interested hospital.
Allow the hospital to leave match when a better doctor arrives.”
Runs in time 𝑂 𝑛2
. Very fast in practice!
65
Please ask
questions!
Stable Matching lecture recap (2/2)
Deferred Acceptance in theory:
• Pareto optimal among all matchings
• Doctor-optimal and hospital-worst among stable assignments
• Doctor-strategyproof, but hospital gaming is possible
Deferred Acceptance in practice:
• Costly evaluations (US colleges, medical interviews)
• Preferences not captured by our model (e.g. couples)
66

More Related Content

Similar to CS269I (Incentives in Computer Science) Lecture 2_ Stable Matching.pdf

Statistical tests
Statistical testsStatistical tests
Statistical tests
martyynyyte
 
Chi-square IMP.ppt
Chi-square IMP.pptChi-square IMP.ppt
Chi-square IMP.ppt
Shivraj Nile
 
Chapter 3 part1-Design of Experiments
Chapter 3 part1-Design of ExperimentsChapter 3 part1-Design of Experiments
Chapter 3 part1-Design of Experiments
nszakir
 
john-michaels-lp-editedmee.docx
john-michaels-lp-editedmee.docxjohn-michaels-lp-editedmee.docx
john-michaels-lp-editedmee.docx
JohnMichaelPerez9
 
Crash Course in A/B testing
Crash Course in A/B testingCrash Course in A/B testing
Crash Course in A/B testing
Wayne Lee
 
Intro to game theory
Intro to game theory Intro to game theory
Intro to game theory
Nadav Carmel
 
1. A researcher is interested in whether students who attend priva.docx
1. A researcher is interested in whether students who attend priva.docx1. A researcher is interested in whether students who attend priva.docx
1. A researcher is interested in whether students who attend priva.docx
swannacklanell
 

Similar to CS269I (Incentives in Computer Science) Lecture 2_ Stable Matching.pdf (8)

Statistical tests
Statistical testsStatistical tests
Statistical tests
 
Chi-square IMP.ppt
Chi-square IMP.pptChi-square IMP.ppt
Chi-square IMP.ppt
 
Chapter 3 part1-Design of Experiments
Chapter 3 part1-Design of ExperimentsChapter 3 part1-Design of Experiments
Chapter 3 part1-Design of Experiments
 
john-michaels-lp-editedmee.docx
john-michaels-lp-editedmee.docxjohn-michaels-lp-editedmee.docx
john-michaels-lp-editedmee.docx
 
Crash Course in A/B testing
Crash Course in A/B testingCrash Course in A/B testing
Crash Course in A/B testing
 
Intro to game theory
Intro to game theory Intro to game theory
Intro to game theory
 
1. A researcher is interested in whether students who attend priva.docx
1. A researcher is interested in whether students who attend priva.docx1. A researcher is interested in whether students who attend priva.docx
1. A researcher is interested in whether students who attend priva.docx
 
ตัวจริง
ตัวจริงตัวจริง
ตัวจริง
 

Recently uploaded

Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Md. Shahidul Islam Prodhan
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
RCC Institute of Information Technology
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
Atif Razi
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
NurvisNavarroSanchez
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
Kamal Acharya
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Antenna efficency lecture course chapter 3.pdf
Antenna  efficency lecture course chapter 3.pdfAntenna  efficency lecture course chapter 3.pdf
Antenna efficency lecture course chapter 3.pdf
AbrahamGadissa
 

Recently uploaded (20)

Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Antenna efficency lecture course chapter 3.pdf
Antenna  efficency lecture course chapter 3.pdfAntenna  efficency lecture course chapter 3.pdf
Antenna efficency lecture course chapter 3.pdf
 

CS269I (Incentives in Computer Science) Lecture 2_ Stable Matching.pdf

  • 2. Please ask questions! Last time: Matching students to dorms Sandra ‘50 Sally ‘73 Susan ‘86 Toyon Stern Branner Key point: Only Sandra knows* how happy she would be in each dorm. So we rely on her to tell the algorithm. * Does Sandra know that? How do you measure happiness anyway? 2
  • 3. Please ask questions! Last time: Matching students to dorms Definition (mechanism): Solicit inputs + algorithm + action Definition (Strategyproof / Truthful): A mechanism is strategyproof/truthful if misreporting preferences can never make a participant better off. Definition (Pareto-optimal): An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵, there is a participant that (strictly) prefers 𝐴 over 𝐵. Theorem: Serial Dictatorship is a truthful mechanism that makes Pareto-optimal assignments. 3 * any other assignment 𝐵 such that at least one participant strictly prefers 𝐵 to 𝐴
  • 4. Please ask questions! Today: the hospital residency problem • After completing 4 years of undergrad and 4 years of med school, med students are finally ready to start their internship (“residency”) • Each applicant has a preference over different residency programs • Each program has a preference over the applicants How should you match applicants to residencies? 4 Simplifying assumption today: Each program has 1 slot
  • 5. Please ask questions! Today: the hospital residency problem • After completing 4 years of undergrad and 4 years of med school, med students are finally ready to start their internship (“residency”) • Each doctor has a preference over different hospitals • Each hospital has a preference over the doctors How should you match doctors with hospitals? 5 Simplifying assumption today: Each hospital has 1 slot
  • 6. Please ask questions! Dorms vs Hospitals 6 Sandra ‘50 Sally ‘73 Stern Branner 6
  • 7. Please ask questions! Dorms vs Hospitals Main difference: dorms don’t have preference over students. Another important difference: centralized vs optionally centralized 7 Must be incentivized to participate!
  • 9. Please ask questions! Unstable matching Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M 9 n n Stanford wants Doctor n n really wants Stanford
  • 10. Please ask questions! Stable Matching 10 n n Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M Def (stable matching): M is a stable matching if there are no blocking pairs.
  • 11. Please ask questions! Stable Matching 11 Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M Def (stable matching): M is a stable matching if there are no blocking pairs. For every unmatched pair (i,j): • Doctor i prefers Hospital M(i) over Hospital j, or; • Hospital j prefers Doctor M(j) over Doctor i equivalent
  • 12. Please ask questions! Stable Matching 12 Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M Def (stable matching): M is a stable matching if there are no blocking pairs. For every unmatched pair (i,j): • Doctor i prefers Hospital M(i) over Hospital j, or; • Hospital j prefers Doctor M(j) over Doctor i equivalent #mustknowthisdef!
  • 13. Please ask questions! Stable Matching 13 Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M Def (stable matching): M is a stable matching if there are no blocking pairs. 13 13 In a stable matching, hospitals can’t find better doctors outside the match Key point: centralized vs optionally centralized
  • 14. Please ask questions! Stable Matching 14 Def (blocking pair): Given Matching M, (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M Def (stable matching): M is a stable matching if there are no blocking pairs. 14 14 In a stable matching, hospitals can’t find better doctors outside the match Key point: centralized vs optionally centralized Stable matchings are important (because of ) But can we find them efficiently?
  • 15. Please ask questions! Deferred Acceptance Algorithm [Gale Shapley ‘62] An algorithm that finds stable matchings!
  • 16. Please ask questions! Main idea: try to match each doctor to most favorite choice; if you discover a blocking pair, just switch the matching! Deferred Acceptance Algorithm Almost-pseudo-code*: While there is an unmatched doctor i: Try to match Doctor i to next-favorite hospital in her list; If this hospital doesn’t have a doctor yet: Both Doctor i and hospital are happy with this new match ☺ Else-if this hospital prefers its current match i’ over i: Doctor i remains unmatched Else-if this hospital prefers i over i’: Unmatch i’; Match (i, hospital) * there is a hidden slide with more detailed pseudocode and runtime analysis
  • 17. Please ask questions! 17 freeDoctors ← Doctors for all d in Doctors: d.current ← 0 for all h in Hospitals: h.D ← NIL Deferred-Acceptance(Doctors,Hospitals): // initialize Deferred Acceptance Algorithm while (exists d in freeDoctors) h ← d.rank(d.current++) if (h.free = true) h.D ← d; h.free ← false remove d from freeDoctors else-if (h.rank(d) < h.rank(h.D)) add h.D to freeDoctors h.D ← d remove d from freeDoctors return (h,h.D) for all h in Hospitals // main loop // h prefers d to previous match // h is d’s next favorite Running time: Each iteration of while loop = O(1) Each iteration: We +1 d.current for some doctor We always have: d.current ≤ 𝑛 for every doctor Therefore, total run-time = 𝑂 𝑛2
  • 19. Please ask questions! DA Example Run 1 19 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 20. Please ask questions! DA Example Run 1 20 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 21. Please ask questions! DA Example Run 1 21 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 22. Please ask questions! DA Example Run 1 22 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 23. Please ask questions! DA Example Run 1 23 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 24. Please ask questions! DA Example Run 1 24 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A
  • 26. Please ask questions! DA Example Run 2 26 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 27. Please ask questions! DA Example Run 2 27 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 28. Please ask questions! DA Example Run 2 28 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 29. Please ask questions! DA Example Run 2 29 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 30. Please ask questions! DA Example Run 2 30 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 31. Please ask questions! DA Example Run 2 31 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 32. Please ask questions! DA Example Run 2 32 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A
  • 33. Please ask questions! 33 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A DA Example Run 2
  • 34. Please ask questions! Main idea: try to match each doctor to most favorite choice; if you discover a blocking pair, just switch the matching! Deferred Acceptance Algorithm Almost-pseudo-code: While there is an unmatched doctor i: Try to match i to next-favorite hospital; If this hospital doesn’t have a doctor yet: Match Doctor i and this hospital Else-if this hospital prefers its current match i’ over i: Doctor i remains unmatched Else-if this hospital prefers i over i’: Unmatch i’; Match (i, hospital) Run-time analysis • Each iteration: 𝑶(𝟏) time • Every iteration, doctor “proposes” to new hospital • Never try to match same doctor and hospital twice • 𝑛2 possible (doctor,hospital) pairs • Therefore, at most 𝒏𝟐 iterations • Therefore, total 𝑶 𝒏𝟐
  • 35. Please ask questions! Questions about DA before we analyze it? 35 Deferred Acceptance Almost-pseudo-code: While there is an unmatched doctor i: Try to match i to next-favorite hospital; If this hospital doesn’t have a doctor yet: Match Doctor i and this hospital Else-if this hospital prefers its current match i’ over i: Doctor i remains unmatched Else-if this hospital prefers i over i’: Unmatch i’; Match (i, hospital) Main idea: try to match each doctor to most favorite choice; if you discover a blocking pair, just switch the matching! Def (blocking pair): (Doctor i, Hospital j) are a blocking pair if they prefer each other to their assignment in M #mustknowthisdef!
  • 36. Please ask questions! Deferred Acceptance works! Theorem: Given n doctors and n hospitals, DA algorithm outputs a complete stable matching. Corollary: A stable matching exists. (This is not obvious!) 36
  • 37. Please ask questions! Proof of Theorem Theorem: Given n doctors and n hospitals, DA algorithm outputs a complete stable matching. Proof: Follows from Claims 1+3 below… 37 Claim 1: At every iteration, current match is stable w.r.t. non-free doctors and hospitals. Claim 2: Once a hospital is matched, it remains matched (possibly to a different doctor) until end of algorithm. Claim 3: At the end of algorithm, every doctor/hospital is matched.
  • 38. Please ask questions! Proof of claims 38 Claim 1: At every iteration, current match is stable w.r.t. non-free doctors and hospitals. Proof by contradiction: Suppose (d,h) blocking pair. → d is currently matched worse than h. → d already tried to match to h. → h either refused d or left d later. Why? → h must be matched to better than d – contradiction! Think-pair-share: Prove these! Claim 3: At the end of algorithm, every doctor/hospital is matched. Proof by contradiction: Suppose (d,h) free. End of algorithm → d already tried h. → after that step, h wasn’t free → by Claim 2, contradiction! Claim 2: Once a hospital is matched, it remains matched (possibly to a different doctor) until end of algorithm. “Proof”: obvious from algorithm
  • 39. Please ask questions! Deferred Acceptance works! Theorem: Given n doctors and n hospitals, DA algorithm outputs a complete stable matching. Proof: Follows from Claims 1+3 below… 39 Claim 1: At every iteration, current match is stable w.r.t. non-free doctors and hospitals. Claim 2: Once a hospital is matched, it remains matched (possibly to a different doctor) until end of algorithm. Claim 3: At the end of algorithm, every doctor/hospital is matched.
  • 40. Please ask questions! Deferred Acceptance Algorithm recap Blocking Pair: A doctor and hospital that prefer each other over their respective matches. Stable Matching: A matching without blocking pairs! Deferred Acceptance Algorithm “Tentatively match each free doctor to best interested hospital. Allow the hospital to leave match when a better doctor arrives.” Runs in time 𝑂 𝑛2 = linear in input size ☺ 40
  • 41. Please ask questions! Deferred Acceptance as a mechanism We have an efficient algorithm! 41
  • 42. Please ask questions! The optimal matching? DA algorithm found a stable matching… • Is it optimal? • What does optimality mean? 42 Theorem: Every stable matching is Pareto-optimal Reminder (Pareto-optimal): An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵, there is a participant (doctor or hospital) that prefers 𝐴 over 𝐵.
  • 43. Please ask questions! The optimal matching? Proof: Suppose 𝐴 is stable, and let 𝐵 be any other matching. Consider a doctor-hospital pair matched in 𝐵, and not matched in 𝐴: By stability of 𝐴, either the doctor or the hospital must prefer their match in 𝐴. 43 Theorem: Every stable matching is Pareto-optimal Reminder (Pareto-optimal): An assignment 𝐴 is Pareto-optimal if for any* other assignment 𝐵, there is a participant (doctor or hospital) that prefers 𝐴 over 𝐵.
  • 44. Please ask questions! The optimal stable matching? Theorem: The matching returned by DA is doctor-optimal, In other words, every doctor is matched to favorite hospital possible in any stable matching. Corollary: DA is doctor-strategyproof I.e. doctors cannot gain from misreporting their preferences. 44
  • 45. Please ask questions! The optimal stable matching? Theorem: The matching returned by DA is hospital-worst, In other words, every hospital is matched to least favorite doctor possible in any stable matching. Caution: DA is NOT hospital-strategyproof 45
  • 46. Please ask questions! The optimal stable matching? Caution: DA is NOT hospital-strategyproof 46 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, B, C B, C, A Example 1 (true preferences): Hospital Y matched to 2nd choice doctor Example 2 (Hospital Y misreporting): Hospital Y matched to top choice doctor
  • 47. Please ask questions! Recap: DA as a mechanism Pareto optimality: Every stable matching is Pareto-optimal. Optimality-among stable matchings DA’s matching is doctor-optimal + hospital-worst Deferred Acceptance and strategic behavior 1. DA is doctor-strategyproof 2. DA is not hospital-strategyproof 3. Stable matching = no (doctor,hospital) prefer to match outside 47 Think-Pair-Share: How would you change DA to make it hospital-optimal (and hospital-strategyproof*)? Which one (doctor-optimal or hospital-optimal) is better? * Everything we discussed so far also applies to hospitals with >1 slot. But with >1 slot, there are no stable hospital-strategyproof mechanisms.
  • 49. Please ask questions! College admission US system: • Universities in a decentralized system Q: How many students to admit? A: Estimate based on historical data • “Whole person review” -> application fees $$ -> limit # of apps/student • Students strategize over where to apply (“safety choices”) In many other countries: • Admission mostly determined by standardized test scores • DA-like mechanisms used in Brazil, China, Hungary, 49 Aka apply to some “safety” (less competitive) schools instead of your favorite-but-competitive choices
  • 50. Please ask questions! Doctors-hospitals How do doctors rank hospitals? • 1950’s: DA-like National Resident Match Program (NRMP) • At the time, very few female doctors (not to mention openly gay doctors) • 1960’s: more couples - want to be near each other (allegedly ;)) • Aka doctors no longer have a ranked preference over hospitals • 1980’s: Negative theory results on stable matching with couples • Stable matching may not exist  • NP-complete computational problem  • 1990’s: Practical successful extension of DA for accommodating couples ☺ 50
  • 51. Please ask questions! Doctors-hospitals How do hospitals rank doctors? • Interviews Costly process: strategize over which doctors to interview (“safety choices”) • Standardized tests? (Probably not anymore - USMLE switched to pass/fail in Jan 2022…) • Letters of rec, med school eval, personal statement and CV Hospitals also strategically use “safety choices” when ranking doctors post-interview. DA is not hospital-strategyproof, but… Theorem: In DA, using safety choices is never safer for hospitals! 51
  • 52. Please ask questions! Doctors-hospitals How do hospitals rank doctors? DA is not hospital-strategyproof, but it’s generally not easy to game the match: 52 Alice Bob Charlie X, Y, Z Y, X, Z Y, Z, X X Y Z B, A, C A, C, B B, C, A Recall example: Y switched B and C to match with A. Needed detailed knowledge of everyone’s preferences for this to work!
  • 53. Please ask questions! Doctors-hospitals How do hospitals rank doctors? Theorem: In DA, using safety choices is never safer for hospitals! Formally, manipulating true rank to move i-th doctor (“safety choice”) to higher position cannot help matching with doctor of rank i-or-better. Proof: • Until Doctor i tries to match with hospital, manipulation has no effect. • After Doctor i tries to match, they can only be replaced by a better doctor. 53
  • 54. Please ask questions! Doctors-hospitals How do hospitals rank doctors? Theorem: In DA, using safety choices is never safer for hospitals! Hospitals still strategically use “safety choices” when ranking doctors post-interview. Why?! Possible explanations: 1. They didn’t pay attention during CS269I lecture 2. Reputation/ego 54
  • 55. Please ask questions! Doctors-hospitals How do hospitals rank doctors? Theorem: In DA, using safety choices is never safer for hospitals! Hospitals still strategically use “safety choices” when ranking doctors post-interview. Why?! Possible explanations: 1. They didn’t pay attention during CS269I lecture 2. Reputation/ego - “number needed to fill” statistic 55 “Number needed to fill” – the lowest rank in hospital’s list of a doctor matched to hospital.
  • 57. Please ask questions! Doctors vs Packets • Suppose that instead of doctors and hospitals, you want to match packets to servers on the internet. 57 n n Lecture2.pptx Lecture2.pdf
  • 58. Please ask questions! Doctors vs Packets • Suppose that instead of doctors and hospitals, you want to match packets to servers on the internet. • When you own all the servers, you don’t have to worry about them matching outside your algorithm... • But it turns out that Deferred Acceptance is just very fast in practice ☺ 58 n n Lecture2.pdf
  • 59. Please ask questions! Doctors vs Packets • Suppose that instead of doctors and hospitals, you want to match packets to servers on the internet. • When you own all the servers, you don’t have to worry about them matching outside your algorithm... • But it turns out that Deferred Acceptance is just very fast in practice ☺ 59
  • 61. Please ask questions! Stanford Marriage Pact • Matches between Stanford students who want to make a pact: “If we don’t get married by time X, we’ll marry each other.” • Historically, Gale-Shapley’s original paper talked about Stable Marriage • Men = doctors; women = hospitals. • Original Marriage Pact used variant of Deferred Acceptance • It doesn’t any more… 61
  • 62. Please ask questions! DA Applications recap Challenges: • Costly evaluations (US colleges, medical interviews) • Strategic choice of candidates/applications • Preference assumption doesn’t always hold • Couples want close assignments • Reputation/ego (“number needed to fill”) Theorem: In DA, “safety choices” are never “safer”. Opportunities: • Distributed implementation, short lists – fast in practice! 62
  • 64. Please ask questions! Pre-recap announcements Next lecture: Top trading cycles Housing for graduate students (+ saving lives!) To-do: • Week 1 short quiz! 64
  • 65. Please ask questions! Stable Matching lecture recap (1/2) Last lecture: 1-sided matching (dorms don’t have preferences!) vs Today: 2-sided matching (hospitals, colleges, etc have preferences!) Blocking Pair: A pair that prefer each other over their respective matches. Stable Matching: A matching without blocking pairs. Deferred Acceptance Algorithm “Tentatively match each free doctor to best interested hospital. Allow the hospital to leave match when a better doctor arrives.” Runs in time 𝑂 𝑛2 . Very fast in practice! 65
  • 66. Please ask questions! Stable Matching lecture recap (2/2) Deferred Acceptance in theory: • Pareto optimal among all matchings • Doctor-optimal and hospital-worst among stable assignments • Doctor-strategyproof, but hospital gaming is possible Deferred Acceptance in practice: • Costly evaluations (US colleges, medical interviews) • Preferences not captured by our model (e.g. couples) 66