Filling in pre-defined shifts with employees according to contractual agreements that enforce fair and cost efficient rosters. The input requires you to make up:

  • open shifts
  • available employees

Additionally, you can customise the solver behaviour by also changing the weights and priority of the constraints

This FILL request schema is used for solving a Shift Filling Problem. It consists of shifts, employees, options and weights.

NameTypeRequiredDescription
shifts[Shift]trueList of Shifts
employees[Employee]trueList of Employees
rules[Rule]falseList of Rules
requirements[Requirement]falseList of Requirements
fairnessBuckets[FairnessBucket]falseList of Fairness buckets
rests[Rest]falseList of Rests
patterns[Pattern]falseList of Patterns
demands[Demand]falseList of Demands
assignments[Assignment]falseList of Assignments
optionsOptionsfalseOptions for solver configuration
weightsWeightsfalseWeighting the constraints
hookstring(uri)falseWebhook for getting notified after request is solved.

Shifts

The shifts represent the demand. These shifts need to be filled in with employees. A shift in its simplest form can be defined by a shift start time (from) and an end time (to). Shifts are uniquely identified by a name and require a specific skill. You can define the number of employees that need to be assigned to this shift with the minimum min to the maximum max.

PropertyTypeDescription
namestringUnique id of the shift
fromstring (datetime)Starting time of the shift
tostring (datetime)End time of the shift
skillsarray of stringsSkill requirements references
costnumberFinancial cost related to this shift. Will be minimised when partialPlanning.
minnumberMinimum number of employees that should be assigned to this shift
maxnumberMaximum number of employees that should be assigned to this shift
prioritynumberForces a priority constraint on this shift with 1 being highest priority and 10 being the lowest.
tagsarray of ShiftTagShift tags. Used to identify groups of shifts in rules.
blocklistarray of stringList of employees that cannot do this shift.
restsarray of ShiftRestShift rests can define required idle/rest time after the shift.

ShiftTag

A shift tag can group shifts together under the same class. For instance: EARLY and NIGHT shifts are typical groups.

NameTypeDescription
namestringName of the tag.

Employees

Define the resources or employees with whom you want to fill up the shifts.

PropertyTypeDescription
namestringUnique identifier for this employee
contractstringReference to contract for this employee.
skillsarray of stringList of skill references.
lastRestDatestring (date)The last date on which the employee had a rest before the planning period.
availabilityarray of stringAvailable date-time range of employee.
preferencearray of stringPreference towards certain shifts. (shift name)
periodRulesarray of PeriodRuleList of Period Rule

Period Rule

A shift rule for an employee that applies to a period of time. Labor rules such as max hours working.

PropertyTypeDescription
periodPlanningPeriodPlanning period for this period rule.
maxWorkingDaysintegerMaximum number of total days working in planning period.
minWorkingDaysintegerMinimum number of total days working in planning period.
minWorkingDurationstringMinimum duration to work in the planning period.
maxWorkingDurationstringMaximum duration to work in the planning period.
minRestDurationBetweenShiftsSameDaystringMinimum duration between two shifts on the same day in this planning period.
minRestDurationstringMinimum duration between any two shifts in this planning period.

Rule

NameTypeDescription
constraintstringType of constraint. Counter or Sequence. A counter counts the number of occurances and the constraint
typetypeType of rule. Counter or Series.
periodperiodPeriod in which this rule applies
minIntegerMinimum number of employees necessary to fill these shifts.
maxIntegerMaximum number of employees necessary to fill these shifts. If min=max then you’ll get that exact amount of employees.
shiftsListShift tags to filter this rule by. For example only shifts with the tag `EARLY`.
thenRuleConsequential rule.

Requirements

Governing skill requirements on certain shifts. For instance, on these specific shifts, we need to have at least 4 employees with skill x.

NameTypeDescription
shiftslist of stringList of shifts that the requirement applies to
skillstringThe skill this requirement applies to
valuenumberThe number of shared resources required for this skill.

Fairness

For a select group of employees and shifts you can require fair distribution of shifts per planning period. The planning period can be the entire planning period or a subset of it.

NameTypeDescription
periodPeriod
employeeslistThe employees in the fairness bucket
shiftslistThe shifts in the fairness bucket
targetstring (duration ISO8601)The target value of workload per employee

Period

Define a planning period for which the fairness holds with from and to dates.

NameTypeDescription
fromstring (date)Start of the period
tostring (date)End of the period

Pattern

Patterns define preferred, prohibited or unpreferred sequences of shifts.

NameTypeDescription
typestringSINGLE_DAY (spanning shifts in a single days) or MULTI_DAY (spanning shifts accross days)
satisfystring(PREFERRED, PROHIBITED, or UNPREFERRED)
elementsPatternElementList of Pattern Elements describing ON/OFF for several shifts
weightIntegerImportance (weight) of the Pattern

PatternElement

A single element defining an entire pattern. The element can define to be ON/OFF for a certain shift (tag).

NameTypeDescription
typestringON (doing that shift) or OFF (not doing that shift)
tagslist of stringList of shift tags to include

Rest

Rests are periods of idle time defined throughout the entire period or either before/after a shift.

Assignment

If you want to set the current schedule, you can set the assignments. That is a list of shift and employee with optionally to lock it.

NameTypeDescription
shiftstringName of the shift
employeestringName of the employee
lockedbooleanIf the shift is locked. Locked shifts cannot be touched by the solver

Options

Custom solver options.

NameTypeDescription
hardAvailabilitybooleanWhether to enforce availability constraints
hardSkillbooleanWhether to enforce skill constraints
hardBlacklistbooleanWhether to enforce blacklist constraints
partialPlanningbooleanPartial planning. Whether to fill all shifts or not. Default is false
penaliseZeroHoursbooleanWhether to penalise employees with zero hours
useAvailabilityLocationsbooleanWhether to use availability locations
alwaysScoreSharedSkillsbooleanWhether to always score shared skills
explanationExplanationExplanation
idleWeekendIdleWeekendIdle weekend definition

ExplanationOptions

NameTypeDescription
enabledbooleanWhether to enable explanation post processing
filterHardConstraintsbooleanWhether to filter hard constraint violated solutions in the alternatives response

IdleWeekendDefinition

How weekends are defined at the organization level.

NameTypeDescription
fromDayOfWeekDayOfWeekDay of the week on which the weekend officially starts.
fromTimeStringTime of day on which the weekend officially starts.
toDayOfWeekDayOfWeekDay of the week on which the weekend officially ends.
toTimeStringTime of day on which the weekend officially ends.
restTimeString (ISO8601 duration)The amount of consecutive idle seconds required between the start and end of the above defined period for it to be considered a free weekend.