Skip to main content

Periodic Rest Constraint

The Periodic Rest Constraint can be used to set a minimum duration of continuous rest that an employee gets in a period. Of all the periods of rest the employee gets, the constraint ensures that at least one of them is of the specified minimum duration per period. A good example of this constraint is to ensure that employees get at least 48 hours of continuous rest in each week, so that they will always have at least 2 consecutive days off (regardless of which days it is planned on).

Payload example 1

The following example defines a periodic rest constraint that ensures that all employees get at least one 48-hour long continuous rest in each week.

{
"periodicRestConstraints": [
{
"id": "48-hours-per-week",
"minimumContinuousRestDuration": {
"hours": 48
},
"periods": {
"recurrentDefinition": {
"daysPerPeriod": 7
}
}
}
]
}
Payload example 2

The following example defines a periodic rest constraint that ensures that all employees get at least one 72-hour long continuous rest in each month.

{
"periodicRestConstraints": [
{
"id": "72-hours-per-month",
"minimumContinuousRestDuration": {
"hours": 72
},
"periods": {
"customDefinitions": [
{
"startDate": "2022-01-01",
"endDate": "2022-01-31"
},
{
"startDate": "2022-02-01",
"endDate": "2022-02-28"
}
]
}
}
]
}
Periodic Rest Constraint in the request payload
id
required
string (constraintId)

Unique identifier for the constraint.

labels
Array of strings (constraintLabels) unique

Labels for the constraint. Labels can be used to group constraints together. For example, if multiple constraints are related to the same shift type, they can all be labeled with the same label.

importance
string (importanceWithStrict)
Enum: "NONE" "VERY_LOW" "LOW" "MEDIUM" "HIGH" "VERY_HIGH" "STRICT"

The importance of the constraint. The higher the importance, the more the solver will take the constraint into account. Under strict importance, the constraint may never be violated.

object (constraintFilters)

Filters to determine the scope of the constraint. Used to indicate what the constraint should be applied to (which employees, which shifts, etc). Leaving this empty means that the constraint always applies.

object (periodicRestTargets)
object (periods) = 1 properties

The periods in which the constraint should be applied.

object (periods) = 1 properties

Periods that should never be considered as rest. For example, use this to indicate that public holidays should not be considered rest periods even when unworked.

Array of objects (periods) [ items = 1 properties ]

Groups of periods during which periodic rest should be met. The constraint is considered satisfied if there is at least one period group for which the periodic rest is met for all of its periods. Cannot be used together with the regular 'periods' field.

employeeIds
Array of strings (constraintEmployeeIds) unique
Deprecated

DEPRECATED - Use filters instead.

shiftIds
Array of strings (constraintShiftIds) unique
Deprecated

DEPRECATED - Use filters instead.

weight
integer (constraintWeightPositive) [ 0 .. 100 ]
Deprecated

DEPRECATED - Use importance instead.

object (constraintFairness)
Deprecated

DEPRECATED - Use FairnessConstraints instead.

object (duration) non-empty
Deprecated

DEPRECATED.

{
  • "id": "string",
  • "labels": [
    ],
  • "importance": "NONE",
  • "filters": {
    },
  • "targets": {
    },
  • "periods": {
    },
  • "blockedPeriods": {
    },
  • "periodGroups": [
    ],
  • "employeeIds": [
    ],
  • "shiftIds": [
    ],
  • "weight": 0,
  • "fairness": {
    },
  • "minimumContinuousRestDuration": {
    }
}