Top Banner
LAW February 2007 1 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)
29

The stable marriage problem an example

Jan 04, 2016

Download

Documents

Jerry King

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 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The stable marriage  problem                               an example

LAW February 2007 1

A 5/3 approximation algorithm for a hard case of stable marriage

Rob Irving

Computing Science DepartmentUniversity of Glasgow

(joint work with David Manlove)

Page 2: The stable marriage  problem                               an example

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

It's an unstable matching - (m1, w4) is a blocking pair

An example matching - {(m1, w1), (m2, w3), (m3, w2), (m4, w4)}

Page 3: The stable marriage  problem                               an example

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

Page 4: The stable marriage  problem                               an example

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)

Page 5: The stable marriage  problem                               an example

LAW February 2007 5

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: r8 r1 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 r7 r1

r5: h1 h4 h3

r6: h2 h3 h1

r7: h4 h1 h3

r8: h3 h4 h2

residents’ preferences hospitals’ quotas and preferences

It's unstable - (r3,h2) is a blocking pair

so is (r5,h1)

An example matching -

{(r1,h2),(r2,h3),(r3,h3),(r4,h4),(r5,h4),(r6,h2),(r7,h1),(r8,h4)}

Page 6: The stable marriage  problem                               an example

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: r8 r1 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 r7 r1

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)}

Page 7: The stable marriage  problem                               an example

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]

Page 8: The stable marriage  problem                               an example

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

Page 9: The stable marriage  problem                               an example

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)}

Page 10: The stable marriage  problem                               an example

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?

Page 11: The stable marriage  problem                               an example

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]

Page 12: The stable marriage  problem                               an example

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)

Page 13: The stable marriage  problem                               an example

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

Page 14: The stable marriage  problem                               an example

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

Page 15: The stable marriage  problem                               an example

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

Page 16: The stable marriage  problem                               an example

LAW February 2007 16

Algorithm SSMTI-APPROX: Phase 1 outcome

m1 : w6 w1 w2 w1 : m3 (m1 m6 m9)

m2 : w7 w10 w3 w2 : m1 (m3 m5 m7)

m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8)

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 (m5 m8 m10)

m5 : w2 w6 w4 w5 w5 : 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

Page 17: The stable marriage  problem                               an example

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 */

Page 18: The stable marriage  problem                               an example

LAW February 2007 18

Algorithm SSMTI-APPROX: Phase 2

m1 : w6 w1 w2 w1 : m3 (m1 m6 m9)

m2 : w7 w10 w3 w2 : m1 (m3 m5 m7)

m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8)

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 (m5 m8 m10)

m5 : w2 w6 w4 w5 w5 : 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

Page 19: The stable marriage  problem                               an example

LAW February 2007 19

Algorithm SSMTI-APPROX: Phase 2

m1 : w6 w1 w2 w1 : m3 (m1 m6 m9)

m2 : w7 w10 w3 w2 : m1 (m3 m5 m7)

m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8)

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 (m5 m8 m10)

m5 : w2 w6 w4 w5 w5 : 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

Page 20: The stable marriage  problem                               an example

LAW February 2007 20

Algorithm SSMTI-APPROX: Phase 2 outcome

m1 : w6 w1 w2 w1 : m3 (m1 m6 m9)

m2 : w7 w10 w3 w2 : m1 (m3 m5 m7)

m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8)

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 (m5 m8)

m5 : w2 w6 w4 w5 w5 : 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 w10: m10 m2

red people are engaged, black people are free

Page 21: The stable marriage  problem                               an example

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

Page 22: The stable marriage  problem                               an example

LAW February 2007 22

Algorithm SSMTI-APPROX: Phase 3

m1 : w6 w1 w2 w1 : m3 (m1 m6 m9)

m2 : w7 w10 w3 w2 : m1 (m3 m5 m7)

m3 : w6 w2 w8 w9 w1 w3 : m2 (m4 m6 m8)

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 (m5 m8)

m5 : w2 w6 w4 w5 w5 : 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 w10: m10 m2

Page 23: The stable marriage  problem                               an example

LAW February 2007 23

Algorithm SSMTI-APPROX: Phase 3

m1 : w6 w1 w2 w1 : m3 m6 m9 m1

m2 : w7 w10 w3 w2 : m1 m7 m3 m5

m3 : w6 w2 w8 w9 w1 w3 : m2 m6 m8 m4

m4 : w7 w9 w8 w3 w4 w4 : m4 m9 m8 m5

m5 : w2 w6 w4 w5 w5 : 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 w10: m10 m2

Page 24: The stable marriage  problem                               an example

LAW February 2007 24

Algorithm SSMTI-APPROX: Phase 3

m1 : w6 w1 : m6 m9

m2 : w7 w2 : m7 m3 m5

m3 : w6 w2 w8 w3 : m8

m4 : w7 w9 w4 : m9 m5

m5 : w2 w6 w4 w5 w5 : m5

m6 : w1 w6 : m1 m3 m5

m7 : w2 w7 : m2 m4 m10

m8 : w3 w8 : m3

m9 : w1 w4 w9 : m4

m10: w7 w10 w10: m10

A stable matching of size 10

Page 25: The stable marriage  problem                               an example

LAW February 2007 25

Visualising the performance guarantee

Engaged men

Free men

Extramen

Extrawomen

M

A

A

Men Women

M = maximum cardinality stable matching

A = stable matching found by algorithm SSMTI-APPROX

Extra men are matched in M but not in A

Extra women must alsobe matched in A

Page 26: The stable marriage  problem                               an example

LAW February 2007 26

Visualising the performance guarantee

Engaged men

Free men

Extramen

Extrawomen

M

A

A

Men Women

M = maximum cardinality stable matching

A = stable matching found by algorithm SSMTI-APPROX

M

s

r-s

s

s s

r-s

r-s

A

These women mustbe matched in A

x

Page 27: The stable marriage  problem                               an example

LAW February 2007 27

Visualising the performance guarantee

Extramen

Extrawomen

M

A

A

Men Women

Inequalities:

(i) |A| ≥ |M| - r

(ii) |A| ≥ |M| - x (a consequence of Phase 2)

(iii) |A| ≥ x + r – s

(iv) |A| ≥ r + s

Algebra gives |M| ≤ 5|A|/3

M

s

r-s

s

s s

r-s

r-s

A

These women mustbe matched in A

x

Page 28: The stable marriage  problem                               an example

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

Page 29: The stable marriage  problem                               an example

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 5The blue matching – size 8 – is also stable