Stable Matching
Stable Matching Hospital Problem
Given a set of hospitals and a set of students . This means there is one student per hospital.
- Each hospital ranks students.
- Each student ranks hospitals.
Goal: We want to design a self-reinforcing admissions process.
A hospital and student form an unstable pair if both conditions are true:
- prefers to one of its admitted students
- prefers to assigned hospital
A stable assignment is one with no unstable pairs. This is the natural and desirable condition. Individual self-interest prevets any hospital-student side deal.
A matching is a set of ordered pairs .
- Each hospital appears in at most one pair of .
- Each studnet appears in at most one pair of .
A matching is perfect if .
Given a perfect matching , hospital and student form an unstable pair if both:
- prefers to matched student
- prefers to matched hospital
An unstable pair could each improve by joint action.
A stable matching is a perfect matching with no unstable pairs.
- E.g.,
- Stable matching need not exist
Gale-Shapley Algorithm
The Gale-Shapley deferred acceptance algorithm is an intuition method that guarantees to find a stable matching.
Gale-Shapley Algorithm (preference lists for hospitals and students) Initialize to empty matching. While (some hospital is unmatched and hasn’t proposed to every student) is the first student in ’s list whom has not yet proposed. If ( is unmatched) Add to matching . Else if ( prefers to current partner ) Replace with the in matching . Else rejects . Return stable matching
Proofs
There are a few proofs we can observe.
- Observation 1: hospitals propose to students in decreasing order of preference
- Observation 2: once a student is matched, the student never becomes unmatched; only “trades up”
(1) Proof of correctness: termination.
- Claim: algorithm terminates after at most iterations of the while loop.
- Proof: each time throught he while look, a hospital proposes to a new student. Thus, there are at most possible proposals.
(2) Proof of correctness: perfect matching.
-
Claim: Gale-Shapley outputs a matching
-
Proof: hospital proposes only if unmatched => matched to <= 1 student student keeps only best hospital => matched to <= 1 hospital
-
Claim: In Gale-Shapley matching, all hospitals get matched
-
Proof by contradiction: Suppose, for the sake of contradiciton, that some hospital is unmatched upon termination of Gale-Shapley algorithm. Then some student, say is unmatched upon termination. By Observation 2, was never proposed to But, proposes to every student, since ends up unmatched.
-
Claim: In Gale-Shapley matching, all students get matched.
-
Proof by counting: By previous claim, all hospitals get matched. Thus, all students get matched.
(3) Proof of correctness: stability.
-
Claim: in gale-shapley matching , there are no unstable pairs.
-
Proof: consider any pair that is not in .
- Case 1: never proposed to . prefers its Gale-Shapley partner to . (hospitals propose in decreaseing order of preference) is not ustable
- Case 2: proposed to . rejected (either right away or later) prefers Gale-Shapley partner (students only trade up) to is not ustable
In either case, the pair is not unstable.
Summary:
- stable matching problem
Hospital Optimality
For a given probelm instance, there may be several stable matchings.
Definition: student is a valid partner for hospital if there exists any stable matching in which and are matched.
Hospital-optimal assignment means that each hospital receives best valid partner.
- is this a perfect matching? is it stable?
Claim: all executions of Gale-Shapley yield hospital-optimal assingment.
- Collorary: hospital-optimal assignment is a stable matching
- Proof by contradiction Suppose a hospital is matched with student other than best valid partner. Hospitals propose in decreasing order of preference => some hospital is rejected by a valid partner during gale-shapley. Let be the first such hospital, and let be the first valid partner that rejects . Let be a stable matching where and are matched. When rejects in Gale-Shapley, forms (or re-affirms) commitment to a hospital, say => prefers to . Let be partner of in . has not been rejected by any valid partner (including ) at the point when is rejected by (because it is the first rejection). Thus, had not yet proposed to when proposed to => prefers to . Thus, is unstable in , a contradiction.
Student pessimality: hospital-optimality comes at the expense of the studnets. Student pessimality assignment: each student receives worst valid partner.
Claim: gale-shapley finds student-pessimal stable matching .
- Proof by contradiction:
Suppose
h-smatched in but is not the worst valid partner for . There exists stable matching in which is paried with a hospital, say , whom prefers less than . => prefers to . Let be the partner of in M. By hospital-optimality, is the best valid partner for => prefers to . Thus, is an unstable pair in , a contradiction.
Context
Extensions to this probelm
- some agents declare others as unacceptable (med-school student unwilling to work in Cleveland)
- some hospitals have more than one psoition
- unequal number of positions and students.
Def: matching is unstable if there is a hospital and student such that
- and are acceptable to each other; and
- either is unmatced, or prefers to assigned hospital; and
- either does not have all its places filled, or prefers to at least one of its assigned students.
Theorem: there exists a stable matching.
- proof: straightforward generalization of gale-shapley algorithm.
Linked from Algorithms