Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4 CSE 331 Sep 7, 2016.

Similar presentations


Presentation on theme: "Lecture 4 CSE 331 Sep 7, 2016."— Presentation transcript:

1 Lecture 4 CSE 331 Sep 7, 2016

2 Read the syllabus CAREFULLY!
I’ll need confirmation in writing. No graded material will be handed back till I get this signed form from you!

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

4 Separate Proof idea/proof details

5 On matchings Mal Wash Simon Inara Zoe Kaylee

6 A valid matching Mal Wash Simon Inara Zoe Kaylee

7 Not a matching Mal Wash Simon Inara Zoe Kaylee

8 Perfect Matching Mal Wash Simon Inara Zoe Kaylee

9 Preferences Mal Wash Simon Inara Zoe Kaylee

10 Instability Mal Wash Simon Inara Zoe Kaylee

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

12 Two stable marriages

13 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 m’ w’ Instablity Stable matching = perfect matching+ no instablity

14 Questions/Comments?

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

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

17 Discuss: Naïve algorithm!

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

19 Gale-Shapley Algorithm
David Gale Lloyd Shapley O(n3) algorithm

20 Moral of the story… >

21 Questions/Comments?

22 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

23 Preferences Mal Wash Simon Inara Zoe Kaylee

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

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

26 If w proposes to m after m’, then she prefers m’ to m
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

27 Questions/Comments?

28 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?

29 GS’ does not output a stable marriage


Download ppt "Lecture 4 CSE 331 Sep 7, 2016."

Similar presentations


Ads by Google