CSE 421 Algorithms Richard Anderson Autumn 2006 Lecture 2.

Slides:



Advertisements
Similar presentations
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Advertisements

Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 2.
MATH 224 – Discrete Mathematics
Reasoning About Code; Hoare Logic, continued
Chapter 5 Fundamental Algorithm Design Techniques.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
Projects Co-ordinator
CSE 421 Algorithms Richard Anderson Lecture 2. Announcements Office Hours –Richard Anderson, CSE 582 Monday, 10:00 – 11:00 Friday, 11:00 – 12:00 –Yiannis.
CSE 421 Algorithms Richard Anderson Lecture 16 Dynamic Programming.
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
EE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Prasanna Chaporkar, Programming.
CSE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Dimosthenes Anthomelidis
CSE 421 Algorithms Richard Anderson Lecture 3. Classroom Presenter Project Understand how to use Pen Computing to support classroom instruction Writing.
Lecture 8 CSE 331 Sep 17, HW 1 due today Place Q1 and Q2 in separate piles I will not accept HWs after 1:15pm.
The Stable Marriage Problem
LECTURE 40: SELECTION CSC 212 – Data Structures.  Sequence of Comparable elements available  Only care implementation has O(1) access time  Elements.
Great Theoretical Ideas in Computer Science.
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 1.
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 1.
Lecture 38 CSE 331 Dec 2, Review Sessions etc. Atri: (at least ½ of) class next Friday Jiun-Jie: Extra office hour next Friday Jesse: Review Session.
Bipartite Matching. Unweighted Bipartite Matching.
CSE 421 Algorithms Richard Anderson (for Anna Karlin) Winter 2006 Lecture 2.
The Stable Marriage Problem
CSCI 256 Data Structures and Algorithm Analysis lecture 1 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSE 373: Data Structures and Algorithms
Lecture 8 CSE 331. Main Steps in Algorithm Design Problem Statement Algorithm Problem Definition “Implementation” Analysis n! Correctness+Runtime Analysis.
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Market Design and Analysis Lecture 2 Lecturer: Ning Chen ( 陈宁 )
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 4.
Lecture 2 What is a computational problem? What is an instance of a problem? What is an algorithm? How to guarantee that an algorithm is correct? What.
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
P, NP, and NP-Complete Problems Section 10.3 The class P consists of all problems that can be solved in polynomial time, O(N k ), by deterministic computers.
Stable Matching.
CSE 421: Introduction to Algorithms
Lecture 6 CSE 331 Sep 11, 2017.
Richard Anderson Autumn 2015 Lecture 8 – Greedy Algorithms II
Richard Anderson (for Anna Karlin) Winter 2006 Lecture 1
Great Ideas in Computing Average Case Analysis
Richard Anderson Autumn 2006 Lecture 1
Richard Anderson Lecture 3
Greedy Algorithms: Homework Scheduling and Optimal Caching
Richard Anderson Autumn 2015 Lecture 1
Richard Anderson Autumn 2016 Lecture 7
Richard Anderson Autumn 2016 Lecture 2
Richard Anderson Autumn 2006 Lecture 1
Richard Anderson Winter 2019 Lecture 8 – Greedy Algorithms II
Lecture 6 CSE 331 Sep 12, 2011.
BST Insert To insert an element, we essentially do a find( ). When we reach a NULL pointer, we create a new node there. void BST::insert(const Comp &
Richard Anderson Autumn 2016 Lecture 8 – Greedy Algorithms II
Lecture 6 CSE 331 Sep 12, 2016.
Richard Anderson Winter 2009 Lecture 2
Lecture 7 CSE 331 Sep 10, 2014.
Richard Anderson Winter 2019 Lecture 1
Divide & Conquer Sorting
Piyush Kumar (Lecture 3: Stable Marriage)
Lecture 5 CSE 331 Sep 9, 2011.
Richard Anderson Winter 2019 Lecture 7
Richard Anderson Winter 2019 Lecture 4
Lecture 7 CSE 331 Sep 11, 2013.
Richard Anderson Autumn 2015 Lecture 7
Richard Anderson Winter 2019 Lecture 2
Richard Anderson Autumn 2016 Lecture 1
Richard Anderson Autumn 2015 Lecture 4
Richard Anderson Autumn 2015 Lecture 2
Richard Anderson Autumn 2019 Lecture 7
Richard Anderson Autumn 2019 Lecture 2
Richard Anderson Autumn 2019 Lecture 8 – Greedy Algorithms II
Presentation transcript:

CSE 421 Algorithms Richard Anderson Autumn 2006 Lecture 2

Announcements It’s on the web. Homework 1, Due October 4 –It’s on the web Subscribe to the mailing list Richard’s office hours: –Tuesday, 2:30-3:20 pm, Friday, 2:30-3:20 pm. Ning’s office hours: –Monday, 12:30-1:20 pm, Tuesday, 4:30-5:20 pm.

A closer look Stable matchings are not necessarily fair m 1 : w 1 w 2 w 3 m 2 : w 2 w 3 w 1 m 3 : w 3 w 1 w 2 w 1 : m 2 m 3 m 1 w 2 : m 3 m 1 m 2 w 3 : m 1 m 2 m 3 m1m1 m2m2 m3m3 w1w1 w2w2 w3w3 How many stable matchings can you find?

Algorithm under specified Many different ways of picking m’s to propose Surprising result –All orderings of picking free m’s give the same result Proving this type of result –Reordering argument –Prove algorithm is computing something mores specific Show property of the solution – so it computes a specific stable matching

Proposal Algorithm finds the best possible solution for M Formalize the notion of best possible solution (m, w) is valid if (m, w) is in some stable matching best(m): the highest ranked w for m such that (m, w) is valid S* = {(m, best(m)} Every execution of the proposal algorithm computes S*

Proof See the text book – pages 9 – 12 Related result: Proposal algorithm is the worst case for W Algorithm is the M-optimal algorithm Proposal algorithms where w’s propose is W-Optimal

Best choices for one side are bad for the other Design a configuration for problem of size 4: –M proposal algorithm: All m’s get first choice, all w’s get last choice –W proposal algorithm: All w’s get first choice, all m’s get last choice m1:m2:m3:m4:w1:w2:w3:w4:m1:m2:m3:m4:w1:w2:w3:w4:

But there is a stable second choice Design a configuration for problem of size 4: –M proposal algorithm: All m’s get first choice, all w’s get last choice –W proposal algorithm: All w’s get first choice, all m’s get last choice –There is a stable matching where everyone gets their second choice m1:m2:m3:m4:w1:w2:w3:w4:m1:m2:m3:m4:w1:w2:w3:w4:

Key ideas Formalizing real world problem –Model: graph and preference lists –Mechanism: stability condition Specification of algorithm with a natural operation –Proposal Establishing termination of process through invariants and progress measure Under specification of algorithm Establishing uniqueness of solution

M-rank and W-rank of matching m-rank: position of matching w in preference list M-rank: sum of m- ranks w-rank: position of matching m in preference list W-rank: sum of w- ranks m 1 : w 1 w 2 w 3 m 2 : w 1 w 3 w 2 m 3 : w 1 w 2 w 3 w 1 : m 2 m 3 m 1 w 2 : m 3 m 1 m 2 w 3 : m 3 m 1 m 2 m1m1 w1w1 m2m2 w2w2 m3m3 w3w3 What is the M-rank? What is the W-rank?

Suppose there are n m’s, and n w’s What is the minimum possible M-rank? What is the maximum possible M-rank? Suppose each m is matched with a random w, what is the expected M-rank?

Random Preferences Suppose that the preferences are completely random If there are n m’s and n w’s, what is the expected value of the M-rank and the W-rank when the proposal algorithm computes a stable matching? m 1 : w 8 w 3 w 1 w 5 w 9 w 2 w 4 w 6 w 7 w 10 m 2 : w 7 w 10 w 1 w 9 w 3 w 4 w 8 w 2 w 5 w 6 … w 1 : m 1 m 4 m 9 m 5 m 10 m 3 m 2 m 6 m 8 m 7 w 2 : m 5 m 8 m 1 m 3 m 2 m 7 m 9 m 10 m 4 m 6 …

Expected Ranks Expected M rank Expected W rank Guess – as a function of n

Expected M rank Expected M rank is the number of steps until all M’s are matched –(Also is the expected run time of the algorithm) Each steps “selects a w at random” –O(n log n) total steps –Average M rank: O(log n)

Expected W-rank If a w receives k random proposals, the expected rank for w is n/(k+1). On the average, a w receives O(log n) proposals –The average w rank is O(n/log n)

Probabilistic analysis Select items with replacement from a set of size n. What is the expected number of items to be selected until every item has been selected at least once. Choose k values at random from the interval [0, 1). What is the expected size of the smallest item.

What is the run time of the Stable Matching Algorithm? Initially all m in M and w in W are free While there is a free m w highest on m’s list that m has not proposed to if w is free, then match (m, w) else suppose (m 2, w) is matched if w prefers m to m 2 unmatch (m 2, w) match (m, w) Executed at most n 2 times

O(1) time per iteration Find free m Find next available w If w is matched, determine m 2 Test if w prefer m to m 2 Update matching

What does it mean for an algorithm to be efficient?