OR-Tools employee scheduling: maximising consecutive shifts

Viewed 552

I've been studying the OR-Tools Employee Scheduling example and would like to change it so that the model would allow employees to be assigned to multiple shifts per day and at the same time give preference to solutions where an employee is assigned consecutive shifts within the span of a given day. Allowing multiple shifts seems straightforward, but how can I define an objective function that would prefer consecutive shifts? I don't want consecutiveness to be a hard constraint for the solution.

1 Answers

First, ignore the nurse rostering example, look at the shift_scheduling_sat.py example.

You can try having more types of shifts.

If you really want flexible shifts, define a maximum number of continuous shifts, each with start and end.

Order them: start1 <= end1 < start2 <= end2 ....

Force each empty shifts to be midnight -> midnight. Then start from there. But I would recommend more sets of fixed shifts.

Related