{
  "resources": [
    {
      "name": "driver-1",
      "shifts": [{
        "from": "2024-03-15T08:00:00Z",
        "to": "2024-03-15T17:00:00Z",
        "breaks": [
          {
            "type": "FIXED",
            "from": "2024-03-15T12:00:00Z",
            "to": "2024-03-15T13:00:00Z"
          }
        ]
      }]
    }
  ],
  "jobs": [
    {
      "name": "delivery-1",
      "duration": 1800
    }
  ]
}

Break Management

Breaks are essential for driver safety, legal compliance, and operational efficiency. This guide covers how to configure various break types, locations, and timing constraints in your routing optimization.

Break Configuration Basics

Breaks are defined within resource shifts:

{
  "resources": [
    {
      "name": "driver-1",
      "shifts": [{
        "from": "2024-03-15T08:00:00Z",
        "to": "2024-03-15T17:00:00Z",
        "breaks": [
          {
            "type": "FIXED",
            "from": "2024-03-15T12:00:00Z",
            "to": "2024-03-15T13:00:00Z"
          }
        ]
      }]
    }
  ],
  "jobs": [
    {
      "name": "delivery-1",
      "duration": 1800
    }
  ]
}

Break Types

Fixed Breaks

Must occur at specific times:

{
  "breaks": [
    {
      "type": "FIXED",
      "from": "2024-03-15T12:00:00Z",
      "to": "2024-03-15T13:00:00Z"
    }
  ]
}

Windowed Breaks

Flexible timing within a window:

{
  "breaks": [
    {
      "type": "WINDOWED",
      "from": "2024-03-15T11:00:00Z",
      "to": "2024-03-15T14:00:00Z",
      "duration": 2700  // 45 minutes anytime in window
    }
  ]
}

Driving Breaks

Reset continuous driving time:

{
  "breaks": [
    {
      "type": "DRIVING",
      "duration": 2700,  // 45 minutes
      "after": 16200     // After 4.5 hours driving
    }
  ]
}

Break Locations

Location Options

{
  "type": "WINDOWED",
  "from": "2024-03-15T11:00:00Z",
  "to": "2024-03-15T14:00:00Z",
  "duration": 3600
}

Driver must return to starting location

Location Impact:

  • DEPOT: Adds travel time to/from depot
  • ANY: No travel time, taken at current location
  • Specific location: Travel time to break location

Break Timing Constraints

Break Before Finish

Ensure breaks complete before shift end:

{
  "shifts": [{
    "from": "2024-03-15T08:00:00Z",
    "to": "2024-03-15T17:00:00Z",
    "breakBeforeFinish": 7200,  // 2 hours before shift end
    "breaks": [{
      "type": "WINDOWED",
      "from": "2024-03-15T11:00:00Z",
      "to": "2024-03-15T15:00:00Z",  // Must finish by 15:00
      "duration": 3600
    }]
  }]
}

Multiple Breaks Example

{
  "shifts": [{
    "from": "2024-03-15T06:00:00Z",
    "to": "2024-03-15T18:00:00Z",
    "breaks": [
      {
        "type": "WINDOWED",
        "from": "2024-03-15T09:00:00Z",
        "to": "2024-03-15T10:30:00Z",
        "duration": 900,  // 15-minute morning break
        "location": "ANY"
      },
      {
        "type": "WINDOWED",
        "from": "2024-03-15T11:30:00Z",
        "to": "2024-03-15T13:30:00Z",
        "duration": 3600,  // 1-hour lunch
        "location": "DEPOT"
      },
      {
        "type": "WINDOWED",
        "from": "2024-03-15T15:00:00Z",
        "to": "2024-03-15T16:30:00Z",
        "duration": 900,  // 15-minute afternoon break
        "location": "ANY"
      }
    ]
  }]
}

Integration with Resumable Jobs

Breaks can interrupt long service jobs:

{
  "jobs": [
    {
      "name": "installation",
      "duration": 14400,  // 4 hours
      "resumable": true   // Can be paused for breaks
    }
  ],
  "resources": [{
    "name": "driver-1",
    "shifts": [{
      "from": "2024-03-15T08:00:00Z",
      "to": "2024-03-15T17:00:00Z",
      "breaks": [{
        "type": "FIXED",
        "from": "2024-03-15T12:00:00Z",
        "to": "2024-03-15T13:00:00Z"
      }]
    }]
  }]
}

Result: Installation runs 8:00-12:00 (4 hours), break 12:00-13:00, resumes 13:00 to completion

Complex Break Scenarios

EU driving regulations:

{
  "resources": [{
    "name": "long-haul-driver",
    "maxDriveTimeInSeconds": 16200,  // 4.5 hours
    "shifts": [{
      "from": "2024-03-15T06:00:00Z",
      "to": "2024-03-15T20:00:00Z",
      "breaks": [
        {
          "type": "DRIVING",
          "duration": 2700,  // 45 minutes
          "after": 16200     // After 4.5 hours driving
        },
        {
          "type": "WINDOWED",
          "from": "2024-03-15T11:00:00Z",
          "to": "2024-03-15T15:00:00Z",
          "duration": 3600  // Daily rest period
        }
      ]
    }]
  }],
  "jobs": [{
    "name": "long-distance-delivery",
    "duration": 1800
  }]
}

Field Service with Breaks

{
  "resources": [{
    "name": "technician",
    "shifts": [{
      "from": "2024-03-15T08:00:00Z",
      "to": "2024-03-15T17:00:00Z",
      "start": {"latitude": 52.520, "longitude": 13.405},
      "breaks": [
        {
          "type": "WINDOWED",
          "from": "2024-03-15T10:00:00Z",
          "to": "2024-03-15T10:30:00Z",
          "duration": 900
        },
        {
          "type": "WINDOWED", 
          "from": "2024-03-15T12:00:00Z",
          "to": "2024-03-15T14:00:00Z",
          "duration": 2700
        }
      ]
    }]
  }],
  "jobs": [{
    "name": "service-1",
    "duration": 3600
  }]
}

Best Practices

1

Plan for Travel Time

Depot breaks require round-trip travel time - position routes accordingly

2

Use Flexible Windows

Windowed breaks give solver more optimization options than fixed breaks

3

Consider Job Locations

“ANY” location breaks avoid unnecessary travel

4

Account for Regulations

Implement legal break requirements as hard constraints

Break Impact on Routes

The solver automatically:

  • Schedules breaks within allowed windows
  • Adds travel time for depot/specific location breaks
  • Splits resumable jobs around breaks
  • Ensures breaks don’t violate time windows
  • Optimizes break placement to minimize disruption

Common Issues:

  • Insufficient time for depot breaks including travel
  • Break windows conflicting with job time windows
  • Too many fixed breaks reducing flexibility

Performance Considerations

Troubleshooting