Skip to main content

Shift Generation

Additionally to giving definitions of shifts in Shifts, it is also possible to let the solver generate shifts itself.

In this case, the solver will need some instructions in the form of Shift Templates. In a Shift Template, it is defined what a generated shift should look like. The solver will generate shifts according to these Shift Templates, when additional shifts (besides the ones defined in Shifts) are needed to cover demand. This way, it is possible for the solver to generate shifts that fit the demand better.

It is possible to provide both Shifts and Shift Templates. However, the solver will prefer to use user created shifts over generated shifts when fulfilling the demand. It is therefore possible that not all Shift Templates are used; shifts are only generated when they are needed.

Payload example

The following defines a shift template for a shift that should start between 04:00 and 06:00 and should end between 14:30 and 16:00. It should have a work duration between 8,5 hours and 11 hours. The break rule states that if the work duration is 10 hours or more, a break of 60 minutes is added to the shift. Hence, the total shift length will be 12 hours.

{
"shiftTemplates": [
{
"id": "template-1",
"workTypeId": "0",
"dayIndicatorRule": "MOST_HOURS",
"startTimeWindow": {
"start": "04:00",
"end": "06:00"
},
"endTimeWindow": {
"start": "14:30",
"end": "16:00"
},
"workDuration": {
"min": {
"hours": 8,
"minutes": 30
},
"max": {
"hours": 11
}
},
"breakRules": [
{
"workMinutesRequiredForBreak": 600,
"breakMinutes": 60
}
]
}
]
}
Shift Template in the request payload
id
required
string

Unique identifier for this shift template. Shifts generated from this shift template, will have this id as their base name, followed by an enumeration.

object (scheduleDays) non-empty

Defines the days that a shift is allowed to be scheduled. By default a shift can be assigned all days.

workTypeId
required
string

Work type id for this shift template. Needs to match a work type id from the configuration part of the payload. This shift template can only be used to cover demand with a similar work type.

onDutyWorkTypeId
string

Input if it is possible to cover any other kind of work, during this shift.

Array of objects

Time windows within the shift in which no work will be done. The Solver will disregard these time windows when considering demand fulfilment as well as employee FTE working time. This means that no demand will be fulfilled in this time window if an employee is assigned to this shift. The duration of these noWorkTimeWindows will also not count towards the assigned employees FTE.

dayIndicatorRule
required
string
Enum: "MOST_HOURS" "START_DAY" "END_DAY" "NEXT_DAY"

Rule used to determine to which day this shift officially belongs. See documentation for more details on the different rules.

assignmentId
string

An assignment to be done in this shift. Will match the assignment in the demand(s). Default is that all assignments can be done. If an assignment is specified then it's only this assignment that can be done during demand fulfilment, in addition to demand that doesn't have any assignments specified.

possibleTaskIds
Array of strings unique

List of taskIds that the shifts generated by this shift template can cover. Default is ["ALL"] meaning that all tasks can be covered. It is also possible to specify ["NONE"] meaning that only demand with no tasks, can be covered.

required
object (timeWindow)

The time window in which the shifts generated will start.

object (timeWindow)

The preferred start time window for shifts generated. Shifts starting in this window will be preferred when employees are assigned shifts. The time window is closed, meaning both start and end are inclusive.

required
object (timeWindow)

The time window in which the shifts generated will end.

object (timeWindow)

The preferred end time window for shifts generated. Shifts ending in this window will be preferred when employees are assigned shifts. The time window is closed, meaning both start and end are inclusive.

required
object (durationInterval)

An interval of durations. Shifts generated will have a duration within this interval. If breakRules are specified, the duration will be the work time of the shift. The break time will be added to the work time duration if the work time is longer than or equal to the workMinutesRequiredForBreak.

object (durationInterval)

The preferred duration for shifts generated. Shifts with this work duration will be preferred when employees are assigned shifts. The duration is closed, meaning both start and end are inclusive.

Array of objects

Rules governing if, and how many, breaks there should be in the shifts generated from the template.

object (connectedShifts) non-empty

List of shifts that are connected to this shift template on the previous day. If defined, this shift template will always be preceded by one of the connected shifts the previous day.

object (connectedShifts) non-empty

List of shifts that are connected to this shift template on the next day. If defined, this shift template will always be followed by one of the connected shifts the next day.

Array of objects (employeeAttributeRequirement)

List of requirements on the attributes that an employee needs to be eligible to work Shifts generated from this template. If an employee does not meet all of the requirements, the employee can not work Shifts generated by this template.

{
  • "id": "string",
  • "allowedDays": {
    },
  • "workTypeId": "string",
  • "onDutyWorkTypeId": "string",
  • "noWorkTimeWindows": [
    ],
  • "dayIndicatorRule": "MOST_HOURS",
  • "assignmentId": "string",
  • "possibleTaskIds": [
    ],
  • "startTimeWindow": {
    },
  • "startTimeWindowPreferred": {
    },
  • "endTimeWindow": {
    },
  • "endTimeWindowPreferred": {
    },
  • "workDuration": {
    },
  • "workDurationPreferred": {
    },
  • "breakRules": [
    ],
  • "connectedShiftsPreviousDay": {
    },
  • "connectedShiftsNextDay": {
    },
  • "attributeRequirements": [
    ]
}