Stable Matching.

Slides:



Advertisements
Similar presentations
Blah blah blah. Zoes shark Thanks to the conference artist Phoebe.
Advertisements

Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 2.
Matching Theory.
Matching problems Toby Walsh NICTA and UNSW. Motivation Agents may express preferences for issues other than a collective decision  Preferences for a.
Improved Efficiency for Private Stable Matching Matthew Franklin, Mark Gondree, and Payman Mohassel University of California, Davis 02/07/07 - Session.
CSE 421 Algorithms Richard Anderson Lecture 2. Announcements Office Hours –Richard Anderson, CSE 582 Monday, 10:00 – 11:00 Friday, 11:00 – 12:00 –Yiannis.
Lecture 8 CSE 331 Sep 17, HW 1 due today Place Q1 and Q2 in separate piles I will not accept HWs after 1:15pm.
CSC 430 Lecture1: Introduction and Python Primer.
The Stable Marriage Problem
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 1.
1 Chapter 1 Introduction: Some Representative Problems Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Stable Matching Problem Goal. Given n men and n women, find a "suitable" matching. n Participants rate members of opposite sex. n Each man lists women.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013.
Lecture 3 CSE 331. Stable Matching Problem Problem Statement Algorithm Problem Definition Implementation Analysis.
Stable Matchings a.k.a. the Stable Marriage Problem
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Stable Matching Lecture 7: Oct 3. Matching A B C DE Boys Girls Today’s goal: to “match” the boys and the girls in a “good” way.
1 Chapter 1 Introduction: Some Representative Problems Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Bipartite Matching. Unweighted Bipartite Matching.
CSE 421 Algorithms Richard Anderson (for Anna Karlin) Winter 2006 Lecture 2.
The Stable Marriage Problem
Incentive compatibility in 2-sided matching markets
CSCI 256 Data Structures and Algorithm Analysis lecture 1 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Market Design and Analysis Lecture 2 Lecturer: Ning Chen ( 陈宁 )
COMP9007: Algorithms Stable Matching. What's in an algorithm? Algorithms can have huge impact For example – A report to the White House from 2010 includes.
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Chapter 1 Introduction: Some Representative Problems
Lower bound for the Stable Marriage Problem
Stable Marriage Problem
Lecture 4 CSE 331 Sep 7, 2016.
Introduction to the Design and Analysis of Algorithms
Chapter 10 Iterative Improvement
The Stable Marriage Problem
Apollo Weize Sun, Mar.10th, 2017.
Lecture 5 CSE 331 Sep 8, 2017.
Maximum Flow - Best algorithms
CSE 421: Introduction to Algorithms
Lecture 7 CSE 331 Sep 15, 2010.
Lecture 4 CSE 331 Sep 6, 2017.
Lecture 6 CSE 331 Sep 11, 2017.
Richard Anderson (for Anna Karlin) Winter 2006 Lecture 1
S. Raskhodnikova; based on slides by K. Wayne
Richard Anderson Autumn 2006 Lecture 1
CSE 421: Introduction to Algorithms
1.1 A First Problem: Stable Matching
Discrete Math for CS CMPSC 360 LECTURE 9 Last time: Strong induction
Blah blah blah.
Richard Anderson Autumn 2015 Lecture 1
Chapter 1 Introduction: Some Representative Problems
Matching and Resource Allocation
Richard Anderson Autumn 2016 Lecture 2
Richard Anderson Autumn 2006 Lecture 1
Lecture 6 CSE 331 Sep 12, 2011.
Lecture 9 CSE 331 Sep 15, 2014.
Lecture 6 CSE 331 Sep 12, 2016.
Richard Anderson Winter 2009 Lecture 2
Lecture 7 CSE 331 Sep 10, 2014.
Richard Anderson Winter 2019 Lecture 1
Piyush Kumar (Lecture 3: Stable Marriage)
Lecture 5 CSE 331 Sep 9, 2011.
Lecture 7 CSE 331 Sep 11, 2013.
Lecture 5 CSE 331 Sep 9, 2016.
CSC 421: Algorithm Design & Analysis
Richard Anderson Winter 2019 Lecture 2
CSC 421: Algorithm Design & Analysis
Richard Anderson Autumn 2015 Lecture 2
Richard Anderson Autumn 2019 Lecture 2
Presentation transcript:

Stable Matching

The Stable Marriage Problem (input) Goal. Given n men, n women, and their preference lists, 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. favorite least favorite favorite least favorite med school admissions has some distracting asymmetries: each college looking for several applicants, but each student looking for one college; there may be more (fewer) applicants than available slots for colleges; each student does not apply to every college "bare-bones" version of the problem; also a change of scenery preserves essential nature of problem; in particular our solution to this simplified version extends to more general case 1st 2nd 3rd 1st 2nd 3rd X A B C A Y X Z Y B A C B X Y Z Z A B C C X Y Z Men’s Preference lists Women’s Preference lists

The Stable Marriage Problem (input) Goal. Given n men, n women, and their preference lists, 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. med school admissions has some distracting asymmetries: each college looking for several applicants, but each student looking for one college; there may be more (fewer) applicants than available slots for colleges; each student does not apply to every college "bare-bones" version of the problem; also a change of scenery preserves essential nature of problem; in particular our solution to this simplified version extends to more general case Problem historically stated in terms of men/women but actually has broad applications Matching Medical students and Hospital residency places in US Auction mechanisms for sponsored internet search JUPAS ……

The Stable Marriage Problem (output) A set of n m-w pairs that constitute a perfect and stable matching Perfect matching: everyone is matched monogamously. Each man is matched to exactly one woman. Each woman is matched to exactly one man. Stability: no incentive for any unmatched pair to undermine assignment by joint action. In matching M, an unmatched pair m-w is unstable if man m and woman w prefer each other to their current partners. Unstable pair m-w could each improve by divorcing their current partners and getting together. Stable matching: perfect matching with no unstable pairs. Stable marriage/matching problem. Given the preference lists of n men and n women, find a stable matching (if one exists).

Stable Matching Problem Q. Is assignment X-C, Y-B, Z-A stable? favorite least favorite favorite least favorite 1st 2nd 3rd 1st 2nd 3rd X A B C A Y X Z Y B A C B X Y Z Z A B C C X Y Z Men’s Preference Lists Women’s Preference Lists

Stable Matching Problem Q. Is assignment X-C, Y-B, Z-A stable? No. X-B is an unstable pair. X and B prefer each other to their current matches (C and Y, respectively). favorite least favorite favorite least favorite 1st 2nd 3rd 1st 2nd 3rd X A B C A Y X Z Y B A C B X Y Z Z A B C C X Y Z Men’s Preference Lists Women’s Preference Lists

Stable Matching Problem Q. Is assignment X-A, Y-B, Z-C stable? A. Yes. favorite least favorite favorite least favorite 1st 2nd 3rd 1st 2nd 3rd X A B C A Y X Z Y B A C B X Y Z Z A B C C X Y Z Men’s Preference Lists Women’s Preference Lists

Stable Matching Problem Q. Do stable matchings always exist? A. Yes. (This is not obvious; we will prove later) Q. Is the stable matching unique? A. No. It is possible that there are several stable matchings favorite least favorite favorite least favorite Suffixes to check all 3 possible matchings: {A-B, C-D}, {A-C, B-D}, {A-D, B-C} 1st 2nd 3rd 1st 2nd 3rd X A B C A Y X Z Y B A C B X Y Z Z A B C C X Y Z Men’s Preference Lists Women’s Preference Lists

Propose-And-Reject Algorithm Propose-and-reject algorithm. [Gale-Shapley 1962] Intuitive algorithm that 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 } Shapley won Nobel Prize in Economics (partially) for this in 2012. Gale was not eligible because he had died in 2008.

Proof of Correctness: Termination Claim. Algorithm terminates after at most n2 iterations of while loop. Pf. A man starts from the first woman in his list and then continues in decreasing order of preference, without proposing to the same woman again. There are only n2 possible proposals. ▪ stable matching is unique for worst-case instance

Proof of Correctness: Perfection Perfection means that in the end of the algorithm each man and woman gets matched to exactly one partner. Observation 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. All men and women get matched. Pf. (by contradiction) Suppose, for sake of contradiction, that man Z is not matched upon termination of algorithm. Then some woman, say A, is not matched upon termination. By Observation 2, A was never proposed to. But, Z must have proposed to everyone, since he ends up single. ▪

Proof of Correctness: Stability Claim. No unstable pairs. Pf. (by contradiction) Suppose A-Z is an unstable pair: each prefers each other to their partner 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. ▪ men propose in decreasing order of preference S* A-Y B-Z . . . women only trade up

Efficient Implementation Efficient 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 or stack. Maintain two arrays wife[m], and husband[w]. if m matched to w then wife[m]=w and husband[w]=m Otherwise, set entry to 0 if unmatched Men proposing. For each man, maintain a list (linked list or array) of women, ordered by preference. could use stack instead of queue for list of free men

Efficient Implementation Women rejecting/accepting. Does woman w prefer man m to man m'? Naïve implementation requires O(n) time for this comparison. For each woman, create inverse of preference list of men. Constant time access for each query after O(n) preprocessing. Pref 1st 8 2nd 7 3rd 3 4th 4 5th 1 5 2 6 6th 7th 8th Inverse 1’ Amy prefers man 3 to 6 since inverse[3] < inverse[6] for i = 1 to n inverse[pref[i]] = i 2 7

Understanding the Solution Q. For a given problem instance, there may be several stable matchings. Recall that Gale-Shapely gives us freedom to decide which man proposes Do all executions of Gale-Shapley yield the same stable matching? If so, which one? A. Yes, it always returns the (unique) matching that is optimal for the men (proof omitted). Optimal for the men means: each man gets his best possible partner in any possible stable matching. Observation. Man and Women are not equivalent in the algorithm. Men propose, women accept/reject. To get a woman optimal algorthm have women propose and men accept/reject. Several variants of the problem exist with many applications.

JUPAS Admission Scheme

JUPAS Admission Scheme Applicants correspond to men that order their programme choices (which correspond to women). Differences w.r.t. to the basic version of the problem: Many more applicants than programme (places) A programme is matched to many (instead of one) applicants. # it’s matched to is its intake http://www.jupas.edu.hk/ The JUPAS computer system will match (the "iteration process") the order of preference you have assigned to your programme choice list with the position you have been placed in each merit order list of these programmes. You will then be made an offer of the highest priority on your programme choice list for which you have the required rating. In other words the matching is optimal (i.e., fair) for the applicants.