250 likes | 268 Views
Explore a step-by-step algorithm for stable hospital-doctor matching, ensuring no unstable pairs exist. Learn about termination conditions and algorithm correctness proofs.
E N D
Matching Residents to Hospitals • Goal. Given a set of preferences among n hospitals and n medical school students, design a self-reinforcing admissions process. • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: Z. Guo
Matching Residents to Hospitals • Goal. Given a set of preferences among n hospitals and n medical school students, design a self-reinforcing admissions process. • Unstable pair: doctor x and hospital A are unstable if: • x prefers A to its assigned hospital, and • A prefers x to its admitted student. • Stable assignment. Assignment with no unstable pairs. • Natural and desirable condition. • Individual self-interest will prevent any applicant/hospital deal from being made. Z. Guo
Example • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: • (A, s), (B, t), (C, q), (D, r) (stable) • (A, t), (B, q), (C, s), (D, r) (un-stable pair: (B, t)) Z. Guo
A Simple Approach • Function Simple-Proposal-But-Invalid • Start with some assignment between doctors and hospitals • While unstable pair exists • “swap” to satisfy the pair • end while Z. Guo
Example • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: • (A, t), (B, q), (C, s), (D, r) (un-stable pair: (B, t)) • -> (A, q), (B, t), (C, s), (D, r) Z. Guo
A Simple Approach • Function Simple-Proposal-But-Invalid • Start with some assignment between doctors and hospitals • While unstable pair exists • “swap” to satisfy the pair • end while • This will NOT work since a loop can occur.Swaps might continually result in new “dissatisfied” pairs. Z. Guo
The Boston Pool Algorithm • The Boston Pool algorithm proceeds in rounds until every position has been filled. • Each round has two stages: • 1. An arbitrary unassigned hospital A offers its position to the best doctor x (according to the hospital’s preference list) who has not already rejected it. • 2. Each doctor ultimately accepts the best offer that she receives, according to her preference list. Thus, if x is currently unassigned, she (tentatively) accepts the offer from A. If x already has an assignment but prefers A, she rejects her existing assignment and (tentatively) accepts the new offer from A. Otherwise, x rejects the new offer. Z. Guo
Example • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: Z. Guo
Example • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: • (A, s), (B, t), (C, q), (D, r) Z. Guo
Example • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: • (A, s), (B, t), (C, q), (D, r) • The matching (A, r), (B, s), (C, q), (D, t) is also stable Z. Guo
Correctness - Termination • Observation 1. Hospitals propose to doctors in decreasing order of preference. • Observation 2. Once a doctor accepts an offer he/she never becomes unmatched, he/she only "trades up“. • Claim. Algorithm terminates after at most n2 rounds. • Pf. Each hospital makes an offer to each doctor at most once (only make offer to “new” doctor), so the algorithm requires at most n2 rounds. • The average (expected) case is O(n lg n). Z. Guo
Correctness • Claim. The algorithm always computes a matching (to all hospitals and doctors) • Pf. It’s obvious that throughout the process, no doctor can accept more than one position, and no hospital can hire more than one doctor. • Pf. (by contradiction) Suppose that Hospital A is not matched upon termination of algorithm. Then some doctor x is not matched upon termination. By Observation 2, x never received an offer. But, A made offers to everyone, since A ends up unmatched. Z. Guo
Correctness • Claim. No unstable pair. • Pf. Suppose doctor x is assigned to hospital A in the final matching, but prefers B. Because every doctor accepts the best offer she receives, x received no offer she liked more than A. In particular, B never made an offer to x. On the other hand, B made offers to every doctor they like more than y. Thus, B prefers y to x, and so there is no instability. Z. Guo
More properties • Def. x is a feasible doctor for A if there exists a stable matching that assigns doctor x to hospital A. • Claim. Each hospital A is rejected only by doctors that are infeasible for A. (Hospital-Optimal) • Pf. (by induction) Consider an arbitrary round of the algorithm, in which doctor x rejects A for B (B is offering x, x prefers B to A). Every doctor that appears higher than x in B’s preference list has already rejected B and therefore is infeasible for B (why?).Now consider an arbitrary matching that assigns x to A: B prefers x to its partner => unstable. B prefers its partner to x => its partner is infeasible (why?), and again the matching is unstable. Z. Guo
More properties • Def. x is a feasible doctor for A if there exists a stable matching that assigns doctor x to hospital A. • Claim. Each hospital A is rejected only by doctors that are infeasible for A. (Hospital-Optimal) • Claim. Each doctor x prefers every other feasible match to its final assignment A. (Doctor-Pessimal) • Pf. Consider an arbitrary stable matching where A is not matched with x but with another doctor y.The previous Claim implies that A prefers x to y (why?). Because the matching is stable, x must therefore prefer her assigned hospital to A. Z. Guo
More properties • No matter which unassigned hospital makes an offer in each round, the algorithm always computes the same matching ( why?) • A doctor can potentially improve her assignment by lying about her preferences • NRMP reversed its matching algorithm in 1998 • So that potential residents offer to work for hospitals in preference order, and each hospital accepts its best offer. • The precise effect of this change on the patients is an open problem. Z. Guo
About its history • Until 1950’s • Competition among hospitals for the best doctors led to earlier and earlier offers of internships, along with tighter deadlines for acceptance. • In the 1940s, medical schools agreed not to release information until a common date during their students’ fourth year. In response, hospitals began demanding faster decisions. • Interns were forced to gamble if their third-choice hospital called first. Z. Guo
In Academia • For graduate school admission, we have the “April 15 Resolution”. • However, the academic job market involves similar gambles, at least in computer science. • Some departments start making offers in February with two-week decision deadlines; others don’t even start interviewing until late March; • MIT notoriously waits until May, when all its interviews are over, before making any faculty offer. Z. Guo
About its history • In the early 1950’s • A central clearinghouse for internship assignments, now called the National Resident Matching Program (NRMP), was established • Each year, doctors submit a ranked list of all hospitals where they would accept an internship, and each hospital submits a ranked list of doctors they would accept as interns. • The NRMP then computes astable assignment of interns to hospitals. Z. Guo
It’s not the end of the story • In reality, most hospitals offer multiple internships, each doctor ranks only a subset of the hospitals and vice versa, and • There are typically more internships than interested doctors. • And then it starts getting complicated, moreover, e.g., • There are couples that willing to stay in the same city/hospital whenever possible… Z. Guo
This course • This class is ultimately about learning two skills that are crucial for all computer scientists: • Intuition: How to think about abstract computation. Z. Guo
This course • This class is ultimately about learning two skills that are crucial for all computer scientists: • Intuition: How to think about abstract computation. • Language: How to talk about abstract computation. Z. Guo
This course • This class is ultimately about learning two skills that are crucial for all computer scientists: • Intuition: How to think about abstract computation. • Language: How to talk about abstract computation. • You can only develop good problem solving skills by solving problems. You can only develop good communication skills by communicating. Z. Guo
Example - Process • Suppose four doctors q,r,s,t, and four hospitals A,B,C,D rank each other as follows: • (A,t); (A,t)(B,r); (C,t)(B,r); (C,t)(B,r)(D,s);(A,s)(C,t)(B,r); (A,s)(C,t)(D,r); (A,s)(B,t)(D,r);+(C,r?);+(C,s?); (A,s)(B,t)(D,r)(C,q); Z. Guo