Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
    • Pick-up and Delivery Routing
    • Task Scheduling
  • Platform
Start Free Trial
  • Employee Shift Scheduling
  • More information
  • FAQs
  • Constraints and weights
  • latest
    • latest
    • 1.38.x
    • 1.37.x

Employee Shift Scheduling

  • The basics
    • Introduction
    • Getting started: Hello world
    • Lessons overview
      • Lesson 1
      • Lesson 2
      • Lesson 3
      • Lesson 4
      • Interlude 1: Basic demo data
      • Lesson 5
      • Lesson 6
      • Lesson 7
    • User guide
      • Terminology
      • Use case guide
      • Scheduling API concepts
      • Integration
      • Constraints
      • Using the API
        • Using the OpenAPI spec
        • API tooling
      • Demo datasets
      • Input datasets
        • Model configuration
        • Model input
        • Planning window
      • Planning window
      • Time zones and Daylight Saving Time (DST)
      • Tags and tag types
      • Input validation
      • Output datasets
        • Metadata
        • Model output
        • Input metrics
        • Key performance indicators (KPIs)
      • Metrics and optimization goals
      • Score analysis
      • Visualization
      • Efficiency X-Ray
      • Assignability analysis
  • Feature guides
    • Employee resource constraints
      • Employee availability and preferences
        • Employee availability
        • Employee preferences
      • Employee contracts
      • Employee priority
      • Pairing employees
      • Employee groups
      • Shift travel and locations
      • Shift Breaks
      • Employee activation
      • 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
        • Consecutive shifts worked
      • 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
        • Consecutive weekends off per period
      • 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 tag types
        • Shift types worked per period
        • Unique tags per employee per period
      • Fairness
        • Balance time worked
        • Balance shift count
    • Shift service constraints
      • Alternative shifts
      • Cost management
        • Cost groups
        • Employee rates
      • Demand-based scheduling
      • Priority and optional shifts
      • Skills and risk factors
      • Shift assignments
        • Shift selection
        • Employee selection
    • Scenarios
      • Configuring labor law compliance
      • Configuring employee well-being
      • Self-rostering and optimization
  • Responding to change
    • Manual intervention
    • Recommendations
    • Real-time planning
  • More information
    • FAQs
      • Constraints and weights
      • Modeling your planning problem
      • Planning horizon and replanning
    • Changelog
    • Upgrade to the latest version
    • Feature requests
Ask Claude Ask ChatGPT

Constraints and weights

Answers to common questions about constraints and weights in the Employee Shift Scheduling model.

  • Which rules should be hard constraints and which should be soft?
  • What should my plans optimize for?
  • How do I choose values for constraint weights?
  • Should I create a configuration profile for each client?
  • If I build Timefold into my own planning software, should my users be able to change constraint weights?
  • How do I handle planning rules that are inconsistent or undocumented?
  • What if the model doesn’t support one of my rules?

Which rules should be hard constraints and which should be soft?

When deciding to use hard or soft constraints, make a rule hard only when a plan that breaks it can’t be used, for instance because it breaks a law, a safety rule, or a physical limit. Make every other rule soft.

The Employee Shift Scheduling model will avoid breaking hard constraints. If it can’t assign work without breaking one, it leaves the work unassigned and shows it as unassigned in the output dataset. Medium constraints push the model to assign as much work as possible, and soft constraints compete with each other based on their weights. Every hard rule you add limits the options the model has, so too many hard rules lead to more unassigned work.

You don’t set the level of each constraint yourself. Each constraint in the model has a fixed level, and many rules have a required version (hard) and a preferred version (soft). You choose the level by which version you use in your input dataset.

For rules with some flexibility, use both versions together. For instance, if employees usually work 40 hours a week but can work up to 48, add a PREFERRED period rule with a minutesWorkedLimit maximum of 2400 minutes and a REQUIRED period rule with a maximum of 2880 minutes. The model then avoids extra hours, but assigns them when covering more shifts is worth the cost.

Constraints that depend on optional input only apply when your input dataset includes that data.

For more information, see Constraints.

What should my plans optimize for?

Optimize for the goals that cost your business the most when a plan gets them wrong.

The right goals depend on your business, so organizations with similar operations often optimize for different things. For instance, one organization accepts overtime to meet its service level agreements, while another limits overtime because it leads to high employee turnover.

To choose your goals:

  1. Decide which metrics matter most to your business and rank them by importance.

  2. Review the example optimization goals for the Employee Shift Scheduling model.

  3. Tune the constraint weights that affect those metrics, as described in How do I choose values for constraint weights?.

Your goals can change over time. For instance, some organizations allow more overtime at the end of a quarter to clear a backlog. Create a configuration profile for each set of goals, and select the profile that matches your current goals when you solve a dataset.

How do I choose values for constraint weights?

Start with the default weights, and change them only when a plan doesn’t match what your planners expect. The Employee Shift Scheduling model’s defaults are set to balance its optimization goals.

Weights are relative. A constraint with a weight of 0 turns the constraint off. Doubling a constraint weight doubles the impact of the constraint. Multiplying every weight by the same number doesn’t change the plan.

Doubling a weight doesn’t halve the related metric. Constraints compete with each other, so the only way to see the effect of a change is to solve datasets with the new weights and compare the results.

To tune the weights:

  1. Find the output metric that doesn’t meet expectations, for instance too much overtime.

  2. Use score analysis to find the constraints that affect that metric.

  3. Change the weights of those constraints in a new configuration profile.

  4. Solve representative datasets with the new profile.

  5. Compare the results. Use the comparison UI for out-of-the-box metrics or your own tool for custom metrics. Check that the metric improved and that no other important metric got worse.

  6. Repeat for the next metric that doesn’t meet expectations.

Hard and medium constraints always take priority over soft constraints, so a higher soft weight never causes the model to break a hard or medium constraint. If increasing a soft weight has no effect on the plan, a hard or medium constraint is probably preventing the change.

The same happens when there aren’t enough resources to assign all the work. Assigning as much work as possible leaves the model few options, so changing soft weights has little effect on the plan.

Weights have a maximum value of 1,000,000,000,000 (one trillion).

For more information, see Metrics and optimization goals and Balancing different optimization goals.

Should I create a configuration profile for each client?

Yes. A configuration profile saves a set of constraint weights, model configuration, and solve settings, so every dataset you solve with that profile uses the same settings. Create a profile for each client, site, or planning scenario that needs different settings. You can add up to 50 configuration profiles for the Employee Shift Scheduling model.

To add a profile, log in to Timefold Platform, select the Employee Shift Scheduling model, and select Configuration profiles. You can also manage profiles with the Platform API.

To use a profile, add its ID to the POST URL when you submit a dataset, for instance ?configurationId=b7eef8b5-14ca-4a45-a943-582381bd1b08. You can also select the profile in the platform UI when you create or re-solve a dataset. Datasets that don’t specify a profile use the default profile. Learn about using configuration profiles.

Use configuration overrides in the input dataset only for values that change from one dataset to the next. Overrides in the input dataset take priority over the profile.

Before you change a profile’s weights, check that your input datasets include the data needed by the related constraints. For instance, the weight of a constraint about preferences has no effect if your input datasets don’t include any preferences.

For more information, see Configuration profiles and parameters.

If I build Timefold into my own planning software, should my users be able to change constraint weights?

In most cases, no. Give your users a small number of named choices instead, and change the weights behind the scenes.

When planners can change every weight, they tend to keep adjusting the settings and re-solving the plan. Planning becomes a manual process again, and planners lose the time that automatic scheduling saves.

Instead, offer one of the following:

  • One default setting that works for most of your clients.

  • Two or three named options that match your clients' goals, for instance "Lowest cost" and "Fairest workload". Each option uses its own configuration profile.

  • A slider between two goals, for instance cost and employee preferences, that changes several weights at once.

If your users are experienced planners who understand the trade-offs between goals, you can give them access to more of the weights. Seeing what the model takes into account can help them trust the plan.

For more information, see Constraints.

How do I handle planning rules that are inconsistent or undocumented?

Start with the rules a plan must follow to be usable, then add rules until your planners accept the plan.

Planning rules often come from different places. Some are laws or contracts, some exist only in a planner’s head, and some are habits that nobody has questioned. Try to identify different sources of rules, for instance, managers and department heads will be able to tell you the rules that are important to their teams. Treat each rule as real until you’ve tested it, but don’t assume every rule must be a hard constraint.

Before you make a rule hard, check your past schedules against it. Past schedules often break rules that planners describe as fixed. Submit one of your past schedules, with its assignments, to score analysis to see which constraints it breaks. If your past schedules regularly break a rule, use the preferred (soft) version of the rule instead of the required (hard) version.

To find out whether a rule is worth its cost, solve the same dataset with and without the rule, and compare the results with your planners. If the plan without the rule is better and still acceptable, you can relax or remove the rule.

For more information, see Which rules should be hard constraints and which should be soft?.

What if the model doesn’t support one of my rules?

First, check whether an existing constraint already covers the rule. The Employee Shift Scheduling model includes constraints for the most common planning rules, and many rules that seem specific to your business can be expressed with existing features. For instance, a rule about who can work at which location can often be expressed with tags.

To check, see Constraints for the constraints grouped by feature, or the full constraint list on the model’s information page in Timefold Platform. If you find the rules don’t quite fit your use case, contact us for help.

If no existing constraint covers the rule, contact us with a description of the rule, including its edge cases and why your business needs it. You can also submit or vote for a request on the feature requests board.

You can’t add your own constraints to the Employee Shift Scheduling model. New constraints are added by Timefold and announced in the changelog. Some new constraints are disabled by default, so check the changelog entry to see whether you need to set a weight to enable it.

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