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.
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. |
| labels | Array of strings unique |
object (days) = 1 properties Days on which this shift is available to be assigned. If not set, the shift is always available. | |
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. |
| 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 (attributeRequirement) 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. | |
object (scheduleDays) non-empty Deprecated DEPRECATED - Use availableDays instead. | |
| assignmentId | string Deprecated |
| workTypeId | string Deprecated |
| onDutyWorkTypeId | string Deprecated |
{- "id": "string",
- "labels": [
- "string"
], - "availableDays": {
- "dates": [
- "2019-08-24"
]
}, - "noWorkTimeWindows": [
- {
- "timeWindow": {
- "regular": {
- "value": {
- "start": "13:00",
- "end": "16:00"
}, - "summary": "A regular 3 hour time window from 13:00 to 16:00."
}
}, - "dayIndicator": -1
}
], - "dayIndicatorRule": "MOST_HOURS",
- "possibleTaskIds": [
- "string"
], - "startTimeWindow": {
- "regular": {
- "value": {
- "start": "13:00",
- "end": "16:00"
}, - "summary": "A regular 3 hour time window from 13:00 to 16:00."
}
}, - "startTimeWindowPreferred": {
- "regular": {
- "value": {
- "start": "13:00",
- "end": "16:00"
}, - "summary": "A regular 3 hour time window from 13:00 to 16:00."
}
}, - "endTimeWindow": {
- "regular": {
- "value": {
- "start": "13:00",
- "end": "16:00"
}, - "summary": "A regular 3 hour time window from 13:00 to 16:00."
}
}, - "endTimeWindowPreferred": {
- "regular": {
- "value": {
- "start": "13:00",
- "end": "16:00"
}, - "summary": "A regular 3 hour time window from 13:00 to 16:00."
}
}, - "workDuration": {
- "min": {
- "hours": 0,
- "minutes": 0
}, - "max": {
- "hours": 0,
- "minutes": 0
}
}, - "workDurationPreferred": {
- "min": {
- "hours": 0,
- "minutes": 0
}, - "max": {
- "hours": 0,
- "minutes": 0
}
}, - "breakRules": [
- {
- "workMinutesRequiredForBreak": 0,
- "breakMinutes": 0
}
], - "connectedShiftsPreviousDay": {
- "shiftIds": [
- "string"
], - "shiftTemplateIds": [
- "string"
], - "dayOff": false
}, - "connectedShiftsNextDay": {
- "shiftIds": [
- "string"
], - "shiftTemplateIds": [
- "string"
], - "dayOff": false
}, - "attributeRequirements": [
- {
- "category": "string",
- "values": [
- "string"
], - "matchType": "NONE",
- "id": "string"
}
], - "allowedDays": {
- "weekDays": [
- 1
], - "dayIndexes": [
- 0
], - "dates": [
- "2019-08-24"
]
}, - "assignmentId": "string",
- "workTypeId": "string",
- "onDutyWorkTypeId": "string"
}