Lecture 5 CSE 331 Sep 10, 2010
HW 1 Posted on course webpage READ THE INSTRUCTIONS CAREFULLY
New tougher deadline If you do not form a group by Sep 14 You will get a ZERO on group leader scribe
Only 71 signed forms I’ll need confirmation in writing. No graded material will be handed back till I get this signed form from you!
One new blog post slot open Sep 15 has one free slot now
On matchings Mal Wash Simon Inara Zoe Kaylee
A valid matching
Not a matching
Perfect Matching
Preferences
Instability
Questions/Comments?
Stable Marriage problem Input: M and W with preferences Output: Stable Matching Set of men M and women W Preferences (ranking of potential spouses) Matching (no polygamy in M X W) Perfect Matching (everyone gets married) m w m’ w’ Instablity Stable matching = perfect matching+ no instablity
First algorithm? Try to match up one man and women who prefer each other most n! perfect matchings Go through all perfect matchings S If S is stable then stop else move to the next matching
Verify if perfect matching is stable Go through all pairs (m,w) n^2 pairs Check if m and w *both* prefer each other to their current matchings O(n) time If so matching is unstable O(n^3) time
Today’s lecture Couple of examples Gale-Shapley algorithm for Stable Marriage problem
Gale-Shapley Algorithm Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free (m,w) get engaged Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output