I am working on a weekly staff scheduling optimization problem with 24/7 demand.
The binary decision variable is: $X_{\text{staff},\,\text{day},\,\text{shift}}$ whether to assign the staff $s$ to day $d$ shift $\text{sh}$.
There are several shift sets for everyday like 8-17 for full time. 14-19 for part time, and 20-6 for night shift.
The 0-1 shift/hour matrix is: $\text{ShiftHourMap}_{\text{shift},\,\text{hour}}$ which has 24 hours as columns, shifts as rows.
The demand is formulated as: $\text{Demand}_{\text{day},\,\text{hour}}$.
The current constraints are:
weekly upper/lower limit of total hours for every staff.
The demand coverage constraint is : $$\sum_{\text{staff}}X_{\text{staff},\,\text{day},\,\text{shift}}\cdot \text{ShiftHourMap}_{\text{shift},\,\text{hour}}\ge\text{Demand}_{\text{day},\,\text{hour}}\,\forall{\text{day},\,\text{hour},\,\text{shift}}$$
The constraint like no assignment of daily shift after a night shift is not necessary, because the night shift is basically sleeping on site and staff sometimes is willing to pick a morning shift right after the overnight shift.
This would be fine if there's no overnight shift. How do I model the constraint to consider the overnight shift? And also, how to model the next Monday's early morning demand (last shift of Sunday)?
Do I model as 24 * 7 hours and use the hour as index?
I can use MiniZinc or Pyomo.