Skip to content

Breaks

The Breaks feature allows you to plan rest stops for vehicles.


What are Breaks?

Breaks define the times and durations during which vehicles must take rest stops on long-distance routes. They are used for legal driver break requirements.


Basic Usage

BreakConstraint Structure

{
  "vehicles": [
    {
      "id": "vehicle_1",
      "breaks": [
        {
          "time_windows": [["12:00:00", "14:00:00"]],
          "service": 1800,
          "description": "Lunch break"
        }
      ]
    }
  ]
}

BreakConstraint Fields

Field Type Required Description
time_windows [[String,String]] Yes Allowed break time windows
service Integer ≥ 0 Optional Break duration (seconds)
description String Optional Break description
max_load [Integer] Optional Maximum load allowed during the break

NOTE: time_windows is plural and an array. Multiple time ranges can be provided.


Use Cases

1. Lunch Break

{
  "breaks": [
    {
      "time_windows": [["12:00:00", "14:00:00"]],
      "service": 2700,
      "description": "Lunch break (45 min)"
    }
  ]
}

45-minute break every 4.5 hours:

{
  "breaks": [
    {
      "time_windows": [["04:30:00", "05:00:00"], ["09:00:00", "09:30:00"]],
      "service": 2700,
      "description": "Legal break"
    }
  ]
}

3. Multiple Breaks

{
  "breaks": [
    {
      "time_windows": [["10:00:00", "10:30:00"]],
      "service": 900,
      "description": "Coffee break"
    },
    {
      "time_windows": [["13:00:00", "14:00:00"]],
      "service": 2700,
      "description": "Lunch"
    }
  ]
}

Configuration

Time Windows

Multiple time ranges can be specified. The vehicle will take a break within one of these ranges:

{
  "time_windows": [
    ["10:00:00", "11:00:00"],
    ["15:00:00", "16:00:00"]
  ]
}

Service Duration

Break duration is specified in seconds:

Duration Seconds
15 min 900
30 min 1800
45 min 2700
1 hour 3600

Python Example

import requests

API_BASE_URL = "https://api.flio.ai"
API_KEY = "YOUR-API-KEY"

payload = {
    "vehicles": [
        {
            "id": "vehicle_1",
            "start": {"latitude": 41.0082, "longitude": 28.9784},
            "time_window": ["08:00:00", "18:00:00"],
            "breaks": [
                {
                    "time_windows": [["12:00:00", "13:00:00"]],
                    "service": 2700,
                    "description": "Lunch break"
                }
            ]
        }
    ],
    "jobs": [...],
    "options": {"minimize": "cost"}
}

url = f"{API_BASE_URL}/solver/optimize?apiKey={API_KEY}"
response = requests.post(url, json=payload)
result = response.json()

Breaks (Break Planning) — Flio.ai

Next Steps