Repository navigation
🧩 Constraint Solving POTD:Problem of the Day: Nurse Rostering #76225
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #76498. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
Nurse rostering asks us to assign each nurse a shift for every day of a planning period so that the ward is staffed and labour rules are respected. Shifts are Day (D), Night (N), or Off (O).
Hard constraints (must hold):
Soft constraint (minimise violations): honour each nurse's day-off requests.
Small instance: 3 nurses (Ann, Ben, Cy), 4 days. Ann asks for day 2 off.
Output: a roster that satisfies all hard constraints and minimises the number of violated requests.
One valid optimal roster (zero violated requests):
Brute force over all 312 ≈ 531k assignments finds 222 feasible rosters, and this one meets Ann's request. You can check it by hand.
Why It Matters
Real wards involve dozens to hundreds of staff and several skill types, and rosters are often rebuilt monthly. The Burke et al. survey (see References) catalogues the variants.
Modeling Approaches
Approach 1: Constraint Programming (CP)
x[n,d] ∈ {D, N, O}for nursenand dayd.count(x[·,d] = D) = 1, likewise for N); a per-nurse cardinality on worked shifts; aregular(automaton) constraint for the rest rule.Approach 2: Mixed-Integer Programming (MIP)
y[n,d,s] ∈ {0,1}withy[n,d,D] + y[n,d,N] + y[n,d,O] = 1.Σn y[n,d,D] = 1andΣn y[n,d,N] = 1for daily cover;2 ≤ Σ_d (1 − y[n,d,O]) ≤ 3for worked shifts;y[n,d,N] + y[n,d+1,D] ≤ 1for the rest rule.1 − y[Ann,2,O]for Ann's request on day 2.Example Model (Pseudo-code, CP style)
Example Model (Pseudo-code)
Key Techniques
Global constraints with automata. The
regularconstraint (Pesant, 2004) encodes the whole sequence of shifts for one nurse as a DFA and gives generalised arc consistency. It removes many infeasible shift values before search, which is more effective than pairwise rest-rule clauses.Search and learning. Use first-fail variable ordering (the day or nurse with fewest remaining feasible shifts) and value ordering that prefers satisfied requests. Lazy-clause-generation solvers such as CP-SAT add nogood learning and restarts, which handle the tightly coupled cover constraints well.
Symmetry breaking. Nurses with the same skills and no requests are interchangeable. Lex-order their rows (lex-leader constraints) to avoid exploring equivalent rosters several times.
Challenge Corner
N → Dconstraints without losing propagation?References
regularandcardinalityentries.)All reactions