Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
  • Platform
Try models
  • Employee Shift Scheduling
  • New and noteworthy

Employee Shift Scheduling

    • Introduction
    • Planning AI concepts
    • Metrics and optimization goals
    • Getting started with employee shift scheduling
    • Understanding the API
    • Employee shift scheduling user guide
    • Employee resource constraints
      • Employee availability
      • Employee contracts
      • Employee contracts: period rules
      • Employee contracts: shift rules
      • Fairness
      • Pairing employees
      • Shift travel and locations
    • Shift service constraints
      • Alternative shifts
      • Demand and supply
      • Mandatory and optional visits
      • Shift assignments
      • Shift sequence patterns: single day shifts
      • Shift sequence patterns: multi-day shifts
      • Shift sequence patterns: daily shift pairings
      • Skills and risk factors
    • Recommendations
    • Real-time planning
    • Time zones and Daylight Saving Time (DST)
    • New and noteworthy
    • Upgrading to the latest versions
    • Feature requests

New and noteworthy

0.40.0

Demo data updates

We have added a new BASIC demo data set which demonstrates a minimal set of Timefold features. This is a simple example that is not meant to be reflective of real-world scheduling needs. It is intended for those early on in their Timefold journey to help them understand the basic features and progress to the more complex features in our other demo data sets.

Rolling window rules

We have added support for defining hourly rolling window periods for the following rules. Previously, the rolling window rules were only available for daily and weekly periods.

  • Shifts worked in rolling window not in required range for employee

  • Days worked in rolling window not in required range for employee

  • Consecutive days off in rolling window not in required range for employee

  • Shifts worked in rolling window not in preferred range for employee

  • Days worked in rolling window not in preferred range for employee

  • Consecutive days off in rolling window not in preferred range for employee

This feature can help formulate constraints that need to be satisfied over a rolling window of time, for example:

  • Maximum 5 days worked in any 168-hour period

  • Maximum 2 night shifts worked in any 168-hour period

  • Minimum 2 consecutive days off in any 168-hour period

Removed unchanged constraints from the recommendations API response

The recommendations API response no longer includes constraintDiffs entries for unchanged justifications to improve clarity and lower the size of the response.

0.39.0

Shift rotations

We have added a new constraint to rotate shift types for employees.

  • Required shift rotation not met for employee

  • Preferred shift rotation not met for employee

Use this to make sure that the employee’s shift types rotate in consecutive periods, for example, "morning" shifts on week 1 and "evening" shifts on week 2.

Consecutive days off per period in range for employee

We have introduced 2 new constraints for better handling of consecutive days off.

  • Constraint: consecutive days off per period not in required range for employee

  • Constraint: consecutive days off per period not in preferred range for employee

This feature allows a minimum of consecutive number of days off per period to be set on contracts. So when an employee needs 2 consecutive days off, their contract can define 1 period rule defining "consecutiveDaysOffLimit.consecutiveDaysOffMin: 2".

Maximum time difference between shift start times

We have added a new constraint that limits the variation in shift start times. It checks whether the time between the earliest shift start and the latest shift start in this period is larger than the period rule’s shiftStartTimeDifferenceInMinutesMax.

  • Shift start time difference in minutes per period not in required range

  • Shift start time difference in minutes per period not in preferred range

This constraint allows you to assign shifts with similar start times to employees, limiting the range of start times individual employees will have during a specific period of time and reducing the disruption to their daily schedule.

Additional metrics

We have added 2 new metrics to provide more insights into solutions.

  1. Assigned shift groups

  2. Unassigned shift groups

This update adds metrics that will give more insights into the model output, including how many shift groups were and how many weren’t allocated in the schedule.

Demo data updates

A series of updates have been made to the available demo datasets:

  • The BASIC demo dataset has been removed in favour of the CONTRACT_RULES dataset

  • The CONTRACT_RULES demo dataset has been extended to a full week (7 days, 60 shifts) for 13 employees

This is to better demonstrate the full capabilities of Timefold. The demo data is now more representative of real working rules, including contract patterns, maximum hours worked per day, maximum hours worked per week, preferences, and unavailabilities.

Added support for diminished returns termination

When submitting a new schedule with unspecified unimprovedSpentLimit in the run termination configuration, the run will use the new diminished returns termination.

Diminished returns terminates the solver early if expected improvements are minimal, saving on CPU costs. This termination is desirable since it terminates based on the relative rate of improvement, and behaves similarly on different hardware and different problem instances. You can find more details in the documentation.

Please see migrating from 0.38.0 to 0.39.0 for more details on run termination configuration changes.

Removed unchanged justifications from the recommendations API response

The recommendations API response no longer includes matchesDiff entries for unchanged justifications to improve clarity and lower the size of the response.

0.38.0

Days off per period in range for employee

We have introduced 2 new constraints for better handling of days off.

  • Constraint: days off per period not in required range for employee

  • Constraint: days off per period not in preferred range for employee

This feature allows a minimum and/or maximum of days off per period to be set on contracts. This means inputs don’t require the inverse logic with period rules anymore, e.g. when an employee needs 2 days off their contract can define 1 period rule defining "daysOffLimit.daysOffMin: 2", instead of a period rule defining "daysWorkedMax: periodLength - 2" for every period with a different length that the rule would apply to.

Rolling window rules

We have introduced rolling window rules to define constraints that need to apply over consecutive number of hours, days, or weeks:

  • Shifts worked in rolling window not in required range for employee

  • Days worked in rolling window not in required range for employee

  • Minutes worked in rolling window not in required range for employee

  • Consecutive days off in rolling window not in required range for employee

  • Consecutive minutes off in rolling window not in required range for employee

  • Shifts worked in rolling window not in preferred range for employee

  • Days worked in rolling window not in preferred range for employee

  • Minutes worked in rolling window not in preferred range for employee

  • Consecutive days off in rolling window not in preferred range for employee

  • Consecutive minutes off in rolling window not in preferred range for employee

This feature can help formulate constraints that need to be satisfied over a rolling window of time, for example:

  • Maximum 10 Sunday shifts worked in any 52-week period

  • Maximum 40 hours worked in any 7-day period

  • Minimum 11 consecutive hours off in any 24-hour period

0.37.0

Maximum number of unique tags per period per employee

We have introduced 2 new constraints to limit the number of unique tags that can be used to assign shifts to employees:

  • Constraint: unique tags per period not in required range for employee

  • Constraint: unique tags per period not in preferred range for employee

This feature can help limit the maximum number of unique tags that can be used to assign shifts to employees. For instance, shift types, routes, skills.

Configurable justifications in the recommendations API

When submitting a recommendations API request, you can specify an optional boolean includeJustifications query parameter to control whether constraint match justifications should be included in the response.

This is useful for getting more fine-grained information about the constraint matches, for instance to learn which period rule is violated by the recommended employee assignment.

Please see the Recommendations guide for more details.

Priorities on Contract Rules

Priorities have been added to contracts. This means some contracts can now have higher priority than others. By default, the highest priority is "1" and the lowest priority is "10". They respectively have the weights: 10 and 1. This means that a contract with priority "1" will have 10 times the impact of an identical contract with priority "10".

  • Employee Contract: Weight

This feature allows for granular control over how much contracts comparatively weigh in solutions. It comes in handy when there is a contract that defines a certain rule that is more important than another, e.g. Contract A defines periodRules which are more important than Contract B’s minutesBetweenShiftRules. In this example, we can set Contract A’s priority to 5 and Contract B’s priority to 10 (default).

Improved performance of the model

We have improved the performance of the model by introducing caching in constraints. We have observed a speedup of 10-50% of the calculation speed, depending on the dataset.

This will result in finding solutions quicker.

0.36.0

Fix days worked per period

When shifts spanned multiple days, counting the days over which the shift spanned wasn’t accurate for periods longer than 1 day and when using the periodShiftOverlapKind START_AND_END. This is now fixed.

  • Days worked per period no in required range for employee

  • Days worked per period no in preferred range for employee

This fix makes sure that shifts spanning multiple days will be accurately counted when using contract period rules with days worked per period and periodShiftOverlapKind set to START_AND_END.

Additional KPIs

We have added 4 new KPIs to provide more insights into solutions.

  1. Activated employees

  2. Total mandatory shifts scheduled

  3. Total optional shifts scheduled

  4. Total travel distance

See OpenAPI Spec or the Timefold Platform UI for a description of their meaning.

This update adds KPIs that will give more insights into the model output, including how many employees were assigned shifts in the schedule, the number mandatory and optional shifts that were scheduled, and the total travel distance.

Speedup of global rules

We have improved the performance and scalability of global rules.

The impacted constraints are:

  • Balance time worked

  • Balance shift count

  • Costs per period not in required range

  • Costs per period not in preferred range

  • Employee assignment disrupted on replanning

  • Shifts worked per period not in required range

  • Shifts worked per period not in preferred range

  • Shifts worked not in required hourly demand range

  • Concurrent shifts worked not in required range

This improvement will result in finding solutions quicker, especially for large datasets.

Deprecation of required minimum

A minimum with a REQUIRED satisfiability is now deprecated because it may be the cause of infeasible solutions when there is a lack of shifts in the input. Use the minimum with a PREFERRED satisfiability instead.

The impacted constraints are:

  • Minutes worked per period not in required range for employee

  • Logged minutes worked per period not in required range for employee

  • Shifts worked per period not in required range for employee

  • Days worked per period not in required range for employee

  • Shift types worked per period not in required range for employee

  • Consecutive days worked not in required range for employee

  • Shifts worked per period not in required range

  • Costs per period not in required range

  • Shifts worked not in required hourly demand range

This update will result in fewer infeasible solutions when using minimums in the listed constraints.

0.35.0

Input metrics

We have added 3 new input metrics that provide information on the dataset input:

  1. number of employees

  2. number of shifts

  3. number of pinned shifts

See OpenAPI Spec for a description of their meaning.

Configurable matching behaviour

The Cost Rules, Period Rules and Global Period Rules previously only checked whether a shift broke a rule if the shift started within the rule’s validity period. Now this behaviour can be configured to also compare the shift’s end time with the rule’s validity period. See the constraint documentation costs per period not in required range and costs per period not in preferred range and the employee contract documentation.

Added "concurrent shifts worked not in required range" constraint

We have added a new concurrent shifts worked not in required range constraint to control the maximum number of shifts that can take place at the same time. The feature is useful in scenarios where the shifts use a shared resource with limited capacity.

See concurrent shifts rules for more information.

Contract travel configurations

It is now possible to specify a list of travel configurations per contract. Each travel configuration can limit the distance from the home location to a shift’s location and the time between 2 shifts at different locations, within a certain time period. See the updated user guide for examples.

Global travel configurations are now deprecated.

0.34.0

Period rules can limit logged time

The contractual period rules can now specify minimum and maximum logged minutes evaluated against the new shift loggedTime attribute. This feature can be useful when limiting minimum/maximum shift hours that differ from the scheduled shift start to end interval, e.g. because breaks are not included in the shift working hours.

See Logged time and period rules and the constraint documentation for details on both REQUIRED and PREFERRED variants.

Added "required shift group assignment mode not met" constraint

We have added a new required shift group assignment mode not met constraint to specify the way the shifts are assigned within shift groups. The feature is useful in scenarios where a piece of work (e.g. product demonstration) should only be done once, but we have multiple time slots (shifts) available for it.

See shift group rules for more information.

0.33.0

Single-day pattern rules updates

We have added a custom move to facilitate matching of PREFERRED patterns.

You may also specify the weight of a single-day shift pattern in the relation to the other single-day patterns. See Employee works preferred single-day shift sequence pattern rule for more information.

The REQUIRED single-day patterns are now deprecated and will be removed in a future version in favour of PREFERRED patterns with a high weight.

Single Day Shift Patterns now have a property ordered (true by default). When set to false, the pattern can be matched even if the shifts don’t follow the same order as their respective pattern elements.

Day Light Saving for employees

Fixed a bug where DLS was not properly applied for employees. zoneOffset on employees is now deprecated in favour of timeZoneId.

For more information, please see:

  • Employee Time Zones

0.32.0

Visualization UI improvements

Shift tags are now displayed in the visualization.

0.31.0

Added activeDateTime and shutdownDateTime fields in model run information.

0.29.0

Limit scope of “minutes between shifts” rules

In Employee Contracts, you can specify the minimum or maximum time between shifts with minutesBetweenShiftsRules. You can now provide a scope for these rules. The scope will limit which pairs of shifts the rule is applied to. The scope excludes shift pairs where the start of the later shift is after the end of the prior shift plus the scope duration. See the updated Employee contracts: period rules for examples.

Mandatory and optional shift assignment

We have extended shift priorities to distinguish between mandatory (default) and optional shifts. Optional shifts are useful in scenarios when conformance with a soft constraint (e.g. a PREFERRED multi-day pattern rule) is more desired than having an extra shift assigned.

For more information, please see:

  • Mandatory and optional shifts

  • Unassigned mandatory shift

  • Unassigned optional shift

Multi-day pattern rules updates

We have added a custom move to facilitate matching of PREFERRED patterns.

You may also specify the weight of a multi-day shift pattern in the relation to the other multi-day patterns. See Employee works preferred multi-day shift sequence pattern rule for more information.

The weight can be used to migrate from REQUIRED patterns to PREFERRED patterns with high weight, see Upgrading to the latest versions for details.

0.28.0

Employees' preferences KPIs

We have added 4 new KPIs that provide information on the employees' preferences:

  1. Average Duration of Employees' Preferences Met

  2. Minimum Duration of Preferences Met Across Employees

  3. Average Duration Employee’s Unpreferences are Violated

  4. Maximum Duration of Unpreferences Violated Across Employees

See OpenAPI Spec or the Timefold Platform UI for a description of their meaning. These KPIs are marked as experimental and subject to change. We would love your feedback.

0.27.0

Multi-day pattern rules updates

We have fixed the multi-day pattern rules to correctly handle a pattern starting with OFF. Please note that if you use a pattern starting or ending with OFF, you must specify the planning window interval to ensure the pattern matches properly throughout the whole period you are planning for.

The REQUIRED multi-day patterns are now deprecated and will be removed in a future version in favour of PREFERRED patterns with a high weight.

See Employee works preferred multi-day shift sequence pattern rule for more information.

0.26.0

Added constraints to minimize gaps between shifts for an employee

We have added a constraint to prefer assigning employees to shifts that are close to each other to minimize the time between shifts. This is useful for cases where the employee works multiple shifts per day.

See Minimize gaps between shifts for employee rule for more information.

0.25.0

Improved demo datasets

We have replaced the existing demo datasets with new ones that are more realistic and better showcase the model’s features.

The new demo datasets cover basic Employee Shift Scheduling capabilities, Contract Period Rules, and Hourly Demand Rules.

Flexible shift priorities

We have added the ability to define custom priorities and weights for shifts. Whenever the model needs to choose between multiple shifts to assign to an employee, it will favor shifts with higher priority.

See Unassigned shift rule for more information.

Added constraints to check maximum number of locations worked for an employee

We extended the period rules to restrict the maximum number of locations an employee works during a period.

See documentation of the rules for more information:

  • Locations worked per period not in required range for employee

  • Locations worked per period not in preferred range for employee

0.24.0

Model renamed to "Employee Shift Scheduling"

We are renaming the “Employee Scheduling” model to “Employee Shift Scheduling” to distinguish between future other models involving scheduling for employees. (We are not changing API urls or entity names, because …)

Model marked as “Stable”

We have also marked this model as “Stable”, meaning that we promise backwards-compatibility for future minor releases.

"Unassigned shift" constraint no longer includes the shift’s duration in the penalty

We have removed the shift’s duration from the constraint’s penalty. We now only consider the shift’s assignmentPriority.

0.22.0

Added balance by time worked rule

We added a new Balance time worked rule.

Use this rule to make sure the time worked is balanced fairly across employees.

Added employee works shifts with preferred or required tags rules

Tags can now be used to define preferred and required shifts for employees.

See documentation of the rules for more information:

  • Employee works shifts with preferred tags

  • Employee works shifts with non-matching required tags

Improved tags documentation

We have improved our documentation related to tags to more clearly give an overview of their possible uses. See Tags and tag types for more information.

Improved performance of balance shift count rule

We fixed an issue in Balance shift count rule, that caused performance degradation for big datasets.

0.21.0

Fixed sequence handling in minutes between shifts rules

We fixed a bug for the Minutes between shifts rules, where the minimum was not always honored for shift sequences.

  • Minutes between shifts not in required range for employee

  • Minutes between shifts not in preferred range for employee

0.20.0

Period rule can optionally define a validity date time span

Period rule defined as a part of employee contract can now specify a validity date time span to further limit when the rule is applicable.

Please see Employee contract period rule for additional details.

0.19.0

Local date time replaced by date time with offset to UTC

All ISO 8601 local date time types have been replaced by ISO 8601 local date time with offset to UTC (Coordinated Universal Time) to support multiple time zones.

Please see Upgrading to the latest versions and Time zones and Daylight Saving Time (DST) for additional details.

Location constraints

Employees and shifts can now provide a location. This allows you to restrict the possible shifts where an employee can work and minimize the travel distance.

The following constraints have been added:

  • Maximum employee to shift travel distance exceeded

  • Minimum time between shifts including travel not met

  • Minimize travel distance

Priority can now be defined for employees

Employee preferences are more likely to be satisfied for employees with higher priority.

Affects the following constraints

  • Employee assignment disrupted on replanning

  • Minutes worked per period not in preferred range for employee

  • Shifts worked per period not in preferred range for employee

  • Days worked per period not in preferred range for employee

  • Shift types worked per period not in preferred range for employee

  • Consecutive days worked not in preferred range for employee

  • Employee is paired with preferred employee

  • Employee is paired with unpreferred employee

  • Employee works during preferred time

  • Employee works during unpreferred time

  • Employee has unpreferred shift near day off request

  • Preferred employee assigned

  • Unpreferred employee assigned

  • Minutes between shifts not in preferred range for employee

  • Employee does not have preferred daily shift pairing

  • Employee has unpreferred daily shift pairing

  • Employee works preferred single day shift sequence pattern

  • Employee works unpreferred single day shift sequence pattern

  • Employee works preferred multi day shift sequence pattern

  • Employee works unpreferred multi day shift sequence pattern

See employee priority.

0.18.0

Shifts worked per period constraints now support employee filtering

Affects the following constraints:

  • Shifts worked per period not in required range

  • Shifts worked per period not in preferred range

The filtering allows you to include, or exclude shifts worked by specific employee types. For example, you can consider only shifts worked by full time employees.

  • © 2025 Timefold BV
  • Timefold.ai
  • Documentation
  • Changelog
  • Send feedback
  • Privacy
  • Legal
    • Light mode
    • Dark mode
    • System default