CSEP 521 Applied Algorithms. Richard Anderson Winter 2013 Lecture 1

Similar documents
CSE 421 Algorithms. Richard Anderson Autumn 2015 Lecture 1

Design and Analysis of Algorithms

Algorithms and Theory of Computation. Lecture 1: Introduction, Basics of Algorithms

CS684 Graph Algorithms

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

Page 1 of 5 Printed: 2/4/09

Alien Worlds. Astronomy 105. Spring 2011

CSE 421 Greedy Algorithms / Interval Scheduling

Chemistry 14C: Structure of Organic Molecules - Winter 2017 Version 56

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

CS320 Algorithms: Theory and Practice. Course Introduction

Aditya Bhaskara CS 5968/6968, Lecture 1: Introduction and Review 12 January 2016

1. REPRESENTATIVE PROBLEMS

CS 570: Machine Learning Seminar. Fall 2016

Physics 141 Course Information

1. REPRESENTATIVE PROBLEMS

Proof methods and greedy algorithms

AS 101: The Solar System (Spring 2017) Course Syllabus

Instructor: Dr. Darryl Kropf 203 S. Biology ; please put cell biology in subject line

UC DAVIS. Circuits I Course Outline

Algorithms Exam TIN093 /DIT602


EOS-310 Severe & Unusual Weather Spring, 2009 Associate Prof. Zafer Boybeyi 1/20/09

Approximation and Randomized Algorithms (ARA) Lecture 1, September 3, 2012

Stellar Astronomy 1401 Spring 2009

Special Topic: Organic Chemistry I (SCI )

Physics 141 Course Information

Astro 32 - Galactic and Extragalactic Astrophysics/Spring 2016

Physics 1B Electricity & Magne4sm

INTRODUCTION TO NUCLEAR AND PARTICLE PHYSICS Physics 4/56301 SPRING 2016 INSTRUCTOR:

Complexity Theory Part Two

Physics 273 (Fall 2013) (4 Credit Hours) Fundamentals of Physics II

Ph 1a Fall General Information

Course Staff. Textbook

Physics 9, Introductory Physics II Spring 2010

Show that the following problems are NP-complete

AS The Astronomical Universe. Prof. Merav Opher - Fall 2013

Physics 2D Lecture Slides Lecture 1: Jan

CSC2556. Lecture 5. Matching - Stable Matching - Kidney Exchange [Slides : Ariel D. Procaccia]

EE595A Submodular functions, their optimization and applications Spring 2011

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 10

Physics 18, Introductory Physics I for Biological Sciences Spring 2010

Class Note #20. In today s class, the following four concepts were introduced: decision

Ch. 2: Lec. 1. Basics: Outline. Importance. Usages. Key problems. Three ways of looking... Colbert on Equations. References. Ch. 2: Lec. 1.

Historical Geology, GEOL 1120 (final version) Spring 2009

CSE 311: Foundations of Computing I. Lecture 1: Propositional Logic

Today s topics. Algorithms. University of Washington Course. Text books. Analyzing the course and content. Course overview

NP-Complete Problems. More reductions

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013

Introduction to CS 4104

Southwestern College CHEM /62 Preparation for General Chemistry Spring Semester 2012

Required Textbook. Grade Determined by

CHEM 4725/8725 Organometallic Chemistry. Spring 2016

1.1 Administrative Stuff

Los Angeles Mission College Chemistry 65 Syllabus Spring Semester 2012

Physics 2D Lecture Slides Lecture 1: Jan

CS 170 Algorithms Spring 2009 David Wagner Final

Course Description Course Objectives Online resources

CHEMISTRY 101 DETAILED WEEKLY TEXTBOOK HOMEWORK & READING SCHEDULE*

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

AS102 -The Astronomical Universe. The boring details. AS102 - Major Topics. Day Labs - Rooms B4 & 606. Where are we (earth, sun) in the universe?

COMPSCI 611 Advanced Algorithms Second Midterm Exam Fall 2017

CS173 Lecture B, November 3, 2015

ASTR1120L & 2030L Introduction to Astronomical Observations Spring 2019

UNIVERSITY OF TORONTO Department of Electrical and Computer Engineering ECE320H1-F: Fields and Waves, Course Outline Fall 2013

PHYS 208, Sections , Spring 2017

Math 410 Linear Algebra Summer Session American River College

CS 6783 (Applied Algorithms) Lecture 3

Astronomy Course Syllabus

Instructor Dr. Tomislav Pintauer Mellon Hall Office Hours: 1-2 pm on Thursdays and Fridays, and by appointment.

Syllabus for Chemistry 12A Spring Semester 2015

CS 598RM: Algorithmic Game Theory, Spring Practice Exam Solutions

PHYS 208, sections , Spring 2017

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

6.046 Recitation 11 Handout

Chemistry 103: Basic General Chemistry (4.0 Credits) Fall Semester Prerequisites: Placement or concurrent enrollment in DEVM F105 or higher

Physics Fall Semester. Sections 1 5. Please find a seat. Keep all walkways free for safety reasons and to comply with the fire code.

Counting Strategies: Inclusion/Exclusion, Categories

PHYS 208, sections , Spring 2018

SYLLABUS SEFS 540 / ESRM 490 B Optimization Techniques for Natural Resources Spring 2017

Angelina College Science and Mathematics Chemistry 1105 Introductory Chemistry Internet General Syllabus

Don t Trust Atoms, they Make Up Everything High School Chemistry

CHEM 1420: Physical Chemistry 2 Thermodynamics, Statistical Mechanics, and Kinetics

More Approximation Algorithms

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

1 Some loose ends from last time

Today s Menu. Administrativia Two Problems Cutting a Pizza Lighting Rooms

ENVIRONMENT AND NATURAL RESOURCES 3700 Introduction to Spatial Information for Environment and Natural Resources. (2 Credit Hours) Semester Syllabus

CS 781 Lecture 9 March 10, 2011 Topics: Local Search and Optimization Metropolis Algorithm Greedy Optimization Hopfield Networks Max Cut Problem Nash

CSC 373: Algorithm Design and Analysis Lecture 12

CHEM 25: Organic Chemistry I (2009FA-CHEM )

1. REPRESENTATIVE PROBLEMS

Chemistry Physical Chemistry I Fall 2017

Math 060/070 PAL: Elementary and Intermediate Algebra Spring 2016

Algorithm Design Strategies V

University of Alaska Fairbanks Chemistry 103: Basic General Chemistry Course Syllabus

CH 331 Syllabus Fall 2012

Counting Strategies: Inclusion/Exclusion, Categories

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 9

Math 16A Discussion Worksheet January 23, 2018

Transcription:

CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 1

CSEP 521 Course Introduction CSEP 521, Applied Algorithms Monday s, 6:30-9:20 pm CSE 305 and Microsoft Building 99 Instructor Richard Anderson, anderson@cs.washington.edu Office hours: CSE 582 Monday, 4:00-5:00 pm or by appointment Teaching Assistant Tanvir Aumi, tanvir@cs.washington.edu Office hours: TBD

Announcements It s on the web. Homework due at start of class on Mondays HW 1, Due January 14, 2013 It s on the web http://www.cs.washington.edu/education/courses/csep521/13wi/

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

Recorded lectures This is a distance course, so lectures are recorded and will be available on line for later viewing However, low attendance in the distance PMP course is a concern Various draconian measures are under discussion We will make lectures available Please attend class, and participate Participation may be a component of the class grade

Lecture schedule Monday holidays: Monday, January 21, MLK Monday, February 18, President s day Make up lectures will be scheduled, which will be recorded for offline viewing Hopefully, some students will attend, so there is a studio audience First makeup lecture: Thursday, January 17, 5:00-6:30 pm Additional makeup lectures to accommodate RJA s travel schedule

Course Mechanics Homework Due Mondays Textbook problems and programming exercises Choice of language Expectation that Algorithmic Code is original Target: 1 week turnaround on grading Late Policy: Two assignments may be turned in up to one week late Exams (In class, tentative) Midterm, Monday, Feb 11 (60 minutes) Final, Monday, March 18, 6:30-8:20 pm Approximate grade weighting HW: 50, MT: 15, Final: 35

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

Setting: Introductory Problem: Stable Matching 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.

Formal notions Perfect matching Ranked preference lists Stability m 1 w 1 m 2 w 2

Example (1 of 3) m 1 : w 1 w 2 m 2 : w 2 w 1 w 1 : m 1 m 2 m 1 w 1 w 2 : m 2 m 1 m 2 w 2

Example (2 of 3) m 1 : w 1 w 2 m 2 : w 1 w 2 w 1 : m 1 m 2 m 1 w 1 w 2 : m 1 m 2 m 2 w 2

Example (3 of 3) m 1 : w 1 w 2 m 2 : w 2 w 1 w 1 : m 2 m 1 m 1 w 1 w 2 : m 1 m 2 m 2 w 2

Formal Problem Input Preference lists for m 1, m 2,, m n Preference lists for w 1, w 2,, w n Output Perfect matching M satisfying stability property: 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 m 2 If w prefers m to m 2 w accepts m, dumping m 2 If w prefers m 2 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 (m 2, w) is matched if w prefers m to m 2 unmatch (m 2, w) match (m, w)

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 m 1 w 1 m 2 w 2 w 1 : m 2 m 3 m 1 w 2 : m 3 m 1 m 2 w 3 : m 3 m 1 m 2 m 3 w 3

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: The algorithm stops in at most n 2 steps

When the algorithms halts, every w Why? is matched Hence, the algorithm finds a perfect matching

The resulting matching is stable Suppose (m 1, w 1 ) M, (m 2, w 2 ) M m 1 prefers w 2 to w 1 m 1 w 1 m 2 w 2 How could this happen?

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

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 m 1 m 2 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 m 3 w 3 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 m 1 : m 2 : m 3 : m 4 : w 1 : w 2 : w 3 : w 4 :

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 m 1 : m 2 : m 3 : m 4 : w 1 : w 2 : w 3 : w 4 :

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 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 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?

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 prefers m to m 2 Update matching

What does it mean for an algorithm to be efficient?

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

Five Problems

Theory of Algorithms What is expertise? How do experts differ from novices?

Introduction of five problems Show the types of problems we will be considering in the class Examples of important types of problems Similar looking problems with very different characteristics Problems Scheduling Weighted Scheduling Bipartite Matching Maximum Independent Set Competitive Facility Location

What is a problem? Instance Solution Constraints on solution Measure of value

Problem: Scheduling Suppose that you own a banquet hall You have a series of requests for use of the hall: (s 1, f 1 ), (s 2, f 2 ),... Find a set of requests as large as possible with no overlap

What is the largest solution?

Greedy Algorithm Test elements one at a time if they can be members of the solution If an element is not ruled out by earlier choices, add it to the solution Many possible choices for ordering (length, start time, end time) For this problem, considering the jobs by increasing end time works

Suppose we add values? (s i, f i, v i ), start time, finish time, payment Maximize value of elements in the solution 5 2 1 1 2 4 1 3 1 6

Greedy Algorithms Earliest finish time Maximum value Give counter examples to show these algorithms don t find the maximum value solution

Dynamic Programming Requests R 1, R 2, R 3,... Assume requests are in increasing order of finish time (f 1 < f 2 < f 3...) Opt i is the maximum value solution of {R 1, R 2,..., R i } containing R i Opt i = Max{ j f j < s i }[Opt j + v i ]

Given a bipartite graph G=(U,V,E), find a subset of the edges M of maximum size with no common endpoints. Application: U: Professors V: Courses (u,v) in E if Prof. u can teach course v Matching

Find a maximum matching

Augmenting Path Algorithm

Reduction to network flow More general problem Send flow from source to sink Flow subject to capacities at edges Flow conserved at vertices Can solve matching as a flow problem

Maximum Independent Set Given an undirected graph G=(V,E), find a set I of vertices such that there are no edges between vertices of I Find a set I as large as possible

Find a Maximum Independent Set A B C E D F G H K J I L O S M N R T P Q U

Verification: Prove the graph has an independent set of size 10

Key characteristic Hard to find a solution Easy to verify a solution once you have one Other problems like this Hamiltonian circuit Clique Subset sum Graph coloring

NP-Completeness Theory of Hard Problems A large number of problems are known to be equivalent Very elegant theory

Are there even harder problems? Simple game: Players alternating selecting nodes in a graph Score points associated with node Remove nodes neighbors When neither can move, player with most points wins 4 3 2 6 5 2 3 4 1 6

5 6 4 6 5 5 6 4 1 6 2 1 4 2 5 8 7 8 5 4 4 5 4 3 4

Competitive Facility Location Choose location for a facility Value associated with placement Restriction on placing facilities too close together Competitive Different companies place facilities E.g., KFC and McDonald s

Complexity theory These problems are P-Space complete instead of NP-Complete Appear to be much harder No obvious certificate G has a Maximum Independent Set of size 10 Player 1 wins by at least 10 points

An NP-Complete problem from Digital Public Health ASHAs use Pico projectors to show health videos to Mothers groups Limited number of Pico projectors, so ASHAs must travel to where the Pico projector is stored Identify storage locations for k Pico projectors to minimize the maximum distance an ASHA must travel

Summary Scheduling Weighted Scheduling Bipartite Matching Maximum Independent Set Competitive Scheduling