Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
    • Pick-up and Delivery Routing
  • Platform
Try models
  • Field Service Routing
  • User guide
  • Constraints

Field Service Routing

    • Introduction
    • Getting started: Hello world
    • User guide
      • Terms
      • Planning AI concepts
      • Constraints
      • Understanding the API
      • Demo datasets
      • Planning window
      • Model configuration
      • Configuration overrides
      • Time zones and daylight-saving time (DST)
      • Routing with Timefold’s maps service
      • Validation
      • Model response
      • Key performance indicators (KPIs)
      • Metrics and optimization goals
    • Vehicle resource constraints
      • Shift hours and overtime
      • Lunch breaks and personal appointments
      • Fairness
      • Route optimization
      • Technician coverage area
      • Technician costs
      • Technician ratings
    • Visit service constraints
      • Time windows and opening hours
      • Skills
      • Visit dependencies
      • Visit requirements
      • Multi-vehicle visits
      • Movable visits and multi-day schedules
      • Priority visits and optional visits
      • Visit service level agreement (SLA)
    • Recommendations
      • Visit time window recommendations
      • Visit group time window recommendations
    • Real-time planning
      • Real-time planning: extended visit
      • Real-time planning: reassignment
      • Real-time planning: emergency visit
      • Real-time planning: no show
      • Real-time planning: technician ill
      • Real-time planning: pinning visits
    • Real-time planning (preview)
      • Real-time planning: extended visit (preview)
      • Real-time planning: reassignment (preview)
      • Real-time planning: emergency visit (preview)
      • Real-time planning: no show (Preview)
      • Real-time planning: technician ill (Preview)
      • Real-time planning: pinning visits (preview)
    • Scenarios
      • Long-running visits
    • Changelog
    • Upgrade to the latest version
    • Feature requests

Constraints

1. Overview

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, technicians must have specific skills for specific jobs.

Breaking hard constraints results in infeasible plans.

Medium constraints help manage plans when resources are limited, for instance, scheduling as many mandatory visits as possible. Medium constraints incentivize Timefold Platform to assign as many customer visits as possible.

Soft constraints help optimize plans based on the business goals, for instance, minimizing travel time.

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

0hard/-257medium/-6119520soft

Timefold examines many solutions during solving and is incentivized to use the solution with the highest score.

From the example score above, you 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 1 hard constraint but has a soft constraint score of 0.

It’s important to note that constraints have competing goals, for instance, a constraint that is concerned with fairness or load balancing may result in a solution that takes longer to execute, whereas constraints concerned with shortening the overall solution time may result in a solution that isn’t fairly disrupted among the available resources.

Timefold balances the competing priorities of constraints to arrive at solutions with the best overall score.

2. Field service routing constraint groups and constraints

Constraints are grouped together with similar constraints into constraint groups. The following constraint groups are available in field service routing.

Vehicle resource constraints:

  • Shift hours and overtime

  • Lunch breaks and personal appointments

  • Fairness

  • Route optimization

  • Technician coverage area

  • Technician costs

  • Technician ratings

Visit service constraints:

  • Time windows and opening hours

  • Skills

  • Visit dependencies

  • Visit requirements

  • Multi-vehicle visits

  • Movable visits and multi-day schedules

  • Priority visits and optional visits

  • Visit service level agreement (SLA)

3. Constraint weights

Every constraint has a weight and a match score that will be applied to the dataset score every time the constraint is matched.

The final score for an instance of a constraint being matched is calculated by multiplying the constraint weight by the match score.

Active soft constraints have a default weight of 1, meaning that all soft constraints are equally weighted. Constraint weights can be changed to make some constraints more important than others.

A constraint with a weight of 10, increases the impact of the score by a factor of 10 (10 * match score).

When a constraint has a weight of 0, the constraint score has no impact.

The match score is derived from the penalty or reward constraints apply when they are matched.

For instance, if a rule specifies a technician should finish work at 17:00, but the technician is assigned overtime and does not arrive at their end location until 17:10, the Max shift end time (soft) will return a score of -600 (the penalty is derived from every second between the time they should have finished and the time they did finish).

If the maxSoftShiftEndTimeWeight (which sets the weight of the Max shift end time (soft) constraint) is set to 1, the final soft score for this instance of the constraint matching will be -600. If the maxSoftShiftEndTimeWeight is set to 2, the final soft score for this instance of the constraint matching will be -1200.

3.1. Constraint weight configuration

Constraint weights can be configured in individual input datasets or as part of a configuration profile that can be reused with future input datasets.

You can access the list of available constraint weights in the configuration profiles.

3.1.1. Configure a configuration profile

Constraint weights can be configured in Timefold Platform by creating a configuration profile and setting the weight in the configuration profile.

Setting the constraint weights in a configuration profile ensures the same weights are used whenever the configuration profile is applied to a dataset.

To configure constraint weights:

  1. Log in to Timefold Platform: app.timefold.ai

  2. Select the field service routing tile.

  3. Select Configuration profiles.

  4. Add a new configuration profile (or modify an existing profile) and configure the constraint weights.

The configuration profile can be specified when you submit a new dataset by appending a query parameter with the configuration profile name to the POST URL.

For instance, if the configuration profile is called test, the query parameter would be: ?configurationId=test

Learn more about configuration parameters and profiles.

3.1.2. Configure constraint weights in an input dataset

Constraint weights can be configured per JSON input dataset.

For instance, to set the exampleWeight to 10 add the following:

{
  "config": {
    "model": {
      "overrides": {
        "exampleWeight": 10
      }
    }
  }
}

Next

  • See the full API spec or try the online API.

  • Learn more about field service routing from our YouTube playlist.

  • Learn about balancing different optimization goals.

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