Lecture 1: Algorithm Design and Analysis - Stable Matching Problem, Study notes of Computer Science

Based on the slides from a lecture by a. Smith on algorithm design and analysis. The lecture covers the stable matching problem, which aims to find a suitable matching between a set of men and women based on their preferences. Examples of preference profiles and stable matching assignments, as well as questions to test understanding of the concept.

Typology: Study notes

Pre 2010

Uploaded on 09/24/2009

koofers-user-twr
koofers-user-twr šŸ‡ŗšŸ‡ø

10 documents

1 / 47

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
8/25/2008 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne
Adam Smith
Algorithm Design and Analysis
LECTURE 1
Analysis of Algorithms
• Course information
• Why study algorithms?
• Stable matching problem
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Partial preview of the text

Download Lecture 1: Algorithm Design and Analysis - Stable Matching Problem and more Study notes Computer Science in PDF only on Docsity!

8/25/

Adam Smith

Algorithm Design and Analysis

LECTURE 1

Analysis of Algorithms

• Course information

• Why study algorithms?

• Stable matching problem

8/25/

Course information

1. Staff

2. Course website

3. Prerequisites

4. Lectures

5. Textbook

6. Syllabus

7. Exams

8. Homework

9. Grading policy

10. Collaboration policy

8/25/

Performance

• Typical goal: Find most space- and time-efficient

algorithm for given problem.

• What else is important?

– (correctness!)

– modularity

– maintainability

– functionality

– robustness

• Performance is the currency of computing

– user-friendliness

– programmer time

– simplicity

– extensibility

– reliability

8/25/

Course Objectives

Material

• Classical algorithms

• Analysis of algorithms

• Standard design techniques

Skills

• Algorithmic Thinking

• Problem-solving & mathematical ability

• Technical writing

Prerequisite: CSE 465 (or equiv.)

Some of things you should have covered:

  • Proofs by induction and contradiction
  • Asymptotic notation (e.g. ``big-O'')
  • Recursive algorithms
  • Elementary data structures: lists, stacks, queues, sorted arrays
  • Binary search
  • Sorting algorithms
  • Graphs and trees
  • Depth- and breadth-first search
  • Basic mathematical tools: arithmetic and geometric series,

counting permutations, vectors and matrices, etc

8/25/

8/25/

Matching Residents to Hospitals

  • Goal: Given a set of preferences among hospitals and medical school students, design a self-reinforcing admissions process.
  • Unstable pair: applicant x and hospital y are unstable if
    • x prefers y to its assigned hospital, and
    • y prefers x to one of its admitted students
  • Stable assignment : no unstable pairs.
    • Individual self-interest will prevent any applicant/hospital deal

from being made.

8/25/

Stable Matching Problem

• Perfect matching:

– Each man gets exactly one woman.

– Each woman gets exactly one man.

• Stability: no incentive for some pair of participants to

undermine assignment by joint action.

– In matching M, an unmatched pair m-w is unstable if man m and

woman w prefer each other to their current partners.

– Unstable pair m-w could each improve by eloping.

• Stable matching: perfect matching with no unstable pairs.

• Problem: Given the preference lists of n men and n

women, find a stable matching if one exists.

8/25/

Stable Matching Problem

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

favorite least favorite favorite least favorite Zeus Amy Bertha Clare Yancey Bertha Amy Clare Xavier Amy Bertha Clare 1 st^2 nd^3 rd Men’s Preference Profile Clare Xavier Yancey Zeus Bertha Xavier Yancey Zeus Amy Yancey Xavier Zeus 1 st^2 nd^3 rd Women’s Preference Profile

8/25/

Stable Matching Problem

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

favorite least favorite favorite least favorite Zeus Amy Bertha Clare Yancey Bertha Amy Clare Xavier Amy Bertha Clare Clare Xavier Yancey Zeus Bertha Xavier Yancey Zeus Amy Yancey Xavier Zeus 1 st^2 nd^3 rd^1 st^2 nd^3 rd Men’s Preference Profile Women’s Preference Profile

8/25/

Stable Matching Problem

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

• A. Yes. X and Y got their first choice; Z is the last

choice for every woman. No man can participate in an

unstable pair.

favorite least favorite favorite least favorite Zeus Amy Bertha Clare Yancey Bertha Amy Clare Xavier Amy Bertha Clare Clare Xavier Yancey Zeus Bertha Xavier Yancey Zeus Amy Yancey Xavier Zeus 1 st^2 nd^3 rd^1 st^2 nd^3 rd Men’s Preference Profile Women’s Preference Profile

8/25/

Stable Roommate Problem

• Stable roommate problem

– 2n people; each person ranks others from 1 to 2n-1.

– Assign roommate pairs so that no unstable pairs.

• Observation. Stable matchings do not always

exist for stable roommate problem.

B

Bob Chris Adam (^) C A B

D
D

Doofus (^) A B C

D
C
A

1 st^2 nd^3 rd A-B, C-D ⇒ B-C unstable A-C, B-D ⇒ A-B unstable A-D, B-C ⇒ A-C unstable

8/25/

Propose-and-Reject Algorithm

• Propose-and-reject algorithm. [Gale-Shapley 1962]

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 }

Zeus Bertha Diane Amy Erika Clare Yancey Amy Diane Clare Bertha Erika Xavier Bertha Erika Clare Diane Amy Wyatt Diane Bertha Amy Clare Erika Victor Bertha Amy Diane Erika Clare 0 th^1 st^2 nd^3 rd^4 th Men’s Preference Profile Erika Yancey Wyatt Zeus Xavier Victor Diane Victor Zeus Yancey Xavier Wyatt Clare Wyatt Xavier Yancey Zeus Victor Bertha Xavier Wyatt Yancey Victor Zeus Amy Zeus Victor Wyatt Yancey Xavier 0 th^1 st^2 nd^3 rd^4 th Women’s Preference Profile Victor proposes to Bertha. Victor Bertha

Zeus Bertha Diane Amy Erika Clare Yancey Amy Diane Clare Bertha Erika Xavier Bertha Erika Clare Diane Amy Wyatt Diane Bertha Amy Clare Erika Victor Bertha Amy Diane Erika Clare 0 th^1 st^2 nd^3 rd^4 th Men’s Preference Profile Erika Yancey Wyatt Zeus Xavier Victor Diane Victor Zeus Yancey Xavier Wyatt Clare Wyatt Xavier Yancey Zeus Victor Bertha Xavier Wyatt Yancey Victor Zeus Amy Zeus Victor Wyatt Yancey Xavier 0 th^1 st^2 nd^3 rd^4 th Women’s Preference Profile Victor proposes to Bertha.

  • Bertha accepts since previously unmatched. Victor Bertha