the stable roommates problem and some extensions david manlove university of glasgow

of 102 /102
L4 #1 The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science Supported by EPSRC grant GR/M13329 nd Nuffield Foundation award NUF-NAL-0

Upload: patia

Post on 08-Jan-2016

45 views

Category:

Documents


1 download

Embed Size (px)

DESCRIPTION

The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science. Supported by EPSRC grant GR/M13329 and Nuffield Foundation award NUF-NAL-02. Stable Roommates (SR): definition Input: 2 n persons; each person ranks all 2 n- 1 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #1

The Stable Roommates Problemand Some Extensions

David Manlove

University of GlasgowDepartment of Computing Science

Supported by EPSRC grant GR/M13329and Nuffield Foundation award NUF-NAL-02

Page 2: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #2

Stable Roommates (SR): definition

Input: 2n persons; each person ranks all 2n-1other persons in strict order

Output: a stable matching

Definitions

A matching is a set of n disjoint pairs of persons

A blocking pair of a matching M is a pair of persons {p,q}M such that:

• p prefers q to his partner in M, and• q prefers p to his partner in M A matching is stable if it admits no blocking pair

Page 3: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #3

Stable Roommates (SR): definition

Input: 2n persons; each person ranks all 2n-1other persons in strict order

Output: a stable matching

Definitions

A matching is a set of n disjoint pairs of persons

A blocking pair of a matching M is a pair of persons {p,q}M such that:

• p prefers q to his partner in M, and• q prefers p to his partner in M A matching is stable if it admits no blocking pair

Example SR instance I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Page 4: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #4

Stable Roommates (SR): definition

Input: 2n persons; each person ranks all 2n-1other persons in strict order

Output: a stable matching

Definitions

A matching is a set of n disjoint pairs of persons

A blocking pair of a matching M is a pair of persons {p,q}M such that:

• p prefers q to his partner in M, and• q prefers p to his partner in M A matching is stable if it admits no blocking pair

Example SR instance I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Page 5: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #5

Stable Roommates (SR): definition

Input: 2n persons; each person ranks all 2n-1other persons in strict order

Output: a stable matching

Definitions

A matching is a set of n disjoint pairs of persons

A blocking pair of a matching M is a pair of persons {p,q}M such that:

• p prefers q to his partner in M, and• q prefers p to his partner in M A matching is stable if it admits no blocking pair

Example SR instance I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

The matching is not stable as {1,3} blocks.

Page 6: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #6

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Page 7: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #7

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

Page 8: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #8

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

Page 9: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #9

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

Page 10: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #10

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

1: 3 2 4 2: 1 3 4 3: 2 1 4 4: 1 2 3

Page 11: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #11

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

1: 3 2 4 2: 1 3 4 3: 2 1 4 4: 1 2 3

Page 12: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #12

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

1: 3 2 4 1: 3 2 4 2: 1 3 4 2: 1 3 4 3: 2 1 4 3: 2 1 4 4: 1 2 3 4: 1 2 3

Page 13: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #13

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

1: 3 2 4 1: 3 2 4 2: 1 3 4 2: 1 3 4 3: 2 1 4 3: 2 1 4 4: 1 2 3 4: 1 2 3

Page 14: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #14

Stable matching in I1: 1: 3 2 42: 4 3 13: 2 1 44: 1 3 2

Example SR instance I2: 1: 3 2 42: 1 3 43: 2 1 44: 1 2 3

1: 3 2 4 1: 3 2 4 2: 1 3 4 2: 1 3 4 3: 2 1 4 3: 2 1 4 4: 1 2 3 4: 1 2 3

The three matchings containing the pairs {1,4}, {2,4}, {3,4} are blocked by the pairs {1,2}, {2,3}, {3,1} respectively.

instance I2 has no stable matching.

Page 15: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #15

Stable marriage (SM) problem

SM is a special case of SR

Input: n men and n women; each person ranks all n members of the opposite sex in orderOutput: a stable matching

Definitions:

A matching is a set of n disjoint (man,woman) pairs

A blocking pair of a matching M is an unmatched (man,woman) pair (m,w) such that:

• m prefers w to his partner in M, and• w prefers m to her partner in M A matching is stable if it admits no blocking pair

• Every instance of SM admits a stable matching• Such a matching can be found by an efficient algorithm known as the Gale/Shapley algorithm

Page 16: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #16

Reduction from SM to SR

An instance I of SM can be reduced to an instance J of SR such that set of stable matchings in I = set of stable matchings in J

SM instance I:U={m1, m2,..., mn} is the set of men, and W={w1, w2,..., wn} is the set of women

SR instance J:People comprise men in U and women in W

mi’s list in J is his list in I together with the men in U\{mi} appended in arbitrary order.

wi’s list in J is her list in I together with the women in W\{wi} appended in arbitrary order.

Proposition: Set of stable matchings in I = set of stable matchings in J

Open question: can we reduce SR to SM?

Page 17: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #17

Efficient algorithm for SR

• Knuth (1976): is there an efficient algorithm for deciding whether there exists a stable matching, given an instance of SR?

• Irving (1985) “An efficient algorithm for the ‘Stable Roommates’ Problem”, Journal of Algorithms, 6:577-595

given an instance of SR, decides whether a stable matching exists; if so, finds one

• Algorithm is in two phases

Phase 1: similar to GS algorithm for SM Phase 2: elimination of “rotations”

• Phase 1: if p proposes to q, p becomes assigned to q, and q becomes assigned from p “assigned” relation is not necessarily symmetric if anyone’s preference list becomes empty, no stable matching exists

Page 18: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #18

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

1: 4 6 2 5 32: 6 3 5 1 43: 4 5 1 6 24: 2 6 5 1 35: 4 2 3 6 16: 5 1 4 2 3

Page 19: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #19

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 32: 6 3 5 1 43: 4 5 1 6 24: 2 6 5 1 35: 4 2 3 6 16: 5 1 4 2 3

Page 20: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #20

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 43: 4 5 1 6 24: 2 6 5 1 3 15: 4 2 3 6 16: 5 1 4 2 3

p=1

Page 21: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #21

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 43: 4 5 1 6 24: 2 6 5 1 3 15: 4 2 3 6 16: 5 1 4 2 3

p=1

Page 22: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #22

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 43: 4 5 1 6 24: 2 6 5 1 3 15: 4 2 3 6 16: 5 1 4 2 3

p=1

Page 23: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #23

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 63: 4 5 1 6 24: 2 6 5 1 3 15: 4 2 3 6 16: 5 1 4 2 3 2

p=2

Page 24: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #24

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 63: 4 5 1 6 24: 2 6 5 1 3 15: 4 2 3 6 16: 5 1 4 2 3 2

p=2

Page 25: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #25

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 63: 4 5 1 6 2 54: 2 6 5 1 3 15: 4 2 3 6 1 36: 5 1 4 2 3 2

p=3

Page 26: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #26

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 63: 4 5 1 6 2 54: 2 6 5 1 3 15: 4 2 3 6 1 36: 5 1 4 2 3 2

p=3

Page 27: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #27

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 6 43: 4 5 1 6 2 54: 2 6 5 1 3 2 15: 4 2 3 6 1 36: 5 1 4 2 3 2

p=4

Page 28: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #28

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 42: 6 3 5 1 4 6 43: 4 5 1 6 2 54: 2 6 5 1 3 2 5/15: 4 2 3 6 1 4 36: 5 1 4 2 3 2

p=5

Page 29: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #29

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 32: 6 3 5 1 4 6 43: 4 5 1 6 2 54: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 2

p=5

Page 30: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #30

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 62: 6 3 5 1 4 6 43: 4 5 1 6 2 54: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 1/2

p=1

Page 31: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #31

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 62: 6 3 5 1 4 43: 4 5 1 6 2 54: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 1

p=1

Page 32: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #32

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 62: 6 3 5 1 4 3 43: 4 5 1 6 2 5 24: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 1

p=2

Page 33: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #33

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 6 62: 6 3 5 1 4 3 43: 4 5 1 6 2 5 24: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 1 1

p=6

Page 34: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #34

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 4 6 2 5 3 6 62: 6 3 5 1 4 3 43: 4 5 1 6 2 5 24: 2 6 5 1 3 2 55: 4 2 3 6 1 4 36: 5 1 4 2 3 1 1

p=6

Page 35: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #35

Phase 1 of Algorithm SR

assign everyone to be free;while ((some person p has a non-empty list) and (p is not assigned to anyone)) {

q := first person on p’s list;/* p proposes to q */assign p to q; /* q is assigned from p */for (each successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r};}

}

assigned to / from1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Page 36: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #36

Some notation

T denotes the set of preference lists after Phase 1fT(x) denotes the first person on x’s listsT(x) denotes the second person on x’s listlT(x) denotes the last person on x’s list

At the termination of Phase 1:

1. y= fT(x) if and only if x=lT(y)2. the pair {x,y} is absent if and only if x prefers lT(x) to y, or y prefers lT(y) to x3. no preference list is empty

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Page 37: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #37

Stable tables

Any set of preference lists satisfying 1, 2 and 3above is called a stable table

Lemma: Suppose that, during the execution of Phase 1, no person’s list becomes empty. Let T denote the set of preference lists at this point. Then T is a stable table.

Lemma: Suppose that, during the execution of Phase 1, some person’s list becomes empty. Then no stable matching exists.

So if somebody’s list becomes empty during Phase 1, we can immediately halt.

Otherwise, proceed to Phase 2…

Page 38: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #38

Phase 2 of the algorithm

Deals with the fact that the assignment relation isnot symmetric in general

involves rotation eliminations

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Let T be a stable table, and let =(x0, y0), (x1, y1), …, (xr-1, yr-1) be a sequence of pairs such that yi=fT(xi) and yi+1=sT(xi) for all i (0 i r-1).

Then is called a rotation exposed in T.

Example: =(x0, y0), (x1, y1) = (3,5), (4,2)y0 = 5 = fT(x0) y1 = 2 = fT(x1)y1 = 2 = sT(x0) y0 = 5 = sT(x1)

Page 39: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #39

Phase 2 of the algorithm

Deals with the fact that the assignment relation isnot symmetric in general

involves rotation eliminations

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Let T be a stable table, and let =(x0, y0), (x1, y1), …, (xr-1, yr-1) be a sequence of pairs such that yi=fT(xi) and yi+1=sT(xi) for all i (0 i r-1).

Then is called a rotation exposed in T.

Example: =(x0, y0), (x1, y1) = (3,5), (4,2)y0 = 5 = fT(x0) y1 = 2 = fT(x1)y1 = 2 = sT(x0) y0 = 5 = sT(x1)

Page 40: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #40

Phase 2 of the algorithm

Deals with the fact that the assignment relation isnot symmetric in general

involves rotation eliminations

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Let T be a stable table, and let =(x0, y0), (x1, y1), …, (xr-1, yr-1) be a sequence of pairs such that yi=fT(xi) and yi+1=sT(xi) for all i (0 i r-1).

Then is called a rotation exposed in T.

Example: =(x0, y0), (x1, y1) = (3,5), (4,2)y0 = 5 = fT(x0) y1 = 2 = fT(x1)y1 = 2 = sT(x0) y0 = 5 = sT(x1)

Page 41: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #41

Phase 2 of the algorithm

Deals with the fact that the assignment relation isnot symmetric in general

involves rotation eliminations

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Let T be a stable table, and let =(x0, y0), (x1, y1), …, (xr-1, yr-1) be a sequence of pairs such that yi=fT(xi) and yi+1=sT(xi) for all i (0 i r-1).

Then is called a rotation exposed in T.

Example: =(x0, y0), (x1, y1) = (3,5), (4,2)y0 = 5 = fT(x0) y1 = 2 = fT(x1)y1 = 2 = sT(x0) y0 = 5 = sT(x1)

Page 42: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #42

Phase 2 of the algorithm

Deals with the fact that the assignment relation isnot symmetric in general

involves rotation eliminations

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

Let T be a stable table, and let =(x0, y0), (x1, y1), …, (xr-1, yr-1) be a sequence of pairs such that yi=fT(xi) and yi+1=sT(xi) for all i (0 i r-1).

Then is called a rotation exposed in T.

Example: =(x0, y0), (x1, y1) = (3,5), (4,2)y0 = 5 = fT(x0) y1 = 2 = fT(x1)y1 = 2 = sT(x0) y0 = 5 = sT(x1)

Page 43: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #43

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 5 24: 2 5 2 55: 4 2 3 4 36: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that:

Page 44: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #44

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3 43: 5 2 24: 2 5 2 55: 4 2 3 46: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that: y0 rejects x0

Page 45: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #45

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3

3/43: 5 2 2 24: 2 5 2 55: 4 2 3 46: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that: y0 rejects x0 , so that x0 proposes to y1

Page 46: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #46

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3 33: 5 2 2 24: 2 5 55: 4 2 3 46: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that: y0 rejects x0 , so that x0 proposes to y1 , then y1 rejects x1

Page 47: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #47

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3 33: 5 2 2 24: 2 5 5 55: 4 2 3 4 46: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that: y0 rejects x0 , so that x0 proposes to y1 , then y1 rejects x1 , so that x1 proposes to y0

Page 48: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #48

Some intuition behind rotations

The rotation =(x0, y0), (x1, y1) = (3,5), (4,2) isexposed in T

assigned to / from

1: 6 6 62: 3 5 4 3 33: 5 2 2 24: 2 5 5 55: 4 2 3 4 46: 1 1 1

x0 has a preference list of length >1, and so is notassigned to / from the same person

The effect of is equivalent to supposing that: y0 rejects x0 , so that x0 proposes to y1 , then y1 rejects x1 , so that x1 proposes to y0

This is called the elimination of

We denote by T / the preference lists remainingafter elimination of

Page 49: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #49

This is T / : assigned to /

from1: 6 6 62: 3 3 33: 2 2 24: 5 5 55: 4 4 46: 1 1 1

It corresponds to the matching {1,6}, {2,3}, {4,5}

Lemma: If T is a stable table with containinga list with at least two entries, then there is arotation exposed in T

Lemma: If T is a stable table, and T / containsno empty lists, then T / is a stable table

Lemma: If there is a stable matching containedin T and is a rotation exposed in T, then thereis a stable matching contained in T /

Page 50: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #50

Phase 2 of Algorithm SR

T := preference lists generated by Phase 1;while ((some list in T is of length >1) and (no list in T is empty)) {

find a rotation exposed in T;T := T / ;

}if (some list in T is empty)

output “no stable matching exists”;else

output T; /* which is a stable matching */

Algorithm found stable matching {1,6}, {2,3}, {4,5}

1: 4 6 2 5 3 2: 6 3 5 1 4

3: 4 5 1 6 2 4: 2 6 5 1 3 5: 4 2 3 6 1 6: 5 1 4 2 3

Algorithm takes cn2 steps for some constant c

Page 51: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #51

Stable Roommates with Ties (SRT)

• Ties are permitted in any preference list

Example SRT instance: 1: (2 3) 4 2: 1 3 4 3: (1 4) 2 4: 3 1 2

• More than one stability definition is possible

Page 52: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #52

Stable Roommates with Ties (SRT)

• Ties are permitted in any preference list

Example SRT instance: 1: (2 3) 4 2: 1 3 4 3: (1 4) 2 4: 3 1 2

• More than one stability definition is possible

Super-stability

A matching M in instance J of SRT is super-stable if there is no pair {p,q}M such that

• p strictly prefers q to his partner in M or is indifferent between them• q strictly prefers p to his partner in M or is indifferent between them

In any instance of SRT with no ties, super-stabilityis the same as normal stabilityRecall: an SR instance can have no stable matching

Page 53: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #53

Stable Roommates with Ties (SRT)

• Ties are permitted in any preference list

Example SRT instance: 1: (2 3) 4 2: 1 3 4 3: (1 4) 2 4: 3 1 2

• More than one stability definition is possible

Super-stability

A matching M in instance J of SRT is super-stable if there is no pair {p,q}M such that

• p strictly prefers q to his partner in M or is indifferent between them• q strictly prefers p to his partner in M or is indifferent between them

In any instance of SRT with no ties, super-stabilityis the same as normal stabilityRecall: an SR instance can have no stable matching

Page 54: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #54

Stable Roommates with Ties (SRT)

• Ties are permitted in any preference list

Example SRT instance: 1: (2 3) 4 2: 1 3 4 3: (1 4) 2 4: 3 1 2

• More than one stability definition is possible

Super-stability

A matching M in instance J of SRT is super-stable if there is no pair {p,q}M such that

• p strictly prefers q to his partner in M or is indifferent between them• q strictly prefers p to his partner in M or is indifferent between them

In any instance of SRT with no ties, super-stabilityis the same as normal stabilityRecall: an SR instance can have no stable matching

Page 55: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #55

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

Page 56: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #56

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 57: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #57

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 58: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #58

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 59: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #59

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 60: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #60

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 61: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #61

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 62: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #62

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 63: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #63

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 64: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #64

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 65: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #65

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 66: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #66

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 67: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #67

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 68: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #68

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 69: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #69

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 70: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #70

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 71: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #71

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 72: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #72

SRT: super-stability (cont)

• Algorithm for finding a super-stable matching if one exists, given an SRT instance

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

• Algorithm is in two phases

Phase 1: similar to SR case– sequence of proposals and deletions– persons become provisionally assigned to / assigned from other persons

Example SRT instance:

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

Page 73: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #73

Phase 1 of Algorithm SRT-Super

while ((some person p has a non-empty list and (p is not assigned to anyone)) {

for (each q at the head of p's list) {/* p proposes to q */assign p to q; /* q is assigned from p */for (each strict successor r of p in q's list) {

if (r is assigned to q)break the assignment;

delete the pair {q,r}; }if ( 2 persons are assigned to q) {

break all assignments to q;for (each r tied with p in q's list)

delete the pair {q,r}; }

}}

Page 74: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #74

After Phase 1:

• If every person’s list has length 1 then the lists specify a super-stable matching

• If some person’s list is empty then no super-stable matching exists

• If nobody’s list is empty and some person’s list has length >1 then we move on to Phase 2

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 75: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #75

After Phase 1:

• If every person’s list has length 1 then the lists specify a super-stable matching

• If some person’s list is empty then no super-stable matching exists

• If nobody’s list is empty and some person’s list has length >1 then we move on to Phase 2

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Phase 2: “reject and reactivate Phase 1”

– select a person p whose list is of length >1– let p be rejected by first person on his list– reactivate Phase 1

Page 76: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #76

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 77: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #77

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 78: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #78

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 79: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #79

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 80: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #80

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty

Page 81: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #81

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 82: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #82

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 83: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #83

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 84: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #84

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 85: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #85

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 86: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #86

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

Page 87: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #87

• Let person 2 be rejected by person 3

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– After Phase 1, person 3’s list is empty– Reinstate the preference lists to their status after Phase 1– Let p reject the last person on his list– Reactivate Phase 1

• Let person 2 reject person 4

1: 62: 3 5 43: 5 24: 2 55: 4 2 36: 1

– All lists now have length 1

Page 88: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #88

1: 62: 33: 24: 55: 46: 1

– All lists have length 1

1: (6 4) 2 5 32: 6 3 5 1 43: (5 4) 1 6 24: 2 6 5 (1 3)5: 4 2 3 6 16: 5 1 4 2 3

– {1,6}, {2,3}, {4,5} is a super-stable matching

Page 89: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #89

Phase 2 of Algorithm SRT-Super

T := preference lists generated by Phase 1;while (some person p’s list in T is of length > 1) {

let q be the person assigned from p ; let r be the person assigned to p;

form T1 from T by letting p be rejected by q;form T2 from T by letting p reject r;

reactivate Phase 1 on T1;reactivate Phase 1 on T2;if (no list in T1 is empty)

T := T1;else if (no list in T2 is empty)

T := T2;else

output “no super-stable matching exists”;}output T; /* which is a super-stable matching */

Page 90: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #90

Phase 2 of Algorithm SRT-Super

T := preference lists generated by Phase 1;while (some person p’s list in T is of length > 1) {

let q be the person assigned from p ; let r be the person assigned to p;

form T1 from T by letting p be rejected by q;form T2 from T by letting p reject r;

reactivate Phase 1 on T1;reactivate Phase 1 on T2;if (no list in T1 is empty)

T := T1;else if (no list in T2 is empty)

T := T2;else

output “no super-stable matching exists”;}output T; /* which is a super-stable matching */

Theorem: (1) Algorithm SRT-Super is correct (2) It takes cn2 steps for some c

Page 91: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #91

Phase 2 of Algorithm SRT-Super

T := preference lists generated by Phase 1;while (some person p’s list in T is of length > 1) {

let q be the person assigned from p ; let r be the person assigned to p;

form T1 from T by letting p be rejected by q;form T2 from T by letting p reject r;

reactivate Phase 1 on T1;reactivate Phase 1 on T2;if (no list in T1 is empty)

T := T1;else if (no list in T2 is empty)

T := T2;else

output “no super-stable matching exists”;}output T; /* which is a super-stable matching */

Theorem: (1) Algorithm SRT-Super is correct (2) It takes cn2 steps for some c

Open problem: characterise the algorithm in terms of rotations, as in the SR case

Page 92: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #92

SRT: strong stability

A matching M in instance J of SRT is strongly stable if there is no pair {p,q}M such that

• p strictly prefers q to his partner in M • q strictly prefers p to his partner in M or is indifferent between them

Example SRT instance:

1: 4 2 3 2: (1 3) 4 3: 1 (4 2)4: 2 3 1

The matching is strongly stable.

• Does there exist an efficient algorithm to decide whether a strongly stable matching exists, given an instance of SRT?

Page 93: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #93

SRT: weak stability

A matching M in instance J of SRT is weakly stable if there is no pair {p,q}M such that

• p strictly prefers q to his partner in M • q strictly prefers p to his partner in M

Example SRT instance: 1: 3 2 4 2: (1 3) 4 3: 2 1 4 4: 1 2 3

The matching is weakly stable.

• The problem of deciding whether an instance of SRT admits a weakly stable matching is NP-complete

Ronn (1990) “NP-complete Stable Matching Problems”, Journal of Algorithms, 11:285-304

Irving and Manlove (2002) “The Stable Roommates Problem with Ties”, Journal of Algorithms, 43:85-105

Page 94: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #94

Other extensions of SR

• Stable Crews Problem (SC)

– Each person p can have one of two roles, e.g. (A) Captain (pA) or (B) Navigator (pB)

1: 4B 3A 2A 2B 3B 4A 2: 1B 4A 3B 4B 1A 3A

3: 1A 2A 2B 4A 4B 1B

4: 2A 1B 2B 3B 1A 3A

E.g. person 2 prefers person 1 as a navigator to person 4 as a captain

Page 95: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #95

Other extensions of SR

• Stable Crews Problem (SC)

– Each person p can have one of two roles, e.g. (A) Captain (pA) or (B) Navigator (pB)

role 1: B 4B 3A 2A 2B 3B 4A 2: A 1B 4A 3B 4B 1A 3A

3: A 1A 2A 2B 4A 4B 1B

4: B 2A 1B 2B 3B 1A 3A

E.g. person 2 prefers person 1 as a navigator to person 4 as a captain

– A matching M is a disjoint set of pairs of persons with roles

– each person is in exactly one pair

– each pair has exactly one Captain (A) and exactly one Navigator (B)

– e.g. {1B, 3A}, {2A, 4B}

Page 96: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #96

– {XA,YB} is a blocking pair of M if (1) X prefers YB to his partner in M (2) Y prefers XA to his partner in M

– A matching is stable if it admits no blocking pair

E.g. {2A, 3B} blocks the previous matching

role1: B 4B 3A 2A 2B 3B 4A 2: A 1B 4A 3B 4B 1A 3A

3: A 1A 2A 2B 4A 4B 1B

4: B 2A 1B 2B 3B 1A 3A

role1: B 4B 3A 2A 2B 3B 4A 2: A 1B 4A 3B 4B 1A 3A

3: B 1A 2A 2B 4A 4B 1B

4: A 2A 1B 2B 3B 1A 3A

– The above matching is stable

Page 97: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #97

– An instance I of SR can be reduced to an instance J of SC such that every stable matching in I corresponds to a stable matching in J and vice versa

– Some instances of SC do not admit a stable matching

– There is an efficient algorithm to find a stable matching, if one exists, given an instance of SC

– If crews are of size 3, the problem of deciding whether a stable matching exists is NP-complete

Cechlárová and Ferková (2001), “The Stable Crews Problem”, submitted for publication

Page 98: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #98

• Stable Fixtures Problem (SF)

– Choose a schedule of fixtures based on teams having preferences over each other

– Two given teams can play each other at most once

– Each team i has a capacity ci , indicating the maximum number of fixtures it can play

– A fixture allocation A is a set of unordered pairs of teams {i, j} such that, for each i, team i is scheduled to play at most ci fixtures

– Example SF instance:

team capacity preferences1: 2 2 3 4

2: 2 1 3 4 3: 2 1 2 44: 2 1 2 3

Page 99: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #99

• Stable Fixtures Problem (SF)

– Choose a schedule of fixtures based on teams having preferences over each other

– Two given teams can play each other at most once

– Each team i has a capacity ci , indicating the maximum number of fixtures it can play

– A fixture allocation A is a set of unordered pairs of teams {i, j} such that, for each i, team i is scheduled to play at most ci fixtures

– Example SF instance:

team capacity preferences1: 2 2 3 4

2: 2 1 3 4 3: 2 1 2 44: 2 1 2 3

– The above fixture allocation is: {1, 2}, {1, 4}, {2, 3}, {3, 4}

Page 100: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #100

– A blocking pair of a fixture allocation A is a pair of teams {i , j}A such that:

i is assigned fewer than ci teams in A or i prefers j to at least one of its assignees and j is assigned fewer than cj teams in A or j prefers i to at least one of its assignees

– A fixture allocation is stable if it admits no blocking pair

– Example SF instance:

team capacity preferences1: 2 2 3 4

2: 2 1 3 4 3: 2 1 2 44: 2 1 2 3

– The above fixture allocation is not stable as {1,3} is a blocking pair

Page 101: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #101

– Example SF instance:

team capacity preferences1: 2 2 3 4

2: 2 1 3 4 3: 2 1 2 44: 2 1 2 3

– The above fixture allocation is stable

– SR is a special case of SF (in which each team has capacity 1)

– There is an efficient algorithm to find a stable fixtures allocation, if one exists, given an instance of SF

Irving and Scott (2002), “The Stable Fixtures Problem”, submitted for publication

• Exchange-Stable Roommates Problem (ESR)• Coalition Formation Games

Page 102: The Stable Roommates Problem and Some Extensions David Manlove University of Glasgow

L4 #102

Summary

• Stable Roommates problem (SR)

– classical algorithm (Irving, 1985)

• Stable Roommates problem with Ties (SRT)

– super-stability (Irving and Manlove, 2002)– strong stability– weak stability (Ronn, 1990)

• Stable Crews problem (SC)– (Cechlarova and Ferkova, 2001)

• Stable Fixtures problem (SF)– (Irving and Scott, 2002)

Open questions:

• SRT under super-stability – rotations?• SRT under strong stability• SC with Ties• SF with Ties