Rotating Workforce Scheduling in MiniZinc (zayenz.se)

🤖 AI Summary
This post demonstrates a practical MiniZinc model for Rotating Workforce Scheduling (RWS), building a realistic cyclic weekly roster by incrementally adding labor constraints. The core viewpoint is a Shift variable per (day, employee) with enums for days and shift types (day, evening, night, off) and a ShiftsAndOff domain. Rotation is handled by unrolling the first employee’s week into a repeated_schedule so constraints can wrap across the cycle. The basic model uses one global_cardinality constraint per day to meet shift requirements and prints any feasible solution (solve satisfy). Successive realistic rules are added: a regular constraint (via regex/finite automaton) to require two consecutive days off per week, sliding_sum constraints over auxiliary off_day booleans to limit work runs (max 5 days), sliding_sum over free_weekend booleans to ensure at least one of three weekends off, and a deterministic automaton/reg encoding to enforce rest around night shifts and a max of three nights in a row. For the AI/ML and OR community the work is significant because it shows how expressive CP encodings (global_cardinality, regular/automata, sliding windows, unrolling) compactly capture complex labor rules and remain computationally cheap: the basic model solved backtrack-free in <1 ms (7 propagators with Gecode), and added constraints raised backtracks and solve times only to milliseconds–tens of milliseconds. The techniques are immediately applicable to hybrid systems (combine CP with ML demand forecasts or learned preferences), scalable rostering, and automated fairness constraints, illustrating practical patterns for integrating domain constraints into optimization pipelines.
Loading comments...
loading comments...