Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
  • Platform
Try models
  • Employee Shift Scheduling
  • User guide
  • Constraints

Employee Shift Scheduling

    • Introduction
    • Planning AI concepts
    • Metrics and optimization goals
    • Getting started with employee shift scheduling
    • Understanding the API
    • User guide
      • Terms
      • Planning window
      • Time zones and Daylight Saving Time (DST)
      • Tags and tag types
      • Constraints
      • Score analysis
    • Employee resource constraints
      • Employee availability
      • Employee contracts
      • Work limits
        • Work limits
        • Minutes worked per period
        • Minutes worked in a rolling window
        • Minutes logged per period
        • Days worked per period
        • Days worked in a rolling window
        • Consecutive days worked
        • Shifts worked per period
        • Shifts worked in a rolling window
        • Weekend minutes worked per period
        • Weekends worked per period
        • Weekends worked in a rolling window
        • Consecutive weekends worked
      • Time off
        • Time off
        • Days off per period
        • Consecutive days off per period
        • Consecutive days off in a rolling window
        • Consecutive minutes off in a rolling window
        • Shifts to avoid close to day off requests
      • Shift rotations and patterns
        • Shift rotations and patterns
        • Shift rotations
        • Single day shift sequence patterns
        • Minimize gaps between shifts
        • Multi-day shift sequence patterns
        • Daily shift pairings
        • Overlapping shifts
        • Shift start times differences
        • Minutes between shifts
      • Shift type diversity
        • Shift type diversity
        • Shift types worked per period
        • Unique tags per period
      • Fairness
        • Fairness
        • Balance time worked
        • Balance shift count
      • Pairing employees
      • Shift travel and locations
    • Shift service constraints
      • Alternative shifts
      • Cost management
      • Demand-based scheduling
      • Mandatory and optional shifts
      • Shift assignments
      • Skills and risk factors
    • Recommendations
    • Real-time planning
    • Changelog
    • Upgrade to the latest version
    • Feature requests

Constraints

Constraints can be considered hard, medium, or soft.

Hard constraints represent rules and limitations of the real world that any planning solution has to respect. For instance, there are only 24 hours in a day and people can only be in one place at a time. Hard constraints also include rules that must be adhered to, for instance, employee contracts.

Breaking hard constraints would result in infeasible plans.

Medium constraints help manage plans when resources are limited, for instance, when there aren’t enough employees to work all the available shifts. Medium constraints incentivize Timefold Platform to assign as many shifts as possible.

Soft constraints help optimize plans based on the business goals, for instance, assign employees to their preferred shifts.

To help determine the quality of the solution, plans are assigned a score with values for hard, medium, and soft constraints.

"0hard/-257medium/-6119520soft"

From this example score we can see zero hard constraints were broken, while both the medium and soft scores have negative values (the scores do not show how many constraints were broken, but values associated with those constraints).

Because breaking hard constraints would result in an infeasible solution, a solution that breaks zero hard constraints and has a soft constraint score of -1,000,000 is better than a solution that breaks one hard constraint and has a soft constraint score of 0.

To learn more about individual constraints, see the Employee resource constraints and Shift service constraints guides.

1. Constraint weight overrides

Every constraint has a default weight of 1, meaning that all constraints are equally important. Use this to express preference of some constraints over others. For example, in order to express that the employee pairing constraint is more important than the rest of the constraints, set the value of the employeeIsPairedWithPreferredEmployeeWeight attribute to 10. In order to turn off a constraint, set the value of the corresponding attribute to 0.

"config": {
  "overrides": {
     "employeeIsPairedWithPreferredEmployeeWeight": 10,
     "employeeWorksDuringPreferredTimeWeight": 0
  }
}
  • © 2025 Timefold BV
  • Timefold.ai
  • Documentation
  • Changelog
  • Send feedback
  • Privacy
  • Legal
    • Light mode
    • Dark mode
    • System default