π§© Constraint Solving POTD:Nurse Rostering β Scheduling Under Hard and Soft Constraints #28721
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 #28942. |
Beta Was this translation helpful? Give feedback.
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.
-
Today's problem sits at the intersection of real-world impact and rich constraint structure: Nurse Rostering (also called the Nurse Scheduling Problem, NSP). It's a canonical benchmark for constraint-based scheduling and a favourite in CP/OR competitions.
Problem Statement
A hospital must assign nurses to shifts over a planning horizon (typically 1β4 weeks) while satisfying a mix of hard requirements and soft preferences.
Small concrete instance β 4 nurses, 3 shifts/day (morning
M, afternoonA, nightN), 7 days:Input:
nnurses,ddays, shift typesS = {M, A, N, Off}req[day][shift]= minimum nurses neededOutput: An assignment
roster[nurse][day] β Sthat satisfies all hard constraints and minimises violations of soft constraints (weighted penalty).Why It Matters
Modeling Approaches
Approach 1 β Constraint Programming (CP)
Decision variables:
x[n, d, s] β {0, 1}β nursenworks shiftson dayd.Key hard constraints:
Soft constraints become a weighted objective:
Trade-offs: CP excels at propagating forbidden-sequence constraints via automaton/regular global constraints and handles complex nurse-specific rules naturally. Search can be slow on large instances without good heuristics.
Approach 2 β Mixed-Integer Programming (MIP)
Same binary variables but the model is handed to a MIP solver (CPLEX, Gurobi).
Key difference β shift pattern columns: Instead of day-by-day variables, enumerate feasible weekly patterns per nurse (each pattern is a sequence of shifts satisfying individual hard constraints). Use a set-covering formulation:
Trade-offs: LP relaxation gives strong lower bounds; column generation scales well when the pattern space is huge. Less natural for nurse-specific preference constraints that interact across nurses.
Example Model β MiniZinc snippet (CP approach)
Key Techniques
1. Global Constraints β
regularandsequenceShift sequences (e.g., "no more than 3 nights in a row", "at least 2 days off after a night block") are perfectly expressed as regular language constraints. The
regular(roster[n,..], automaton)global constraint propagates these efficiently via arc consistency on the sequence automaton β far stronger than posting individual binary constraints.2. Variable/Value Ordering Heuristics
3. Symmetry Breaking
If nurses share identical contracts, permuting them produces equivalent solutions. Add lexicographic ordering constraints on nurse assignment vectors:
This alone can reduce search space by
k!forksymmetric nurses.Challenge Corner
References
Beta Was this translation helpful? Give feedback.
All reactions