Computational Processes II

Slides:



Advertisements
Similar presentations
The Mathematics Of 1950s Dating: Who wins the battle of the sexes? Great Theoretical Ideas In Computer Science Steven Rudich CS Spring 2003 Lecture.
Advertisements

Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Marriage, Honesty, & Stability N ICOLE I MMORLICA, N ORTHWESTERN U NIVERSITY.
Tutorial 5 of CSCI2110 Eulerian Path & Hamiltonian Cycle Tutor: Zhou Hong ( 周宏 )
Lecture 2: Greedy Algorithms II Shang-Hua Teng Optimization Problems A problem that may have many feasible solutions. Each solution has a value In maximization.
Social Networks 101 P ROF. J ASON H ARTLINE AND P ROF. N ICOLE I MMORLICA.
1 Discrete Structures & Algorithms Graphs and Trees: IV EECE 320.
Stable Marriage Problem William Kozma Jr ECE 443/543.
1 Bipartite Matching Polytope, Stable Matching Polytope x1 x2 x3 Lecture 10: Feb 15.
The Stable Marriage Problem
The Mathematics Of Dating and Marriage: Who wins the battle of the sexes? The Mathematics Of Dating and Marriage: Who wins the battle of the sexes? (adapted.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? Adapted from a presentation by Stephen Rudich.
결혼문제로 본 조합론.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? Presentation by Shuchi Chawla with some modifications.
Advanced Algorithms Piyush Kumar (Lecture 1: Introduction) Welcome to COT5405.
Stable Matchings a.k.a. the Stable Marriage Problem
Great Theoretical Ideas in Computer Science.
Marriage and Mathematics Lau Ting Sum Samson Suen Wai.
Lecture 23: Stable Marriage ( Based on Lectures of Steven Rudich of CMU and Amit Sahai of Princeton) Shang-Hua Teng.
Stable Matching Lecture 7: Oct 3. Matching A B C DE Boys Girls Today’s goal: to “match” the boys and the girls in a “good” way.
Stable Marriages (Lecture modified from Carnegie Mellon University course Great Theoretical Ideas in Computer Science)
Great Theoretical Ideas in Computer Science for Some.
Matching Lecture 19: Nov 23.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? CS Lecture 2.
18.1 CompSci 102 Today’s topics 1950s TV Dating1950s TV Dating.
Algorithms used by CDNs Stable Marriage Algorithm Consistent Hashing.
18.1 CompSci 102 Today’s topics Impaired wanderingImpaired wandering Instant InsanityInstant Insanity 1950s TV Dating1950s TV Dating Final Exam reviewFinal.
Dating Advice from Mathematics
מתמטיקה בדידה Discrete Math Lecture 12 1 TexPoint fonts used in EMF.
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Matching.
Chapter 1 Introduction: Some Representative Problems
Stable Marriage Problem
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes?
Mathematical Induction II
Maximum Flow - Best algorithms
Great Theoretical Ideas in Computer Science
The Mathematics Of 1950’s Dating: Who wins The Battle of The Sexes?
Lecture 5 CSE 331 Sep 10, 2010.
Lecture 4 CSE 331 Sep 6, 2017.
Mathematics for Computer Science MIT 6.042J/18.062J
Computational Processes
Lecture 6 CSE 331 Sep 11, 2017.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes?
Richard Anderson (for Anna Karlin) Winter 2006 Lecture 1
S. Raskhodnikova; based on slides by K. Wayne
Computational Processes II
Asymptotics & Stirling’s Approximation
and Structural Induction II
Richard Anderson Autumn 2006 Lecture 1
CSE 421: Introduction to Algorithms
Discrete Math for CS CMPSC 360 LECTURE 9 Last time: Strong induction
and Structural Induction II
Mathematics for Computer Science MIT 6.042J/18.062J
Chapter 1 Introduction: Some Representative Problems
Mathematics for Computer Science MIT 6.042J/18.062J
Matching and Resource Allocation
Who does better, boys or girls?
Computational Processes
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Lecture 6 CSE 331 Sep 12, 2016.
Lecture 7 CSE 331 Sep 10, 2014.
Richard Anderson Winter 2019 Lecture 1
Piyush Kumar (Lecture 3: Stable Marriage)
Derived Variables A derived variable v is simply a function
Lecture 7 CSE 331 Sep 11, 2013.
Algorithms Lecture # 26 Dr. Sohail Aslam.
Presentation transcript:

Computational Processes II Mathematics for Computer Science MIT 6.042J/18.062J Computational Processes II Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

Computational Processes Last lecture: Invariants & Partial Correctness.

Computational Processes Today: Termination, Derived Variables, Getting Married.

A derived variable, v, is a function giving a value to each state. Derived variables A derived variable, v, is a function giving a value to each state. Robot example: Sum of coordinates, v ::= x + y. Parity of x + y, w ::= v mod 2.

Derived variables For GCD, already have variables x, y.

Proof of GCD termination: variable y is strictly decreasing and Derived variables Proof of GCD termination: variable y is strictly decreasing and natural number valued.

Termination follows by least number principle: Derived variables Termination follows by least number principle: y must take a least value, and thus the algorithm is stuck.

Strictly Decreasing Variable 16 12 8 4 Goes down at every step State

Weakly Decreasing Variable 16 12 8 4 Down or constant after each step State

Weakly Decreasing Variable (We used to call weakly decreasing variables “nonincreasing” variables.)

Weakly Decreasing Variable OK terminology but remember: nonincreasing is NOT SAME as “not increasing.”

In-class Problem Problem 1

Stable Marriage A Marriage Problem 1 2 3 4 5 Boys Girls A B C D E

Preferences: Boys Girls 1: CBEAD A : 35214 2 : ABECD B : 52143 Stable Marriage Preferences: Boys Girls 1: CBEAD A : 35214 2 : ABECD B : 52143 3 : DCBAE C : 43512 4 : ACDBE D : 12345 5 : ABDEC E : 23415

Try “greedy” strategy for boys Preferences 1: CBEAD 2 : ABECD Stable Marriage 1: CBEAD 2 : ABECD 3 : DCBAE 4 : ACDBE 5 : ABDEC Preferences Try “greedy” strategy for boys

Marry Boy 1 with Girl C Preferences (his 1st choice) 1: CBEAD Stable Marriage Marry Boy 1 with Girl C (his 1st choice) Preferences 1: CBEAD 2 : ABECD 3 : DCBAE 4 : ACDBE 5 : ABDEC 1 C

Marry Boy 1 with Girl C Preferences (his 1st choice) 2 : ABE D Stable Marriage Marry Boy 1 with Girl C (his 1st choice) Preferences 2 : ABE D 3 : D BAE 4 : A DBE 5 : ABDE 1 C

Marry Boy 1 with Girl C Preferences (his 1st choice) 2 : ABED 3 : DBAE Stable Marriage Marry Boy 1 with Girl C (his 1st choice) Preferences 2 : ABED 3 : DBAE 4 : ADBE 5 : ABDE 1 C

(best remaining choice) Preferences Stable Marriage Next: Marry Boy 2 with Girl A: (best remaining choice) Preferences 2 : ABED 3 : DBAE 4 : ADBE 5 : ABDE 1 C 2 A

Final “boy greedy” marriages Stable Marriage Final “boy greedy” marriages 1 C 3 D 2 A 4 B 5 E

Stable Marriage Trouble! 1 C 4 B

Boy 4 likes Girl C better than his wife. Stable Marriage Boy 4 likes Girl C better than his wife. 1 C 4 B

Stable Marriage and vice-versa 1 C 4 B

Stable Marriage Rogue Couple 1 C 4 B

Stable Marriage Problem: Marry everyone without any rogue couples!

Stable Marriage Do it! PROBLEM 2

Matching Hospitals & Residents. Matching Dance Partners. Stable Marriage More than a puzzle: College Admissions (original Gale & Shapley paper, 1962) Matching Hospitals & Residents. Matching Dance Partners.

Stable Marriage

Stable Marriage The Mating Algorithm

Stable Marriage The Mating Algorithm: day by day

Morning: boy serenades favorite girl Stable Marriage Morning: boy serenades favorite girl Ted Alice Bob

Morning: boy serenades favorite girl Stable Marriage Morning: boy serenades favorite girl Afternoon: girl rejects all but favorite Ted Alice Bob

… … Morning: boy serenades favorite girl Stable Marriage Morning: boy serenades favorite girl Afternoon: girl rejects all but favorite Evening: rejected boy writes off girl … Alice … Ted

Stop when no rejects. favorite suitor. Girl marries her Stable Marriage Stop when no rejects. Girl marries her favorite suitor.

In-class Problem Problem 3

Partial Correctness: Termination: Everyone is married. Stable Marriage Partial Correctness: Everyone is married. Marriages are stable. Termination: there exists a Wedding Day.

State q: Each boy’s set of eligible girls Stable Marriage Model as State Machine State q: Each boy’s set of eligible girls q(Bob)={Carole, Alice, …}

Derived Variable: serenading Stable Marriage Derived Variable: serenading Bob’s favorite eligible girl.

Derived Variable: suitors Stable Marriage Derived Variable: suitors all boys serenading Alice.

Derived Variable: favorite Stable Marriage Derived Variable: favorite Carole’s preferred suitor.

Different girls have different favorites, Stable Marriage Different girls have different favorites, because boys serenade one girl at a time.

Lemma: A girl’s favorite tomorrow Stable Marriage Lemma: A girl’s favorite tomorrow will be at least as desirable as today’s. favorite(G) is weakly increasing for each G.

Lemma: A boy’s love tomorrow will be no more desirable than today’s. Stable Marriage Lemma: A boy’s love tomorrow will be no more desirable than today’s. serenading(B) is weakly decreasing for each B.

So  Wedding Day. Derived Variable: total-girls-names Stable Marriage Derived Variable: total-girls-names ::= total number of names not crossed off boy’s lists Strictly decreasing & N-valued. So  Wedding Day.

Mating Invariant If G has rejected B, then she has Stable Marriage Mating Invariant If G has rejected B, then she has a better current favorite.

Mating Invariant If G has rejected B, then she has Stable Marriage Mating Invariant If G has rejected B, then she has a better current favorite. Proof: favorite(G) is weakly increasing.

Everyone is Married on the Wedding Day Stable Marriage Everyone is Married on the Wedding Day Proof by contradiction: If B is not married, can’t be serenading, so list is empty. By Invariant all girls have favorites better than B. So all girls are married. So all boys are married.

Stable Marriage Stability: Similar easy argument using the Invariant.

In-class Problem Problem 4

Who does better, boys or girls? Stable Marriage Who does better, boys or girls? Girls’ suitors get better, and boy’s sweethearts get worse, so girls do better? No!

Mating Algorithm is Optimal for all Boys at once. Pessimal for all Stable Marriage Mating Algorithm is Optimal for all Boys at once. Pessimal for all Girls.

More questions, rich theory: Stable Marriage More questions, rich theory: Other stable marriages possible? Can be many. Can a boy do better by lying? – No! Can a girl do better by lying – Yes!