Skip to content

Minimum number of staff per shift

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

Implemented using Google's OR Tools

src/cp/constraints/min_staffing.py
if min_staffing is not None:
    model.add(sum(potential_working_staff) == min_staffing)
else:
    model.add(sum(potential_working_staff) >= 0)

For each day, shift required skill level ("Azubi", ...) we gather all eligible employees, get the minimum number of staff defined in cases/{case_id}/minimal_number_of_staff.json and collect all the corresponding variables (potential_working_staff). The sum of those (number of people working) needs be equal to the required number (min_staffing). If there is no required min_staffing, e.g. when there are additional special shifts (Z60), we dont restrict the solution space.