Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.

Slides:



Advertisements
Similar presentations
Strong Stability in the Hospitals/Residents Problem Robert W. Irving, David F. Manlove and Sandy Scott University of Glasgow Department of Computing Science.
Advertisements

1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University Péter Biró Department of Computer.
Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science.
1 Student-Project Allocation with Preferences over Projects David Manlove Gregg OMalley University of Glasgow Department of Computing Science Supported.
1 Almost stable matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of Computer.
1 Student-Project Allocation with Preferences over Projects David Manlove University of Glasgow Department of Computing Science Joint work with Gregg OMalley.
Strong Stability in the Hospitals/Residents Problem
Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
Joint work with Rob Irving
Algorithms and Networks
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
Lectures on Network Flows
An Experimental Test of House Matching Algorithms Onur Kesten Carnegie Mellon University Pablo Guillen University of Sydney.
Great Theoretical Ideas in Computer Science.
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Data Transmission and Base Station Placement for Optimizing Network Lifetime. E. Arkin, V. Polishchuk, A. Efrat, S. Ramasubramanian,V. PolishchukA. EfratS.
Popular Matching David Abraham Carnegie Mellon University Kavitha Telikepalli Max-Planck-Institut für Informatik Kurt Mehlhorn Rob Irving University of.
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
1 Combinatorial Dominance Analysis The Knapsack Problem Keywords: Combinatorial Dominance (CD) Domination number/ratio (domn, domr) Knapsack (KP) Incremental.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Induction and recursion
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Strong Stability in the Hospitals/Residents Problem Robert W. Irving, David F. Manlove and Sandy Scott University of Glasgow Department of Computing Science.
Summer School on Matching Problems, Markets and Mechanisms David Manlove.
Computational complexity of competitive equilibria in exchange markets Katarína Cechlárová P. J. Šafárik University Košice, Slovakia Budapest, Summer school,
Algorithmic Game Theory and Internet Computing Vijay V. Vazirani Georgia Tech Dispelling an Old Myth about an Ancient Algorithm.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Homework 2. Problem 1 Families 1…..N go out for dinner together. To increase their social interaction, no two members of the same family use the same.
L3 #1 The Hospitals / Residents Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science Supported by EPSRC grant.
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
August 16, 2010 MPREF’10 Dynamic House Allocation Sujit Gujar 1, James Zou 2 and David C. Parkes 2 5 th Multidisciplinary Workshop on Advances in Preference.
All Pair Shortest Path IOI/ACM ICPC Training June 2004.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Algorithms for Student-Project Allocation
Bipartite Matching. Unweighted Bipartite Matching.
The Stable Marriage Problem
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Assignments and matchings Chapter 12 Presented by Yorai Geffen.
Network Flows Chun-Ta, Yu Graduate Institute Information Management Dept. National Taiwan University.
1 “Almost stable” matchings in the Roommates problem David Abraham Computer Science Department Carnegie-Mellon University, USA Péter Biró Department of.
© The McGraw-Hill Companies, Inc., Chapter 12 On-Line Algorithms.
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
Introduction to Graph Theory
11 -1 Chapter 12 On-Line Algorithms On-Line Algorithms On-line algorithms are used to solve on-line problems. The disk scheduling problem The requests.
Graph Data Management Lab, School of Computer Science Add title here: Large graph processing
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department.
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
IOI/ACM ICPC Training 4 June 2005.
Chapter 10 Iterative Improvement
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Design and Analysis of Algorithm
Bipartite Graphs What is a bipartite graph?
Algorithms and Networks
Lectures on Network Flows
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
“Almost stable” matchings in the Roommates problem
CS 583 Analysis of Algorithms
Popularity in the Capacitated House Allocation Problem
Bipartite Graph 1. A graph G is bipartite if the node set V can be partitioned into two sets V1 and V2 in such a way that no nodes from the same set are.
Matching and Resource Allocation
Rank Maximal Matching By Robert W. Irving, Telikepalli Kavitha,
離散數學 DISCRETE and COMBINATORIAL MATHEMATICS
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Presentation transcript:

Pareto Optimality in House Allocation Problems David Manlove Department of Computing Science University of Glasgow David Abraham Computer Science Department Carnegie-Mellon University Katarína Cechlárová Institute of Mathematics PJ Safárik University in Košice Kurt Mehlhorn Max-Planck-Institut fűr Informatik Saarbrűcken Supported by Royal Society of Edinburgh/Scottish Executive Personal Research Fellowship and Engineering and Physical Sciences Research Council grant GR/R84597/01

2 House Allocation problem (HA) Set of agents A={a 1, a 2, …, a r } Set of houses H={h 1, h 2, …, h s } Each agent a i has an acceptable set of houses A i  H a i ranks A i in strict order of preference Example: a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 Let n = r + s and let m =total length of preference lists  a 1 finds h 1 and h 2 acceptable a 3 prefers h 4 to h 3

3 Applications House allocation context: Large-scale residence exchange in Chinese housing markets Yuan, 1996 Allocation of campus housing in American universities, such as Carnegie-Mellon, Rochester and Stanford Abdulkadiroğlu and Sönmez, 1998 Other matching problems: US Naval Academy: students to naval officer positions Roth and Sotomayor, 1990 Scottish Executive Teacher Induction Scheme Assigning students to projects

4 The underlying graph Weighted bipartite graph G=(V,E) Vertex set V=A  H Edge set: { a i, h j }  E if and only if a i finds h j acceptable Weight of edge { a i, h j } is rank of h j in a i ’s preference list Example a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 a1a1 a2a2 a3a3 a4a4 h1h1 h2h2 h3h3 h4h4    

5 Definition of a matching A matching M is a subset of A×H such that: if (a i, h j )  M then a i finds h j acceptable each agent belongs to at most one pair in M each house belongs to at most one pair in M Example a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 a1a1 a2a2 a3a3 a4a4 h1h1 h2h2 h3h3 h4h4     M={(a 1, h 1 ), (a 2, h 4 ), (a 3, h 3 )} M(a 1 )=h 1

6 Maximum matchings In many applications we wish to match as many agents as possible A maximum matching is a matching with largest size Example Some maximum matchings are “better” than others! a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4

7 Pareto optimal matchings A matching M 1 is Pareto optimal if there is no matching M 2 such that: 1. Some agent is better off in M 2 than in M 1 2. No agent is worse off in M 2 than in M 1 Example M 1 is not Pareto optimal since a 1 and a 2 could swap houses – each would be better off M 2 is Pareto optimal a 1 : h 2 h 1 a 2 : h 1 h 2 a 3 : h 3 a 1 : h 2 h 1 a 2 : h 1 h 2 a 3 : h 3 M1M1 M2M2

8 Testing for Pareto optimality A matching M is maximal if there is no agent a and house h, each unmatched in M, such that a finds h acceptable A matching M is trade-in-free if there is no matched agent a and unmatched house h such that a prefers h to M(a) A matching M is coalition-free if there is no coalition, i.e. a sequence of matched agents  a 0,a 1,…,a r-1  such that a i prefers M(a i ) to M(a i+1 ) (0  i  r-1) a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 Proposition: M is Pareto optimal if and only if M is maximal, trade-in-free and coalition-free M is not maximal due to a 3 and h 3

9 Testing for Pareto optimality A matching M is maximal if there is no agent a and house h, each unmatched in M, such that a finds h acceptable A matching M is trade-in-free if there is no matched agent a and unmatched house h such that a prefers h to M(a) A matching M is coalition-free if there is no coalition, i.e. a sequence of matched agents  a 0,a 1,…,a r-1  such that a i prefers M(a i ) to M(a i+1 ) (0  i  r-1) a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 Proposition: M is Pareto optimal if and only if M is maximal, trade-in-free and coalition-free M is not trade-in-free due to a 2 and h 3

10 Testing for Pareto optimality A matching M is maximal if there is no agent a and house h, each unmatched in M, such that a finds h acceptable A matching M is trade-in-free if there is no matched agent a and unmatched house h such that a prefers h to M(a) A matching M is coalition-free if there is no coalition, i.e. a sequence of matched agents  a 0,a 1,…,a r-1  such that a i prefers M(a i+1 ) to M(a i ) (0  i  r-1) a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 Proposition: M is Pareto optimal if and only if M is maximal, trade-in-free and coalition-free M is not coalition-free due to  a 1, a 2, a 4  a1a1 a3a3 a4a4 h1h1 h3h3 h4h4 a2a2 h2h2

11 Testing for Pareto optimality A matching M is maximal if there is no agent a and house h, each unmatched in M, such that a finds h acceptable A matching M is trade-in-free if there is no matched agent a and unmatched house h such that a prefers h to M(a) A matching M is coalition-free if there is no coalition, i.e. a sequence of matched agents  a 0,a 1,…,a r-1  such that a i prefers M(a i+1 ) to M(a i ) (0  i  r-1) a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 Lemma: M is Pareto optimal if and only if M is maximal, trade-in-free and coalition-free

12 The envy graph Straightforward to check a given matching M for the maximality and trade-in-free properties in O(m) time To check for the existence of a coalition: Form the envy graph of M, denoted by G(M) Vertex for each matched agent Edge from a i to a j if and only if a i prefers M(a j ) to M(a i ) Example a 1 : h 2 h 1 a 2 : h 3 h 4 h 2 a 3 : h 4 h 3 a 4 : h 1 h 4 M admits a coalition if and only if G(M) has a directed cycle Theorem: we may check whether a given matching M is Pareto optimal in O(m ) time a1a1 a4a4 a2a2

13 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2

14 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2

15 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2

16 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 M 1 ={(a 1,h 1 ), (a 2,h 2 )}

17 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 M 1 ={(a 1,h 1 ), (a 2,h 2 )}

18 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 M 1 ={(a 1,h 1 ), (a 2,h 2 )}

19 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 M 1 ={(a 1,h 1 ), (a 2,h 2 )}

20 Finding a Pareto optimal matching Simple greedy algorithm, referred to as the serial dictatorship mechanism by economists for each agent a in turn if a has an unmatched house on his list match a to the most-preferred such house; else report a as unmatched; Theorem: The serial dictatorship mechanism constructs a Pareto optimal matching in O(m ) time Abdulkadiroğlu and Sönmez, 1998 Example a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 a 1 : h 1 h 2 h 3 a 2 : h 1 h 2 a 3 : h 1 h 2 M 1 ={(a 1,h 1 ), (a 2,h 2 )} M 2 ={(a 1,h 3 ), (a 2,h 2 ), (a 3,h 1 )}

21 Related work Rank maximal matchings Matching M is rank maximal if, in M 1. Maximum number of agents get their first-choice house; 2. Subject to (1), maximum number of agents get their second-choice house; etc. Irving, Kavitha, Mehlhorn, Michail, Paluch, SODA 04 A rank maximal matching is Pareto optimal, but need not be of maximum size Popular matchings Matching M is popular if there is no other matching M ’ such that: more agents prefer M ’ to M than prefer M to M ’ Abraham, Irving, Kavitha, Mehlhorn, SODA 05 A popular matching is Pareto optimal, but need not exist

22 Related work (cont) Take underlying weighted bipartite graph G The weight of a matching M in G is the sum of the weights of the edges contained in M where A M is the set of agents who are matched in M rank a (h) is the rank of h in a ’s preference list Find a maximum cardinality minimum weight matching M in G M is Pareto optimal For if not there exists a matching M′ such that rank a (M′(a))  rank a (M(a)) for all a  A M rank a (M′(a)) < rank a (M(a)) for some a  A M so M′ contradicts the minimum weight property of M A maximum cardinality minimum weight matching may be found in O(  nmlog n) time Gabow and Tarjan, 1989

23 Faster algorithm for finding a maximum Pareto optimal matching Three-phase algorithm with O(  nm) overall complexity Phase 1 – O(  nm) time Find a maximum matching in G Classical O(  nm) augmenting path algorithm Hopcroft and Karp, 1973 Phase 2 – O(m) time Enforce trade-in-free property Phase 3 – O(m) time Enforce coalition-free property Extension of Gale’s Top-Trading Cycles (TTC) algorithm Shapley and Scarf, 1974

24 Phase 1 a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Maximum matching M in G has size 8 M must be maximal No guarantee that M is trade-in-free or coalition-free

25 Phase 1 a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Maximum matching M in G has size 9 M must be maximal No guarantee that M is trade-in-free or coalition-free

26 Phase 1 a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Maximum matching M in G has size 9 M must be maximal No guarantee that M is trade-in-free or coalition-free M not coalition-free M not trade-in-free

27 Phase 2 description For each house h, maintain a list L h, initially containing those pairs ( a, r ) such that: a is a matched agent who prefers h to M(a) r is the rank of h in a ’s list Maintain a stack S of unmatched houses h whose list L h is nonempty Each matched agent a maintains a pointer curr a to the rank of M(a) Example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 6, 6), (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  (a 7, 7)  L h 11 =  (a 6, 8)  S =  h 6, h 7  curr a 6 =10 curr a 7 =9

28 Phase 2 description a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 6, 6), (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  (a 7, 7)  L h 11 =  (a 6, 8)  S =  h 6, h 7  curr a 6 =10 curr a 7 =9

29 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 6, 6), (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  (a 7, 7)  L h 11 =  (a 6, 8)  S =  h 6, h 7  curr a 6 =10 curr a 7 =9

30 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  (a 7, 7)  L h 11 =  (a 6, 8)  S =  h 6, h 10  curr a 6 =6 curr a 7 =9

31 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  (a 7, 7)  L h 11 =  (a 6, 8)  S =  h 6, h 10  curr a 6 =6 curr a 7 =9

32 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  (a 6, 8)  S =  h 6, h 11  curr a 6 =6 curr a 7 =7

33 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  (a 6, 8)  S =  h 6, h 11  curr a 6 =6 curr a 7 =7

34 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 6, 5), (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  S =  h 6  curr a 6 =6 curr a 7 =7

35 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  S =  h 7  curr a 6 =5 curr a 7 =7

36 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 7, 4), (a 8, 6)  L h 7 =  (a 7, 5), (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  S =  h 7  curr a 6 =5 curr a 7 =7

37 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 7, 4), (a 8, 6)  L h 7 =  (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  S =  curr a 6 =5 curr a 7 =5

38 Phase 2 example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 while S is nonempty pop a house h from S; remove the first pair (a,r) from the head of L h ; if r < curr a // a prefers h to M(a) let h’= M(a); remove (a,h’) from M and add (a,h) to M; curr a := h; h := h’; push h onto the stack if L h is nonempty; L h 6 =  (a 7, 4), (a 8, 6)  L h 7 =  (a 8, 5)  L h 8 =  (a 6, 4)  L h 10 =  L h 11 =  S =  curr a 6 =5 curr a 7 =5

39 Once Phase 2 terminates, matching is trade-in-free Data structures may be initialised in O(m) time Main loop takes O(m) time overall  Phase 2 is O(m) Coalitions may remain… Phase 2 termination

40 Once Phase 2 terminates, matching is trade-in-free Data structures may be initialised in O(m) time Main loop takes O(m) time overall  Phase 2 is O(m) Coalitions may remain… Phase 2 termination Example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9

41 Elimination of coalitions Repeatedly finding and eliminating coalitions takes O(m 2 ) time Cycle detection in G(M) takes O(m) time O(m) coalitions in the worst case Faster method: extension of TTC algorithm An agent matched to his/her first-choice house cannot be in a coalition Such an agent can be removed from consideration Houses matched to such agents are no longer exchangeable Such a house can be removed from consideration This rule can be recursively applied until either No agent remains (matching is coalition-free) A coalition exists, which can be found and removed Phase 3 description

42 Build a path P of agents (represented by a stack) Each house is initially unlabelled Each agent a has a pointer p(a) pointing to M(a) or the first unlabelled house on a ’s preference list (whichever comes first) Keep a counter c(a) for each agent a (initially c(a)=0 ) This represents the number of times a appears on the stack Outer loop iterates over each matched agent a such that p(a)  M(a) Initialise P to contain agent a Inner loop iterates while P is nonempty Pop an agent a ’ from P If c(a ’ )=2 we have a coalition (CYCLE) Remove by popping the stack and label the houses involved Else if p(a ’ )=M(a ’ ) we reach a dead end (BACKTRACK) Label M(a ’ ) Else add a ’’ where p(a ’ )=M(a ’’ ) to the path (EXTEND) Push a ’ and a ’’ onto the stack Increment c(a ’’ ) Phase 3 description

43 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 P=a1P=a1 a1a1

44 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 0h 3 a 4 1h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 P=a1, a4P=a1, a4 EXTEND a4a4

45 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 1h 3 a 4 1h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 EXTEND a4a4 P=  a 1, a 4, a 3  a3a3

46 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 1h 3 a 4 1h 4 a 5 1h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 EXTEND a4a4 P=  a 1, a 4, a 3, a 5  a3a3 a5a5

47 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 1h 3 a 4 2h 4 a 5 1h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 EXTEND a4a4 P=  a 1, a 4, a 3, a 5, a 4  a3a3 a5a5

48 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 1h 3 a 4 2h 4 a 5 1h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 CYCLE a4a4 P=  a 1, a 4, a 3, a 5  a3a3 a5a5

49 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 CYCLE a4a4 a3a3 a5a5 P=  a 1, a 4, a 3, a 5 

50 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 P=a1P=a1

51 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 EXTEND P=  a 1, a 2  a2a2

52 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 1h 9 a1a1 EXTEND P=  a 1, a 2, a 9  a2a2 a9a9

53 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 1h 9 a1a1 BACKTRACK P=  a 1, a 2  a2a2 a9a9

54 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 1h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 P=  a 1, a 2  a2a2

55 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 2h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 EXTEND P=  a 1, a 2, a 1  a2a2

56 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 2h 1 a 2 1h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 CYCLE P=  a 1, a 2  a2a2

57 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 a1a1 CYCLE P=  a 1, a 2  a2a2

58 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 1h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 P=a6P=a6 a6a6

59 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 1h 6 a 7 0h 7 a 8 1h 8 a 9 0h 9 P=  a 6, a 8  EXTEND a6a6 a8a8

60 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 1h 6 a 7 1h 7 a 8 1h 8 a 9 0h 9 P=  a 6, a 8, a 7  EXTEND a6a6 a8a8 a7a7

61 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 2h 6 a 7 1h 7 a 8 1h 8 a 9 0h 9 P=  a 6, a 8, a 7, a 6  EXTEND a6a6 a8a8 a7a7

62 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 2h 6 a 7 1h 7 a 8 1h 8 a 9 0h 9 P=  a 6, a 8, a 7  CYCLE a6a6 a8a8 a7a7 Agent counter House label

63 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 P=  a 6, a 8, a 7  CYCLE a6a6 a8a8 a7a7

64 Phase 3: example a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9 Agent counter House label a 1 0h 1 a 2 0h 2 a 3 0h 3 a 4 0h 4 a 5 0h 5 a 6 0h 6 a 7 0h 7 a 8 0h 8 a 9 0h 9 P= 

65 Once Phase 3 terminates, matching is coalition-free Data structures may be initialised in O(m) time Nested loops take O(m) time overall  Phase 3 is O(m) Phase 3 termination a 1 : h 4 h 5 h 3 h 2 h 1 a 2 : h 3 h 4 h 5 h 9 h 1 h 2 a 3 : h 5 h 4 h 1 h 2 h 3 a 4 : h 3 h 5 h 4 a 5 : h 4 h 3 h 5 a 6 : h 2 h 3 h 5 h 8 h 6 h 7 h 1 h 11 h 4 h 10 a 7 : h 1 h 4 h 3 h 6 h 7 h 2 h 10 h 5 h 11 a 8 : h 1 h 5 h 4 h 3 h 7 h 6 h 8 a 9 : h 4 h 3 h 5 h 9

66 Initial property rights Suppose A ’  A and each member of A ’ owns a house initially For each agent a  A ’, denote this house by h(a) Truncate a ’s list at h(a) Form matching M by pre-assigning a to h(a) Use Hopcroft-Karp algorithm to augment M to a maximum cardinality matching M ’ in restricted HA instance Then proceed with Phases 2 and 3 as before Constructed matching M ’ is individually rational If A ’= A then we have a housing market TTC algorithm finds the unique matching that belongs to the core Shapley and Scarf, 1974 Roth and Postlewaite, 1977

67 Minimum Pareto optimal matchings Problem of finding a minimum Pareto optimal matching is NP-hard Result holds even if all preference lists have length 3 Reduction from Minimum Maximal Matching Problem is approximable within a factor of 2 Follows since any Pareto optimal matching is a maximal matching in the underlying graph G Any two maximal matchings differ in size by at most a factor of 2 Korte and Hausmann, 1978

68 Interpolation of Pareto optimal matchings Given an HA instance I, p - (I) and p + (I) denote the sizes of a minimum and maximum Pareto optimal matching Theorem: I admits a Pareto optimal matching of size k, for each k such that p - (I)  k  p + (I) Given a Pareto optimal matching of size k, O ( m ) algorithm constructs a Pareto optimal matching of size k+1 or reports that k = p + (I) Based on assigning a vector  r 1, …, r k  to an augmenting path P =  a 1, h 1, …, a k, h k  where r i =rank a i (h i ) Examples:  1,3,2   1,2,2  Find a lexicographically smallest augmenting path h1h1 h2h2 h3h3 h4h h5h5 a1a1 a2a2 a3a3 a4a

69 Summary Definition of the House Allocation problem (HA) O(m) algorithm for testing a matching for Pareto optimality O(m) algorithm for finding a Pareto optimal matching O(  nm) algorithm for finding a maximum Pareto optimal matching NP-hardness of finding a minimum Pareto optimal matching Interpolation result More information: D.J. Abraham, K. Cechlarova, D.F.M., K. Mehlhorn: Pareto Optimality in House Allocation Problems, to appear at ISAAC 2004: the 15 th International Symposium on Algorithms and Computation, Hong Kong, December 20-22, 2004

70 Open problems Finding a maximum Pareto optimal matching Ties in the preference lists Solvable in O(  nmlog n) time Solvable in O(  nm) time? One-many case (houses may have capacity >1 ) Non-bipartite case Solvable in O(  (n  (m, n))mlog 3/2 n) time D.J. Abraham, D.F. Manlove Pareto optimality in the Roommates problem Technical Report TR of the Computing Science Department of Glasgow University Solvable in O(  nm) time?