Features

Maximum route duration

A how-to guide for using maximum route duration with vehicle routing.

This feature is configurable via .json input, without the need for code customization and is available for both the Marketplace app and Platform. You can find a list of all available features here.

This how-to guide assumes you already completed the get started with vehicle routing tutorial.

Field nameRequiredData typeSI UnitDefined onExampleConfigurable via defaults
max_durationNointsecondsvehicle{"max_duration": 123}

It may be useful to set a hard limit on the maximum duration of a route for a vehicle. For example, if the vehicle or vehicle driver has a limited availability. This limit can be set via the max_duration feature on vehicles. The duration is given in seconds.

Please note that the max_duration includes any time spent traveling, waiting at stops, and servicing them.

When defining start_time and end_time on a vehicle there is a time duration defined by end_time - start_time. The route duration is limited by the most constrained duration between end_time - start_time and max_duration.

Here is an example defining different maximum durations for vehicles. A sample output obtained after solving the problem is also shown.

{
  "defaults": {
    "vehicles": {
      "speed": 5,
      "start_time": "2023-01-01T12:00:00Z"
    },
    "stops": {
      "unplanned_penalty": 20000,
      "duration": 300
    }
  },
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.772695, "lat": 34.967146 }
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 }
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 }
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 }
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 }
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 }
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 }
    }
  ],
  "vehicles": [
    {
      "id": "v1",
      "max_duration": 1800
    },
    {
      "id": "v2",
      "max_duration": 1200
    }
  ]
}
Copy

Page last updated