Blah blah blah. Zoes shark Thanks to the conference artist Phoebe.

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.
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.
1 Overview of Graph Theory Addendum “The Stable Marriage Problem” Instructor: Carlos Pomalaza-Ráez Fall 2003 University of Oulu, Finland.
Naveen Garg, CSE, IIT Delhi
Matching Theory.
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.
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.
Stabiele huwelijken. The Stable Marriage Problem: More Marital Happiness Than Reality TV Dave Toth.
1 Bipartite Matching Polytope, Stable Matching Polytope x1 x2 x3 Lecture 10: Feb 15.
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.
Week 11 - Friday.  What did we talk about last time?  Exam 2 post mortem  Cycle detection  Connectivity.
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.
L3 #1 The Hospitals / Residents Problem and Some Extensions David Manlove University of Glasgow Department of Computing Science Supported by EPSRC grant.
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.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? Adapted from a presentation by Stephen Rudich.
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.
Stable Marriage Problem Introductory talk Yosuke KIKUCHI Dept Comp. and Info. Eng. Tsuyama College of Tech OKAYAMA, JAPAN.
CSE 331: Review. Main Steps in Algorithm Design Problem Statement Algorithm Real world problem Problem Definition Precise mathematical def “Implementation”
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.
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.
Stable Marriages (Lecture modified from Carnegie Mellon University course Great Theoretical Ideas in Computer Science)
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.
Market Design and Analysis Lecture 2 Lecturer: Ning Chen ( 陈宁 )
IOI/ACM ICPC Training 4 June 2005.
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Matching.
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
The Stable Marriage Problem
Lecture 5 CSE 331 Sep 8, 2017.
Maximum Flow - Best algorithms
CSE 421: Introduction to Algorithms
Lecture 5 CSE 331 Sep 10, 2010.
Lecture 4 CSE 331 Sep 6, 2017.
Richard Anderson Autumn 2006 Lecture 1
Lecture 5 CSE 331 Sep 6, 2013.
Lecture 5 CSE 331 Sep 7, 2012.
Blah blah blah.
Chapter 1 Introduction: Some Representative Problems
Lecture 6 CSE 331 Sep 12, 2011.
Lecture 5 CSE 331 Sep 5, 2014.
Piyush Kumar (Lecture 3: Stable Marriage)
A Grand Tour of Stable Matching Problems
Lecture 5 CSE 331 Sep 9, 2011.
Lecture 5 CSE 331 Sep 9, 2016.
Presentation transcript:

Blah blah blah

Zoes 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 MenWomen 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 m i marries woman w j woman w j marries man m i No, not bigamy … bijection

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

There are algorithms for this The Gale Shapely algorithm, O(n 2 ) problem has n variables, each with n partners and is of size O(n 2 ) 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)) // ms most preferred partner 2.3 if isMarried(w) // unconditional remarriage! L := add(L,partner(w)) // ws partner is free … again! delete(preferenceList(w),partner(w)) delete(preferenceList(partner(w)),w) 2.4 marry(m,w) // m and w get married. 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) Now youve 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

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

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

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

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

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

Free: Men 1: : : : Women 1: : : : before after Male-oriented EGS Men 1: 3 2: 2 1 3: 1 2 4: 4 Women 1: 2 3 2: 3 2 3: 1 4: 4 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 1 st stab) : : : : : : : : n variables, each with a domain (1.. n) n 2 channeling constraints v i = j v j = i n 2 stability constraints 2 allDiffs (one for men, one for women) done

Whats a stability constraint? : : : : : : : : n 2 stability constraints An example, between man m 4 and woman w 3 (1) locate position of w 3 in m 4 s preference list (2) locate position of m 4 in w 3 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(n 4 ) allDiffs are redundant No good news then?

Hey! It was a 1 st stab!

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

Combining the Constraints : : : : : : : : (m 4 = 3 w 3 = 4) stable(m 4,w 3 ) 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

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

The constraint has structure : : : : : : : : Combined nogoods: {(3,1),(3,3),(3,2),(4,4),(1,4),(2,4),(1,2),(2,2)} m4m4 w3w3 m4m4 w3w3 Arrange in preference order Cant see it?

The constraint has structure : : : : : : : : Combined nogoods: {(3,1),(3,3),(3,2),(4,4),(1,4),(2,4),(1,2),(2,2)} m4m4 w3w3 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 w k is top of m i s listm i is top of w k s list mimi wkwk mimi wkwk Done Revise(i,k)

Nice, interesting, … but still O(n 4 )

An O(n 2 ) encoding (a 1 st stab) The intuition, part 1a Man to woman: I love you. Marry me. Please say yes! Woman to man: thats the best offer Ive 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! Ive married someone better than you. Beat it! Man to man: Och well. Theres always someone else. In a mans world

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

An O(n 2 ) encoding (a 1 st stab) w k,h = 0 w k has accepted a proposal from better than her h th choice w k,h = 0 w k,h+1 = 0 If w k has accepted a proposal from her h th choice or better then w k has accepted a proposal from her h+1 th choice or better m i,j = 1 m i has proposed to his j th choice or worse

An O(n 2 ) encoding (a 1 st stab) m 3 proposes to 2 nd choice w 6 has been proposed to by better than her 5 th

An O(n 2 ) encoding, the stability constraints Suppose man m i has a partner no better than j th choice, i.e. m i,j = 1 and j th choice is woman w k preference person Man m 3 proposed to his 2 nd choice, w 6 Suppose woman w k has a partner better than h th choice, i.e. w k,h = 0 and h th choice is man m i preference person Woman w 6 has a partner better than her 7 th choice, m 3 Therefore m i is rejected by w k, and m i has a partner no better than his j+1 th choice, i.e. m i,j+1 = 1

m i is rejected by w k, and m i has a partner no better than his j+1 th choice, i.e. m i,j+1 = 1 w k is m i s jth choice m i is w k s h th choice the constraint is An O(n 2 ) encoding, the stability constraints This increments the pointer to the head of m i s preference list

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

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

An O(n 2 ) encoding On the completion of (male-oriented) propagation the preference list for m i the maximum value of j such that m ij = 1 gives the head of the list the preference list for w i minimum value of j such that w i,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(n 2 ) encoding … the complexity 2n 2 variables domains are {0,1} 6n(n-1) constraints arc consistency complexity is O(ed r ) 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(n 2 ) This is same complexity as the GS algorithm, and is linear in the size of the input. It is optimal

A 2 nd 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(n 4 ) space 0/1 encoding gives us XGS-lists and failure free enumeration for SMI O(n 2 ), 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?