RU beehive logo ITEC dept promo banner
ITEC 122
2008fall
ibarland

homeinfolecturesexamsarchive

lect14c

We will discuss the Matching problem, which you already thought about on hw12—FSMs; matching. We re-cap:

Consider the Marriage Problem: we'll introduce it with an example input: Four men (Alistair, Bernie, Corky, Dweezil -- abbreviated A,B,C,D resp.), and four women (Winnie, Xena, Yolanda, Zelda -- abbreviated W,X,Y,Z resp.), along with their preferences for hooking up marriage:

Alistair:  W,X,Y,Z
Bernie:    W,X,Z,Y
Corky:     W,Y,Z,X
Dweezil:   X,W,Y,Z

Winnie:    A,B,C,D
Xena:      C,B,D,A
Yolanda:   D,B,A,C
Zelda:     C,B,A,D
The task is to come up with a pairing of each person with someone of the opposite gender.

For example, one dating company, “HappyGuys” came up with the following solution: A+W, B+X, C+Y, D+Z.

Another company, “HappyGals” arrived at a different solution: A+W, C+X, D+Y, B+Z.

  1. Give an input with two men and two women and their preferences. Then, provide all possible solutions to your input.
  2. Give a second (fundamentally different1) input with two men and two women. Remember, an input consists of the people and their preferences.
  3. Challenge Question: When there are 2 men and 2 women, how many different (non-isomorphic) inputs are there?
  4. In the HappyGals solution to the example given above, what happens, when Bernie+Zelda happen to go out dancing at the same club as Corky+Xena?

  5. To think about for lecture (no writing required):

Finally, consider The Suitor's Algorithm (phrased in medieval, rather sexist terms):

This repeats until there are no changes.
We will talk about this algorithm in lecture, starting with the question of whether the Suitor's Algorithm is even guaranteed to terminate.

Analyzing solutions

How many possible solutions? What is a good solution?

Suitors Algorithm

(You can also see Wikipedia on Stable Marriage Problem.

Termination; running time

Questions:

- does this algorithm terminate?
   (Argue why there won't be some loop that goes on forever.)
  Yes:  [why?]
    At each step, a woman's preference will stay the same or go up
      (never down).
    It can only go up a maximum of n times.
    If 

  Alternately: Each man will move no more than n times,
    and there aren't any 

  Note how our proof gives a bound on the running time.

- When this algorithm stops, does it give a solution?
  That is, does every woman's tower have exactly one man at it?
  Yes -- when algorithrm terminates, there won't be more
  than one man at a tower (otherwise we wouldn't have terminated).
  
  By counting: if n men are assigned to n towers
    and none of them have 2 or more, then each must have exactly one.



- Is The Suitor's ALgorithm guaranteed to produce a stable solution?

  Yes: Proof by contradiction:
       Suppose not; suppose that after a solution is reached,
       some couple A,Z would prefer to break out of the solution.
       In that case, Z visited A's tower (before the person he ended up
       with).  But then A must have spurned Z, meaning she had some
       better catch M dangling on the line.
       So her final catch A* must at least as good as M, who was better then Z.
       So she would not want to swap with Z, contradicting our premise
       that A+Z would both prefer each other to their solution.
       

Optimal Solutions

Definition: A matching M is optimal for a person k if:
pref(k,M(k)) = max_S { pref(k,S(k)) | S is a stable matching }

Lemma: If a woman A is flirting with a man M (during the Suitor's Algorithm), and she eventually ends up with some man N (perhaps M=N), then pref(A,N) ≥ pref(A,M).


Th'm:
The Suitor's algorithm yields a match which 
is optimal for every single man.
  [that is, their most-preferred match, out of any stable matching.]


Proof:
  Proof by contradiction: 
    suppose *some* man is not paired with his optimal mate.

  In particular, during the algorithm,
  consider the first man who passes up his optimal mate; call him 'M'.
  Call M's optimal match opt(m).

   Clearly, in the suitor's alg, M won't end up with anybody 
     preferred higher than opt(M).
   Suppose at some point, he visits opt(M)'s tower.
   But some other man N is there, and opt(M) chooses N over M.

     (Note that if Y shows up at that tower,
      it's because he was spurned by all his higher choices,
      and Y can't be with any of those women higher choices 
      in a stable solution.)

   Well then, by def'n of "opt", there is some (other) matching
   where M+opt(M), N+...we'll call her X
     opt(M): ...,N,...,M,... (since M got bumped)
     N:    ...,X,...
    Where does opt(M) fit, in N's list-of-preferences?
      We can't put opt(M) *before* X, else S isn't stable.
      We can't put opt(M) *after* X; this is the *first* round
        where somebody is leaving their optimal mate.


Lemma:
   If M is matched with with W in a male-optimal matching,
   then M is W's pessimal (least-preferred) choice 
   out of all stable matches.
Proof:
   Consider any (other) stable matching S,
     where M is matched with soembody else, X.
   But M prefers W to X (by opt).
   Since S is stable, W prefers her match in S to M.

1 Two inputs are fundamentally different if you can't change one into the other just by re-naming. That is, the two inputs should not be isomorphic.      

homeinfolecturesexamsarchive


©2008, Ian Barland, Radford University
Last modified 2008.Dec.12 (Fri)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme