Chapter 15. The Housing Allocation Problem
Classical algorithm descriptions for the housing allocation problem.
This page: Classical forms. View LLP forms »
This page collects the classical algorithm descriptions for the housing allocation problem. The lattice-linear (LLP) reformulations live on the LLP companion page.
The housing market
There are $n$ agents and $n$ houses. Each agent owns one house and has a strict preference ranking over all houses. A core allocation is an assignment of houses to agents such that no coalition of agents can improve by trading among themselves. Shapley and Scarf (1974) proved that a core allocation always exists and can be found by Gale's Top Trading Cycle (TTC) algorithm.
Gale's Top Trading Cycle
Build a directed graph where each agent points to the owner of her top remaining choice. Since the graph has finitely many nodes and each node has out-degree one, at least one cycle must exist. Every agent in a cycle trades along the cycle (each gets the house she pointed to). Remove those agents, update preference lists, and repeat. The sequential algorithm runs in $O(n^2)$ time.
TTC (Top Trading Cycle)
Gale's TTC algorithm works in stages. At each stage: (1) build the top-choice graph where each unassigned agent points to the owner of her top remaining house; (2) find all cycles (at least one must exist since every node has out-degree 1); (3) implement the trades — each agent in a cycle gets the house she pointed to — and remove those agents.
Time complexity: $O(n^2)$, where $n$ is the number of agents.
Default preferences are from the book's worked example (4 agents): $a_0\!: h_1, h_2, h_0, h_3$; $a_1\!: h_0, h_3, h_1, h_2$; $a_2\!: h_0, h_1, h_3, h_2$; $a_3\!: h_1, h_0, h_2, h_3$.