Weekend Distribution Constraint
Soft constraint
The Weekend Distribution Constraint is being deprecated in favour of the PeriodicDistributionConstraint. You should no longer build a new integration with this constraint.
Set rules for maximum working weekends or minimum non-working weekends surrounding a work weekend.
The minimum surrounding weekends is a count of weekends before or after a working weekend which the employee must have off.
The constraint can also be configured to only apply to particular workTypes.
The constraint is specified with a weight, and for this weight, particular logic applies during solving.
| Weight | Logic |
|---|---|
| 0-89 | The constraint is scored according to the weight - the heigher the weight, the worse it is to violate the constraint, but the solver will do it if it is necessary. |
| 90-99 | The constraint is still scored according to weight, but in the first round of solving, maximum weekends (free neighbours/maxWeekend properties) cannot be violated. In subsequent rounds, that constraint is relaxed (not applying, and may be violated). |
| 100 | The constraint is scored according to weight, and the solver will not violate the constraint. |
See the payload example below to get started and check out the API reference for full configurability of the constraint.
The following defines that employee 2 should work a maximum of two weekends of work types 1 or 2.
{
"weekendDistributionConstraints": [
{
"id": "wdc-123",
"weight": 100,
"maxWorkingWeekends": 2,
"workTypeIds": ["1", "2"],
"employeeIds": ["2"]
}
]
}
Weekend Distribution Constraint in the request payload
| id required | string (constraintId) Unique identifier for the constraint. |
| weight | integer (constraintWeightPositive) [ 0 .. 100 ] Deprecated DEPRECATED - Use importance instead. |
| maxWorkingWeekends | integer >= 0 Defines the number of weekends in the scheduling period that employee can work. The constraint is triggered if the number of working weekends exceeds this value. 0 means that employee can't work any weekend in scheduling period. Will default to the total number of weekends in the scheduling period if not specified. |
| minSurroundingFreeWeekends | integer >= 0 Default: 0 Defines the smallest number of free weekends employee should have before and after working on a weekend. 0 means that employee(s) can work on a weekend even when the previous and/or the next weekend is not free. |
| workTypeIds | Array of strings (constraintWorkTypeIds) unique List of workType IDs for which the constraint applies. The workTypeIds should be present in workType section. If work type ids are not specified, the constraint will be applied to all work types. |
| 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. |
object (constraintFairness) Deprecated DEPRECATED - Use FairnessConstraints instead. |
{- "id": "string",
- "weight": 0,
- "maxWorkingWeekends": 0,
- "minSurroundingFreeWeekends": 0,
- "workTypeIds": [
- "string"
], - "employeeIds": [
- "string"
], - "fairness": {
- "fairnessWeight": 0,
- "fteAdjustedFairness": false
}
}