CS 401: Computer Algorithms I
Stable Matching
Xiaorui Sun
1
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
Xiaorui Sun
1
Talk about how to solve problems using computers, aka, algorithms. Goal:
Content: Most of chapter 1-8
2
Course textbook
Talk about how to solve problems using computers, aka, algorithms. Goal:
Prerequisite:
3
Talk about how to solve problems using computers, aka, algorithms. Goal:
Grading Scheme
Five problem sets due on Wed 4pm
(https://www.gradescope.com/courses/169509) TA: Wenyu Jin
4
Course textbook
5
6
Zoran Amy Claire Brenda Yuri Brenda Claire Amy Xavier Amy Claire Brenda 1st 2nd 3rd
Men’s Preference Profile
Claire Xavier Zoran Yuri Brenda Xavier Zoran Yuri Amy Yuri Zoran Xavier 1st 2nd 3rd
Women’s Preference Profile
favorite least favorite favorite least favorite
7
8
m w
9
Zoran Amy Claire Brenda Yuri Brenda Claire Amy Xavier Amy Claire Brenda 1st 2nd 3rd
Men’s Preference Profile
Claire Xavier Zoran Yuri Brenda Xavier Zoran Yuri Amy Yuri Zoran Xavier 1st 2nd 3rd
Women’s Preference Profile
favorite least favorite favorite least favorite
10
Zoran Amy Claire Brenda Yuri Brenda Claire Amy Xavier Amy Claire Brenda Claire Xavier Zoran Yuri Brenda Xavier Zoran Yuri Amy Yuri Zoran Xavier 1st 2nd 3rd 1st 2nd 3rd
favorite least favorite favorite least favorite
Men’s Preference Profile Women’s Preference Profile
11
Zoran Amy Claire Brenda Yuri Brenda Claire Amy Xavier Amy Claire Brenda Claire Xavier Zoran Yuri Brenda Xavier Zoran Yuri Amy Yuri Zoran Xavier 1st 2nd 3rd 1st 2nd 3rd
favorite least favorite favorite least favorite
Men’s Preference Profile Women’s Preference Profile
12
B
Bob Chris Adam
C A B D D
David
A B C D C A
1st 2nd 3rd A-B, C-D Þ B-C unstable A-C, B-D Þ A-B unstable A-D, B-C Þ A-C unstable
(or “same-sex” stable matching)
13
Initialize each person to be free. while (some man is free and hasn't proposed to every woman) { Choose such a man m w = 1st 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.