List of Conditions
We differentiate between two types of conditions:
-
Constraints (Hard) are essential requirements that must be satisfied for a valid schedule. For example, this includes factors like already planned vacation days.
-
Objectives (Soft) represent aspects that can be optimized but do not constitute strict requirements. An example of this would be minimizing the number of consecutive night shifts.
Constraints¶
Navigation Links¶
- Free day after night shift phase
- Hierarchy of intermediate shifts
- Max one shift per day
- Minimum rest time between shifts
- Minimum number of staff per shift
- Planned shifts
- Rounds (Visiten)
- Target working time per month
- Vacation days and free shifts
All Constraints¶
Free day after night shift phase 4¶
Likelihood of Confusion
Different then the constraint Free days after Night Shift Phase
According to recommendations for the healthy organization of night and shift work, workers should have at least 24 hours of free time after a night shift. This ensures that workers have sufficient rest after a night shift. Therefore, if an employee works the night shift today and does not work the night shift tomorrow, they must take the day off.
Hierarchy of intermediate Shifts 2¶
Intermediate shifts are assigned once the minimum staffing requirement is met and sufficient personnel resources are available. The assignment of these shifts follows a specific pattern: we prioritize one shift per day for each weekday, followed by weekend shifts. After that, we aim to assign two shifts on weekdays, and then again on weekends.
In cases where two or more intermediate shifts are scheduled in a single day, the station management will convert them into early and late shifts, as these options tend to be more popular among staff. However, it’s important to note that this conversion process is currently manual and not automated by our application.
Max one shift per day¶
Each employee is permitted to work only one shift per day. It is important to note that a night shift counts as part of the day on which it begins.
Minimum Rest Time 3¶
According to Occupational Health and Safety Law (Arbeitsschutzgesetz) the minimum rest time for normal employees need to be at least 11 hours. In hospitals there can be exception to this rule. We did not implement a solution that can vary the minimum rest time, but we just do not allow an early shift following a late shift, because then the rest time would only be 9 hours.
Minimum number of staff per shift 2¶
Each shift has a minimum required number of staff. This is a hard constraint that must be met. The goal is to ensure that the required number of qualified staff members are present for each shift. Therefore, the total number of staff members assigned to a shift must be equal to the required number of staff for that shift. If there are additional ressources, the fourth kind of shift, intermediate shifts, will be assigned. Qualifications are not ordered, which means, that a "Fachkraft" (engl. skilled worker) cannot replace an "Azubi" (engl. trainee).
The required number of staff can be changed in cases/{caseID}/minimal_number_of_staff.json
. Currently we use those numbers:
Fachkräfte¶
Mo | Tu | We | Th | Fr | Sa | Su | |
---|---|---|---|---|---|---|---|
Early | 3 | 3 | 4 | 3 | 3 | 2 | 2 |
Late | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
Night | 2 | 2 | 2 | 2 | 2 | 1 | 1 |
Hilfskräfte¶
Mo | Tu | We | Th | Fr | Sa | Su | |
---|---|---|---|---|---|---|---|
Early | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
Late | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
Night | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Azubis¶
Mo | Tu | We | Th | Fr | Sa | Su | |
---|---|---|---|---|---|---|---|
Early | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Late | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Night | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Planned Shifts 2¶
Planned shifts are shifts that are already assigned in TimeOffice. All planned shifts are hard constraints, meaning they are automatically assigned and there will be not solution without those. An example would be the special shift (Z60), which can be assigned to an employee each Thursday in TimeOffice and then also be assigned in our application.
Rounds (Visiten) 2¶
In the early shift, at least one employee must conduct a round. Employees need to have a proper qualification to conduct a round. Therefore, at least one qualified employee needs to be assigned to an early shift on workdays.
Target working time per month 1¶
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.
Vacation days and free shifts 1¶
Vacation days must remain free, and the day before a vacation day no night shift is allowed. This vacation days are automatically read from the database / TimeOffice.
Objectives¶
All the objectives are combined (added) to a total objective function
that the minimum will be approximated from. Each objective has a weight by which one
could change the importance of a specific objective. Those weights are set in src/cp/solve.py
and should be always greater or equal to 1.0:
objectives = [
FreeDaysNearWeekendObjective(10.0, employees, days),
MinimizeConsecutiveNightShiftsObjective(2.0, employees, days, shifts),
MinimizeHiddenEmployeesObjective(100.0, employees, days, shifts),
MinimizeOvertimeObjective(4.0, employees, days, shifts),
NotTooManyConsecutiveDaysObjective(MAX_CONSECUTIVE_DAYS, 1.0, employees, days),
RotateShiftsForwardObjective(1.0, employees, days, shifts),
EverySecondWeekendFreeObjective(1.0, employees, days, shifts),
]
Navigation Links¶
- Every Second Weekend Free Objective
- Free days after night shift phase
- Free days near weekend
- Maximize Wishes
- Minimize hidden employees
- Minimize number of consecutive night shifts
- Minimize overtime and undertime
- Not too many consecutive working days
- Rotate shifts forwards
All Objectives¶
Every second weekend free objective¶
Rewards if an employee has every second weekend (Sat, Sun) free.
Feature Request
In the final presentation of our project another implemenation of Free Days Near Weekend was requested. This is our new, complementary objective, but there is room for improvement. More details can be found in this open issue.
Free days after night shift phase 2¶
Likelihood of Confusion
Different then the constraint Free day after Night Shift Phase
There is also a constraint (soft) called Free day after night shift phase, which ensures that there are at least 24h free after a night shift phase. This objective promotes anthoher 24h free after night shift phase (in total 48h, meaning two days).
Free days near weekend¶
A schedule is found that increases the number of free days near weekends (Fri, Sat, Sun, Mon) for employees.
Maximize Wishes 2¶
We try to grant as many wishes of the employees as possible. The employee can wish for a free shift or a complete free day. In our visualization wishes are also shown:
- colored small diamond: employee wishes to have shift corresponding to the color off
- brown triangle: employee wished to have the whole day off
- green background: wish for specific shift off was granted
- yellow background: wish for complete day off was granted
Minimize hidden employees¶
Hidden employees are employees that do not exist. Shifts should only be assigned to them if otherwise a valid solution cannot be found. This for example happens, if there is a shortage on skilled employees. Hidden employees do not have the same rules as real employees, they can work multiple shifts per day. They should indicate how many employees / how many shifts are missing to get a valid schedule.
Minimize number of consecutive night shifts 4¶
The aim is to minimize the length of night shift phases, defined as consecutive night shifts occurring one after another.
Minimize overtime and undertime¶
The goal is to minimize both overtime and undertime to ensure a fair and equitable distribution of work among employees. Hard limits are established, as outlined in the section on Target Working Time per Month.
Not too many consecutive working days 4¶
The aim is to minimize consecutive working days that extend to six or more, in order to prevent prolonged periods of work.
Rotate shifts forwards 4¶
The forward shift rotation constraint requires employees to transition from earlier shifts to later shifts, promoting better health and reducing fatigue. An employee's weekly schedule should progress from early shifts to late shifts and then to night shifts, not the other way around.