Features

Maximum wait time

A how-to guide for using maximum wait times 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.

The format for timestamps should be RFC3339, e.g.: "2023-01-01T00:00:00Z".

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

Field nameRequiredData typeSI UnitDefined onExampleConfigurable via defaults
max_waitNointsecondsvehicle{"max_wait": 123}
max_waitNointsecondsstop{"max_wait": 123}

The max_wait feature is the maximum amount of time, in seconds, a vehicle is allowed to wait at a stop for the start_time_window to open, in case the vehicle arrives at the stop early.

  • When defining max_wait on a stop, the vehicle waiting time at the stop is limited.
  • When defining max_wait on a vehicle, the total waiting time aggregated for all assigned stops ain the vehicle's route is limited.
  • max_wait can be defined on both stops and vehicles.
  • If the vehicle has to wait at a stop, there is additional information displayed on the output, such as the waiting_duration for a stop or the route_waiting_duration for a vehicle.

Please note that waiting time is constrained only for stops that have a start_time_window defined. This happens because there is no waiting time if there is no earliest start time defined for the stop.

Here is an example that defines the maximum wait time for stops. A sample output obtained after solving the problem is also shown.

{
  "defaults": {
    "vehicles": {
      "speed": 15,
      "start_time": "2023-01-01T12:00:00Z"
    },
    "stops": {
      "unplanned_penalty": 20000,
      "duration": 10,
      "max_wait": 1800
    }
  },
  "stops": [
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "max_wait": 600,
      "start_time_window": ["2023-01-01T12:20:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "max_wait": 600,
      "start_time_window": ["2023-01-01T12:05:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:45:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.77159, "lat": 34.96714 }
    }
  ],
  "vehicles": [
    {
      "id": "v1"
    }
  ]
}
Copy

Here is another example that defines the maximum wait time for a vehicle. Notice that the max_wait is noticeably larger compared to the first example, given that when the feature is defined on the vehicle, the aggregate waiting time is the one constrained. A sample output obtained after solving the problem is also shown.

{
  "defaults": {
    "vehicles": {
      "speed": 15,
      "start_time": "2023-01-01T12:00:00Z",
      "max_wait": 600
    },
    "stops": {
      "unplanned_penalty": 20000
    }
  },
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:45:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:05:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:10:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "max_wait": 300,
      "start_time_window": ["2023-01-01T12:15:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:05:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.77159, "lat": 34.96714 },
      "start_time_window": ["2023-01-01T12:20:00Z", "2023-01-01T13:00:00Z"]
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.77159, "lat": 34.96714 }
    }
  ],
  "vehicles": [
    {
      "id": "v1"
    },
    {
      "id": "v2",
      "max_wait": 1200
    }
  ]
}
Copy

Page last updated