Blah blah blah.

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.
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.
The Stable Marriage Problem and Constraint Programming.
LAW February A 5/3 approximation algorithm for a hard case of stable marriage Rob Irving Computing Science Department University of Glasgow (joint.
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 2.
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.
Lecture 6 CSE 331 Sep 14. A run of the GS algorithm Mal Wash Simon Inara Zoe Kaylee.
CSE 421 Algorithms Richard Anderson Lecture 2. Announcements Office Hours –Richard Anderson, CSE 582 Monday, 10:00 – 11:00 Friday, 11:00 – 12:00 –Yiannis.
Lecture 4 CSE 331 Sep 9, Blog posts for lectures Starts from today See Sep 8 post on the blog.
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.
Lecture 6 CSE 331 Sep 10, Homeworks HW 1 posted online: see blog/piazza Pickup graded HW 0 in TA OHs.
Chapter 10: Iterative Improvement Simplex Method The Design and Analysis of Algorithms.
The Stable Marriage Problem
1 Stable Matching Problem Goal. Given n men and n women, find a "suitable" matching. n Participants rate members of opposite sex. n Each man lists women.
Pelvic floor Specialised Constraints for Stable Matching Problems Contact details: 17 Lilybank Gardens Glasgow G12 8QQ The Problem.
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.
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Specialised Binary Constraint for the Stable Marriage Problem with Ties and incomplete preference lists By Chris Unsworth and Patrick Prosser.
All Pair Shortest Path IOI/ACM ICPC Training June 2004.
Design & Co-design of Embedded Systems Final Project: “The Match Maker” Second Phase Oral Presentation Safa S. Mahmoodian.
Bipartite Matching. Unweighted Bipartite Matching.
The Stable Marriage Problem
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Dating Advice from Mathematics
IOI/ACM ICPC Training 4 June 2005.
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Matching.
Chapter 1 Introduction: Some Representative Problems
Lower bound for the Stable Marriage Problem
Stable Marriage Problem
Lecture 4 CSE 331 Sep 7, 2016.
Introduction to the Design and Analysis of Algorithms
Chapter 10 Iterative Improvement
The Stable Marriage Problem
Lecture 5 CSE 331 Sep 8, 2017.
Maximum Flow - Best algorithms
Lecture 6 CSE 331 Sep 9, 2013.
CSE 421: Introduction to Algorithms
Various Graph Algorithms
Lecture 5 CSE 331 Sep 10, 2010.
Lecture 7 CSE 331 Sep 15, 2010.
Lecture 4 CSE 331 Sep 6, 2017.
Lecture 6 CSE 331 Sep 11, 2017.
Lecture 6 CSE 331 Sep 13, 2010.
S. Raskhodnikova; based on slides by K. Wayne
Richard Anderson Autumn 2006 Lecture 1
CSE 421: Introduction to Algorithms
1.1 A First Problem: Stable Matching
Lecture 5 CSE 331 Sep 6, 2013.
Lecture 5 CSE 331 Sep 7, 2012.
Chapter 1 Introduction: Some Representative Problems
Lecture 6 CSE 331 Sep 12, 2011.
Lecture 9 CSE 331 Sep 15, 2014.
Lecture 5 CSE 331 Sep 5, 2014.
Lecture 6 CSE 331 Sep 12, 2016.
Lecture 7 CSE 331 Sep 10, 2014.
Piyush Kumar (Lecture 3: Stable Marriage)
A Grand Tour of Stable Matching Problems
Lecture 5 CSE 331 Sep 9, 2011.
Lecture 7 CSE 331 Sep 11, 2013.
Lecture 5 CSE 331 Sep 9, 2016.
Week 10 - Wednesday CS221.
Presentation transcript:

Blah blah blah

Zoe’s shark

Thanks to the conference artist Phoebe

A Constraint Programming Approach to The Stable Marriage Problem

What is the Stable Marriage Problem? (SM) We have n men and n women Each man ranks the n women and each woman ranks the men Men Women 1 2 3 4 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 Each man has to marry a woman. Bigamy is not allowed. Marriages must be stable done

No Bigamy? There is a bijection from men to women man mi marries woman wj  woman wj marries man mi No, not bigamy … bijection 

Stable? An example 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 man 2 marries woman 4 <2,4> man 3 marries woman 1 <3,1> man 2 prefers woman 1 to woman 4 woman 1 prefers man 2 to man 3 man 2 and woman 1 will elope

There are algorithms for this The Gale Shapely algorithm, O(n2) problem has n variables, each with n partners and is of size O(n2) The complexity of the algorithm is linear in the size of the input

The Extended Gale Shapley Algorithm (man optimal) 1 L := list of free men 2. While L   2.1 m := selectAndRemoveFrom(L) // note, m is removed from L 2.2 w := first(preferenceList(m)) // m’s most preferred partner 2.3 if isMarried(w) // unconditional remarriage! 2.3.1 L := add(L,partner(w)) // w’s partner is free … again! 2.3.2 delete(preferenceList(w),partner(w)) 2.3.3 delete(preferenceList(partner(w)),w) 2.4 marry(m,w) // m and w get married.  2.5 for each m’ in preferenceList(w) 2.5.1 if w prefers m to m’ // remove unacceptable pairs 2.5.1.1 delete(preferenceList(w),m’) 2.5.1.2 delete(preferenceList(m’),w) Now you’ve seen it

The Extended Gale Shapley Algorithm (man optimal) “… reduces the preference lists by eliminating pairs that can readily be identified as not belonging to any stable matching” Gusfield and Irving, 1989

male-oriented extended Gale-Shapely algorithm An example of the male-oriented extended Gale-Shapely algorithm Male-oriented EGS

Free: 1,2,3,4 m = 1 (first free man) w = 3 (man 1’s first choice) engaged(m,w) delete pairs : <3,3>,<4,3>,<2,3> Men 1: 3 1 2 4 2: 2 1 4 3 3: 1 3 2 4 4: 4 3 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 3 4 2 4: 4 1 2 3 Men 1: 3 1 2 4 2: 2 1 4 3 3: 1 3 2 4 4: 4 3 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 3 4 2 4: 4 1 2 3 Men 1: 3 1 2 4 2: 2 1 4 3 3: 1 3 2 4 4: 4 3 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 3 4 2 4: 4 1 2 3 Men 1: 3 1 2 4 2: 2 1 4 3: 1 2 4 4: 4 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 4: 4 1 2 3

Free: 2,3,4 m = 2 (first free man) w = 2 (man 2’s first choice) engaged(m,w) delete pairs : <1,2>,<4,2> Men 1: 3 1 2 4 2: 2 1 4 3: 1 2 4 4: 4 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 4: 4 1 2 3 Men 1: 3 1 2 4 2: 2 1 4 3: 1 2 4 4: 4 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 4: 4 1 2 3 Men 1: 3 1 4 2: 2 1 4 3: 1 2 4 4: 4 1 Women 1: 2 3 4 1 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 1 2 4 2: 2 1 4 3: 1 2 4 4: 4 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 4: 4 1 2 3

Free: 3,4 m = 3 (first free man) w = 1 (man 3’s first choice) engaged(m,w) delete pairs : <4,1>,<1,1> Men 1: 3 1 4 2: 2 1 4 3: 1 2 4 4: 4 1 Women 1: 2 3 4 1 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 1 4 2: 2 1 4 3: 1 2 4 4: 4 1 Women 1: 2 3 4 1 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 1 4 2: 2 1 4 3: 1 2 4 4: 4 1 Women 1: 2 3 4 1 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 1 4 2: 2 1 4 3: 1 2 4 4: 4 1 Women 1: 2 3 4 1 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 4 2: 2 1 4 3: 1 2 4 4: 4 Women 1: 2 3 2: 3 2 3: 1 4: 4 1 2 3

Free: 4 m = 4 (first free man) w = 4 (man 4’s first choice) engaged(m,w) delete pairs : <1,4>,<2,4>,<3,4> Men 1: 3 4 2: 2 1 4 3: 1 2 4 4: 4 Women 1: 2 3 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 4 2: 2 1 4 3: 1 2 4 4: 4 Women 1: 2 3 2: 3 2 3: 1 4: 4 1 2 3 Men 1: 3 2: 2 1 3: 1 2 4: 4 Women 1: 2 3 2: 3 2 3: 1 Men 1: 3 4 2: 2 1 4 3: 1 2 4 4: 4 Women 1: 2 3 2: 3 2 3: 1 4: 4 1 2 3

Male-oriented EGS Free:  Men 1: 3 1 2 4 2: 2 1 4 3 3: 1 3 2 4 4: 4 3 1 2 Women 1: 2 3 4 1 2: 3 2 1 4 3: 1 3 4 2 4: 4 1 2 3 before Men 1: 3 2: 2 1 3: 1 2 4: 4 Women 1: 2 3 2: 3 2 3: 1 after done

The Extended Gale Shapley Algorithm (man optimal) On completion we have man optimal GS-lists if men marry their 1st partners we get man optimal stable marriages female pessimal stable marriages We can also apply female oriented EGS The intersection of the man and woman lists gives us GS-lists

A Constraint Encoding (a 1st stab) 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 2n variables, each with a domain (1 .. n) n2 channeling constraints vi = j  vj = i n2 stability constraints 2 allDiff’s (one for men, one for women) done

What’s a stability constraint? n2 stability constraints 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 An example, between man m4 and woman w3 (1) locate position of w3 in m4’s preference list (2) locate position of m4 in w3’s preference list (3) compute the Cartesian product beyond these points {(1,2),(2,2)} these are nogoods done

Arc consistency does not compute the GS-lists We require search Encoding is O(n4) allDiff’s are redundant No good news then?

Hey! It was a 1st stab!

Combining the Constraints The channeling constraints guarantee a bijection 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 m4 = 3  w3 = 4 Nogoods: m4 marries w3 and w3 marries some one else! {(3,1),(3,3),(3,2)} Nogoods: w3 marries m4 and m4 marries some one else! {(4,4),(1,4),(2,4)}

Combining the Constraints 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 (m4 = 3  w3 = 4)  stable(m4,w3) Combined nogoods: {(3,1),(3,3),(3,2),(4,4),(1,4),(2,4),(1,2),(2,2)} Do this for all man/woman pairs

Combining the Constraints Arc consistency now computes the GS-lists we have a proof We have failure free enumeration with a value ordering heuristic The encoding trivially extends to SMTI (an NP-complete problem) The encoding is O(n4) So, some good news then?

The constraint has structure 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 Combined nogoods: {(3,1),(3,3),(3,2),(4,4),(1,4),(2,4),(1,2),(2,2)} m4 w3 m4 w3 Arrange in preference order Can’t see it?

The constraint has structure 1 2 3 4 : 2 3 4 1 : 3 2 1 4 : 1 3 4 2 : 4 1 2 3 : 3 1 2 4 : 2 1 4 3 : 1 3 2 4 : 4 3 1 2 Combined nogoods: {(3,1),(3,3),(3,2),(4,4),(1,4),(2,4),(1,2),(2,2)} m4 w3 I is illegal, bigamy B is blocking, unstable A is allowed More generally

Revision of constraints Revising only certain shapes of constraints has an effect mi wk mi wk wk is top of mi’s list mi is top of wk’s list Revise(i,k) Revise(i,k) Done

Nice, interesting, … but still O(n4) 

An O(n2) encoding (a 1st stab) In a man’s world The intuition, part 1a Man to woman: I love you. Marry me. Please say yes! Woman to man: that’s the best offer I’ve had. Okay. (and by the way, all you other guys, beat it!) The intuition, part 1b Man to woman: I love you. Marry me. Please say yes! Woman to man: Who do you think you are! I’ve married someone better than you. Beat it! Man to man: Och well. There’s always someone else.

An O(n2) encoding (a 1st stab) The intuition, part 1.1a Assume man mi has proposed to his jth choice, woman wk assume wk is not engaged to someone she prefers to mi wk should reject any proposals from men less preferred than mi The intuition, part 1.1b Assume man mi has proposed to his jth choice, woman wk assume wk is engaged to someone she prefers to mi mi should then propose to his j+1th choice The following description is male-oriented and has a symmetric female orientation

An O(n2) encoding (a 1st stab) mi,j = 1  mi has proposed to his jth choice or worse wk,h = 0  wk has accepted a proposal from better than her hth choice wk,h = 0  wk,h+1 = 0 If wk has accepted a proposal from her hth choice or better then wk has accepted a proposal from her h+1th choice or better

An O(n2) encoding (a 1st stab) m3 proposes to 2nd choice w6 has been proposed to by better than her 5th

An O(n2) encoding, the stability constraints preference person Man m3 proposed to his 2nd choice, w6 Suppose man mi has a partner no better than jth choice, i.e. mi,j = 1 and jth choice is woman wk Suppose woman wk has a partner better than hth choice, i.e. wk,h = 0 and hth choice is man mi preference person Woman w6 has a partner better than her 7th choice, m3 Therefore mi is rejected by wk, and mi has a partner no better than his j+1th choice, i.e. mi,j+1 = 1

An O(n2) encoding, the stability constraints  mi is rejected by wk, and mi has a partner no better than his j+1th choice, i.e. mi,j+1 = 1 wk is mi’s jth choice mi is wk’s hth choice the constraint is This increments the pointer to the head of mi’s preference list

An O(n2) encoding, the stability constraints Otherwise mi becomes engaged to wk, and wk now has a partner better than her h+1th choice, i.e. wk,h+1 = 0 wk is mi’s jth choice mi is wk’s hth choice This deletes the tail of wk’s preference list

An O(n2) encoding Obviously, symmetrically we have the female orientation

An O(n2) encoding On the completion of (male-oriented) propagation the preference list for mi the maximum value of j such that mij = 1 gives the head of the list the preference list for wi minimum value of j such that wi,j+1 = 0 gives the tail of the list when we do male and female propagation we get the XGS-list, a superset of the GS-list = (6,5,3) = (5,6)

An O(n2) encoding … the complexity 2n2 variables domains are {0,1} 6n(n-1) constraints arc consistency complexity is O(edr) where e is number of constraints d is domain size r is arity of constraints for our encoding e = 6n(n-1), d = 2, r  3 O(n2) This is same complexity as the GS algorithm, and is linear in the size of the input. It is optimal

A 2nd stab at the 0/1 encoding Generalises to incomplete list (SMI) we prove that the AC on the 0/1 model gives XGS-lists we prove that we get failure free enumeration

Conclusions A naïve encoding as a csp However, combining the constraints AC gives us GS-lists and failure free enumeration easily extend to SMTI O(n4) space 0/1 encoding gives us XGS-lists and failure free enumeration for SMI O(n2), optimal! Non-trivial SM constraint may be part of a bigger problem something like allDiff Question “If there is a special algorithm, such as GS, is it worth encoding as a csp?” In this case “Yes.”

Questions?