I'm trying to create a schedule for shifts for each employee given employee shift availability. I have a tuple defined to include shift start time, shift end time, max people on shift. The input also includes a list of arrays for employee shift preferences, For example [[1 0 0 1 1],...] which represents that employee 1 is available for shifts 1, 4, 5 but not 2, 3. Note that shift times are not mutually exclusive and can overlap.
I have a decision variable x[i,j] which is 1 if employee i is staffed for shift j, 0 otherwise. After I execute, I'm expecting x[i,j] to be a matrix indicating for each employee which shift they are assigned to. I have my other constraints including shift capacity. But I'm stuck on how to create the constraint to make sure that assigned shifts are not overlapping.
One idea I have is to do compare x[i,j] and x[i,k] where j =/= k and see if they checking if start time of i > end time of j OR start time of j > end time of i. But I'm not sure how to implement this in OPL.