Employees
Employees form the foundation for all schedules produced by the solver. The primary objective for all produced schedules is to assign employees to shifts in such a way that they can optimally cover all demand for labour.
The employees
component of request payloads is used to specify which employees are available for assignment in the schedule. It allows for many configurations that provide more information about each specific employee. This page will give some pointers on how this is done.
Employees in the request payload
id required | string Unique identifier for this employee. |
Array of objects (employeeAttribute) List of attributes that this employee has. Shifts, demands and tasks can have requirements on the attributes that an employee has. | |
Array of objects List of roles that this employee can work in. Each role can have additional attributes that the employee has when working in that role. Note that roles are not required, and an employee can work without any roles for. | |
object Information about the employee's desired and allowed work time. | |
Array of objects (scheduledShift) List of pre-scheduled shifts for this employee. Can be used to assure that these days and shifts are not changed, or changed as little as possible, by the Solver. | |
readOnly | boolean Default: false If set to true, the employee will only work their pre-assigned shifts. These will not be altered, and the solver will not assign new shifts to this employee. |
dayRestRuleId | string Deprecated DEPRECATED - Use PeriodicRestConstraint instead. A reference to a day rest rule to apply to this employee specifically. If not specified, the default day rest rule will be used. If no default is specified a random day rest rule will be used, from the list of available day rest rules in the Configuration part of the payload. |
[- {
- "id": "string",
- "attributes": [
- {
- "example_1": {
- "value": {
- "id": "personnel_group",
- "values": [
- "personnel_group_morning",
- "personnel_group_afternoon"
]
}, - "summary": "This example shows an employee with two personnel groups. The employee can be assigned to shifts that require an employee to be part of either the \"personnel_group_morning\" or \"personnel_group_afternoon\" (or both)."
}
}
], - "roles": [
- {
- "id": "string",
- "attributes": [
- {
- "example_1": {
- "value": {
- "id": "personnel_group",
- "values": [
- "personnel_group_morning",
- "personnel_group_afternoon"
]
}, - "summary": "This example shows an employee with two personnel groups. The employee can be assigned to shifts that require an employee to be part of either the \"personnel_group_morning\" or \"personnel_group_afternoon\" (or both)."
}
}
]
}
], - "workTime": {
- "maxHoursInFTECountPeriod": 0,
- "weekHoursRules": {
- "minWeekHours": 168,
- "maxWeekHours": 168,
- "maxWeekHoursWeight": 100,
- "applyMaxWeekHoursToAnySevenConsecutiveDays": false
}
}, - "scheduledShifts": [
- {
- "shiftId": "string",
- "locked": false,
- "sticky": true,
- "scheduleDays": {
- "dayIndexes": {
- "example_1": {
- "value": [
- 0,
- 1,
- 2,
- 3
], - "summary": "First four days of the planning horizon."
}
}
}
}
], - "readOnly": false,
- "dayRestRuleId": "string"
}
]
Worktime specification
Employees can have very different contracts with different requirements on the number of hours worked. These can be specified using the workTime
object.
Weekly worktimes
The minimum and maximum number of hours worked by an employee can be specified on a weekly level. By default this is assumed to be applied to each calendar week (Monday-Sunday) separately. Alternatively, you can specify that the worktime rules should apply to any consecutive days.
Note that the minimum number of hours per week is a recommendation for the solver. Solutions are not guaranteed to adhere to this. The maximum number of hours can be configured to either be a hard limit or a recommendation (to avoid overtime).
The following example shows an employee that may only be assigned 200 hours of work throughout the entire period. For any period of seven consecutive days, he is preferred to work between 20-40 hours. On a scale from 0 to 100, the importance of avoiding overtime for this employee is set to 50.
{
"id": "employee-1",
"workTime": {
"maxHoursInFTECountPeriod": 200,
"weekHoursRules": {
"minWeekHours": 20,
"maxWeekHours": 40,
"maxWeekHoursWeight": 50
},
"applyMaxWeekHoursToAnySevenConsecutiveDays": true
}
}
Attributes
Employee attributes provide a flexible way to specify custom characteristics for each employee. These attributes can be used to determine eligibility for shifts, demands, or tasks. In addition, some constraints can be configured to apply to all employees that meet certain attribute requirements. Some good examples of characteristics where it might make sense to use attributes are departments
, competences
, or personnel_groups
.
Each attribute must have its own unique key indicating what kind of attribute it is. An employee can have multiple values for the same attribute.
Here's an example of how to specify attributes for an employee:
The following example shows an employee that is part of the departments finance
and hr
, and has the competences manager
and accountant
. Finally, they are part of the personnel group group-1
.
{
"id": "employee-1",
"attributes": [
{
"id": "department",
"values": ["finance", "hr"]
},
{
"id": "competence",
"values": ["manager", "accountant"]
},
{
"id": "personnel-group",
"values": ["group-1"]
}
]
}
In addition to ineligibility through attributes
, the solver allows for direct specification of ineligibilities for any individual employee. See Prioritization.
Prescheduled shifts
It is possible to start the solver from a partially filled schedule where employees already have some shifts assigned to them. These are specified in prescheduledShifts
. If these pre-assignments are set to be locked
, the solver will never change them. The solver therefore considers unlocked prescheduled shifts as suggestions.
If there are any employees in the payload who should only work their prescheduled shifts and not be assigned to any new shifts, they can be configured to be a readOnly
employee. The solver will not assign such employees to any new shifts.
The following example shows an employee that is prescheduled to work shift-1
shifts on each of the first four days of the schedule. These assignments are locked
and will not be changed by the solver.
{
"id": "employee-1",
"scheduledShifts": [
{
"shiftId": "shift-1",
"locked": true,
"scheduleDays": {
"dayIndexes": [0, 1, 2, 3]
}
}
]
}