You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Daily problem from the constraint solving world β 2026-03-31 Β· Category: Scheduling
Problem Statement
A hospital must assign nurses to shifts over a planning horizon (typically one to four weeks). Each shift is one of Day (D), Evening (E), or Night (N), and there is also an Off (O) option. Nurses have different skill levels, contracts, and personal preferences. The scheduler must respect hard rules (safety, labor law) and optimize soft objectives (fairness, preference satisfaction).
Concrete Instance (5 nurses, 7 days)
Nurses: Alice, Bob, Carol, Dan, Eve
Shifts: D (07β15h), E (15β23h), N (23β07h), O (off)
Days: Mon β¦ Sun
Hard constraints:
β’ Each shift type needs β₯ 1 nurse per day
β’ No nurse works more than 5 shifts per week
β’ No nurse works a Night shift directly followed by a Day shift
β’ Each nurse gets β₯ 2 days off per week
Soft objectives (minimize):
β’ Deviation from requested days off
β’ Understaffing on any shift
β’ Unfair distribution of Night shifts
```
**Input:** nurse profiles, shift demands, contract rules, preferences
**Output:** an assignment `roster[nurse][day] β {D, E, N, O}` satisfying all hard constraints and minimising the weighted soft-constraint violations.
---
### Why It Matters
**Healthcare operations** β Poor rosters lead to staff burnout and care-quality issues; an optimized schedule can reduce overtime costs by 10β20% while improving nurse satisfaction scores.
**Labor-law compliance at scale** β Hospitals employ hundreds of nurses across dozens of wards. Manual scheduling is error-prone and typically takes days; automated solvers can generate compliant rosters in minutes.
**Benchmark domain** β Nurse rostering is a canonical benchmark for CP, MIP, and metaheuristics. The [INRC (International Nurse Rostering Competition)]((nurserostering.com/redacted) has run multiple editions (2010, 2015) providing standardized instances.
---
### Modeling Approaches
#### Approach 1 β Constraint Programming (CP)
**Decision variables:**
`roster[n][d] β {D, E, N, O}` for each nurse `n β 1..N`, day `d β 1..H`
**Key constraints (hard):**
```
βd: |{n | roster[n][d] = D}| β₯ demand_D[d] # staffing
βd: |{n | roster[n][d] = E}| β₯ demand_E[d]
βn, d: roster[n][d] = N β roster[n][d+1] β D # no NβD sequence
βn: sum(d: roster[n][d] β O) β€ max_shifts[n] # contract
```
**Objective:** minimise weighted sum of soft-constraint violations (modelled as auxiliary integer variables with penalties).
**Trade-offs:** CP excels at expressing complex sequence constraints (e.g., forbidden patterns) via automaton/regular constraints. Propagation can prune large parts of the search space quickly. Scales well to medium instances (β€ 100 nurses, β€ 28 days) with good variable ordering.
---
#### Approach 2 β Mixed-Integer Programming (MIP)
**Binary decision variables:**
`x[n][d][s] β {0,1}` β nurse `n` is assigned shift `s` on day `d`
**Key constraints:**
```
βn,d: Ξ£_s x[n][d][s] = 1 # exactly one shift per (nurse,day)
βd,s: Ξ£_n x[n][d][s] β₯ demand[d][s] # coverage
βn,d: x[n][d][N] + x[n][d+1][D] β€ 1 # no NβD
βn: Ξ£_{d,sβ O} x[n][d][s] β€ max_shifts[n]
Trade-offs: MIP solvers (Gurobi, HiGHS, CPLEX) provide proven optimality gaps and excellent LP relaxation bounds. However, modeling complex sequential patterns requires many auxiliary binary variables, which can slow root-node LP solve. MIP typically outperforms CP on large, loosely-constrained instances.
Approach 3 β Local Search / Metaheuristics
Start from any feasible (or near-feasible) assignment and iteratively improve by applying moves:
Swap move: exchange shifts between two nurses on the same day
Block move: shift a nurse's pattern by one day
Used in practice (e.g., simulated annealing, tabu search) for very large instances where exact methods time out. Trade-off: no optimality guarantee, but can find good solutions quickly for 500+ nurses.
Example Model β MiniZinc (CP)
int: N; % number of nursesint: H; % planning horizon (days)array[1..N, 1..H] ofvar0..3: roster;
% 0=Off, 1=Day, 2=Evening, 3=Night% Demand coverage (Day shift, day 1 needs >=2)array[1..H] ofint: demand_day;
constraintforall(din1..H)(
sum(nin1..N)(roster[n,d] ==1) >=demand_day[d]
);
% No Night followed by Dayconstraintforall(nin1..N, din1..H-1)(
not (roster[n,d] ==3/\roster[n,d+1] ==1)
);
% At most max_shifts shifts per week (days 1..7)int: max_shifts=5;
constraintforall(nin1..N)(
sum(din1..min(7,H))(roster[n,d] !=0) <=max_shifts
);
% Soft: penalise understaffing on Evening shiftsarray[1..H] ofvar0..N: understaffing_eve;
constraintforall(din1..H)(
understaffing_eve[d] =max(0,
demand_eve[d] -sum(nin1..N)(roster[n,d] ==2))
);
varint: obj=sum(din1..H)(understaffing_eve[d]);
solveminimizeobj;
Key Techniques
1. Global Constraints for Sequences
The regular (or automaton) global constraint in CP can encode any forbidden shift pattern expressible as a DFA. For nurse rostering, this is used to enforce rules like "no more than 3 consecutive nights" or "at least 2 days off after a night block" in a single, efficiently propagated constraint β far more scalable than individual binary constraints.
2. Column Generation (MIP)
For large instances, a DantzigβWolfe decomposition treats each nurse's complete weekly pattern as a column. The master problem selects a set of patterns (one per nurse) satisfying coverage. The pricing subproblem (a shortest-path or CP sub-problem per nurse) generates improving patterns. This dramatically reduces the MIP size and often finds high-quality solutions quickly.
3. Symmetry Breaking
Nurses with identical skill profiles and contracts are interchangeable. Adding lexicographic ordering constraints (e.g., roster[1] β€_lex roster[2] for equivalent nurses) eliminates symmetric solutions and can reduce search by orders of magnitude.
Challenge Corner
Extension β Stochastic Demand:
In practice, demand is uncertain (sick calls, emergencies). Can you model nurse rostering as a two-stage stochastic program β a fixed base roster in stage 1 and recourse assignments (overtime, swaps) in stage 2? How would you handle the exponential number of scenarios efficiently?
Bonus: What symmetry-breaking constraints remain valid when nurses are no longer interchangeable due to seniority-based overtime preferences?
References
Cheang et al. (2003). "Nurse rostering problems β a bibliographic survey." European Journal of Operational Research, 151(3), 447β460. β Comprehensive survey of the domain.
Haspeslagh et al. (2014). "The first international nurse rostering competition 2010." Annals of Operations Research, 218(1), 221β236. β Benchmark instances and competition results.
Van den Bergh et al. (2013). "Personnel scheduling: A literature review." European Journal of Operational Research, 226(3), 367β385. β Broader workforce scheduling context.
Rossi, van Beek & Walsh (2006). Handbook of Constraint Programming, Elsevier. β Chapter 18 covers scheduling constraint models in depth.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Daily problem from the constraint solving world β 2026-03-31 Β· Category: Scheduling
Problem Statement
A hospital must assign nurses to shifts over a planning horizon (typically one to four weeks). Each shift is one of Day (D), Evening (E), or Night (N), and there is also an Off (O) option. Nurses have different skill levels, contracts, and personal preferences. The scheduler must respect hard rules (safety, labor law) and optimize soft objectives (fairness, preference satisfaction).
Concrete Instance (5 nurses, 7 days)
Objective: minimise
Ξ£ penalty_k * violation_k(LP relaxation provides a lower bound).Trade-offs: MIP solvers (Gurobi, HiGHS, CPLEX) provide proven optimality gaps and excellent LP relaxation bounds. However, modeling complex sequential patterns requires many auxiliary binary variables, which can slow root-node LP solve. MIP typically outperforms CP on large, loosely-constrained instances.
Approach 3 β Local Search / Metaheuristics
Start from any feasible (or near-feasible) assignment and iteratively improve by applying moves:
Used in practice (e.g., simulated annealing, tabu search) for very large instances where exact methods time out. Trade-off: no optimality guarantee, but can find good solutions quickly for 500+ nurses.
Example Model β MiniZinc (CP)
Key Techniques
1. Global Constraints for Sequences
The
regular(orautomaton) global constraint in CP can encode any forbidden shift pattern expressible as a DFA. For nurse rostering, this is used to enforce rules like "no more than 3 consecutive nights" or "at least 2 days off after a night block" in a single, efficiently propagated constraint β far more scalable than individual binary constraints.2. Column Generation (MIP)
For large instances, a DantzigβWolfe decomposition treats each nurse's complete weekly pattern as a column. The master problem selects a set of patterns (one per nurse) satisfying coverage. The pricing subproblem (a shortest-path or CP sub-problem per nurse) generates improving patterns. This dramatically reduces the MIP size and often finds high-quality solutions quickly.
3. Symmetry Breaking
Nurses with identical skill profiles and contracts are interchangeable. Adding lexicographic ordering constraints (e.g.,
roster[1] β€_lex roster[2]for equivalent nurses) eliminates symmetric solutions and can reduce search by orders of magnitude.Challenge Corner
References
Beta Was this translation helpful? Give feedback.
All reactions