8
$\begingroup$

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:

  1. weekly upper/lower limit of total hours for every staff.

  2. 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.

$\endgroup$
1
  • $\begingroup$ Would you see this or this. They may not be exactly as you want, but they may be useful. $\endgroup$
    – A.Omidi
    Sep 4, 2019 at 4:24

1 Answer 1

5
$\begingroup$

I'm not sure I understand what the questions are. In your demand constraint, you should also include a term for $X_{\text{staff},\,\text{day} - 1, \,\text{overnight}}$ on every day other than day 1. On day 1, the equivalent tweak is to adjust the demand by the staff level of the overnight shift from the last day of the previous week (which you presumably know).

Adjusting for carryover to the first day of the following planning horizon is a bit trickier. You might want to search for "horizon effects" (or something similar with the word "horizon" in it) in the context of scheduling or planning models. There are multiple approaches to dealing with horizon limits. Three among them come to mind. The first is to ignore the horizon and just take your chances on what the carryover staff is the following week. This is best not used if there's a legitimate chance you would not be able to cover demand (because this week's model put too few people in the graveyard shift at the end of the week). The second option is to add a constraint assigning a nonzero lower limit to the final graveyard shift. You would have to guess the limit to use. The third option is to assign a per-person value for the last graveyard shift and incorporate it into the objective (as a cost reduction, assuming you're minimizing cost). Again, that coefficient would necessarily be a guess. The idea is to encourage the solver to put people in that last shift.

Assuming you are armed with a reasonable amount of historical demand data, you could try option 2 or option 3 with various guesses for the extra parameter (staff lower limit or staff "bonus" value) and see which value produces best overall results on the historical data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.