Preemptively: I've been trying to find different solutions to this for a few days to no avail, looking for anything useful.
Problem:
I am currently trying to find a solution for the Minimum Shift Design problem whereby we try to optimize the number of shits and employees needed to satisfy staffing requirements over a period of time.
Approach
We have:
shift_needs = s_iwhich represents the staffing needs for each houri=0..11as well as themax_employeesthe maximum number of employeese_i_j, whereiis the employee number andjthe hour.Truemeans employeeiis working at hourj
So it's essentially a simple ILP and solving it is trivial BUT the issue I am having is to constrain the shifts. I.e., we need to have consecutive True without False in-between.
This is OK:
[True, True, True, True, False, False, False, False, False, False, False, False]
This is no OKt:
[True, True, False, True, False, False, True, True, False, False, False, False]
I tried to add a constraint whereby:
- if
e_i_j == Truethen we can't haveAnd(e_i_j+1 == False, e_i_j-1 == False) - if
e_i_j == Falsethen we can't haveAnd(e_i_j+1 == True, e_i_j-1 == True)
But then I still get clusters.
What would be the best approach to achieve the goal? Thanks in advance.