Richard Anderson Autumn 2015 Lecture 1

Slides:



Advertisements
Similar presentations
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.
Advertisements

CSE 421 Algorithms Richard Anderson Autumn 2006 Lecture 2.
EE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Prasanna Chaporkar, Programming.
MATH 330: Ordinary Differential Equations Fall 2014.
CSE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Dimosthenes Anthomelidis
Slide 1 Instructor: Dr. Hong Jiang Teaching Assistant: Mr. Sheng Zhang Department of Computer Science & Engineering University of Nebraska-Lincoln Classroom:
CSE 421 Algorithms Richard Anderson Lecture 3. Classroom Presenter Project Understand how to use Pen Computing to support classroom instruction Writing.
University of Colorado - Dept of Aerospace Engineering Sciences - Introduction to FEM This is ASEN 5007: Introduction to Finite Element Methods.
Lecture 6 CSE 331 Sep 10, Homeworks HW 1 posted online: see blog/piazza Pickup graded HW 0 in TA OHs.
The Stable Marriage Problem
Lecture 4 CSE 331 Sep 6, TA change Swapnoneel will leave us for 531 Jiun-Jie Wang will join us.
Lecture 2 CSE 331. Day 1 Survey On UBlearns Day 1 Survey (talking points) Security MS PhD for research Building PC’s for 442 It’s ok to play games –
Great Theoretical Ideas in Computer Science.
CS 456 Advanced Algorithms Where: Engineering Bldg When: Monday & Wednesday 12:00 – 1:15 p.m. Texts: Algorithm Design, Jon Kleinberg & Eva Tardos.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 1.
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 1.
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.
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Computer Network Fundamentals CNT4007C
ICS 6D Discrete Mathematics for Computer Science Fall 2014
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Matching.
CPT S 317: Automata and Formal Languages
Lecture 4 CSE 331 Sep 7, 2016.
CSE 662 – Languages and Databases Class Overview
Lecture 8 CSE 331 Sep 14, 2011.
Geology I: Earth’s Interior(ERTH-1100)
CSE 421: Introduction to Algorithms
Introduction.
Lecture 4 CSE 331 Sep 6, 2017.
Lecture 6 CSE 331 Sep 11, 2017.
Richard Anderson (for Anna Karlin) Winter 2006 Lecture 1
Introduction CSE 373 Data Structures.
Organization of Programming Languages
Richard Anderson Autumn 2006 Lecture 1
CSE 421: Introduction to Algorithms
Richard Anderson Lecture 3
CSE1311 Introductory Programming for Engineers & Scientists
Lecture 5 CSE 331 Sep 6, 2013.
Lecture 5 CSE 331 Sep 7, 2012.
Automata and Formal Languages
CSE 421 Richard Anderson Autumn 2015, Lecture 3
Richard Anderson Autumn 2016 Lecture 7
Lecture 3 CSE 331 Sep 1, 2017.
Richard Anderson Autumn 2016 Lecture 2
Richard Anderson Autumn 2006 Lecture 1
Lecture 6 CSE 331 Sep 12, 2011.
Lecture 5 CSE 331 Sep 5, 2014.
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
Piyush Kumar (Lecture 3: Stable Marriage)
Richard Anderson Lecture 27 Survey of NP Complete Problems
Lecture 5 CSE 331 Sep 9, 2011.
Richard Anderson Winter 2019 Lecture 7
Type Systems for Programming Languages
Richard Anderson Winter 2019 Lecture 4
Richard Anderson Autumn 2015 Lecture 7
Richard Anderson Winter 2019 Lecture 2
Richard Anderson Autumn 2016 Lecture 1
Introduction Lecture 1 Wed, Jan 17, 2007.
Richard Anderson Autumn 2015 Lecture 6
Richard Anderson Autumn 2015 Lecture 2
Richard Anderson Autumn 2019 Lecture 7
Richard Anderson Autumn 2019 Lecture 2
Richard Anderson Autumn 2019 Lecture 1 Announcements only
Presentation transcript:

Richard Anderson Autumn 2015 Lecture 1 CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 1

CSE 421 Course Introduction CSE 421, Introduction to Algorithms MWF, 1:30-2:20 pm MGH 421 Instructor Richard Anderson, anderson@cs.washington.edu Office hours: CSE 582 Office hours TBD Teaching Assistants Cyrus Rashtchian Yueqi Sheng Erin Yoon Kuai Yu

Announcements It’s on the web. Homework due Wednesdays HW 1, Due October 7, 2015 It’s on the web (or will be soon) You should be on the course mailing list But it will probably go to your uw.edu account

Text book Algorithm Design Jon Kleinberg, Eva Tardos Read Chapters 1 & 2 Expected coverage: Chapter 1 through 7

Course Mechanics Homework Exams (In class) Approximate grade weighting Due Wednesdays About 5 problems, sometimes programming Target: 1 week turnaround on grading Exams (In class) Midterm, Monday, November 2 (probably) Final, Monday, December 14, 2:30-4:20 pm Approximate grade weighting HW: 50, MT: 15, Final: 35 Course web Slides, Handouts

All of Computer Science is the Study of Algorithms

How to study algorithms Zoology Mine is faster than yours is Algorithmic ideas Where algorithms apply What makes an algorithm work Algorithmic thinking

Introductory Problem: Stable Matching Setting: Assign TAs to Instructors Avoid having TAs and Instructors wanting changes E.g., Prof A. would rather have student X than her current TA, and student X would rather work for Prof A. than his current instructor. Purpose of the example: new, interesting problem, show how different ideas apply

Formal notions Perfect matching Ranked preference lists Stability m1 w1 m2 w2

Example (1 of 3) m1: w1 w2 m2: w2 w1 w1: m1 m2 w2: m2 m1 m1 w1 m2 w2

Example (2 of 3) m1: w1 w2 m2: w1 w2 w1: m1 m2 w2: m1 m2 m1 w1 m2 w2

Example (3 of 3) m1: w1 w2 m2: w2 w1 w1: m2 m1 w2: m1 m2 m1 w1 m2 w2

Formal Problem Input Output Preference lists for m1, m2, …, mn Preference lists for w1, w2, …, wn Output Perfect matching M satisfying stability property:  m’, w’’, (m’, w’’) is NOT an instability If (m’, w’)  M and (m’’, w’’)  M then (m’ prefers w’ to w’’) or (w’’ prefers m’’ to m’)

Idea for an Algorithm m proposes to w If w is unmatched, w accepts If w is matched to m2 If w prefers m to m2 w accepts m, dumping m2 If w prefers m2 to m, w rejects m Unmatched m proposes to the highest w on its preference list that it has not already proposed to

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 (m2, w) is matched if w prefers m to m2 unmatch (m2, w) match (m, w)

Example m1 w1 m2 w2 m3 w3 m1: w1 w2 w3 m2: w1 w3 w2 m3: w1 w2 w3 w1: m2 m3 m1 w2: m3 m1 m2 w3: m3 m1 m2 m2 w2 m3 w3 Order: m1, m2, m3, m1, m3, m1

Does this work? Does it terminate? Is the result a stable matching? Begin by identifying invariants and measures of progress m’s proposals get worse (have higher m-rank) Once w is matched, w stays matched w’s partners get better (have lower w-rank)

Claim: If an m reaches the end of its list, then all the w’s are matched

Claim: The algorithm stops in at most n2 steps Each m asks each w at most once

When the algorithms halts, every w is matched Why? Hence, the algorithm finds a perfect matching Invariant: partial matching What happens when some m reaches its last choice? exactly n-1 w’s much be matched last choice must be available

The resulting matching is stable Suppose (m1, w1)  M, (m2, w2)  M m1 prefers w2 to w1 How could this happen? m1 w1 m2 w2 m1 proposed to w2 before w1 w2 rejected m1 for m3 w2 prefers m3 to m1 w2 prefers m2 to m3

Result Simple, O(n2) algorithm to compute a stable matching Corollary A stable matching always exists

A closer look Stable matchings are not necessarily fair m1: w1 w2 w3 w1: m2 m3 m1 w2: m3 m1 m2 w3: m1 m2 m3 m2 w2 m3 w3 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 may be 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: M’s: 1342 2341 3124 4123 W’s: 2341 1342 4123 3124

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: M’s: 1342 2431 3214 4123 W’s: 2431 1342 4123 3214

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