What’s the problem?
description
Transcript of What’s the problem?
![Page 1: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/1.jpg)
![Page 2: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/2.jpg)
What’s the problem?
Something like stable marriage problem … but without sex.
![Page 3: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/3.jpg)
What’s the problem?Stable Marriage Problem (SM)
Ant: Bea, Ann, Cat
Bob: Bea, Cat, Ann
Cal: Ann, Bea, Cat
Ann: Bob, Ant, Cal
Bea: Cal, Ant, Bob
Cat: Cal, Bob, Ant
- Men rank women, - Women rank men- Match men to women in a matching M such that there is no incentive for a (m,w) pair not in M to divorce and elope- i.e. it is stable, there are no blocking pairs
Order n squared
![Page 4: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/4.jpg)
What’s the problem?Stable Marriage Problem (SM)
Ant: Bea, Ann, Cat
Bob: Bea, Cat, Ann
Cal: Ann, Bea, Cat
Ann: Bob, Ant, Cal
Bea: Cal, Ant, Bob
Cat: Cal, Bob, Ant
- Men rank women, - Women rank men- Match men to women in a matching M such that there is no incentive for a (m,w) pair not in M to divorce and elope- i.e. it is stable, there are no blocking pairs
Order n squared
![Page 5: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/5.jpg)
What’s the problem?Stable Marriage Problem (SM)
Ant: Bea, Ann, Cat
Bob: Bea, Cat, Ann
Cal: Ann, Bea, Cat
Ann: Bob, Ant, Cal
Bea: Cal, Ant, Bob
Cat: Cal, Bob, Ant
- Men rank women, - Women rank men- Match men to women in a matching M such that there is no incentive for a (m,w) pair not in M to divorce and elope- i.e. it is stable, there are no blocking pairs
Order n squared
![Page 6: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/6.jpg)
What’s the problem?Stable Marriage Problem (SM)
Ant: Bea, Ann, Cat
Bob: Bea, Cat, Ann
Cal: Ann, Bea, Cat
Ann: Bob, Ant, Cal
Bea: Cal, Ant, Bob
Cat: Cal, Bob, Ant
- Men rank women, - Women rank men- Match men to women in a matching M such that there is no incentive for a (m,w) pair not in M to divorce and elope- i.e. it is stable, there are no blocking pairs
Order n squared
![Page 7: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/7.jpg)
What’s the problem?Stable Roommates (SR)
![Page 8: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/8.jpg)
What’s the problem?Stable Roommates (SR)
Order n squared(Knuth thought not)
![Page 9: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/9.jpg)
What’s the problem?Stable Roommates (SR)
Order n squared(Rob thought so)
![Page 10: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/10.jpg)
What’s the problem?Stable Roommates (SR)
The green book
![Page 11: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/11.jpg)
What’s the problem?Stable Roommates (SR)
Taken from “The green book”
10 agents, each ranks 9 others, gender-free(n=10, n should be even)
![Page 12: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/12.jpg)
What’s the problem?Stable Roommates (SR)
Taken from “The green book”
7 stable matchings
![Page 13: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/13.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
1985 Code
![Page 14: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/14.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
1985 Code
![Page 15: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/15.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
![Page 16: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/16.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
![Page 17: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/17.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
![Page 18: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/18.jpg)
What’s the problem?Stable Roommates (SR)
The Algorithm (Pascal)
![Page 19: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/19.jpg)
Stephan & Ciaran spotted something!
![Page 20: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/20.jpg)
A simple constraint model
Stable Roommates (SR)
![Page 21: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/21.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
![Page 22: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/22.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
![Page 23: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/23.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 3=5,6,8,2,1,7,10,4,9
![Page 24: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/24.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 3,5=1 The 5th preference of agent 3 is agent 1
![Page 25: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/25.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
agent j is agent i’s kth choice𝑟𝑎𝑛𝑘𝑖 , 𝑗=𝑘
![Page 26: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/26.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
agent j is agent i’s kth choice𝑟𝑎𝑛𝑘𝑖 , 𝑗=𝑘
NOTE: a rank value that is low is a preferred choice (large numbers are bad)
![Page 27: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/27.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
agent 5 is agent 3’s 1st choice𝑟𝑎𝑛𝑘3,5=1
![Page 28: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/28.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
agent j is agent i’s kth choice𝑟𝑎𝑛𝑘3,5=1
𝑎𝑖∈{1..𝑛−1 } constrained integer variable agent i with a domain of ranks
![Page 29: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/29.jpg)
A simple constraint modelStable Roommates (SR)
𝑝𝑟𝑒𝑓 𝑖 Preference list for agent i
𝑝𝑟𝑒𝑓 𝑖 ,𝑘= 𝑗 agent j is agent i’s kth choice
agent j is agent i’s kth choice𝑟𝑎𝑛𝑘3,5=1
𝑎7=6 agent 7 gets 6th choice and that is agent 10
![Page 30: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/30.jpg)
A simple constraint modelStable Roommates (SR)
Given two agents, i and j, if agent i is matched to an agent he prefers less than agent jthen agent j must match up with an agent he prefers to agent i
![Page 31: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/31.jpg)
A simple constraint modelStable Roommates (SR)
Given two agents, i and j, if agent i is matched to an agent he prefers less than agent jthen agent j must match up with an agent he prefers to agent i
![Page 32: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/32.jpg)
A simple constraint modelStable Roommates (SR)
Given two agents, i and j, if agent i is matched to an agent he prefers less than agent jthen agent j must match up with an agent he prefers to agent i
(1) agent variables, actually we allow incomplete lists!
![Page 33: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/33.jpg)
A simple constraint modelStable Roommates (SR)
Given two agents, i and j, if agent i is matched to an agent he prefers less than agent jthen agent j must match up with an agent he prefers to agent i
(1) agent variables, actually we allow incomplete lists!(2) If agent i is matched to agent he prefers less than agent j then agent j must match with someone better than agent i
![Page 34: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/34.jpg)
A simple constraint modelStable Roommates (SR)
Given two agents, i and j, if agent i is matched to an agent he prefers less than agent jthen agent j must match up with an agent he prefers to agent i
(1) agent variables, actually we allow incomplete lists!(2) If agent i is matched to agent he prefers less than agent j then agent j must match with someone better than agent i(3) If agent i is matched to agent j then agent j is matched to agent i
![Page 35: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/35.jpg)
3: 5 6 8 2 1 7 10 4 9
1: 8 2 9 3 6 4 5 7 10
(2)
Given two agents, 1 and 3, if agent 1 is matched to an agent he prefers less than agent 3then agent 3 must match with an agent he prefers to agent 1
![Page 36: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/36.jpg)
3: 5 6 8 2 1 7 10 4 9
1: 8 2 9 3 6 4 5 7 10(3)
Given two agents, 1 and 3, if agent 1 is matched to agent 3then agent 3 is matched to agent 1
![Page 37: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/37.jpg)
choco
![Page 38: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/38.jpg)
choco
Read in the problem
![Page 39: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/39.jpg)
choco
Build the model
![Page 40: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/40.jpg)
choco
Find and print first matching
![Page 41: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/41.jpg)
Neat
![Page 42: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/42.jpg)
Can model SMI as SRIAnt: Bea, Ann, Cat
Bob: Bea, Cat, Ann
Cal: Ann, Bea, Cat
Ann: Bob, Ant, Cal
Bea: Cal, Ant, Bob
Cat: Cal, Bob, Ant
men women women+6
SM SRI
![Page 43: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/43.jpg)
Yes, but what’s new here?
![Page 44: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/44.jpg)
Yes, but what’s new here?
1. Model appeared twice in workshops2. Applied to SM but not SR! (two sets of variables, more complicated)3. One model for SM, SMI, SR & SRI4. Simple & elegant
![Page 45: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/45.jpg)
Yes, but what’s new here?
But this is hard to believe … it is slower than Rob’s 1985 results!
1. Model appeared twice in workshops2. Applied to SM but not SR! (two sets of variables, more complicated)3. One model for SM, SMI, SR & SRI4. Simple & elegant
![Page 46: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/46.jpg)
Yes, but what’s new here?
But this is hard to believe … it is slower than Rob’s 1985 results!
1. Model appeared twice in workshops2. Applied to SM but not SR! (two sets of variables, more complicated)3. One model for SM, SMI, SR & SRI4. Simple & elegant
![Page 47: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/47.jpg)
Cubic to achieve phase-1 table
Not so neat
![Page 48: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/48.jpg)
A specialised constraint
When an agent’s domain is filtered AC revises all constraints that involve that variable.
![Page 49: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/49.jpg)
A specialised constraint
When an agent’s domain is filtered AC revises all constraints that involve that variable.
In this case that is n constraints
![Page 50: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/50.jpg)
A specialised constraint
When an agent’s domain is filtered AC revises all constraints that involve that variable.
In this case that is n constraints
We can do better than this, reducing complexity of model by O(n)
![Page 51: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/51.jpg)
A specialised constraint
I implemented a specialised binary SR constraint and an n-ary SR constraintThis deals with incomplete listsThis is presented in the paper
You can also download and run this
![Page 52: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/52.jpg)
A specialised constraint
Here’s the code.Not much to it
![Page 53: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/53.jpg)
A specialised constraint
Constructor
![Page 54: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/54.jpg)
A specialised constraint
awakening
![Page 55: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/55.jpg)
A specialised constraint
lower bound changes
![Page 56: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/56.jpg)
A specialised constraint
upper bound changes
![Page 57: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/57.jpg)
A specialised constraint
removal of a value
![Page 58: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/58.jpg)
A specialised constraint
instantiate
![Page 59: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/59.jpg)
![Page 60: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/60.jpg)
![Page 61: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/61.jpg)
Empirical study
When I was younger, my mother did things to annoy me
![Page 62: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/62.jpg)
Empirical study
SR: simple constraint model, enumerated domainsSRB: simple constraint model, bound domainsSRN: specialised n-ary constraint, enumerated domains
![Page 63: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/63.jpg)
10 < n < 100: read, build, find all stable matchings
![Page 64: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/64.jpg)
100 < n < 1000: read, build, find all stable matchings
![Page 65: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/65.jpg)
This is new (so says Rob and David)
n, average run time, nodes (maximum), proportion with matchings, maximum number of matchings
![Page 66: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/66.jpg)
So?
![Page 67: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/67.jpg)
Well, think on this …
![Page 68: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/68.jpg)
What’s still to do?
Prove that the model finds a stable matching in quadratic time …
![Page 69: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/69.jpg)
This was all my own work …
![Page 70: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/70.jpg)
… well, with some help from
David Manlove Rob Irving,
Jeremy SingerIan Gent
Chris Unsworth Stephan Mertens Ciaran McCreesh Paul Cockshott
Joe Sventek Augustine Kwanashie
Andrea
![Page 71: What’s the problem?](https://reader035.fdocuments.us/reader035/viewer/2022070423/56816725550346895ddbb763/html5/thumbnails/71.jpg)