Download presentation

Presentation is loading. Please wait.

Published byDiego Williamson Modified over 2 years ago

1
The Stable Marriage Problem and Constraint Programming

2
1: : : : : : : : : : : : What is a SM? MENWOMEN What do you mean by stable? assume man I is married to woman Y woman X is married to man J man I prefers woman X to his partner (woman Y) woman X prefers man I to her partner (man J) the marriages are unstable man I and woman X will elope Harrison Ford is not going to leave his wife and take Andrea away from me

3
A Blocking Pair 1: : : : : : : : : : : : MENWOMEN M6 marries W6, his 5th choice W5 marries M1, her 4th choice M6 prefers W5 to W6 & W5 prefers M6 to M1 This is a blocking pair, and is unstable Romeo marries Liz, Richard marries Juliet … is this stable?

4
A Solution 1: : : : : : : : : : : : MENWOMEN

5
The Basic Gale Shapley (GS) Algorithm 1. L := list of free men 2. While isNotEmpty(L) 2.1 m := selectFrom(L) // but do not delete m from L 2.2 w := first(preferenceList(m)) // ms most preferred partner 2.3 if isUnmarried(w) marry(m,w) L := remove(L,m) 2.4 else // w is already married if w prefers m to partner(w) L := add(L,partner(w)) // free, at last! delete(preferenceList(w),partner(w)) // divorced :( delete(preferenceList(partner(w)),w) // divorced :( marry(m,w) // w gets a better partner :) else delete(preferenceList(w),m) // w will not remarry for m delete(preferenceList(m),w) // and m stays in L Note: 1. Man optimal, men propose 2. The order of L is immaterial 3. The algorithm terminates with a man optimal (woman pessimal) stable matching always (there is always a stable matching) 4. O(n^2), and uses data structures initialised in O(n^2)

6
The Extended Gale Shapley Algorithm (man optimal) 1. L := list of free men 2. While isNotEmpty(L) 2.1 m := selectAndRemoveFrom(L) // note, removed from L 2.2 w := first(preferenceList(m)) 2.3 if isMarried(w) // unconditional remarriage! L := add(L,partner(w)) delete(preferenceList(w),partner(w)) delete(preferenceList(partner(w)),w) 2.4 marry(m,w) 2.5 for each m in preferenceList(w) if w prefers m to m // remove unacceptable pairs delete(preferenceList(w),m) delete(preferenceList(m),w) … reduces the preference lists by eliminating pairs that can readily be identified as not belonging to any stable matching Gusfield and Irving, 1.2.4, page 15, 1989

7
The Extended Gale Shapley Algorithm We can apply the algorithm for men, and then for women The reduced preference lists are called the GS-lists The GS lists contain all matchings We can generate a man optimal matching by marrying each man to his first preference

8
A (naïve) CP encoding of SM 1: : : : : : : : : : : : MENWOMEN a permutation problem with n variables, each with n values n man variables and n woman variables, domain size of n a marriage constraint between each (man,woman) pair if manX marries womanY then womanY marries manX a stability constraint between each (man,woman) pair list all blocking pairs between a man and woman an allDifferent constraint

9
The Stability Constraint 1: : : : : : : : : : : : MENWOMEN by example, consider man 6 and woman 5 the following marriages for (m6,w5) are unstable (6,1) m6 prefers w5 to w6 and w5 prefers m6 to m1 (6,4) m6 prefers w5 to w6 and w5 prefers m6 to m4 (6,5) m6 w5 w6 w5 m6 m5 (4,1) m6 prefers w5 to w4 and w5 prefers m6 to m1 (4,4) w4 m4 (4,5) w4 m5 easily generated, as cross product of tails of preference lists a binary constraint, extensional representation, list of nogoods

10
The Marriage Constraint 1: : : : : : : : : : : : MENWOMEN a binary constraint between (man,woman) pairs manX = Y -> womanY = X this is called a channeling constraint the allDiff constraint is now redundant

11
Improving Propagation 1: : : : : : : : : : : : MENWOMEN The problem has been slightly changed it should be obvious that in all stable matchings man 1 marries woman 1 (anything else is unstable) nogoods stability {(3,5),(3,6), … (3,4), …, (5,5), …,(5,4)} achieving arc consistency does NOT detect this marriage (channeling) constraint and stability constraint operate independently however we can COMBINE marriage and stability constraints nogoods marriage {(2,1),(3,1),…,(6,1),(1,2),(1,3),…,(1,6)} we now have one (not two) tighter constraint capturing all the nogoods {(2,1),(3,1),…,(6,1), (1,2),(1,3),…,(1,6),(3,5),(3,6),…,(3,4),…,(5,5),…,(5,4)}

12
So? AC now detects inevitability of marriage of man 1 to woman 1 AC reduces the domains more than the initial encoding However O(n^4) encoding in space and time there are n(n-1) constraints each constraint is of size O(n^2) this is also true of the naïve encoding

13
1: : : : : : : : : : : : MENWOMEN Nogoods: {(6,1),(6,4),(4,1),(4,4), (5,1),(5,2),(5,3),(5,4),(5,5), (1,6),(2,6),(3,6),(4,6),(6,6)}

14
1: : : : : : : : : : : : MENWOMEN

15
AC and EGS, the main results the Arc Consistent domains are (extended) Gale Shapley lists Enumerating all solutions using MAC can result in failure driven backtracking we have examples of this the domains are not GAC they may contain pairs that are not in any stable matching SAC would achieve GAC Using value ordering and MAC results in failure free enumeration AC on SM is O(n^4) whereas GS is O(n^2) There is an O(n^2) algorithm for achieving GAC

16
A brief history on how we got there 1. Naïve encoding of Davids exam question in choco (494) 2. Ian and Toby investigate constrainedness of SM (489,500) 3. Barbara encodes SM in Solver (497) … it would be nice if it could be solved polynomially in constraint programming. and … it might be possible to show that AC by itself is sufficient to remove all values which cannot participate in a solution … 4. David, Rob, Ian and Patrick improve propagation (495) 5. Barbara shows that enumerating solutions is not failure free (498) 6. Proof that AC domains are GS-lists (502) 7. Barbara finds a small counter example for (5) above From 1 to 7 in 3 weeks, with 6 people

17
Still to do 1. Prove that value ordering and MAC allows failure free enumeration 2. Explore the connection between rotations and MAC enumeration 3. Investigate how to efficiently encode AC and GAC for SM into a CP language 4. Investigate AC and SMI

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google