1 / 29

The stable marriage problem an example

A 5/3 approximation algorithm for a hard case of stable marriage Rob Irving Computing Science Department University of Glasgow (joint work with David Manlove ). The stable marriage problem an example. m 1 : w 2 w 4 w 1 w 3 w 1 : m 2 m 1 m 4

jerry-king
Télécharger la présentation

The stable marriage problem an example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A 5/3 approximation algorithm for a hard case of stable marriageRob IrvingComputing Science DepartmentUniversity of Glasgow(joint work with David Manlove) LAW February 2007

  2. The stable marriage problem an example m1: w2 w4 w1 w3 w1: m2 m1 m4 m2: w3 w1 w4 w2: m4 m3 m1 m3: w2 w3 w3: m1 m4 m3 m2 m4: w4 w1 w3 w2 w4: m2 m1 m4 men’s preferences women’s preferences An example matching - {(m1, w1), (m2, w3), (m3, w2), (m4, w4)} It's an unstable matching - (m1, w4)is a blocking pair LAW February 2007

  3. The stable marriage problem an example m1: w2 w4 w1 w3 w1: m2 m1 m4 m2: w3 w1 w4 w2: m4 m3 m1 m3: w2 w3 w3: m1 m4 m3 m2 m4: w4 w1 w3 w2 w4: m2 m1 m4 men’s preferences women’s preferences {(m1, w4), (m2, w1), (m3, w2), (m4, w3)}- a stable matching LAW February 2007

  4. Stable marriage facts • There is always at least one stable matching • The Gale-Shapley algorithm finds such a matching [Gale & Shapley 1962] • There may be many stable matchings • exponentially many in some cases [Knuth 1976] • All stable matchings have the same size and involve the same people [Gale & Sotomayor 1985] • The version of stable marriage described here is usually called "Stable Marriage with Incomplete Lists" (SMI) LAW February 2007

  5. The Hospitals / Residents probleman example r1: h4 h2 h1 h1: 2: r2 r7 r1 r5 r4 r6 r3 r2: h3 h1 h4 h2: 2: r8r1 r3 r6 r3: h2 h3 h1 h3: 2: r3 r5 r2 r6 r8 r7 r4 r4: h3 h4 h1 h4: 3: r5 r8 r2 r4 r7r1 r5: h1 h4 h3 r6: h2 h3 h1 r7: h4 h1 h3 r8: h3 h4 h2 residents’ preferences hospitals’ quotas and preferences An example matching - {(r1,h2),(r2,h3),(r3,h3),(r4,h4),(r5,h4),(r6,h2),(r7,h1),(r8,h4)} It's unstable - (r3,h2)is a blocking pair so is(r5,h1) LAW February 2007

  6. The Hospitals / Residents problem an example r1: h4 h2 h1 h1: 2: r2 r7 r1 r5 r4 r6 r3 r2: h3 h1 h4 h2: 2: r8r1 r3 r6 r3: h2 h3 h1 h3: 2: r3 r5 r2 r6 r8 r7 r4 r4: h3 h4 h1 h4: 3: r5 r8 r2 r4 r7r1 r5: h1 h4 h3 r6: h2 h3 h1 r7: h4 h1 h3 r8: h3 h4 h2 residents’ preferences hospitals’ capacities and preferences A stable matching {(r1,h2),(r2,h3),(r3,h2),(r4,h4),(r5,h1),(r6,h3),(r7,h4),(r8,h4)} LAW February 2007

  7. Stable matching in practice • The National Resident Matching Program (NRMP) • a scheme that each year matches over 30,000 graduating medical students (residents) to hospitals in the US • Since the early 1950s, the NRMP has used essentially the Gale-Shapley algorithm [Roth 1984] • Owes its success to the stability of its matching • Similar matching schemes in other countries and other contexts • including the ‘SFAS’ scheme in Scotland [Irving 1998] LAW February 2007

  8. Ties in the preference lists • Stable Marriage with Ties and Incomplete Lists (SMTI) • Hospitals / Residents with Ties (HRT) • Each preference list can contain one or more ties • arguably a more realistic model in practical applications • large hospitals cannot reasonably differentiate among all of their many applicants • Now, a pair blocks a matching only if both members of the pair would be better off if matched together • sometimes called weak stability • To find a stable matching, break the ties arbitrarily and apply the Gale-Shapley algorithm • But now – stable matchings can have different sizes LAW February 2007

  9. SMTI - an illustration m1: w3 (w1 w2) w4 w1: m1 m2 m3 m4 m2: w1 w3 w2: m1 m4 m3: w3 w1 w3: m4 m3 m1 m2 m4: w1 (w3 w4) w2 w4: m4 m1 men’s preferences women’s preferences A stable matching of size 4: {(m1, w2), (m2, w1), (m3, w3), (m4, w4)} A stable matching of size 2: {(m1, w1), (m4, w3)} LAW February 2007

  10. A hard stable matching problem • For Stable Marriage (and therefore Hospitals Residents) with incomplete lists and ties • It's NP-hard to find a maximum cardinality stable matching • even if • all the ties are on one side, and • a tie occurs only at the end of a list, and • all ties are of length 2 • [Iwama, Manlove et al 1999] • [Manlove, Irving et al 2002] • Question: what about polynomial-time approximation? • Can we decide on a 'good' way to break the ties? LAW February 2007

  11. Approximating maximum cardinality SMTI • Trivially 2-approximable • max cardinality ≤ 2 * min cardinality • But APX-complete • [HIIMMMS 2003] • And not approximable within 21/19 (unless P = NP) • 13/7-approximable if all ties are of length 2 • 8/5-approximable if all ties are of length 2 and on just one side • 10/7 approximable (randomised) if, in addition, ≤ 1 tie per list • [Halldórsson et al 2003] • 15/8 approximable in the general case • [Iwama et al, SODA 2007] LAW February 2007

  12. A case of practical interest • 'Special' HRT (SHRT) • residents' preference lists are strict • hospitals' lists can contain one tie, of arbitrary length, at the end • reflects the situation where hospitals are asked to rank as many candidates as they reasonably can, then place all others in a single tie at the end of their list • 'Special' SMTI (SSMTI) • men's preference lists are strict • women's lists can contain one tie, of arbitrary length, at the end • MAX-SSMTI is NP-hard (and so MAX-SHRT is too) LAW February 2007

  13. Approximating Max-SSMTI and MAX-SHRT • There is a polynomial-time approximation algorithm for maximum cardinality SSMTI ( and for SHRT) with an approximation guarantee of 5/3. • Algorithm is quite different from the approach used by previous approximation algorithms for variants of MAX-SMTI • Consists of three phases: • Phase 1 : apply a tailored version of the Gale-Shapley algorithm • Phase 2 : find a maximum cardinality matching of selected subsets • Phase 3 : break the ties according to a particular rule, then apply standard Gale-Shapley LAW February 2007

  14. Algorithm SSMTI-APPROX: Phase 1 assign each person to be free; /* free = not engaged */ while (some woman w is free) and (w has a non-empty list) and (w has an untied man m at the head of her list) { w proposes, and becomes engaged to m; /* m can never have a 'worse' mate than w; in particular, m is matched in every stable matching */ for each successor w' of w on m's list { if w' is engaged to m break the engagement; delete the pair (m,w') from the preference lists; } } Fact: engaged men are matched in every stable matching LAW February 2007

  15. Algorithm SSMTI-APPROX: Phase 1 m1 : w6 w1 w2 w10 w5 w8 w1 : m2 m3 (m1 m6 m9) m2 : w7 w10 w3 w1 w6 w2 : m1 (m3 m5 m7) m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8) m4 : w7 w9 w8 w3 w4 w5 w4 : m4 m9 (m5 m8 m10) m5 : w2 w6 w4 w5 w10 w5 : m4 m1 m5 m7 m6 : w1 w3 w6 : m2 (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : m1 (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10 w4 w10: m5 (m1 m2 m10) men’s preferences women’s preferences LAW February 2007

  16. Algorithm SSMTI-APPROX: Phase 1 outcome m1: w6 w1 w2w1: m3 (m1 m6 m9) m2: w7 w10 w3w2: m1 (m3 m5 m7) m3: w6 w2 w8 w9 w1w3: m2 (m4 m6 m8) m4: w7 w9 w8 w3 w4w4: m4 m9 (m5 m8 m10) m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10 w4 w10: (m2 m10) red people are engaged, black people are free LAW February 2007

  17. Algorithm SSMTI-APPROX: Phase 2 Find a maximum cardinality matching F of free men and women; for each pair (m,w)  F promote m from the tie to the head of w's list; reactivate phase 1; /* essentially extends the sets of engaged men and women */ LAW February 2007

  18. Algorithm SSMTI-APPROX: Phase 2 m1: w6 w1 w2w1: m3 (m1 m6 m9) m2: w7 w10 w3w2: m1 (m3 m5 m7) m3: w6 w2 w8 w9 w1w3: m2 (m4 m6 m8) m4: w7 w9 w8 w3 w4w4: m4 m9 (m5 m8 m10) m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10 w4 w10: (m2 m10) red people are engaged, black people are free LAW February 2007

  19. Algorithm SSMTI-APPROX: Phase 2 m1: w6 w1 w2w1: m3 (m1 m6 m9) m2: w7 w10 w3w2: m1 (m3 m5 m7) m3: w6 w2 w8 w9 w1w3: m2 (m4 m6 m8) m4: w7 w9 w8 w3 w4w4: m4 m9 (m5 m8 m10) m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10 w4 w10: m10 m2 red people are engaged, black people are free LAW February 2007

  20. Algorithm SSMTI-APPROX: Phase 2 outcome m1: w6 w1 w2w1: m3 (m1 m6 m9) m2: w7 w10 w3w2: m1 (m3 m5 m7) m3: w6 w2 w8 w9 w1w3: m2 (m4 m6 m8) m4: w7 w9 w8 w3 w4w4: m4 m9 (m5 m8) m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10w10: m10 m2 red people are engaged, black people are free LAW February 2007

  21. Algorithm SSMTI-APPROX: Phase 3 • for each woman w • break the tie (if any) in w's list, • placing the free men ahead of the engaged men; • reactivate phase 1; /* now just classical Gale-Shapley */ • return the set of engaged pairs; • This is obviously a stable matching • All we have done is decide how to break the ties and then apply Gale-Shapley LAW February 2007

  22. Algorithm SSMTI-APPROX: Phase 3 m1: w6 w1 w2w1: m3 (m1m6 m9) m2: w7 w10 w3w2: m1 (m3 m5m7) m3: w6 w2 w8 w9 w1w3: m2 (m4m6 m8) m4: w7 w9 w8 w3 w4w4: m4 m9 (m5m8) m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : (m1 m3 m5) m7 : w2 w5 w7 : (m2 m4 m10) m8 : w3 w4 w8 : (m3 m4) m9 : w1 w4 w9 : (m3 m4) m10: w7 w10w10: m10 m2 LAW February 2007

  23. Algorithm SSMTI-APPROX: Phase 3 m1: w6 w1 w2w1: m3 m6 m9 m1 m2: w7 w10 w3w2: m1 m7 m3 m5 m3: w6 w2 w8 w9 w1w3: m2 m6 m8 m4 m4: w7 w9 w8 w3 w4w4: m4 m9 m8 m5 m5: w2 w6 w4 w5w5: m5 m7 m6 : w1 w3 w6 : m1 m3 m5 m7 : w2 w5 w7 : m2 m4 m10 m8 : w3 w4 w8 : m3 m4 m9 : w1 w4 w9 : m3 m4 m10: w7 w10w10: m10 m2 LAW February 2007

  24. Algorithm SSMTI-APPROX: Phase 3 m1: w6w1: m6 m9 m2: w7w2: m7 m3 m5 m3: w6 w2 w8w3: m8 m4: w7 w9w4: m9 m5 m5: w2 w6 w4 w5w5: m5 m6: w1w6: m1 m3 m5 m7: w2w7: m2 m4 m10 m8: w3w8: m3 m9: w1 w4w9: m4 m10: w7 w10w10: m10 A stable matching of size 10 LAW February 2007

  25. Visualising the performance guarantee Extra men are matched in M but not in A A Engaged men Extra women must also be matched in A Extra women M Extra men M = maximum cardinality stable matching A = stable matching found by algorithm SSMTI-APPROX Free men A Women Men LAW February 2007

  26. Visualising the performance guarantee These women must be matched in A M s s A Engaged men x A s Extra women M r-s s Extra men M = maximum cardinality stable matching A = stable matching found by algorithm SSMTI-APPROX r-s Free men A r-s Women Men LAW February 2007

  27. Visualising the performance guarantee These women must be matched in A M s s A • Inequalities: • |A| ≥ |M| - r • |A| ≥ |M| - x (a consequence of Phase 2) • |A| ≥ x + r – s • |A| ≥ r + s • Algebra gives |M| ≤ 5|A|/3 x A s Extra women M r-s s Extra men r-s A r-s Women Men LAW February 2007

  28. Further observations • The algorithm extends in a (fairly) straightforward way to SHRT • with the same performance guarantee of 5/3 • We have no example where the 5/3 bound is realised • The worst case we have is 8/5 • so maybe a sharper analysis could improve the bound • Open question • Can these or similar techniques give good approximation algorithms for more general cases? • e.g. when men also can have a tie at the end of their list LAW February 2007

  29. A bad case for Algorithm SSMTI-APPROX m1 : w5 w2 w1 : m3 (m8 m5) m2 : w6 w3 w2 : m1 m6 m3 : w5 w7 w8 w1 w3 : m2 m7 m4 : w6 w8 w7 w4 w4 : m4 m8 m5 : w1 w5 : (m3 m1) m6 : w2 w6 : (m4 m2) m7 : w3 w7 : (m4 m3) m8 : w1 w4 w8 : (m3 m4) Algorithm can return the red matching – size 5 The blue matching – size 8 – is also stable LAW February 2007

More Related