Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 3 CSE 331 Sep 2, 2016.

Similar presentations


Presentation on theme: "Lecture 3 CSE 331 Sep 2, 2016."— Presentation transcript:

1 Lecture 3 CSE 331 Sep 2, 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 Join piazza!

4 Main Steps in Algorithm Design
Problem Statement Real world problem Problem Definition Precise mathematical def Algorithm “Implementation” Data Structures Analysis Correctness/Run time

5 National Resident Matching

6 (Screen) Docs are coming to BUF
Buffalo General Hawkeye (M*A*S*H) Millard Filmore (Gates Circle) JD (Scrubs) Millard Filmore (Suburban)

7 What can go wrong?

8 The situation is unstable!

9 What happens in real life
Preferences Information Preferences

10 NRMP plays matchmaker

11 Stable Matching Problem
David Gale Lloyd Shapley

12 Questions/Comments?

13 Matching Employers & Applicants
Input: Set of employers (E) Set of applicants (A) Preferences Output: An assignment of applicants to employers that is “stable” For every x in A and y in E such that x is not assigned to y, either (i) y prefers every accepted applicant to x; or (ii) x prefers her employer to y

14 Simplicity is good

15 Questions to think about
1) How do we specify preferences? Preference lists 2) Ratio of applicant vs employers 1:1 3) Formally what is an assignment? (perfect) matching 4) Can an employer get assigned > 1 applicant? NO 5) Can an applicant have > 1 job? 6) How many employer/applicants in an applicants/employers preferences? All of them 7) Can an employer have 0 assigned applicants? NO 8) Can an applicant have 0 jobs?

16 Questions/Comments?

17 Non-feminist reformulation
n men Each with a preference list n women Match/marry them in a “stable” way

18 On matchings Mal Wash Simon Inara Zoe Kaylee

19 A valid matching Mal Wash Simon Inara Zoe Kaylee

20 Not a matching Mal Wash Simon Inara Zoe Kaylee

21 Perfect Matching Mal Wash Simon Inara Zoe Kaylee

22 Preferences Mal Wash Simon Inara Zoe Kaylee

23 Instability Mal Wash Simon Inara Zoe Kaylee

24 Questions/Comments?

25 Discuss: Naïve algorithm!

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

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

28 Moral of the story… >


Download ppt "Lecture 3 CSE 331 Sep 2, 2016."

Similar presentations


Ads by Google