1 / 30

CSE 331 Lecture - Stable Marriage Problem and Gale-Shapley Algorithm

This lecture covers the Stable Marriage Problem, including the Naïve Algorithm and the Gale-Shapley Algorithm. Topics include perfect matching, instability, stable marriages, and computing algorithms. Questions and comments are welcome.

barbarae
Download Presentation

CSE 331 Lecture - Stable Marriage Problem and Gale-Shapley Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 4 CSE 331 Sep 6, 2017

  2. Read the syllabus CAREFULLY! No graded material will be handed back till you submit a signed form!

  3. Sign-up for mini projects Deadline: Monday, Sep 25, 11:59pm Email me your group (=3) composition

  4. Separate Proof idea/proof details

  5. TA office hours finalized

  6. Makeup recitations TODAY, 4-5pm in Davis 338A Tomorrow, 5-6pm in Davis 113A

  7. On matchings Mal Inara Wash Zoe Simon Kaylee

  8. A valid matching Mal Inara Wash Zoe Simon Kaylee

  9. Not a matching Mal Inara Wash Zoe Simon Kaylee

  10. Perfect Matching Mal Inara Wash Zoe Simon Kaylee

  11. Preferences Mal Inara Wash Zoe Simon Kaylee

  12. Instability Mal Inara Wash Zoe Simon Kaylee

  13. A stable marriage Even though BBT and JA are not very happy

  14. Two stable marriages

  15. 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 polyandry/gamy in M X W) Perfect Matching (everyone gets married) m w Instablity m’ w’ Stable matching = perfect matching+ no instablity

  16. Questions/Comments?

  17. Two Questions Does a stable marriage always exist? If one exists, how quickly can we compute one?

  18. Today’s lecture Naïve algorithm Gale-Shapley algorithm for Stable Marriage problem

  19. The naïve algorithm Incremental algorithm to produce all n! prefect matchings? Go through all possible perfect matchings S If S is a stable matching then Stop n! matchings Else move to the next perfect matching

  20. Gale-Shapley Algorithm David Gale Lloyd Shapley O(n3) algorithm

  21. Moral of the story… >

  22. Questions/Comments?

  23. 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

  24. Preferences Mal Inara Wash Zoe Simon Kaylee

  25. GS algorithm: Firefly Edition Inara Mal Zoe Wash 4 5 6 1 2 3 Kaylee Simon 4 5 6 1 2 3

  26. Observation 1 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 Once a man gets engaged, he remains engaged (to “better” women) 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

  27. Observation 2 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 If w proposes to m after m’, then she prefers m’ to m (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

  28. Questions/Comments?

  29. Why bother proving correctness? Consider a variant where any free man or free woman can propose Is this variant any different? Can you prove it?

  30. GS’ does not output a stable marriage

More Related