stable matching / analyzing efficiency - umass amherstsheldon/teaching/mhc/cs312... ·...

10
Stable Matching / Analyzing Efficiency

Upload: others

Post on 04-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Stable Matching /Analyzing Efficiency

Page 2: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Today

Announcement: HW1 is posted, due next Thursday in class

Topics

Stable matching proofs

Efficiency of algorithms

Page 3: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Propose-and-Reject (Gale-Shapley) Algorithm

Initialize each college and student to be free.while (some college is free and hasn't made offers to every student) {

Choose such a college cs = 1st student on c’s list to whom c has not made offerif (s is free)

assign c and s to be engagedelse if (s prefers c to current college c’)

assign c and s to be engaged, and c’ to be free

elses rejects c

}

Page 4: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Questions about the Gale-Shapley Algorithm

Does the loop terminate?

Is the matching perfect, that is, is it one-to-one?

Is the matching stable?

Page 5: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Proof by Contradiction(Review)

Goal: prove that A is true

1. Assume A is false.2.Reason to a contradiction with some other

known fact3.Conclude that A must therefore be true.

Page 6: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

On Fairness...

Gale-Shapley algorithm is asymmetric: seems that colleges have the upper hand

What can we say formally?

Page 7: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

A Remarkable ResultA given problem instance may have several stable matchings

Def. College c is a valid partner of student s if there exists some stable matching in which they are matched.

College-optimal assignment. Each college receives best valid student.

Claim. All executions of GS yield college-optimal assignment, which is a stable matching!

What proof technique should we use?

Page 8: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Algorithm Design

Formulate the problem precisely

Design an algorithm to solve the problem

Prove the algorithm correct

Analyze the algorithm’s runtime

Page 9: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Analyzing Running Time(Chapter 2)

What is efficiency?

Tools: asymptotic growth of functions

Practice finding asymptotic running time of algorithms

Page 10: Stable Matching / Analyzing Efficiency - UMass Amherstsheldon/teaching/mhc/cs312... · 2014-01-19 · A given problem instance may have several stable matchings Def. College c is

Is My Algorithm Efficient?Idea: Implement it, time how long it takes.

Problems?

Effects of the programming language?Effects of the processor?Effects of the amount of memory?Effects of other things running on the computer?Effects of the input values?Effects of the input size?