Shift Layout Constraint
Soft constraint
The Shift Layout Constraint is being deprecated in favour of the RestBetweenShiftsConstraint (we are extending it with time off in terms of days). You should no longer build a new integration with this constraint.
Specify a break duration between each assigned shift of a given ID, type, or work type. This constraint applies to employees independently, meaning that the break duration does not apply if different employees are assigned to the given shift.
See the payload example below to get started and check out the API reference for full configurability of the constraint.
The following defines a desired break time of two days between each shift_1 shift assigned to any specific employee.
{
"shiftLayoutConstraints": [
{
"id": "slc-123",
"weight": 100,
"minDaysBetweenShifts": 2,
"shiftIds": ["shift_1"]
}
]
}
Shift Layout Constraint in the request payload
id required | string (constraintId) The id of the constraint should be UNIQUE in the context of constraint type. |
weight | integer (constraintWeightPositive) [ 0 .. 100 ] Describes how much the constraint is taken into account when solving the schedule. The higher the value, the more solver will penalize the constraint violation. None of the weight values make it a hard constraint - even when weight is set to 100 it is not guaranteed that the constraint will be satisfied. The weight value is relative to other constraints. |
object (constraintFairness) Describes how much fairness is taken into account for the constraint. | |
minDaysBetweenShifts required | integer >= 1 The minimum number of days between shifts indicated by shiftId or shiftTypeId. |
shiftIds | Array of strings (constraintShiftIds) unique If shiftIds are specified, shifts that has matching id are constrained. |
shiftTypeIds | Array of strings (constraintShiftTypeIds) unique If shiftTypeIds are specified, shifts that has matching shiftType are constrained. |
workTypeIds | Array of strings (constraintWorkTypeIds) unique If workTypeIds are specified, shifts that has matching workType are constrained. |
employeeIds | Array of strings (constraintEmployeeIds) unique List of employee ids for which the constraint applies. The employee ids must be present in the employee section. If not specified, the constraint will be applied to all employees. |
{- "id": "string",
- "weight": {
- "example_1": {
- "value": 0,
- "summary": "The constraint is not taken into account when solving the schedule as it has weight 0."
}, - "example_2": {
- "value": 100,
- "summary": "Solver will try its best to satisfy the constraint as it has weight 100."
}
}, - "fairness": {
- "fairnessWeight": {
- "example_1": {
- "value": 0,
- "summary": "The fairness is not taken into account when solving the schedule."
}, - "example_2": {
- "value": 100,
- "summary": "Solver will try its best to make the constraint as fair as possible."
}
}, - "fteAdjustedFairness": false
}, - "minDaysBetweenShifts": 1,
- "shiftIds": {
- "example_1": {
- "value": [
- "shift_1",
- "shift_2"
], - "summary": "The constraint will be applied only to shifts with id \"shift_1\" or \"shift_2\"."
}, - "example_2": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined shifts."
}
}, - "shiftTypeIds": {
- "example_ids": {
- "value": [
- "shift_type_1",
- "shift_type_2"
], - "summary": "The constraint will be applied only to shift types with id \"shift_type_1\" and \"shift_type_2\"."
}, - "example_all_shift_types": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined shift types."
}
}, - "workTypeIds": {
- "example_1": {
- "value": [
- 0,
- 3
], - "summary": "The constraint will be applied only to work type with id 0 and 3."
}, - "example_2": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined work types."
}
}, - "employeeIds": {
- "example_ints": {
- "value": [
- 1,
- 5,
- 3
], - "summary": "The constraint will be applied only to employees with id 1, 5 and 3."
}, - "example_all_employees": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined employees."
}, - "example_string": {
- "value": [
- "Lars Petersen",
- "123qwerty"
], - "summary": "The constraint will be applied to listed employees."
}
}
}