SLIDE 1 Stable matchings from the perspective of distributed algorithms
Jukka Suomela — HIIT, University of Helsinki, Finland Joint work with Patrik Floréen, Petteri Kaski, and Valentin Polishchuk
1 1 2 2 1 1 1 3 3 2 2 1 1 2
NO YES YES YES
Carleton University, 19 April 2010
SLIDE 2
Part I: Introduction
2 / 49
Stable matchings
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 3 Stable marriage problem
3 / 49
Input: bipartite graph G = (R ∪ B, E) . . .
- R = red nodes
- B = blue nodes
SLIDE 4 Stable marriage problem
4 / 49
Input: bipartite graph G = (R ∪ B, E) . . .
- R = red nodes
- B = blue nodes
Example 1:
- red node r: PhD student
- blue node b: PhD position
- edge {r, b}: student r has applied for position b
- who gets which position?
SLIDE 5 Stable marriage problem
5 / 49
Input: bipartite graph G = (R ∪ B, E) . . .
- R = red nodes
- B = blue nodes
Example 2:
- red node r: woman
- blue node b: man
- edge {r, b}: r and b know each other
- who will marry whom?
SLIDE 6 Stable marriage problem
6 / 49
Input: bipartite graph G = (R ∪ B, E) and preferences
- 1 = most preferred partner
- but anyone is better than no-one
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 7
Stable marriage problem
7 / 49
Output: a stable matching, i.e., a matching without unstable edges
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 8
Stable marriage problem
8 / 49
Matching: subset M ⊆ E of edges such that each node adjacent to at most one edge in M
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 9
Stable marriage problem
9 / 49
Matching: subset M ⊆ E of edges such that each node adjacent to at most one edge in M
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 10
Stable marriage problem
10 / 49
Matching: subset M ⊆ E of edges such that each node adjacent to at most one edge in M
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 11 Stable marriage problem
11 / 49
Unstable edge: edge {r, b} /
∈ M such that
- r prefers b to r’s current partner (if any)
- b prefers r to b’s current partner (if any)
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 12 Stable marriage problem
12 / 49
Unstable edge: edge {r, b} /
∈ M such that
- r prefers b to r’s current partner (if any)
- b prefers r to b’s current partner (if any)
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 13 Stable marriage problem
13 / 49
Unstable edge: edge {r, b} /
∈ M such that
- r prefers b to r’s current partner (if any)
- b prefers r to b’s current partner (if any)
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 14
Stable marriage problem
14 / 49
Stable matching: no unstable edges
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 15 Stable marriage problem
15 / 49
Stable matching: no unstable edges Potential applications:
- Good solution in many assignment problems
(e.g., matching PhD students with positions)?
- Useful concept in analysing real-world
social networks (e.g., human relations)?
SLIDE 16 Stable marriage problem
16 / 49
Stable matching: no unstable edges
- Does it always exist?
- How to find one?
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 17
Part II: Finding a stable matching
17 / 49
Gale–Shapley
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 18
Stable marriage problem
18 / 49
An adaptation of the Gale–Shapley algorithm (1962) Begin with an empty matching
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 19
Stable marriage problem
19 / 49
Unmatched red nodes send proposals to their most-preferred neighbours
1 1 2 2 1 1 1 3 3 2 2 1 1 2 ? ? ? ?
SLIDE 20
Stable marriage problem
20 / 49
Blue nodes accept the best proposal
1 1 2 2 1 1 1 3 3 2 2 1 1 2
NO YES YES YES
SLIDE 21
Stable marriage problem
21 / 49
Blue nodes accept the best proposal Remove rejected edges and repeat. . .
3 1 1 2 2 1 1 1 1 2 3 2 1 2
SLIDE 22
Stable marriage problem
22 / 49
Unmatched red nodes send proposals to their most-preferred neighbours
2 2 1 1 1 3 1 1 1 2 3 2 1 2 ?
SLIDE 23
Stable marriage problem
23 / 49
Blue nodes accept the best proposal It is ok to change mind if a better proposal is received!
2 2 1 1 1 3 1 2 1 1 2 3 2 1 ×
YES
SLIDE 24
Stable marriage problem
24 / 49
Blue nodes accept the best proposal Remove rejected edges and repeat. . .
1 2 2 1 1 1 3 2 1 2 3 2 1 1
SLIDE 25 Stable marriage problem
25 / 49
Eventually each red node
- is matched, or
- has been rejected by all neighbours
1 2 2 1 1 1 3 2 1 2 3 2 1 1
SLIDE 26
Stable marriage problem
26 / 49
Let {r, b} /
∈ M: (i) b ∈ B rejected r ∈ R = ⇒ b was matched to a more preferred neighbour = ⇒ {r, b} is not unstable
b 1 1 1 3 2 1 r 1 2 3 2 1 1 2 2
SLIDE 27
Stable marriage problem
27 / 49
Let {r, b} /
∈ M: (ii) r ∈ R did not ask b ∈ B = ⇒ r is matched to a more preferred neighbour = ⇒ {r, b} is not unstable
b 1 1 1 3 2 1 r 1 2 3 2 1 1 2 2
SLIDE 28
Stable marriage problem
28 / 49
The Gale–Shapley algorithm finds a stable matching – in particular, a stable matching always exists Ok, that was published 48 years ago, more recent news?
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 29
Part III: Stable matchings in a distributed setting
29 / 49
Stable matchings are unstable
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 30
Stable matchings in a distributed setting
30 / 49
Node = computer, edge = communication link Efficient distributed algorithms for stable matchings?
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 31 Stable matchings in a distributed setting
31 / 49
The Gale–Shapley algorithm can be interpreted as a distributed algorithm
- proposal, acceptance, rejection: messages
1 1 2 2 1 1 1 3 3 2 2 1 1 2
NO YES YES YES
SLIDE 32 Stable matchings in a distributed setting
32 / 49
Many nice properties:
- small messages, deterministic
- unique identifiers not needed
1 1 2 2 1 1 1 3 3 2 2 1 1 2
NO YES YES YES
SLIDE 33
Stable matchings in a distributed setting
33 / 49
But Gale–Shapley isn’t fast – it cannot be fast!
1 1 2 2 1 1 2 2 1 1 2 1 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 1 1 2 2
SLIDE 34
Stable matchings in a distributed setting
34 / 49
Solution depends on the input in distant parts of network
= ⇒ worst-case running time Ω(diameter)
1 1 2 2 1 1 2 2 1 1 2 1 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 1 1 2 2
SLIDE 35
Stable matchings in a distributed setting
35 / 49
Stable matchings are unstable! Minor changes in input may require major changes in output
1 1 2 2 1 1 2 2 1 1 2 1 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 1 1 2 2
SLIDE 36 Stable matchings in a distributed setting
36 / 49
Stable matchings are unstable! Minor changes in input may require major changes in output
- This isn’t really what we would expect to happen,
e.g., in real-world large scale social networks
- Very distant parts of the network should not affect
my choices
- Are stable matchings the right problem to study?
Matchings that are more robust and more local?
SLIDE 37
Part IV: Almost stable matchings
37 / 49
Truncating Gale–Shapley
1 1 2 1 1 2 2 1 1 1 2 3 3 2
SLIDE 38 Almost stable matchings
38 / 49
Our contribution: asking the right questions
- What if we allow a small fraction
- f unstable edges?
- What happens if we run Gale–Shapley
for a small number of rounds? Others have asked similar questions, too. . .
SLIDE 39 Almost stable matchings
39 / 49
What if we allow a small fraction of unstable edges?
- Biró et al. (2008): finding a maximum matching
with few unstable edges is hard
- Finding any matching with few unstable edges?
Running Gale–Shapley for a small number of rounds?
- Quinn (1985): experimental work suggests
that we get few unstable edges
- Any theoretical guarantees?
SLIDE 40
Almost stable matchings
40 / 49
Definition: A matching M is ǫ-stable if there are at most ǫ|M| unstable edges Main result: There is a distributed algorithm that finds an ǫ-stable matching in O(∆2/ǫ) rounds Algorithm: Just run the distributed version of Gale–Shapley for that many steps!
∆ = maximum degree of G
SLIDE 41
Almost stable matchings
41 / 49
During the Gale–Shapley algorithm:
{r, b} ∈ E is an unstable edge = ⇒ r unmatched and r has not yet proposed b
3 1 1 2 2 1 1 1 1 2 3 2 1 2
SLIDE 42
Almost stable matchings
42 / 49
Key idea: define total potential
= number of unmatched red nodes with proposals left = how much red nodes could “gain”
if we did not truncate Gale–Shapley
3 2 1 1 2 2 1 1 1 1 2 3 2 1
SLIDE 43
Almost stable matchings
43 / 49
Key idea: define total potential
= number of unmatched red nodes with proposals left
Initially high
1 2 3 3 2 1 2 1 1 2 2 1 1 1
SLIDE 44
Almost stable matchings
44 / 49
Key idea: define total potential
= number of unmatched red nodes with proposals left
Zero if we run the full Gale–Shapley
1 2 2 1 1 1 3 2 1 2 3 2 1 1
SLIDE 45 Almost stable matchings
45 / 49
- Potential is non-increasing: if a red node loses
its partner, another red node gains a partner
- Assume that potential is α after round k > 1
= ⇒ α nodes received ‘no’ or ‘break’ in round k = ⇒ at least α edges removed in round k = ⇒ at least (k − 1)α edges removed
in rounds 2, 3, . . . , k
- At most O(∆|M|) edges removed in total
= ⇒ potential O(∆|M|/k) after round k = ⇒ O(∆2|M|/k) unstable edges
SLIDE 46 Almost stable matchings
46 / 49
Generalises to weighted matchings Applications (in bipartite, bounded-degree graphs):
- Local (2 + ǫ)-approximation algorithm
for maximum-weight matching
- Centralised randomised algorithm for
estimating the size of a stable matching
(All stable matchings have the same size!)
SLIDE 47 Almost stable matchings
47 / 49
But I think the most interesting observation is this:
- Almost stable matchings are a local problem
(at least in bounded-degree graphs)
- There is a simple local algorithm that finds
a robust, almost stable matching M
- The matching M can be easily maintained
in a dynamic network, constructed by using an efficient self-stabilising algorithm, etc.
SLIDE 48
Almost stable matchings
48 / 49
Research question: are almost stable matchings the right concept when we try to understand and analyse real-world social networks, matching markets, etc.?
3 1 1 2 2 1 1 1 1 2 3 2 1 2
SLIDE 49 Summary
49 / 49
Stable matching:
- global problem, any solution is unrobust
Almost stable matching:
- local problem, robust solutions exist
No new algorithms needed, just a new analysis
- f the Gale–Shapley algorithm from 1962
http://www.cs.helsinki.fi/jukka.suomela/