Top Banner
Stable Marriage Stable Marriage Problem Problem Sangita Satapathy Sangita Satapathy Asst. Professor Asst. Professor
50

Stable Marriage Problem Sangita Rani Satapathy

Jun 30, 2015

Download

Education

Sangita Rani

Hi friends!! I have shared this PPT for you.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Stable  Marriage Problem  Sangita Rani Satapathy

Stable Marriage Stable Marriage ProblemProblem

Sangita SatapathySangita Satapathy

Asst. ProfessorAsst. Professor

Page 2: Stable  Marriage Problem  Sangita Rani Satapathy

# Introduction# Introduction

# Background Theory# Background Theory

# Formal Definition# Formal Definition

# Real world Application# Real world Application

# Issues# Issues

Page 3: Stable  Marriage Problem  Sangita Rani Satapathy

Whom to marry ? Whom to marry ?

How to Distribute students among How to Distribute students among laboratory ?laboratory ?

How to Distribute interns into How to Distribute interns into hospital s ? hospital s ?

: : solving dilemmas of daily life, solving dilemmas of daily life, one algorithm at a time one algorithm at a time

IntroductionIntroduction

Page 4: Stable  Marriage Problem  Sangita Rani Satapathy

WARNING: This lecture contains mathematical content that may be shocking to some Persons.

Page 5: Stable  Marriage Problem  Sangita Rani Satapathy

Problem NO:1Problem NO:1

Hospitals are offering Jobs to medical Hospitals are offering Jobs to medical studentsstudents

• Medical students, when they Medical students, when they received offers from hospitals, they received offers from hospitals, they used to wait in case a better offer used to wait in case a better offer would present itselfwould present itselffrom a hospital more to their liking. from a hospital more to their liking.

It ends up in : It ends up in :

Background Theory:Background Theory:

Page 6: Stable  Marriage Problem  Sangita Rani Satapathy

unhappy students who accepted their unhappy students who accepted their first offers only to regret itfirst offers only to regret it

OROR

unhappy hospitals when students did unhappy hospitals when students did not keepnot keep

their earlier commitments.their earlier commitments.

Page 7: Stable  Marriage Problem  Sangita Rani Satapathy

Problem NO:2Problem NO:2

The problem of assigning sailors The problem of assigning sailors to boats in the U.S, Navy. Sailors to boats in the U.S, Navy. Sailors are given new assignments every are given new assignments every few years and they are required few years and they are required to hand in a preference list.to hand in a preference list.

Page 8: Stable  Marriage Problem  Sangita Rani Satapathy

• Gale and Shapley came up to solve Gale and Shapley came up to solve these types of problems with these types of problems with stable matching : ( Stable Marriage stable matching : ( Stable Marriage Problem)Problem)

Page 9: Stable  Marriage Problem  Sangita Rani Satapathy

• The The Stable marriage problem Stable marriage problem (SMP) (SMP) is basically the problem of is basically the problem of finding a stable matching between finding a stable matching between two sets of persons, the men and two sets of persons, the men and the women, where each person in the women, where each person in every group has a list containing every group has a list containing every person that belongs to other every person that belongs to other group ordered by preferencegroup ordered by preference

Definition Definition

Page 10: Stable  Marriage Problem  Sangita Rani Satapathy

• Genetic algorithms are used to Genetic algorithms are used to solve such problems and often solve such problems and often produces better solutionsproduces better solutions

Page 11: Stable  Marriage Problem  Sangita Rani Satapathy

The Mathematics Of 1950’s Dating: The Mathematics Of 1950’s Dating: Who wins the battle of the Marriage?Who wins the battle of the Marriage?

Page 12: Stable  Marriage Problem  Sangita Rani Satapathy

Marriage ScenarioMarriage Scenario• There are n boys and n girls• Each girl has her own ranked

preference list of all the boys• Each boy has his own ranked

preference list of all the girls• The lists have no ties

Question: How do we pair them off?

Page 13: Stable  Marriage Problem  Sangita Rani Satapathy

C,B,A,D

1

B,A,D,C

2

D,C,A,B

3

A,B,C,D

4

A

3,4,1,2

B

1,2,3,4

C

4,3,2,1

D

1,3,4,2

Page 14: Stable  Marriage Problem  Sangita Rani Satapathy

Blocking CouplesBlocking Couples

Suppose we pair off all the boys and Suppose we pair off all the boys and girls. girls. Now suppose that some boy Now suppose that some boy and some girl prefer each other to and some girl prefer each other to the people to whom they are paired.the people to whom they are paired. They will be called a They will be called a Blocking Blocking couplecouple..

Page 15: Stable  Marriage Problem  Sangita Rani Satapathy

Why be with them when we can be with each

other?

Page 16: Stable  Marriage Problem  Sangita Rani Satapathy

Stable PairingsStable Pairings

A pairing of boys and girls is called A pairing of boys and girls is called stablestable if it contains no Blocking if it contains no Blocking couples.couples.

C,B,A,D

1B,A,D,C

D,C,A,B

3A,B,C,D

4

A

3,4,1,2

B

1,2,3,4

C

4,3,2,1

D

1,3,4,2

2

Page 17: Stable  Marriage Problem  Sangita Rani Satapathy

Given a set of preference lists, Given a set of preference lists, how do we find a stable pairing?how do we find a stable pairing?

Page 18: Stable  Marriage Problem  Sangita Rani Satapathy

Given a set of preference lists, Given a set of preference lists, how do we find a stable pairing?how do we find a stable pairing?

Wait! We don’t even know that such a

pairing always exists!

Page 19: Stable  Marriage Problem  Sangita Rani Satapathy

Can you argue that the couples will not

continue breaking up and reforming forever?

Page 20: Stable  Marriage Problem  Sangita Rani Satapathy

The algorithm contains following four The algorithm contains following four steps.steps.

1. boy proposes to his desirable girl one 1. boy proposes to his desirable girl one by one.by one.

2. girl decides whether accept or reject.2. girl decides whether accept or reject.

3. If a boy is refused, then he remove her 3. If a boy is refused, then he remove her name from his preference list.name from his preference list.

4. Repeat the steps above, until every 4. Repeat the steps above, until every boy is accepted by a girl. boy is accepted by a girl.

Gale-ShapleyGale-Shapley algorithmalgorithm

Page 21: Stable  Marriage Problem  Sangita Rani Satapathy

For each day that some boy gets a “No” do:For each day that some boy gets a “No” do:• MorningMorning

– Each girl stands on her balcony– Each boy proposes under the balcony of the best girl

whom he has not yet crossed off• Afternoon (for those girls with at least one suitor)Afternoon (for those girls with at least one suitor)

– To today’s best suitor: “Maybe, come back tomorrow”“Maybe, come back tomorrow”– To any others: “No, I will never marry you” “No, I will never marry you”

• EveningEvening– Any rejected boy crosses the girl off his list

Each girl marries the boy to whom she last said Each girl marries the boy to whom she last said “maybe”“maybe”

Traditional Marriage AlgorithmTraditional Marriage Algorithm

Page 22: Stable  Marriage Problem  Sangita Rani Satapathy

Female

The Traditional Marriage The Traditional Marriage AlgorithmAlgorithm

String

Worshipping males

Page 23: Stable  Marriage Problem  Sangita Rani Satapathy

Traditional Marriage AlgorithmTraditional Marriage Algorithm

While there is an unmatched boy, do:While there is an unmatched boy, do:• Some unmatched boy proposes to next girl on his listSome unmatched boy proposes to next girl on his list• If girl is unmatched:If girl is unmatched:

– boy & girl get engaged• If girl is matched but prefers boy to her current fiancé:If girl is matched but prefers boy to her current fiancé:

– boy & girl get engaged– previous fiancé becomes unmatched

• If girl is matched and prefers fiancé to proposerIf girl is matched and prefers fiancé to proposer– proposer is rejected

Each girl marries the boy to whom she is last engagedEach girl marries the boy to whom she is last engaged

Page 24: Stable  Marriage Problem  Sangita Rani Satapathy

Does the Traditional Marriage Does the Traditional Marriage Algorithm always produce a Algorithm always produce a

stablestable pairing? pairing?

Page 25: Stable  Marriage Problem  Sangita Rani Satapathy

Does the Traditional Marriage Does the Traditional Marriage Algorithm always produce a Algorithm always produce a

stablestable pairing? pairing?

Wait! There is a more primary

question!

Page 26: Stable  Marriage Problem  Sangita Rani Satapathy

Does TMA always terminate?Does TMA always terminate?

• It might encounter a situation where algorithm does not specify what to do next (core dump error)

• It might keep on going for an infinite number of days

Page 27: Stable  Marriage Problem  Sangita Rani Satapathy

Improvement LemmaImprovement Lemma: If a girl is : If a girl is engaged to a boy, then she will engaged to a boy, then she will always be engaged (or married) to always be engaged (or married) to someone at least as good.someone at least as good.

•She would only let go of him in order to get engaged to someone better

•She would only let go of that guy for someone even better

•She would only let go of that guy for someone even better

•AND SO ON . . . . . . . . . . . . .

Page 28: Stable  Marriage Problem  Sangita Rani Satapathy

Improvement LemmaImprovement Lemma: If a girl is : If a girl is engaged to a boy, then she will engaged to a boy, then she will always be engaged (or married) to always be engaged (or married) to someone at least as good.someone at least as good.

•She would only let go of him in order to get engaged to someone better

•She would only let go of that guy for someone even better

•She would only let go of that guy for someone even better

•AND SO ON . . . . . . . . . . . . . Proof by Induction

Page 29: Stable  Marriage Problem  Sangita Rani Satapathy

LemmaLemma: No boy can be rejected : No boy can be rejected by all the girlsby all the girls

Proof by contradiction.Proof by contradiction.

Suppose boy b is rejected by all the Suppose boy b is rejected by all the girls.girls. At that point: At that point:• Each girl must have a suitor other than b

• The n girls have n suitors, b not among them. Thus, there are at least n+1 boys

Contradiction

Page 30: Stable  Marriage Problem  Sangita Rani Satapathy

TheoremTheorem: The TMA always : The TMA always terminates in at most nterminates in at most n22 days days

• A “master list” of all n of the boys lists starts with a total of n X n = n2 girls on it.

• Each day that at least one boy gets a “No”, at least one girl gets crossed off the master list

• Therefore, the number of days is bounded by the original size of the master list n(n-1) <= n2.

Page 31: Stable  Marriage Problem  Sangita Rani Satapathy

Steven Rudich: www.discretemath.com www.rudich.net

CorollaryCorollary: Each girl will marry : Each girl will marry her absolute favorite of the boys her absolute favorite of the boys

who visit her during the TMAwho visit her during the TMA

Page 32: Stable  Marriage Problem  Sangita Rani Satapathy

Great! We know that TMA will Great! We know that TMA will terminate and produce a pairing.terminate and produce a pairing.

But is it stable?But is it stable?

Page 33: Stable  Marriage Problem  Sangita Rani Satapathy

TheoremTheorem: Let T be the pairing : Let T be the pairing produced by TMA. T is stable.produced by TMA. T is stable.

ggbb

gg**bb**

Page 34: Stable  Marriage Problem  Sangita Rani Satapathy

TheoremTheorem: Let T be the pairing : Let T be the pairing produced by TMA. T is stable.produced by TMA. T is stable.

ggbb

I rejected you when you I rejected you when you came to my balcony, came to my balcony, now I got someone now I got someone

better.better.

gg**

Page 35: Stable  Marriage Problem  Sangita Rani Satapathy

TheoremTheorem: Let T be the pairing : Let T be the pairing produced by TMA. T is stable.produced by TMA. T is stable.

• Let b and g be any couple in T.• Suppose b prefers g* to g. We will argue

that g* prefers her husband to b.• During TMA, b proposed to g* before he

proposed to g. Hence, at some point g* rejected b for someone she preferred. By the Improvement lemma, the person she married was also preferable to b.

• Thus, every boy will be rejected by any girl he prefers to his wife. T is stable.

Page 36: Stable  Marriage Problem  Sangita Rani Satapathy

Opinion PollOpinion Poll

Who is better off

in traditio

nal

dating, the boys

or the girls

?

Page 37: Stable  Marriage Problem  Sangita Rani Satapathy

Forget TMA for a momentForget TMA for a moment

How should we define what How should we define what we mean when we say “the we mean when we say “the optimal girl for boy b”?optimal girl for boy b”?

Flawed Attempt:Flawed Attempt: “The girl at the top of b’s “The girl at the top of b’s

list”list”

Page 38: Stable  Marriage Problem  Sangita Rani Satapathy

The Optimal GirlThe Optimal Girl

A boy’s A boy’s optimal girloptimal girl is the highest is the highest ranked girl for whom there is ranked girl for whom there is somesome stable pairing in which the boy gets stable pairing in which the boy gets

her.her.

She is the She is the bestbest girl he can girl he can conceivably get in a stable world. conceivably get in a stable world.

Page 39: Stable  Marriage Problem  Sangita Rani Satapathy

The Pessimal GirlThe Pessimal Girl

A boy’s A boy’s pessimal girlpessimal girl is the lowest is the lowest ranked girl for whom there is ranked girl for whom there is somesome stable pairing in which the boy gets stable pairing in which the boy gets

her.her.

She is the She is the worstworst girl he can girl he can conceivably get in a stable world. conceivably get in a stable world.

Page 40: Stable  Marriage Problem  Sangita Rani Satapathy

Dating Heaven and HellDating Heaven and Hell

A pairing is A pairing is male-optimalmale-optimal if if every every boy gets boy gets his his optimaloptimal mate. This is the best of all mate. This is the best of all possible stable worlds for every boy possible stable worlds for every boy simultaneously.simultaneously.

A pairing is A pairing is male-pessimalmale-pessimal if if every every boy boy gets his gets his pessimalpessimal mate. This is the worst mate. This is the worst of all possible stable worlds for every boy of all possible stable worlds for every boy simultaneously.simultaneously.

Page 41: Stable  Marriage Problem  Sangita Rani Satapathy

Dating Heaven and HellDating Heaven and Hell

Does a male-optimal pairing always Does a male-optimal pairing always exist? exist?

If so, is it stable?If so, is it stable?

Page 42: Stable  Marriage Problem  Sangita Rani Satapathy

The Mathematical The Mathematical Truth!Truth!

The Traditional Marriage The Traditional Marriage Algorithm always Algorithm always

produces a produces a male-optimalmale-optimal, , female-pessimalfemale-pessimal pairing. pairing.

Page 43: Stable  Marriage Problem  Sangita Rani Satapathy

Advice to femalesAdvice to females

Learn to make the first move. Learn to make the first move.

Conclusions…Conclusions…

Page 44: Stable  Marriage Problem  Sangita Rani Satapathy

REAL-WORLD APPLICATIONSREAL-WORLD APPLICATIONS

• College admissions and the College admissions and the hospitals residents problemhospitals residents problem

• The sailors-boats problemThe sailors-boats problem• The stable room-mates problemThe stable room-mates problem• Application in router technologyApplication in router technology• Stable allocation problemStable allocation problem

Page 45: Stable  Marriage Problem  Sangita Rani Satapathy

Application in router technologyApplication in router technology

• MUFCA is an algorithm for solving MUFCA is an algorithm for solving the problem of creating a Router the problem of creating a Router used in LAN switches that combine used in LAN switches that combine input and output queueinput and output queue

• In order for it to handle inputsIn order for it to handle inputs

and outputs, it uses the Gale and outputs, it uses the Gale Shapley algorithmShapley algorithm

Page 46: Stable  Marriage Problem  Sangita Rani Satapathy

Each input in MUFCA has a urgency value and Each input in MUFCA has a urgency value and according to that value, the preference lists according to that value, the preference lists for each switch are created,for each switch are created,

and then inputs are matched with the outputs.and then inputs are matched with the outputs.

Page 47: Stable  Marriage Problem  Sangita Rani Satapathy

Other issues…Other issues…

• What if people lie?What if people lie?• What about same-sex What about same-sex couples, couples, or pairing or pairing roommates?roommates?

( Not a straight-forward ( Not a straight-forward instance of SMP)instance of SMP)

Page 48: Stable  Marriage Problem  Sangita Rani Satapathy

REFERENCESREFERENCES

• Biro, P. and boylove, D.F. and Mittal, S., (2010), Biro, P. and boylove, D.F. and Mittal, S., (2010), Size Size versus stability in the marriage problem. Theoreticalversus stability in the marriage problem. Theoretical

Computer Science, 411 (16-18). pp. 1828-1841. ISSN Computer Science, 411 (16-18). pp. 1828-1841. ISSN 0304-39750304-3975

• D. Gale and L. S. Shapley, D. Gale and L. S. Shapley, College admissions and the College admissions and the stability of marriagestability of marriage, American Mathematical Monthly , American Mathematical Monthly 69 (1962), 9-15 69 (1962), 9-15

• Dan Gusfield and Robert W. Irving, Dan Gusfield and Robert W. Irving, The Stable The Stable Marriage Problem: Structures and AlgorithmsMarriage Problem: Structures and Algorithms, MIT Press, , MIT Press, 19891989

Page 49: Stable  Marriage Problem  Sangita Rani Satapathy

THANK YOUTHANK YOU

Page 50: Stable  Marriage Problem  Sangita Rani Satapathy

ANY QUERY?ANY QUERY?