Matching problems Toby Walsh NICTA and UNSW Motivation  Agents may express preferences for issues other than a collective decision Preferences for a spouse Preferences for.

Download Report

Transcript Matching problems Toby Walsh NICTA and UNSW Motivation  Agents may express preferences for issues other than a collective decision Preferences for a spouse Preferences for.

Matching problems
Toby Walsh
NICTA and UNSW
Motivation
 Agents may express preferences for issues
other than a collective decision
Preferences for a spouse
Preferences for a room-mate
Preferences for a work assignment
…
 All examples of matching problems
Husbands with Wives
Students with Rooms
Doctors with Hospitals
…
Stable marriage
 What do I know?
Ask me again after
June 21st
 Mathematical
abstraction
Idealized model
All men can totally
order all women
…
Qu i c k T i m e ™ a n d a
d e c o m p re s s o r
a re n e e d e d t o s e e t h i s p i c tu re .
Stable marriage
Given preferences of n men
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Given preferences of n women
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Stable marriage
Given preferences of n men
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Given preferences of n women
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
 Find a stable marriage
Stable marriage
Given preferences of n men
Given preferences of n women
Find a stable marriage
Assignment of men to women (or equivalently
of women to men)
Idealization: everyone marries at the same time
No pair (man,woman) not married to each other
would prefer to run off together
Idealization: assumes no barrier to divorce!
Stable marriage
Unstable solution
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Bertha & Greg would prefer to elope
Stable marriage
One solution
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Men do ok, women less well
Stable marriage
Another solution
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Women do ok, men less well
Gale Shapley algorithm
Initialize every person to be free
While exists a free man
Find best woman he hasn’t proposed to yet
If this woman is free, declare them engaged
Else if this woman prefers this proposal to her current
fiance then declare them engaged (and “free” her
current fiance)
Else this woman prefers her current fiance and she
rejects the proposial
Gale Shapley algorithm
 Initialize every person to be free
 While exists a free man
 Find best woman he hasn’t
proposed to yet
 If this woman is free, declare
them engaged
 Else if this woman prefers this
proposal to her current fiance
then declare them engaged (and
“free” her current fiance)
 Else this woman prefers her
current fiance and she rejects
the proposial
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Gale Shapley algorithm
Terminates with everyone matched
Suppose some man is unmatched at the end
Then some woman is also unmatched
But once a woman is matched, she only “trades” up
Hence this woman was never proposed to
• But if a man is unmatched, he has proposed to and been
rejected by every woman
This is a contradiction as he has never proposed to
the unmatched woman!
Gale Shapley algorithm
Terminates with perfect matching
Suppose there is an unstable pair in the final
matching
Case 1. This man never proposed to this
woman
As men propose to women in preference order, man
must prefer his current fiance
Hence current pairing is stable!
Gale Shapley algorithm
Terminates with perfect matching
Suppose there is an unstable pair in the final
matching
Case 1. This man never proposed to this
woman
Case 2. This man had proposed to this woman
But the woman rejected him (immediately or later)
However, women only ever trade up
Hence the woman prefers her current partner
So the current pairing is stable!
Gale Shapley algorithm
Each of n men can make at most (n-1) proposals
Hence GS runs in O(n2) time
There may be more than one stable marriage
GS finds man optimal solution
There is no stable matching in which any man
does better
GS finds woman pessimal solution
In all stable marriages, every woman does at
least as well or better
Gale Shapley algorithm
 GS finds male optimal solution
Suppose some man is engaged to someone who is not
the best possible woman
 Then they have proposed and been rejected by this
woman
 Consider first such man A, who is rejected by X in favour
ultimately of marrying B
• There exists (some other) stable marriage with A married to X
and B to Y
 By assumption, B has not yet been rejected by his best
possible woman
 Hence B must prefer X at least as much as his best
possible woman
 So (A,X) (B,Y) is not a stable marriage as B and X would
prefer to elope!
Gale Shapley algorithm
 GS finds woman pessimal solution
Suppose some womman is engaged to someone who is
not the worst possible man
 Let (A,X) be married but A is not worst possible man for X
 There exists a stable marriage with (B,X) (A,Y) and B
worse than A for X
 By male optimality, A prefers X to Y
 Then (A,Y) is unstable!
Gale Shapley algorithm
 Initialize every person to be free
 While exists a free man
 Find best woman he hasn’t
proposed to yet
 If this woman is free, declare
them engaged
 Else if this woman prefers this
proposal to her current fiance
then declare them engaged (and
“free” her current fiance)
 Else this woman prefers her
current fiance and she rejects
the proposial
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Gale Shapley algorithm woman optimal
 Initialize every person to be free
 While exists a free woman
 Find best man she hasn’t
proposed to yet
 If this man is free, declare them
engaged
 Else if this man prefers this
proposal to his current fiance
then declare them engaged (and
“free” his current fiance)
 Else this man prefers his
current fiance and he rejects
the proposial
Greg: Amy>Bertha>Clare
Harry: Bertha>Amy>Clare
Ian: Amy>Bertha>Clare
Amy: Harry>Greg>Ian
Bertha: Greg>Harry>Ian
Clare: Greg>Harry>Ian
Extensions: ties
 Cannot always make up
our minds
 Angelina or Jennifer?
 Either would be equally
good!
 Stability
 (weak) no couple strictly
prefers each other
 (strong) no couple such
that one strictly prefers
the other, and the other
likes them as much or
more
Extensions: ties
 Stability
(weak) no couple strictly prefers each other
(strong) no couple such that one strictly prefers the
other, and the other likes them as much or more
 Existence
Strongly stable marriage may not exist
 O(n4) algorithm for deciding existence
Weakly stable marriage always exists
 Just break ties aribtrarily
 Run GS, resulting marriage is weakly stable!
Extensions: incomplete preferences
 There are some people
we may be unwilling to
marry
 I’d prefer to remain single
than marry Margaret
 (m,w) unstable iff
 m and w do not find each
other unacceptable
 m is unmatched or prefers
w to current fiance
 w is unmatched or prefers
w to current fiance
Extensions: incomplete prefs
GS algorithm
Extends easily
Men and woman partition into two sets
Those who have partners in all stable
marriages
Those who do not have partners in any stable
marriage
Extensions: ties & incomplete prefs
Weakly stable marriages may be different
sizes
Unlike with just ties where they are all complete
Finding weakly stable marriage of max.
cardinality is NP-hard
Even if only women declare ties
Extensions: unequal numbers
For instance, more men than woman
See China!
Matching unstable if pair (m,w)
m and w do not find each other unacceptable
m is unmatched or prefers w to current fiance
w is unmatched or prefers w to current fiance
Extensions: unequal numbers
GS algorithm
Extends easily
If |men|>|women| then all woman are
married in a stable solution
Men partition into two sets
Those who have partners in all stable marriages
Those who do not have partners in any stable
marriage
Strategy proofness
GS is strategy proof for men
Assuming male optimal algorithm
No man can do better than the male optimal
solution
However, women can profit from lying
Assuming male optimal algorithm is run
And they know complete preference lists
Strategy proofness
 Greg: Amy>Bertha>Clare
 Harry: Bertha>Amy>Clare
 Ian: Amy>Bertha>Clare
 Amy lies
 Amy: Harry>Greg>Ian
 Bertha: Greg>Harry>Ian
 Clare: Greg>Harry>Ian
 Amy: Harry>Ian>Greg
 Bertha: Greg>Harry>Ian
 Clare: Greg>Harry>Ian
Impossibility of strategy proofness
[Roth 82]
No matching procedure for which stating the truth
is a dominant strategy for all agents when
preference lists can be incomplete
Consider
Greg: Amy>Bertha
Harry: Bertha>Amy
Amy: Harry>Greg
Bertha: Greg>Harry
Two stable marriages:
(Greg,Amy)(Harry,Bertha) or (Greg,Bertha)(Harry,Amy)
Impossibility of strategy proofness
Consider
 Greg: Amy>Bertha
 Harry: Bertha>Amy
Amy: Harry>Greg
Bertha: Greg>Harry
Two stable marriages:
 (Greg,Amy)(Harry,Bertha) or (Greg,Bertha)(Harry,Amy)
Suppose we get male optimal solution
 (Greg,Amy)(Harry,Bertha)
 If Amy lies and says Harry is only acceptable partner
 Then we must get (Harry,Amy)(Greg,Bertha) as this is the
only stable marriage
Other cases can be manipulated in a similar way
Impossibility of strategy proofness
Strategy proofness is hard to achieve
[Roth and Sotomayor 90] With any matching procedure, if
preference lists are strict, and there is more than one stable
marriage, then at least one agent can profitably lie
assuming the other agents tell the truth
But one side can have no incentive to lie
[Dubins and Freedman 81] With a male-proposing
matching algorithm, it is a weakly-dominant strategy for the
men to tell the truth
 Weakly-dominant=???
Some lessons learnt?
 Historically men have
in fact proposed to
woman
Men: propose early and
often
Men: don’t lie
Women: ask out the
guys
(Bad news) Women:
lying and turning down
proposals can be to
your advantage!
Hospital residents problem
 Matching of residents to hospitals
Hospitals express preferences over resident
Hospitals declare how many residents they take
Residents express preferences over hospitals
 Matching (h,r) unstable iff
They are acceptable to each other
r is unmatched or r prefers h to current hospital
h is not full or h prefers r to one its current residents
Stable roommate
2n agents
Each ranks every other agent
Pair up agents according to preferences
No stable matching may exist
Adam:
Bob>Chris>Derek
Bob:
Chris>Adam>Derek
Chris:
Adam>Bob>Derek
Derek:
Adam>Bob>Chris
Conclusions
 Preferences turn up in matching problems
Stable marriage
Roommate
Hospital-residents problem
 We may wish to represent
Ties
Incompatability (aka “incomplete preference lists)
..
 Complexity depends on this
Stable marriage on total orders is O(n2)
Stable marriage with ties and incomplete preference
lists is NP-hard
Conclusions
 Many different formalisms for representing
preferences
CP nets, soft constraints, utilities, …
 Many different dimensions to analyse these
formalisms along
Expressiveness, succinctness, …
 Many interesting computational problems
Computing optimal, ordering outcomes, manipulating
result, deciding when to terminate preference elicitation,
…