cs 401 computer algorithms i
play

CS 401: Computer Algorithms I Stable Matching Xiaorui Sun 1 - PowerPoint PPT Presentation

CS 401: Computer Algorithms I Stable Matching Xiaorui Sun 1 This Course Talk about how to solve problems using computers, aka, algorithms. Goal: Learn algorithm design principles How to analyze the runtime Correctness proof


  1. CS 401: Computer Algorithms I Stable Matching Xiaorui Sun 1

  2. This Course Talk about how to solve problems using computers, aka, algorithms. Goal: • Learn algorithm design principles • How to analyze the runtime • Correctness proof • Understand some problems are difficult Content: Most of chapter 1-8 • Representative problems • Basic of algorithm analysis • Graphs • Greedy algorithms • Divide and conquer • Dynamic programming Course textbook • Network flow • NP and Computational Intractability 2

  3. This Course Talk about how to solve problems using computers, aka, algorithms. Goal: • Learn algorithm design principles • How to analyze the runtime • Correctness proof • Understand some problems are difficult Prerequisite: • Discrete math (set, tree, graph) • Data structures (queue, stack, tree, graph) • Basic proof techniques (contradiction, induction) 3

  4. This Course Talk about how to solve problems using computers, aka, algorithms. Goal: • Learn algorithm design principles • How to analyze the runtime • Correctness proof • Understand some problems are difficult Grading Scheme • Homework ~ 50% Five problem sets due on Wed 4pm • Midterm ~ 20% • Final ~ 30% • Submit through GradeScope (https://www.gradescope.com/courses/169509) Course textbook TA: Wenyu Jin 4

  5. Where to get help? • Ask question in the class • Use Blackboard raise hand function • All the lectures will be recorded (watch through Blackboard) • Read the textbook! • Website: http://www.cs.uic.edu/~xiaorui/cs401 • Lecture slides, homework • Piazza: piazza.com/uic/fall2020/2020fallcs40141675 • Announcements, online discussion forum • TA will answer course related questions • Office hours: • Myself: Fri 2pm-4pm • Wenyu Jin: Tue 10am-12pm 5

  6. Stable Matching Problem Given n men and n women, find a “stable matching”. • We know the preference of all people. favorite least favorite favorite least favorite 1 st 2 nd 3 rd 1 st 2 nd 3 rd Xavier Amy Brenda Claire Amy Yuri Xavier Zoran Yuri Brenda Amy Claire Brenda Xavier Yuri Zoran Zoran Amy Brenda Claire Claire Xavier Yuri Zoran Men’s Preference Profile Women’s Preference Profile 6

  7. Stable Matching Perfect matching: • Each man gets exactly one woman. • Each woman gets exactly one man. Stability: no incentive to exchange • an unmatched pair m - w is unstable • if man m and woman w prefer each other to current partners. 7

  8. Stable Matching Perfect matching: • Each man gets exactly one woman. • Each woman gets exactly one man. Stability: no incentive to exchange • an unmatched pair m - w is unstable • if man m and woman w prefer each other to current partners. w m Stable matching: perfect matching with no unstable pairs. Stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists. 8

  9. Example Question. Is assignment X-C, Y-B, Z-A stable? favorite least favorite favorite least favorite 1 st 2 nd 3 rd 1 st 2 nd 3 rd Xavier Amy Brenda Claire Amy Yuri Xavier Zoran Yuri Brenda Amy Claire Brenda Xavier Yuri Zoran Zoran Amy Brenda Claire Claire Xavier Yuri Zoran Men’s Preference Profile Women’s Preference Profile 9

  10. Example Question. Is assignment X-C, Y-B, Z-A stable? Answer. No. Brenda and Xavier will hook up. favorite least favorite favorite least favorite 1 st 2 nd 3 rd 1 st 2 nd 3 rd Xavier Amy Brenda Claire Amy Yuri Xavier Zoran Yuri Brenda Amy Claire Brenda Xavier Yuri Zoran Zoran Amy Brenda Claire Claire Xavier Yuri Zoran Men’s Preference Profile Women’s Preference Profile 10

  11. Example (cont’d) Question: Is assignment X-A, Y-B, Z-C stable? Answer: Yes. favorite least favorite favorite least favorite 1 st 2 nd 3 rd 1 st 2 nd 3 rd Xavier Amy Brenda Claire Amy Yuri Xavier Zoran Yuri Brenda Amy Claire Brenda Xavier Yuri Zoran Zoran Amy Brenda Claire Claire Xavier Yuri Zoran Men’s Preference Profile Women’s Preference Profile 11

  12. Existence of Stable Matchings Question. Do stable matchings always exist? Answer. Yes, but not obvious. Stable roommate problem: (or “same-sex” stable matching) 2n people; each person ranks others from 1 to 2n-1 . Assign roommate pairs so that no unstable pairs. 1 st 2 nd 3 rd B C D Adam A-B, C-D Þ B-C unstable C A D Bob A-C, B-D Þ A-B unstable A-D, B-C Þ A-C unstable A B D Chris A B C David So, Stable matchings do not always exist for stable roommate problem. 12

  13. Propose-And-Reject Algorithm [Gale-Shapley’62] Initialize each person to be free. while (some man is free and hasn't proposed to every woman) { Choose such a man m w = 1 st woman on m 's list to whom m has not yet proposed if ( w is free) assign m and w to be engaged else if ( w prefers m to her fiancé m' ) assign m and w to be engaged, and m' to be free else w rejects m } Theorem: Propose-And-Reject Algorithm always finds a stable matching. 13

Recommend


More recommend