Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
    • Pick-up and Delivery Routing
  • Platform
Try models
  • Pick-up and Delivery Routing
  • Driver resource constraints
  • Route optimization

Pick-up and Delivery Routing

    • Introduction
    • Getting started: Hello world
    • User guide
      • Terminology
      • Use case guide
      • Planning AI concepts
      • Integration
      • Constraints
      • Understanding the API
      • Demo datasets
      • Input datasets
        • Model configuration
        • Model input
        • Planning window
      • Input validation
      • Output datasets
        • Metadata
        • Model output
        • Input metrics
        • Key performance indicators (KPIs)
      • Routing with Timefold’s maps service
      • Metrics and optimization goals
    • Driver resource constraints
      • Lunch breaks and personal appointments
      • Route optimization
      • Shift hours and overtime
      • Driver capacity
    • Job service constraints
      • Time windows and opening hours
      • Skills
      • Multi-day schedules and movable stops
      • Dependencies between stops
      • Priority jobs and optional jobs
      • Stop service level agreement (SLA)
      • Job requirements and tags
        • Job required drivers
        • Job pooling
        • Prohibit job combinations
        • Maximum time burden
        • Tags
    • Recommendations
      • Job time window recommendations
      • Stop time window recommendations
    • Real-time planning
      • Real-time planning: pinning stops
    • Changelog
    • Upgrading to the latest versions
    • Feature requests

Route optimization

By default, Timefold optimizes routes to minimize the amount of time drivers spend driving between stops. This lowers costs, reduces emissions, and makes drivers more productive as they spend less time driving.

1. Minimize travel time

The Minimize travel time soft constraint is invoked when a stop is assigned to a driver route. The constraint adds a soft penalty to the dataset score for every second of travel time in the route plan, which is calculated based on the travel time between stops and breaks in the driver shift itinerary.

Soft constraints compete with each other as the solver optimizes the final solution. That means this constraint may leave jobs unassigned in favor of jobs with different soft constraints.

Every soft constraint has a weight that can be configured to change the relative importance of the constraint compared to other constraints.

Learn about constraint weights.

2. Required reachable itineraries and stops

Every driver shift itinerary needs to represent a route that is reachable on the map. For instance, a shift starting on the mainland cannot be assigned a job stop located on an island which is not connected by a route to the mainland.

In case a driver shift itinerary contains an unreachable route, it gets penalized with a hard score penalty by one or both of the following constraints:

  • Do not assign unreachable routes: Penalizes a driver shift itinerary that contains an unreachable route caused by an unreachable stop, break, or shift end location.

  • Only assign reachable stops: Penalizes a stop which is unreachable from the location of the previous stop in the itinerary or the driver shift start location (in the case of the first stop in the itinerary).

The model output elements DriverShiftPlan, StopPlan and BreakPlan contain the unreachable boolean attribute indicating:

  • DriverShiftPlan.unreachable = true: The driver shift itinerary contains a route between two locations that is unreachable on the map, such a route can be:

    • From the driver shift start location to the first stop or break with location.

    • From a break with location to the next break with location or the next stop.

    • From a stop to the next break with location or the next stop.

    • From the last stop or break with location to the driver shift end location.

  • StopPlan.unreachable = true: The previous itinerary item is unreachable or the route from the previous stop, location break, or driver shift start to the stop location is not reachable on the map.

  • BreakPlan.unreachable = true: The previous itinerary item is unreachable or the route from the previous stop, location break, or driver shift start to the break location is not reachable on the map.

The unreachable attribute is omitted when false to avoid increasing payload size.

Example of model output containing an unreachable route to Stop A and Break B in a driver shift itinerary:

{
  "shifts": [
    {
      "id": "Ann - Monday",
      "itinerary": [
        {
          "id": "Stop A",
          "kind": "STOP",
          "unreachable": true
        },
        {
          "id": "Break B",
          "kind": "BREAK",
          "startTime": "2026-01-12T14:00:00-04:00",
          "endTime": "2026-01-12T15:00:00-04:00",
          "unreachable": true
        }
      ],
      "unreachable": true
    }
  ]
}

Next

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

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