Title: Matching problems
1Matching problems
- Toby Walsh
- NICTA and UNSW
2Motivation
- 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
3Stable marriage
- What do I know?
- Ask me again after June 21st
- Mathematical abstraction
- Idealized model
- All men can totally order all women
-
4Stable marriage
- Given preferences of n men
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Given preferences of n women
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
5Stable marriage
- Given preferences of n men
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Given preferences of n women
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
- Find a stable marriage
6Stable 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!
7Stable marriage
- Unstable solution
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
Bertha Greg would prefer to elope
8Stable marriage
- One solution
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
Men do ok, women less well
9Stable marriage
- Another solution
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
Women do ok, men less well
10Gale Shapley algorithm
- Initialize every person to be free
- While exists a free man
- Find best woman he hasnt 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
11Gale Shapley algorithm
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
- Initialize every person to be free
- While exists a free man
- Find best woman he hasnt 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
12Gale 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!
13Gale 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!
14Gale 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!
15Gale 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
16Gale 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!
17Gale 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!
18Gale Shapley algorithm
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
- Initialize every person to be free
- While exists a free man
- Find best woman he hasnt 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
19Gale Shapley algorithm woman optimal
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
- Initialize every person to be free
- While exists a free woman
- Find best man she hasnt 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
20Extensions 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
21Extensions 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!
22Extensions incomplete preferences
- There are some people we may be unwilling to
marry - Id 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
23Extensions 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
24Extensions 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
25Extensions 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
26Extensions unequal numbers
- GS algorithm
- Extends easily
- If mengtwomen 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
27Strategy 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
28Strategy proofness
- Greg AmygtBerthagtClare
- Harry BerthagtAmygtClare
- Ian AmygtBerthagtClare
- Amy HarrygtGreggtIan
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
- Amy lies
- Amy HarrygtIangtGreg
- Bertha GreggtHarrygtIan
- Clare GreggtHarrygtIan
29Impossibility 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 AmygtBertha Amy
HarrygtGreg - Harry BerthagtAmy Bertha
GreggtHarry - Two stable marriages
- (Greg,Amy)(Harry,Bertha) or (Greg,Bertha)(Harry,Am
y)
30Impossibility of strategy proofness
- Consider
- Greg AmygtBertha Amy
HarrygtGreg - Harry BerthagtAmy Bertha
GreggtHarry - Two stable marriages
- (Greg,Amy)(Harry,Bertha) or (Greg,Bertha)(Harry,Am
y) - 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
31Impossibility 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???
32Some lessons learnt?
- Historically men have in fact proposed to woman
- Men propose early and often
- Men dont lie
- Women ask out the guys
- (Bad news) Women lying and turning down
proposals can be to your advantage!
33Hospital 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
34Stable roommate
- 2n agents
- Each ranks every other agent
- Pair up agents according to preferences
- No stable matching may exist
- Adam BobgtChrisgtDerek
- Bob ChrisgtAdamgtDerek
- Chris AdamgtBobgtDerek
- Derek AdamgtBobgtChris
35Conclusions
- 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
36Conclusions
- 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,