23
A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Embed Size (px)

Citation preview

Page 1: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

A Constraint Programming Approach to theHospitals / Residents ProblemBy David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Page 2: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 3: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 4: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

The Hospital/Residents Problem This is a real world problem The National Resident Matching

Program (NRMP) in the US 31,000 residents matched to 2,300

hospitals The Canadian Resident Matching

Service (CaRMS) The Scottish PRHO Allocation

scheme (SPA)

Page 5: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

The Hospital/Residents Problem

Residents Hospitals

R1R2R3

: R2 R3 R1: R2 R1 R3

: H1 H2: H1 H2: H1 H2

H1H2

We have n residentsand m hospitals

Each resident ranks the m hospitalsAnd each hospital ranks the n residents

Objective :To find a matching of residents to hospitalsSuch that the matching is Stable

(2)(1)

Each hospital has a capacity c

And the hospital capacities not exceeded

Page 6: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

The Hospital/Residents Problem

Residents Hospitals

R1R2R3

: R2 R3 R1: R2 R1 R3

: H1 H2: H1 H2: H1 H2

H1H2

A matching

R3 and H1 would both be better off if they were matched to each other

(2)(1)

But not a stable one

A matching is only stable iff it contains no Blocking pairs

In this matching R3 and H1 are a Blocking pair

Page 7: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

The Hospital/Residents Problem

Residents Hospitals

R1R2R3

: R2 R3 R1: R2 R1 R3

: H1 H2: H1 H2: H1 H2

H1H2

A stable matching

(2)(1)

Page 8: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 9: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

The Algorithms

Two Algorithms Resident-Oriented (RGS) Hospital-Oriented (HGS)

Both reach a fixed point RGS-lists HGS-lists Union of these is GS-lists

Both run in O(L) time and require O(nm) space

Page 10: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 11: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Cloned Solution

Residents Hospitals

R1R2R3

: R2 R3 R1: R2 R1 R3

: H1 H2: H1 H2: H1 H2

H1H2

If a hospital has capacity > 1

(2)(1)

H1aH1bH2

(1)(1)(1)

: R2 R3 R1: R2 R3 R1: R2 R1 R3

: H1a H1b H2: H1a H1b H2: H1a H1b H2

It can be cloned into c hospitals with capacity 1We then expand the residents preference lists

This is now a stable marriage instanceWhich can be solved by any stable marriage solution

Page 12: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 13: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Constraint Based Model (CBM) a variable for each of the n

Residents each with a domain (1 .. m)

C variables for each of the m Hospitals each with a domain (1 .. n)

O(Lc) standard “toolbox” constraints Takes O(Lc(n+m)) time to enforce

AC Takes O(Lc) space

Page 14: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 15: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Specialised Binary Constraint (HR2) a variable for each of the n

Residents each with a domain (1 .. m)

a variables for each of the m Hospitals each with a domain (1 .. n)

O(L) Specialised Binary constraints Details are in the paper

Takes O(Lc(n+m)) time to enforce AC

Takes O(nm) space

Page 16: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 17: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Specialised N-ary Constraint (HRN) a variable for each of the n

Residents each with a domain (1 .. m)

a variables for each of the m Hospitals each with a domain (1 .. n)

1 Specialised n-ary constraints Details are in the paper

Takes O(Lc) time to enforce AC Takes O(nm) space

Page 18: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 19: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Computational Comparison

50/13/4 100/20/5 1k/100/10 5k/250/20 20k/550/37

50k/1.2k/42

Cloned 5.84 - - - - -

CBM 0.24 0.36 4.75 - - -

HR2 0.15 0.18 0.88 9.91 112 -

HRN 0.12 0.15 0.22 0.53 1.42 4.2

Page 20: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 21: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Conclusion

We have proposed three new constraint solutions to the Hospital/Residents problem A model that uses toolbox

constraints A specialised binary constraint A specialised n-ary constraint

Page 22: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Contents The Hospital/Residents Problem The Algorithms Cloned Solution Constraint Based Model (CBM) Specialised Binary Constraint (HR2) Specialised N-ary Constraint (HRN) Computational Comparison Conclusion Questions

Page 23: A Constraint Programming Approach to the Hospitals / Residents Problem By David Manlove, Gregg O’Malley, Patrick Prosser and Chris Unsworth

Questions

Any Questions?