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

cs 401 computer algorithms i
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

CS 401: Computer Algorithms I

Stable Matching

Xiaorui Sun

1

slide-2
SLIDE 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
  • Network flow
  • NP and Computational Intractability

2

Course textbook

slide-3
SLIDE 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

slide-4
SLIDE 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) TA: Wenyu Jin

4

Course textbook

slide-5
SLIDE 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

slide-6
SLIDE 6

Stable Matching Problem

Given n men and n women, find a “stable matching”.

  • We know the preference of all people.

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

slide-7
SLIDE 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

slide-8
SLIDE 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.

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

m w

slide-9
SLIDE 9

Example

  • Question. Is assignment X-C, Y-B, Z-A stable?

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

slide-10
SLIDE 10

Example

  • Question. Is assignment X-C, Y-B, Z-A stable?
  • Answer. No. Brenda and Xavier will hook up.

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

slide-11
SLIDE 11

Example (cont’d)

Question: Is assignment X-A, Y-B, Z-C stable? Answer: Yes.

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

slide-12
SLIDE 12

Existence of Stable Matchings

  • Question. Do stable matchings always exist?
  • Answer. Yes, but not obvious.

Stable roommate problem:

2n people; each person ranks others from 1 to 2n-1. Assign roommate pairs so that no unstable pairs. So, Stable matchings do not always exist for stable roommate problem.

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)

slide-13
SLIDE 13

Propose-And-Reject Algorithm [Gale-Shapley’62]

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.