(Latest Revision: Mon Jan 20 18:01:41 PST 2020 ) Take Home Exercise #1

Take Home Exercise #1

CS 4400 Practice Exercise
Stable Matching Problem


Here is a sample of how the Gale-Shapley algorithm would solve 
a stable matching problem:

INPUT

Xavier  Amy     Bertha  Clare
Yancey  Bertha  Amy     Clare
Zeus    Amy     Bertha  Clare

Amy     Yancey  Xavier  Zeus
Bertha  Xavier  Yancey  Zeus
Clare   Xavier  Yancey  Zeus

Gale-Shapley ALGORITHM RUN script

1.	Xavier proposes to Amy.
2.	Amy pairs with Xavier because she is free.
3.	Yancey proposes to Bertha.
4.	Bertha pairs with Yancey because she is free.
5.	Zeus proposes to Amy.
6.	Amy rejects Zeus because she likes her current match, Xavier, more.
7.	Zeus remains free.
8.	Zeus proposes to Bertha.
9.	Bertha rejects Zeus because she likes her current match, Yancey, more.
10.	Zeus remains free.
11.	Zeus proposes to Clare.
12.	Clare pairs with Zeus because she is free.

Now everyone has a match.

Here Are The Matches: 

    WOMEN      MEN
    Amy       Xavier
    Bertha    Yancey
    Clare     Zeus

==============================

==============================
Your Assignment:

Process the following input in the same manner the sample input was 
processed, as illustrated above.

Produce the same kind of script (step-by-step) of the actions taken by 
the Gale-Shapley algorithm, plus write what the final matching is.

The men are Abe, Ben, Cal, and Dan.  
The women are Eve, Fey, Gem, and Hil.

The preference lists are 

Abe   Hil Fey Gem Eve
Ben   Gem Hil Fey Eve
Cal   Gem Fey Hil Eve
Dan   Gem Hil Eve Fey

Eve    Abe Ben Dan Cal
Fey    Ben Cal Abe Dan
Gem    Ben Abe Dan Cal
Hil    Abe Ben Cal Dan