Stable Marriage Problem Sangita Rani Satapathy

Preview:

DESCRIPTION

Hi friends!! I have shared this PPT for you.

Citation preview

Stable Marriage Stable Marriage ProblemProblem

Sangita SatapathySangita Satapathy

Asst. ProfessorAsst. Professor

# Introduction# Introduction

# Background Theory# Background Theory

# Formal Definition# Formal Definition

# Real world Application# Real world Application

# Issues# Issues

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

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

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:

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.

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.

• 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)

• 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

• 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

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?

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?

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

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

Why be with them when we can be with each

other?

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

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?

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!

Can you argue that the couples will not

continue breaking up and reforming forever?

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

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

Female

The Traditional Marriage The Traditional Marriage AlgorithmAlgorithm

String

Worshipping males

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

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

stablestable pairing? pairing?

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!

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

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

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

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

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.

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

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?

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

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

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.

Opinion PollOpinion Poll

Who is better off

in traditio

nal

dating, the boys

or the girls

?

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”

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.

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.

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.

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?

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.

Advice to femalesAdvice to females

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

Conclusions…Conclusions…

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

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

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.

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)

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

THANK YOUTHANK YOU

ANY QUERY?ANY QUERY?

Recommended