Demands
Demand is the need for workforce and defines how many employees you need at work at any given time in the planning period. Specifying demands in the payload is done using the Demands
property.
Demands in the request payload
object (scheduleDaysWithoutWeekDays) = 1 properties List of days on which this demand exists. Multiple demands can exist on the same day. | |
Array of objects (shiftDemand) List of shift demands that exist on the days specified in the days field. | |
Array of objects (timeDemand) List of time demands that exist on the days specified in the days field. |
[- {
- "days": {
- "dayIndexes": {
- "example_1": {
- "value": [
- 0,
- 1,
- 2,
- 3
], - "summary": "First four days of the planning horizon."
}
}
}, - "shiftDemands": [
- {
- "shiftId": "string",
- "min": 0,
- "ideal": 0,
- "max": 0,
- "attributeRequirements": [
- {
- "id": "string",
- "values": [
- "string"
], - "matchType": "NONE",
- "min": 1
}
], - "priority": 1
}
], - "timeDemands": [
- {
- "timeSlotId": "string",
- "min": 0,
- "ideal": 0,
- "max": 0,
- "priority": 1
}
]
}
]
The Automatic Rostering API allows you to define demand for workforce in two different ways:
ShiftDemand
allows you to specify demand by stating which shifts you need on which days, and how many people you need working those shifts.TimeDemand
allows you to specify demand by stating how many employees you need at different times of day throughout your schedule. The API will then assign shifts to cover the demand at those times.
A request to the Automatic Rostering API should either specify all demand as ShiftDemand
, or all demand as TimeDemand
. A combination of both is currently not supported.
Choose which type of demand suits your needs, then find below some pointers on how to configure the Demands
object for your use case.
ShiftDemand
If you have already configured Shifts in your request, then using these to specify ShiftDemand
is very simple. Consider the following example.
The following shows how to specify that on days 1 and 2 you require 2 people to work Shift A and 2 people to work Shift B, while on day 3 you only require 2 people working Shift B.
{
"demands": [
{
"days": {
"dayIndexes": [0, 1]
},
"shiftDemands": [
{
"shiftId": "ShiftA",
"ideal": 2
},
{
"shiftId": "ShiftB",
"ideal": 2
}
]
},
{
"days": {
"dayIndexes": [2]
},
"shiftDemands": [
{
"shiftId": "ShiftB",
"ideal": 2
}
]
}
]
}
Attribute requirements
In principle, all employees assigned to a demand must be compatible with the attribute requirements on that demand. However, it is also possible to specify a minimum number of assigned employees that must be compatible.
The first demand requires all employees to be able to drive. For the second demand, at least one of the assigned employees should be a nurse.
{
"demands": [
{
"shiftDemands": [
{
"shiftId": "shift1",
"ideal": 2,
"attributeRequirements": [
{
"id": "competences",
"values": [
"driving"
]
}
]
},
{
"shiftId": "shift2",
"ideal": 2,
"attributeRequirements": [
{
"id": "personnelGroup",
"values": [
"nurses"
],
"min": 1
}
]
}
]
}
]
}
TimeDemand
When demand is defined as the time periods for when employees are needed. Based on the available shifts, the solver then assigns employees to the shifts that are able to cover this demand.
A demand always belongs to a day, so in the cases where there are demand intervals spanning midnight, this has to be specified in separate demands.
If several demands with the same attributes overlap, they are merged together, as visualized in the below example with three demands that have overlapping time intervals.