Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5 CSE 331 Sep 11, 2015. Submit the form I’ll need confirmation in writing. No graded material will be handed back till I get this signed form.

Similar presentations


Presentation on theme: "Lecture 5 CSE 331 Sep 11, 2015. Submit the form I’ll need confirmation in writing. No graded material will be handed back till I get this signed form."— Presentation transcript:

1 Lecture 5 CSE 331 Sep 11, 2015

2 Submit the form 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 Email me your group (=7) composition + your chosen algorithm

4 Homeworks HW 1 posted online: see piazza Pickup graded HW 0 starting Monday

5 Remember to read HW policies

6 Separate Proof idea/proof details Proof details with no proof idea will get you a zero for the entire problem

7 A valid matching Mal Wash Simon Inara Zoe Kaylee

8 Not a matching Mal Wash Simon Inara Zoe Kaylee

9 Perfect Matching Mal Wash Simon Inara Zoe Kaylee

10 Preferences Mal Wash Simon Inara Zoe Kaylee

11 Instability Mal Wash Simon Inara Zoe Kaylee

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

13 Two stable marriages

14 Stable Marriage problem Set of men M and women W Matching (no polyandry/gamy in M X W) Perfect Matching (everyone gets married) Instablity m m w w m’m’w’w’ Preferences (ranking of potential spouses) Stable matching = perfect matching+ no instablity

15 Questions/Comments?

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

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

18 Discuss: Naïve algorithm!

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

20 Gale-Shapley Algorithm David Gale Lloyd Shapley O(n 3 ) 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 Wash Simon Inara Zoe Kaylee

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

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

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

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


Download ppt "Lecture 5 CSE 331 Sep 11, 2015. Submit the form I’ll need confirmation in writing. No graded material will be handed back till I get this signed form."

Similar presentations


Ads by Google