I am trying to model the following: There is a shop open from xx AM to yy PM. In each 30 min time slot, there have to be demand[timeSlot] = x employees present.
E.g. the shop is open from 08am to 10am. Then there are the slots 8am-08:30, 08:30-09:00, 09:00-09:30 and 09:30-10:00 with demand = [1,2,2,1].
I have a set of employees. For each employee, I want to represent their working time with an interval decision variable: dvar interval x[e in Employees] optional size 4..8
My problem now is formulating the constraint that in each time slot, the demand for employees must be met. How can I match the intervals (having start and end time) with the coverage of the time slot?
The constraint should be like this:
sum(e in Employees, x[e] covers time slot s) x[e] >= demand[s], for all time slots s
For example, in the time slot 09:00-09:30, two employees have to be present. So I need at least to decision variable intervals, which each have a starting time smaller or equal than 09:00 and endTime greater or equal than 09:30.
Anyone understand what I am trying to do and maybe have some hint or the solution?
Thanks a lot!