Princeton COS 423 - A First Problem: Stable Matching

Unformatted text preview:

Algorithm Design by Éva Tardos and Jon Kleinberg • Copyright © 2005 Addison Wesley • Slides by Kevin Wayne1.1 A First Problem: Stable Matching2Matching Residents to HospitalsGoal. Given a set of preferences among hospitals and medical schoolstudents, design a self-reinforcing admissions process.Unstable pair: applicant x and hospital y are unstable if:! x prefers y to its assigned hospital.! y prefers x to one of its admitted students.Stable assignment. Assignment with no unstable pairs.! Natural and desirable condition.! Individual self-interest will prevent any applicant/hospital dealfrom being made.3Stable Matching ProblemGoal. Given n men and n women, find a "suitable" matching.! Participants rate members of opposite sex.! Each man lists women in order of preference from best to worst.! Each woman lists men in order of preference from best to worst.Zeus Amy ClareBerthaYancey Bertha ClareAmyXavier Amy ClareBertha1st2nd3rdMen’s Preference Profilefavorite least favoriteClare Xavier ZeusYanceyBertha Xavier ZeusYanceyAmy Yancey ZeusXavier1st2nd3rdWomen’s Preference Profilefavorite least favorite4Stable Matching ProblemPerfect matching: everyone is matched monogamously.! Each man gets exactly one woman.! Each woman gets exactly one man.Stability: no incentive for some pair of participants to undermineassignment by joint action.! In matching M, an unmatched pair m-w is unstable if man m andwoman w prefer each other to current partners.! Unstable pair m-w could each improve by eloping.Stable matching: perfect matching with no unstable pairs.Stable matching problem. Given the preference lists of n men and nwomen, find a stable matching if one exists.5Stable Matching ProblemQ. Is assignment X-C, Y-B, Z-A stable?Zeus Amy ClareBerthaYancey Bertha ClareAmyXavier Amy ClareBertha1st2nd3rdMen’s Preference ProfileClare Xavier ZeusYanceyBertha Xavier ZeusYanceyAmy Yancey ZeusXavier1st2nd3rdWomen’s Preference Profilefavorite least favorite favoriteleast favorite6Stable Matching ProblemQ. Is assignment X-C, Y-B, Z-A stable?A. No. Bertha and Xavier will hook up.Zeus Amy ClareBerthaYancey Bertha ClareAmyXavier Amy ClareBerthaMen’s Preference ListClare Xavier ZeusYanceyBertha Xavier ZeusYanceyAmy Yancey ZeusXavierWomen’s Preference List1st2nd3rd1st2nd3rdfavorite least favorite favoriteleast favorite7Stable Matching ProblemQ. Is assignment X-A, Y-B, Z-C stable?A. Yes.Zeus Amy ClareBerthaYancey Bertha ClareAmyXavier Amy ClareBerthaMen’s Preference ListClare Xavier ZeusYanceyBertha Xavier ZeusYanceyAmy Yancey ZeusXavierWomen’s Preference List1st2nd3rd1st2nd3rdfavorite least favorite favoriteleast favorite8Stable Roommate ProblemQ. Do stable matchings always exist?A. Not obvious a priori.Stable roommate problem.! 2n people; each person ranks others from 1 to 2n-1.! Assign roommate pairs so that no unstable pairs.Observation. Stable matchings do not always exist for stableroommate problem.BBobChrisAdamCABDDDoofusA B CDCA1st2nd3rdA-B, C-D ! B-C unstableA-C, B-D ! A-B unstableA-D, B-C ! A-C unstableis core of market nonempty?9Propose-And-Reject AlgorithmPropose-and-reject algorithm. (Gale-Shapley, 1962) Intuitive methodthat guarantees to find a stable matching.Initialize each person to be free.while (some man is free and hasn't proposed to every woman) { Choose such a man m w = 1st woman on m's list to whom m has not yet proposed if (w is free) assign m and w to be engaged else if (w prefers m to her fiancé m') assign m and w to be engaged, and m' to be free else w rejects m}10Proof of Correctness: TerminationObservation 1. Men propose to women in decreasing order of preference.Observation 2. Once a woman is matched, she never becomes unmatched;she only "trades up."Claim. Algorithm terminates after at most n2 iterations of while loop.Pf. Each time through the while loop a man proposes to a new woman.There are only n2 possible proposals. !WyattVictor1stAB2ndCD3rdCBAZeusYanceyXavier CDABBADC4thEE5thADEEDCBEBerthaAmy1stWX2ndYZ3rdYXVErikaDianeClare YZVWWVZX4thVW5thVZXYYXWZn(n-1) + 1 proposals required11Proof of Correctness: PerfectionClaim. All men and women get matched.Pf. (by contradiction)! Suppose, for sake of contradiction, that Zeus is not matched upontermination of algorithm.! Then some woman, say Amy, is not matched upon termination.! By Observation 2, Amy was never proposed to.! But, Zeus proposes to everyone, since he ends up unmatched. !12Proof of Correctness: StabilityClaim. No unstable pairs.Pf. (by contradiction)! Suppose A-Z is an unstable pair: each prefers each other topartner in Gale-Shapley matching S*.! Case 1: Z never proposed to A. ! Z prefers his GS partner to A. ! A-Z is stable.! Case 2: Z proposed to A. ! A rejected Z (right away or later) ! A prefers her GS partner to Z. ! A-Z is stable.! In either case A-Z is stable, a contradiction. !Bertha-ZeusAmy-YanceyS*. . .men propose to favorite women firstwomen only trade up13SummaryStable matching problem. Given n men and n women, and theirpreferences, find a stable matching if one exists.Gale-Shapley algorithm. Guarantees to find a stable matching for anyproblem instance.Q. How to implement GS algorithm efficiently?Q. If there are multiple stable matchings, which one does GS find?14Efficient ImplementationEfficient implementation. We describe O(n2) time implementation.Representing men and women.! Assume men are named 1, …, n.! Assume women are named 1', …, n'.Engagements.! Maintain a list of free men, e.g., in a queue.! Maintain two arrays wife[m], and husband[w].– set entry to 0 if unmatched– if m matched to w then wife[m]=w and husband[w]=mMen proposing.! For each man, maintain a list of women, ordered by preference.! Maintain an array count[m] that counts the number of proposalsmade by man m.15Efficient ImplementationWomen rejecting/accepting.! Does woman w prefer man m to man m'?! For each woman, create inverse of preference list of men.! Constant time access for each query after O(n) preprocessing.for i = 1 to n inverse[pref[i]] = iPref1st82nd73rd34th45th1 5 266th7th8thInverse 4th2nd8th6th5th7th1st3rd1 2 3 4 56 7 8AmyAmyAmy prefers man 3 to 6since inverse[3] < inverse[6]2716Understanding the SolutionQ. For a given problem instance, there may be several stablematchings. Do all executions of Gale-Shapley yield the same stablematching? If so, which one?An instance with two stable matchings.! A-X, B-Y, C-Z.! A-Y, B-X,


View Full Document

Princeton COS 423 - A First Problem: Stable Matching

Download A First Problem: Stable Matching
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A First Problem: Stable Matching and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A First Problem: Stable Matching 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?