1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department...

32
1 “Almost stable” matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer Science and Information Theory Budapest University of Technology and Economics, Hungary David Manlove Department of Computing Science University of Glasgow, UK

Transcript of 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department...

Page 1: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

1

“Almost stable” matchings in the Roommates problem

David AbrahamComputer Science DepartmentCarnegie-Mellon University, USA

Péter Biró Department of Computer Science and Information TheoryBudapest University of Technology and Economics, Hungary

David ManloveDepartment of Computing ScienceUniversity of Glasgow, UK

Page 2: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

2

Stable Roommates Problem (SR)

D Gale and L Shapley, “College Admissions and the Stability of Marriage”, American Mathematical Monthly, 1962

Input: 2n agents; each agent ranks all 2n-1 other agents in

strict orderOutput: a stable matching

A matching is a set of n disjoint pairs of agents

A blocking pair of a matching M is a pair of agents {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: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

3

Example SR Instance (1)

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

Page 4: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

4

Example SR Instance (1)

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

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

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

Page 5: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

5

Example SR Instance (2)

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

Page 6: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

6

Example SR Instance (2)

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

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

instance I2 has no stable matching.

1: 2 3 42: 3 1 43: 1 2 44: 1 2 3

1: 2 3 42: 3 1 43: 1 2 44: 1 2 3

Page 7: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

7

Application: kidney exchange

d1

p1

Page 8: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

8

Application: kidney exchange

d1

p1

d2

p2

Page 9: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

9

Application: kidney exchange

d1

p1

d2

p2

A. Roth, T. Sönmez, U. Ünver, Pairwise Kidney Exchange, Journal of Economic Theory, to

appear

Page 10: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

10

Application: kidney exchange

d1

p1

d2

p2

A. Roth, T. Sönmez, U. Ünver, Pairwise Kidney Exchange, Journal of Economic Theory, to

appear

(d1 , p1) (d2 , p2)

• Create a vertex for each donor-patient pair

• Edges represent compatibility• Preference lists can take into

account degrees of compatibility

Page 11: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

11

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 the Stable Marriage problem Phase 2: elimination of “rotations”

Page 12: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

12

Empirical results

Instance size

% s

olu

ble

Experiments based on taking average of s1 , s2 , s3 where sj is number of soluble instances among 10,000 randomly generated instances, each of given size 2n

Results due to Colin Sng

Instancesize

4 20 50 100 200 500 1000

2000

4000

6000

8000

%soluble

96.3 82.9

73.1

64.3

55.1

45.1

38.8 32.2 27.8 25.0 23.6

Page 13: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

13

Coping with insoluble SR instances: 1. Coalition Formation Games

• Generalisation of SR

Partition agents into sets of size 1 Notions of B-preferences / W-preferences Cechlárová and Hajduková, 1999 Cechlárová and Romero-Medina, 2001 Cechlárová and Hajduková, 2002

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

• Example: insoluble SR instance

• {1,3,6}, {2,4,5} is a partition of the agents

Page 14: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

14

• Given a partition P of the agents, define P(i) to be the set containing agent i

• Given a set of agents S, define best(i,S) to be the best agent in S according to i ’s preferences

• A set of agents C is said to be a blocking coalition of P if i prefers best(i,C) to best(i,P(i)) for all iC

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

Coalition Formation Games: B-preferences

• {1,3,6}, {2,4,5} is a partition of the agents

• {1,2,3} is a blocking coalition

Page 15: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

15

• A partition P is B-stable if it admits no blocking coalition

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

Coalition Formation Games: B-stability

• Every CFG instance admits a B-stable partition

• Such a partition may be found in linear time

• Also results for W-stability

• {1,5,6}, {2,3,4} is a B-stable partition of the agents

Page 16: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

16

Coping with insoluble SR instances: 2. Stable partitions

• Stable partition

Tan 1991 (Journal of Algorithms) Generalisation of a stable matching Permutation of the agents such that:

1. each agent i does not prefer -1(i) to (i)2. if i prefers j to -1(i) then j does not prefer i to -1(j)

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

• Example:=1,4,6, 2,3,5

(i) shown in green -1(i) shown in red

E.g. 4 prefers 5 to -1(4)=1 5 prefers -1(5)=3 to 4

Page 17: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

17

• Every SR instance admits a stable partition

• A stable partition can be found in linear time

• There may be more than one stable partition, but: any two stable partitions contain exactly the same odd

cycles

• An SR instance I is insoluble if and only if a stable partition in I contains an odd cycle

• Any stable partition containing only even cycles can be decomposed into a stable matching Tan 1991 (Journal of Algorithms)

• A stable partition can be used to find a maximum matching such that the matched pairs are stable within themselves Tan 1991 (International Journal of Computer Mathematics)

Properties of stable partitions

Page 18: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

18

• Given a stable partition • Delete a single agent from each odd cycle• Decompose each even cycles into pairs

Maximum matching where the matched pairs are stable within themselves

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

• Example

=1,4,6, 2,3,5

Page 19: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

19

• Given a stable partition • Delete a single agent from each odd cycle• Decompose each even cycles into pairs

Maximum matching where the matched pairs are stable within themselves

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

• Example

=1,4,6, 2,5

Page 20: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

20

• Given a stable partition • Delete a single agent from each odd cycle• Decompose each even cycles into pairs

Maximum matching where the matched pairs are stable within themselves

1: 2 5 4 3 62: 3 6 5 1 43: 4 5 2 6 14: 2 6 5 1 35: 6 2 3 4 16: 3 1 4 5 2

• Example

=1,4, 2,5

Page 21: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

21

• Given a stable partition • Delete a single agent from each odd cycle• Decompose each even cycles into pairs

Maximum matching where the matched pairs are stable within themselves

1: 2 5 4 3 62: 5 1 44: 2 5 1 35: 2 4 1

• Example

• Matching M={{1,4},{2,5}} is stable in the smaller instance

• A maximum matching such that the matched pairs are stable within themselves can be constructed in linear time from a stable partition

Page 22: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

22

• The following instance I3 of SR is insoluble1: 2 3 5 6 42: 3 1 6 4 53: 1 2 4 5 64: 5 6 2 3 15: 6 4 3 1 26: 4 5 1 2 3

• Let bp(M) denote the set of blocking pairs of matching M

|bp(M2)|=12

1: 2 3 5 6 42: 3 1 6 4 53: 1 2 4 5 64: 5 6 2 3 15: 6 4 3 1 26: 4 5 1 2 3

1: 2 3 5 6 42: 3 1 6 4 53: 1 2 4 5 64: 5 6 2 3 15: 6 4 3 1 26: 4 5 1 2 3

|bp(M1)|=2

• Stable partition 1,2,3, 4,5,6

Coping with insoluble SR instances:3. “Almost stable” matchings

Page 23: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

23

1: 2 3 42: 3 1 43: 1 2 44: 1 2 3

Coping with insoluble SR instances:Method 2 vs method 3

• Recall the insoluble instance I2 of SR:

• Tan’s algorithm for method 2 constructs a matching of size 1, e.g. M1={{1,2}}

• Any such matching M has |bp(M)|2

1: 2 3 42: 3 1 43: 1 2 44: 1 2 3

• Method 3: consider e.g. M2={{1,2},{3,4}}

• |bp(M2)|=1

1: 2 3 42: 3 1 43: 1 2 44: 1 2 3

• So |M2|=2|M1| and |bp(M2)|=½|bp(M1)|

Page 24: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

24

Hardness results for SR

• Let I be an SR instance

• Define bp(I)=min{|bp(M)|: M is a matching in I}

• Define MIN-BP-SR to be problem of computing bp(I), given an SR instance I

• Theorem 1: MIN-BP-SR is not approximable within n½-, for any > 0, unless P=NP

• Define EXACT-BP-SR to be problem of deciding whether I admits a matching M such that |bp(M)|=K, given an integer K

• Theorem 2: EXACT-BP-SR is NP-complete

Page 25: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

25

Outline of the proof

• Using a “gap introducing” reduction from EXACT-MM

• Given a cubic graph G=(V,E) and an integer K, decide whether G admits a maximal matching of size K

EXACT-MM is NP-complete, by transformation from MIN-MM (Minimization version), which is NP-complete for cubic graphs

Horton and Kilakos, 1993

• Create an instance I of SR with n agents

• If G admits a maximal matching of size K then I admits a matching with p blocking pairs, where p=|V|

• If G admits no maximal matching of size K, then bp(I) > p n½-

Page 26: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

26

Preference lists with ties

• Let I be an instance of SR with ties

• Problem of deciding whether I admits a stable matching is NP-complete

Ronn, Journal of Algorithms, 1990 Irving and Manlove, Journal of Algorithms, 2002

• Can define MIN-BP-SRT analogously to MIN-BP-SR

• Theorem 3: MIN-BP-SRT is not approximable within n1-, for any > 0, unless P=NP, even if each tie has length 2 and there is at most one tie per list

• Define EXACT-BP-SRT analogously to EXACT-BP-SR

• Theorem 4: EXACT-BP-SRT is NP-complete for each fixed K 0

Page 27: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

27

Polynomial-time algorithm

• Theorem 5: EXACT-BP-SR is solvable in polynomial time if K is fixed

• Algorithm also works for possibly incomplete preference lists

• Given an SR instance I where m is the total length of the preference lists, O(mK+1) algorithm finds a matching M where |bp(M)|=K or reports that none exists

• Idea:1. For each subset B of agent pairs {ai, aj} where |B|=K2. Try to construct a matching M in I such that bp(M)=B

• Step 1: O(mK) subsets to consider

• Step 2: O(m) time

Page 28: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

28

Outline of the algorithm

• Let {ai, aj}B where |B|=K

• Preference list of ai : … … ak … … aj … …

• If {ai, aj}bp(M) then {ai, ak}M

• Delete {ai, ak} but must not introduce new blocking pairs

• Preference list of ak : … … ai … … aj … …

• If {ai, ak} B then {aj, ak}M

• Delete {ak, aj} and mark ak

• Check whether there is a stable matching M in reduced SR instance such that all marked agents are matched in M

Page 29: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

29

Interpolation of |bp(M)|

• Clearly |bp(M)|½(2n)(2n-2)=2n(n-1) for any matching M

• Is |bp(M)| an interpolating invariant? That is, given an SR instance I, if I admits matchings M1, M2 such that |bp(M1) |=k and |bp(M2)|=k+2, is there a matching M3 in I such that |bp(M3)|=k+1 ?

Not in general!

1: 2 3 5 6 42: 3 1 6 4 53: 1 2 4 5 64: 5 6 2 3 15: 6 4 3 1 26: 4 5 1 2 3

Instance I3 admits 15 matchings:• 9 admit 2 blocking pairs• 2 admit 6 blocking pairs• 3 admit 8 blocking pairs• 1 admits 12 blocking pairs

Page 30: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

30

Upper and lower bounds for bp(I)

• As already observed, bp(I)2n(n-1)

• Let be a stable partition in an SR instance I

• Let C denote the number of odd cycles of length 3 in

• Upper bound: bp(I) 2C(n-1)

• Lower bound: bp(I) C/2

Page 31: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

31

Open problems

1. Is there an approximation algorithm for MIN-BP-SR that has performance guarantee o(n2)?

An upper bound is 2C(n-1)

2. Are the upper/lower bounds for bp(I) tight?

3. Determine values of kn and obtain a characterisation of In such that In is an SR instance with 2n agents in which bp(In)=kn and

kn = max{bp(I) : I is an SR instance with 2n agents}

Page 32: 1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.

32

Acknowledgements - individuals• Katarína Cechlárová• Rob Irving

Acknowledgements - funding• Centre for Applied Mathematics and Computational Physics,

Budapest University of Technology and Economics• Hungarian National Science Fund (grant OTKA F 037301)• EPSRC (grant GR/R84597/01)• RSE / Scottish Executive Personal Research Fellowship• RSE International Exchange Programme

More informationD.J. Abraham, P. Biró, D.F.M., “Almost stable” matchings in the Roommates problem, to appear in Proceedings of WAOA ’05: the

3rd Workshop on Approximation and Online Algorithms, Lecture

Notes in Computer Science, Springer-Verlag, 2005

Further details