CSCI 256 Data Structures and Algorithm Analysis lecture 1 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.

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.
Matching Theory.
Matching problems Toby Walsh NICTA and UNSW. Motivation Agents may express preferences for issues other than a collective decision  Preferences for a.
CPSC 413 Fall To learn the material in CPSC 413 and get the grade I’m aiming for will require me to put significant effort into the course.
Telling a computer how to behave (via pseudocode -- a workaround for Computing’s Tower of Babel.) COS 116, Spring 2010 Adam Finkelstein.
Lecture 6 CSE 331 Sep 14. A run of the GS algorithm Mal Wash Simon Inara Zoe Kaylee.
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.
Lecture 4 CSE 331 Sep 9, Blog posts for lectures Starts from today See Sep 8 post on the blog.
Lecture 5 CSE 331 Sep 11, HW 1 out today Will be handed out at the END of the lecture Read the homework policy document carefully START EARLY! ©ehow.com.
CSE 421 Algorithms Richard Anderson Autumn 2006 Lecture 2.
Lecture 8 CSE 331 Sep 18, Homeworks Hand in your HW 1 HW 2 and solutions to HW 1 out at the end of class Not naming your collaborators is same as.
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.
Telling a computer how to behave (via pseudocode -- a workaround for Computing’s Tower of Babel.) COS 116, Spring 2012 Adam Finkelstein.
Creating new worlds inside the computer COS 116: 2/10/2011 Sanjeev Arora.
Lecture 6 CSE 331 Sep 10, Homeworks HW 1 posted online: see blog/piazza Pickup graded HW 0 in TA OHs.
CSC 430 Lecture1: Introduction and Python Primer.
The Stable Marriage Problem
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 1.
1 Chapter 1 Introduction: Some Representative Problems Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Stable Matching Problem Goal. Given n men and n women, find a "suitable" matching. n Participants rate members of opposite sex. n Each man lists women.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013.
Algorithm Design by Éva Tardos and Jon Kleinberg Slides by Kevin Wayne Copyright © 2004 Addison Wesley COS 423: Theory of Algorithms Kevin Wayne Princeton.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 4.
Lecture 3 CSE 331. Stable Matching Problem Problem Statement Algorithm Problem Definition Implementation Analysis.
Advanced Algorithms Piyush Kumar (Lecture 1: Introduction) Welcome to COT5405.
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 –
Stable Matchings a.k.a. the Stable Marriage Problem
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
1 Chapter 1 Introduction: Some Representative Problems Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Winter 2009 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 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 ( 陈宁 )
Market Design and Analysis Lecture 1 Lecturer: Ning Chen ( 陈宁 )
COMP9007: Algorithms Stable Matching. What's in an algorithm? Algorithms can have huge impact For example – A report to the White House from 2010 includes.
Matching Boys Girls A B C D E
Stable Matching.
Chapter 1 Introduction: Some Representative Problems
Stable Marriage Problem
Introduction to the Design and Analysis of Algorithms
Chapter 10 Iterative Improvement
The Stable Marriage Problem
CSE 421: Introduction to Algorithms
Lecture 5 CSE 331 Sep 10, 2010.
Lecture 6 CSE 331 Sep 11, 2017.
Richard Anderson (for Anna Karlin) Winter 2006 Lecture 1
Chapter 2 Basics of Algorithm Analysis
S. Raskhodnikova; based on slides by K. Wayne
Richard Anderson Autumn 2006 Lecture 1
CSE 421: Introduction to Algorithms
1.1 A First Problem: Stable Matching
Discrete Math for CS CMPSC 360 LECTURE 9 Last time: Strong induction
Richard Anderson Autumn 2015 Lecture 1
Chapter 1 Introduction: Some Representative Problems
Richard Anderson Autumn 2016 Lecture 2
Richard Anderson Autumn 2006 Lecture 1
Lecture 6 CSE 331 Sep 12, 2011.
Chapter 2 Basics of Algorithm Analysis
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)
Lecture 7 CSE 331 Sep 11, 2013.
Richard Anderson Winter 2019 Lecture 2
Richard Anderson Autumn 2016 Lecture 1
Richard Anderson Autumn 2015 Lecture 2
Richard Anderson Autumn 2019 Lecture 2
Presentation transcript:

CSCI 256 Data Structures and Algorithm Analysis lecture 1 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some by Iker Gondra

Course Overview MSCS Dept webpage: CS 256

Algorithm –[webster.com] A procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps that frequently involves repetition of an operation –[Knuth, TAOCP] An algorithm is a finite, definite, effective procedure, with some input and some output Algorithms Great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense, and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing. - Francis Sullivan

Theory of Algorithms "As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will arise - By what course of calculation can these results be arrived at by the machine in the shortest time? - Charles Babbage

Theory of Algorithms Claim: All* of Computer Science is the study of algorithms What constitutes expertise in this area? How do experts differ from novices? –Partial answer – there is a difference between doing something and doing it well – we strive to do it well (eg: guarantee correctness every time termination, scalability (at least for well described subclass of problems) (* well maybe much!!!)

The Algorithmic Enterprise The algorithmic enterprise consists of two fundamental components: –the task of getting to the mathematically clean core of a problem, and then –the task of identifying the appropriate algorithm design techniques, based on the structure of the problem.

Course Goals Goal: To convey the algorithmic approach as a design process that: –begins with problems arising across the full range of computing applications, –builds on an understanding of algorithm design techniques, and –results in the development of efficient solutions to these problems. The material and our discussions in this course will be structured around a sequence of three steps: –Describing a problem and working out its precise (clean mathematical) formulation; –Employing an appropriate design technique to develop an algorithm; –Proving properties of the algorithm (including its correctness) and analyzing its efficiency.

Algorithmic Paradigms Design and analysis of computer algorithms –Greed –Divide-and-conquer –Dynamic programming –Network flow –Intractability –Coping with intractability

A First Problem: Stable Matching Setting: –Assign TAs to Instructors –Avoid having TAs and Instructors wanting to change 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

Stable Matching Problem Goal: Given n men and n women, find a "suitable" matching –Each man lists women in order of preference from best to worst –Each woman lists men in order of preference from best to worst ZeusAmy Clare Bertha Yancey Bertha Clare Amy XavierAmy Clare Bertha 1 st 2 nd 3 rd Men’s Preference Profile favoriteleast favorite ClareXavierZeusYancey BerthaXavierZeusYancey AmyYanceyZeusXavier 1 st 2 nd 3 rd Women’s Preference Profile favoriteleast favorite

Stable Matching Problem Perfect matching: everyone is matched monogamously –Each man gets exactly one woman –Each woman gets exactly one man Instability: incentive for some pair of participants to undermine assignment by joint action –In matching M, a pair m-w is unstable if man m and woman w prefer each other over their current partners

Stable Matching Problem Stable matching: perfect matching with no unstable pairs Stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists

Stable Matching Problem Q: Is assignment X-C, Y-B, Z-A stable? ZeusAmyClareBertha YanceyBerthaClareAmy XavierAmyClareBertha 1 st 2 nd 3 rd Men’s Preference Profile ClareXavierZeusYancey BerthaXavierZeusYancey AmyYanceyZeusXavier 1 st 2 nd 3 rd Women’s Preference Profile favoriteleast favoritefavorite least favorite

Stable Matching Problem Q: Is assignment X-C, Y-B, Z-A stable? A: No. Bertha and Xavier will hook up ZeusAmyClareBertha YanceyBerthaClareAmy XavierAmyClareBertha 1 st 2 nd 3 rd Men’s Preference Profile ClareXavierZeusYancey BerthaXavierZeusYancey AmyYanceyZeusXavier 1 st 2 nd 3 rd Women’s Preference Profile favoriteleast favoritefavorite least favorite

Stable Matching Problem Q: Is assignment X-A, Y-B, Z-C stable? A: Yes ZeusAmyClareBertha YanceyBerthaClareAmy XavierAmyClareBertha ClareXavierZeusYancey BerthaXavierZeusYancey AmyYanceyZeusXavier 1 st 2 nd 3 rd 1 st 2 nd 3 rd favoriteleast favoritefavorite least favorite Men’s Preference ProfileWomen’s Preference Profile

Example – stable matching everyone gets first choice m 1 : w 1 w 2 m 2 : w 2 w 1 w 1 : m 1 m 2 w 2 : m 2 m 1 m1m1 m2m2 w2w2 w1w1

Example: unique stable matching m 1 : w 1 w 2 m 2 : w 1 w 2 w 1 : m 1 m 2 w 2 : m 1 m 2 m1m1 m2m2 w2w2 w1w1 m 1 : w 1 w 2 m 2 : w 1 w 2 w 1 : m 1 m 2 w 2 : m 1 m 2

2 stable matchings m 1 : w 1 w 2 m 2 : w 2 w 1 w 1 : m 2 m 1 w 2 : m 1 m 2 both men are as happy as possible; or both women are as happy as possible

Example: can you find a stable matching? (Exercise for the student!) 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 m2m2 w2w2 w1w1 m3m3 w3w3

Indicators of Stable Matching Problem Want Perfect matching Have Preference lists (ranking is strictly increasing) Want Stability –Instable (dotted line: m1 and w2 prefer each other) m1m1 w1w1 m2m2 w2w2

Intuitive Idea for a Proposal Algorithm m proposes to w –If w is unmatched, w accepts –If w is matched to m' If w prefers m to m', w accepts If w prefers m' to m, w rejects Unmatched m proposes to w highest on its preference list that m has not already proposed to

Propose-And-Reject Algorithm Propose-and-reject algorithm [Gale-Shapley 1962]: Intuitive method that guarantees output which is a stable matching Initialize each person to be free while (some man is free and hasn't proposed to every woman) { Choose such a man m w = 1 st 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 }

Example 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 m2m2 w2w2 w1w1 m3m3 w3w3

Does this Work? Does it terminate? Is the result a stable matching? Is the solution unique? What is the complexity? To analyse, we begin by identifying measures of progress and invariants: –Observation 1: Men propose to women in decreasing order of preference –Observation 2: Once a woman is matched, she never becomes unmatched; she only “trades up.”