Skip to content

Target working time per month

Each employee has an individual monthly work target. This target is considered a hard constraint because it must be met within a certain range. A maximum deviation of one day shift is allowed (±7.67 hours), but this is minimized by the objective function to ensure minimal overtime/undertime. Therefore, the total working time must fall within the range of all possible shift combinations and the target working time range.

Implemented using Google's OR Tools

src/cp/constraints/target_working_time.py
target_working_time = employee.get_available_working_time()
model.add(working_time_variable <= target_working_time + TOLERANCE_MORE)
model.add(working_time_variable >= target_working_time - TOLERANCE_LESS)

For each non hidden employee create a variable representing the total work time in minutes which we restrict to being in [target_working_time + TOLERANCE_LESS, target_working_time + TOLERANCE_MORE]. The target working time is the difference between the "SOLL"-Time given in TimeOffice and the "IST"-Time in TimeOffice. Those are exported from the database and stored in cases/{case_id}/target_working_minutes.json as target and actual.

Note

Please note that we made an exception for the employee "Milburn Loremarie", because her target-actual time does not match the availabe shifts. She only has three not forbidden / not blocked days on which we need to work 30+ hours, this does not add up.