Stable Marrage

The Overview

  • Given a set of n number of males and a set of n number of females, have each group rate each member in ascending order of preference.

  • The algorithm terminates when a stable-perfect matching is found.

  • A unstable perfect matching is when women w is paired with man m, but there exists a situation where man m' prefers w, and w prefers m' back.

    • i.e. there exists a situation where the engagements should mutually change.

  • A stable perfect matching is when all men and women are paired in such a way that there exist no situation where man m and women w prefer each other and all are engaged.

  • A day is considered to be 1 full iteration in the algorithm. That is, every day every male proposes to his best preference. The first pseudo implementation does not have a clear concept of a 'day', but the second one does.

http://www.cs.princeton.edu/~wayne/kleinberg-tardos/pdf/01StableMatching.pdf

English-Code :: Gale-Shapely Algorithm:

  1. Have each man propose the his first preference.

  2. Have each women select her most preferred option from the from the current set of proposals, breaking a current engagement if necessary.

    1. Note: If all man have unique women preferences (some permutation of the women), then everyone is engaged on day 1, although it may not necessarily be stable.

  3. Continue until stable-perfect matching

Observations

  • Once matched a female does not become unmatched. She only trades up.

  • Once a male is matched, he can potentially become unmatched, and when he is unmatched, he can only trade down.

  • Running time: O(MF)O(M * F)

Pseudo-code

Alternatively:

Males and Females

Rankings

Last updated

Was this helpful?