21
CS 321. Algorithm Analysis & Design Lecture 15 Interlude: Stable Matchings A Valentine Day Special Disclaimer - People shown on these slides are a part of a fictitious story. Not to be taken seriously!

15 - 12 Feb - Stable Matchings

Embed Size (px)

Citation preview

Page 1: 15 - 12 Feb - Stable Matchings

CS 321. Algorithm Analysis & Design Lecture 15

Interlude: Stable MatchingsA Valentine Day Special

Disclaimer - People shown on these slides are a part of a fictitious story. Not to be taken seriously!

Page 2: 15 - 12 Feb - Stable Matchings

Input: Two sets of agents (men and women), and some notion of preferences.

The Matching Problem

Output: A pairing of the agents that satisfies some reasonable property.

Page 3: 15 - 12 Feb - Stable Matchings
Page 4: 15 - 12 Feb - Stable Matchings
Page 5: 15 - 12 Feb - Stable Matchings
Page 6: 15 - 12 Feb - Stable Matchings
Page 7: 15 - 12 Feb - Stable Matchings

There is a perfect matching between A and B if, and only if,

there is no congestion*.

Hall’s Marriage Theorem

Let G = (V,E) be a bipartite graph with bipartition V = (A,B); and suppose |A| = |B|.

(i.e, there is no subset S of A for which N(S) is smaller than S.)

Page 8: 15 - 12 Feb - Stable Matchings
Page 9: 15 - 12 Feb - Stable Matchings

>

>

Page 10: 15 - 12 Feb - Stable Matchings

Stability

A marriage between A and B is stable if there is no pair of couples

(a ⟷ p) and (b ⟷ q)

such that a prefers q over p and q prefers a over b.

Page 11: 15 - 12 Feb - Stable Matchings

Goal: Design an Stable Matching Algorithm

The men keep proposing.

The women keep rejecting, as long as it makes sense.

Page 12: 15 - 12 Feb - Stable Matchings
Page 13: 15 - 12 Feb - Stable Matchings
Page 14: 15 - 12 Feb - Stable Matchings

To begin with, every man proposes to the

woman on the top of his list.

A woman always accepts her first proposal,

and accepts the best among multiple proposals.

Page 15: 15 - 12 Feb - Stable Matchings

The first round Proposals on the left

and engagements on the right.

Page 16: 15 - 12 Feb - Stable Matchings

As long as a man is free, he proposes to the next woman on

his list.

A woman accepts a proposal either if she is single, or if the proposal is better than

her current partner.

Page 17: 15 - 12 Feb - Stable Matchings

The second round Proposals on the left

and engagements on the right.

Page 18: 15 - 12 Feb - Stable Matchings

The third round Proposals on the left

and engagements on the right.

The algorithm terminates because we now have a matching.

Page 19: 15 - 12 Feb - Stable Matchings
Page 20: 15 - 12 Feb - Stable Matchings

The total number of proposals made is at most n2.

The algorithm always terminates with a matching.

The matching is stable.

If m is free at some point in the execution of the algorithm, then there is a woman to whom he has

not yet proposed.

The algorithm always terminates with a matching.

Page 21: 15 - 12 Feb - Stable Matchings

>

>

This situation is not possible with the algorithm - RK would have proposed to KK first, and

she has no reason to reject the proposal!

Proof of STABILITY