How to define this complex labor rule as a constraint in MIP?

54 Views Asked by At

Im trying to define a complex labor rule as constraints in a MIP, solved with CPLEX. My key decision variable is a binary x(i,j) indicating if shift i is assigned to employee j. The labor rule is as follows (standard Dutch labor law):

  • in every period of 7*24 hours (at every start of a shift a new 'period' starts, so not 7 full days!), an employee must have an uninterrupted rest of at least 36 hours between two shifts OR
  • in every period of 14*24 hours (same definition of period), the employee has sufficient uninterrupted rests of at least 32hours, adding up to at least 72 hours.

A rest must be fully within the period. So if the initial shift (hence the period) starts at Dec 1 08:00, and there are shifts on each day with the last one ending on Dec 6 22:00, the first part of the rule is violated, since the rest is only 34 hours from Dec 6 22:00 until Dec 8 08:00.

What I have thought of so far:

  • I can define a continuous variable as the rest after a shift, and sum those (smartly), but given that last example, I would need a max(rest, endofperiod) making it nonlinear. In other words: the usable rest after a shift depends on the start of the period
  • I can 'simplify' the rule by making 3 (or more...) binary variables: Is32, Is36, Is40 hours of rest. Then I'd either have the 36 in the first week, or a valid combination of the others in 2 weeks. We know which variables to include in the sum, because we can check beforehand if the 32/36/40 hours are completely within the period. This is however an imperfect solution, as it would not allow (for example) two rests of 34 and 38 hours (as the would be marked as 32 and 36, hence not adding up to 72)

Do you have any (well performing) suggestions? Thank you in advance! PS: this is my first post here, I hope I made everything clear...

0

There are 0 best solutions below