Skip to main content

Employee Utilization Constraint

This constraint can be for two purposes:

  1. Set an upper bound on the amount of hours worked by employees in some period.
  2. Set a lower bound on the amount of hours worked by employees in some period.
Enforcement of lower and upper bounds

Upper bounds on the amount of hours are strictly enforced. An employee will never work more hours than specified in a constraint. Lower bounds are treated as targets. The solver will attempt to assign each employee at least as many hours as specified in a constraint. The importance of satisfying the minHours targets is set by adjusting this constraint's weight.

Specifying the scope of a constraint

By default, an employee utilization constraint applies to all employees. Specifying employeeIds will make the constraint apply to these employees only. Each constraint is applied to every targeted employee individually: a constraint applied to 2 employees with a maxHours of 30 will allow each of them to work 30 hours in total.

Similarly, the constraint applies to the entire scheduling period by default. Specifying scheduleDays will make the constraint apply only to hours worked on those days. A constraint does not put any limits on hours worked outside of its scheduleDays.

If shiftIds is specified, the constraint will only limit the number of hours worked on any of the specified shifts. For example, if a constraint has a maxHours of 10 and a shiftIds targeting shift-1, then the constraint only ensures employees work no more than 10 hours on shift-1 shifts. The number of hours worked on other shifts is not affected.

Payload example

The following example shows an employee utilization constraint which has the following effects:

  • In the first week, each employee is preferred to work at least 20 hours on shift-1 and shift-2 shifts.
  • In the first week, each employee may work no more than 40 hours on shift-1 and shift-2 shifts.

The constraint applies to all employees, since no employeeIds were specified.

{
"employeeUtilizationConstraints": [
{
"id": "euc-1",
"minHours": 20,
"maxHours": 40,
"shiftIds": [
"1", "2"
],
"scheduleDays": {
"dayIndexes": [0, 1, 2, 3, 4]
}
}
]
},
Employee Utilization 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.

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.

shiftIds
Array of strings (constraintShiftIds) unique

List of shift ids for which the constraint applies. The shift ids must be present in the shift section. If not specified, the constraint will be applied to all shifts.

roleIds
Array of strings unique

List of role ids that the constraint should be applied to. If roles are specified, the constraint will only take into account work that is carried out using one of these roles.

minHours
integer

The minimum number of hours that should be worked by employees on shifts that match the constraint in each period. This is treated as a target - it is not guaranteed that the number of hours worked will be greater than this value.

maxHours
integer

The maximum number of hours that should be worked by employees on shifts that match the constraint in each period. This is treated as a hard limit - the number of hours worked will never exceed this value.

minShifts
integer

The minimum number of shifts that match the constraint that an employee should work in each period. This is treated as a target - it is not guaranteed that the number of shifts worked will be greater than this value.

maxShifts
integer

The maximum number of shifts that match the constraint that an employee should work in each period. This is treated as a hard limit - the number of shifts worked will never exceed this value.

object

Settings to determine if and how bonus time rules affect the constraint.

object

Settings to determine if and how default time rules affect the constraint.

object (periods) = 1 properties

The periods in which the constraint should be applied. The minHours and maxHours will be applied to each period separately.

object (scheduleDays) non-empty
Deprecated

DEPRECATED - Use periods instead.

{
  • "id": "string",
  • "weight": {
    },
  • "employeeIds": {
    },
  • "shiftIds": {
    },
  • "roleIds": [
    ],
  • "minHours": 0,
  • "maxHours": 0,
  • "minShifts": 0,
  • "maxShifts": 0,
  • "bonusTime": {
    },
  • "defaultTime": {
    },
  • "periods": {
    },
  • "scheduleDays": {
    }
}