The Stable Marriage Problem and Constraint Programming.

Slides:



Advertisements
Similar presentations
Modelling and Solving the Stable Marriage problem using Constraint Programming David Manlove and Gregg OMalley University Of Glasgow Department of Computing.
Advertisements

Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science.
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
An empirical study of the stable marriage problem with ties and incomplete lists (SMTI) Ian Gent & Patrick Prosser.
Blah blah blah. Zoes shark Thanks to the conference artist Phoebe.
Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept.
Maximal Independent Sets of a Hypergraph IJCAI01.
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 2.
Global Constraints Toby Walsh NICTA and University of New South Wales
1 Overview of Graph Theory Addendum “The Stable Marriage Problem” Instructor: Carlos Pomalaza-Ráez Fall 2003 University of Oulu, Finland.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
MBD and CSP Meir Kalech Partially based on slides of Jia You and Brian Williams.
Matching Theory.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Lecture 2: Greedy Algorithms II Shang-Hua Teng Optimization Problems A problem that may have many feasible solutions. Each solution has a value In maximization.
Matching problems Toby Walsh NICTA and UNSW. Motivation Agents may express preferences for issues other than a collective decision  Preferences for a.
Specialised N-ary Constraint for the Stable Marriage Problem By Chris Unsworth and Patrick Prosser.
What’s the problem? Something like stable marriage problem … but without sex.
Joint work with Rob Irving
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Lecture 4 CSE 331 Sep 9, Blog posts for lectures Starts from today See Sep 8 post on the blog.
Constraint Satisfaction Problems
1 Bipartite Matching Polytope, Stable Matching Polytope x1 x2 x3 Lecture 10: Feb 15.
Chapter 5 Outline Formal definition of CSP CSP Examples
Lecture 8 CSE 331 Sep 17, HW 1 due today Place Q1 and Q2 in separate piles I will not accept HWs after 1:15pm.
Constraint Satisfaction Problems
The Stable Marriage Problem
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
L3 #1 The Hospitals / Residents Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science Supported by EPSRC grant.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Pelvic floor Specialised Constraints for Stable Matching Problems Contact details: 17 Lilybank Gardens Glasgow G12 8QQ The Problem.
Lecture 4 CSE 331 Sep 6, TA change Swapnoneel will leave us for 531 Jiun-Jie Wang will join us.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
Lecture 2 CSE 331. Day 1 Survey On UBlearns Day 1 Survey (talking points) Security MS PhD for research Building PC’s for 442 It’s ok to play games –
Stable Matchings a.k.a. the Stable Marriage Problem
Lecture 5 CSE 331 Sep 11, Submit the form I’ll need confirmation in writing. No graded material will be handed back till I get this signed form.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.
Specialised Binary Constraint for the Stable Marriage Problem with Ties and incomplete preference lists By Chris Unsworth and Patrick Prosser.
Bipartite Matching. Unweighted Bipartite Matching.
The Stable Marriage Problem
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Market Design and Analysis Lecture 2 Lecturer: Ning Chen ( 陈宁 )
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Matching.
Stable Marriage Problem
Lecture 4 CSE 331 Sep 7, 2016.
Introduction to the Design and Analysis of Algorithms
Chapter 10 Iterative Improvement
Lecture 5 CSE 331 Sep 8, 2017.
CSE 421: Introduction to Algorithms
Lecture 6 CSE 331 Sep 11, 2017.
Lecture 6 CSE 331 Sep 13, 2010.
Constraints and Search
Blah blah blah.
Chapter 1 Introduction: Some Representative Problems
Constraint satisfaction problems
Lecture 6 CSE 331 Sep 12, 2011.
Lecture 6 CSE 331 Sep 12, 2016.
Piyush Kumar (Lecture 3: Stable Marriage)
Lecture 5 CSE 331 Sep 9, 2016.
Constraint satisfaction problems
Week 10 - Wednesday CS221.
Presentation transcript:

The Stable Marriage Problem and Constraint Programming

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

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?

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

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)

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

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

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

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

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

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

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

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

1: : : : : : : : : : : : MENWOMEN

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

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

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