Maximum wait time¶
Info
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.
Info
The format for timestamps should be RFC3339, e.g.:
"2023-01-01T00:00:00Z".
| Field name | Required | Data type | SI Unit | Defined on | Example | Configurable via defaults |
|---|---|---|---|---|---|---|
max_wait |
No | int |
seconds |
vehicle |
{"max_wait": 123} |
✅ |
max_wait |
No | int |
seconds |
stop |
{"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_waiton a stop, the vehicle waiting time at the stop is limited. - When defining
max_waiton a vehicle, the total waiting time aggregated for all assigned stops ain the vehicle's route is limited. max_waitcan 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_durationfor a stop or theroute_waiting_durationfor 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"
}
]
}
{
"options": {
"check": {
"duration": 30000000000,
"verbosity": "off"
},
"format": {
"disable": {
"progression": true
}
},
"model": {
"constraints": {
"disable": {
"attributes": false,
"capacities": null,
"capacity": false,
"distance_limit": false,
"groups": false,
"maximum_duration": false,
"maximum_stops": false,
"maximum_wait_stop": false,
"maximum_wait_vehicle": false,
"mixing_items": false,
"precedence": false,
"start_time_windows": false,
"vehicle_end_time": false,
"vehicle_start_time": false
},
"enable": {
"cluster": false
}
},
"objectives": {
"capacities": "",
"cluster": 0,
"distance": 0,
"early_arrival_penalty": 1,
"late_arrival_penalty": 1,
"min_stops": 1,
"stop_balance": 0,
"travel_duration": 0,
"unplanned_penalty": 1,
"vehicle_activation_penalty": 1,
"vehicles_duration": 1
},
"properties": {
"disable": {
"duration_groups": false,
"durations": false,
"initial_solution": false,
"stop_duration_multipliers": false
},
"maximum_time_horizon": 15552000
},
"validate": {
"disable": {
"resources": false,
"start_time": false
},
"enable": {
"matrix": false,
"matrix_asymmetry_tolerance": 20
}
}
},
"solve": {
"duration": 10000000000,
"iterations": 50,
"parallel_runs": 1,
"plateau": {
"absolute_threshold": -1,
"delay": 0,
"duration": 0,
"iterations": 0,
"relative_threshold": 0
},
"run_deterministically": true,
"solver": {
"plan_group_size": {
"delta": 0,
"delta_after_iterations": 1000000000,
"max_value": 2,
"min_value": 2,
"snap_back_after_improvement": true,
"start_value": 2,
"zigzag": true
},
"unplan_units": {
"delta": 2,
"delta_after_iterations": 125,
"max_value": -1,
"min_value": 2,
"snap_back_after_improvement": true,
"start_value": 2,
"zigzag": true
},
"unplan_weights": "Vehicle:3,Island:1,Location:293"
},
"start_solutions": 1
}
},
"solutions": [
{
"objective": {
"name": "1 * vehicles_duration + 1 * unplanned_penalty",
"objectives": [
{
"base": 310,
"factor": 1,
"name": "vehicles_duration",
"value": 310
},
{
"base": 40000,
"factor": 1,
"name": "unplanned_penalty",
"value": 40000
}
],
"value": 40310
},
"unplanned": [
{
"id": "Kinkaku-ji",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
{
"id": "Kyoto Imperial Palace",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
}
],
"vehicles": [
{
"id": "v1",
"route": [
{
"arrival_time": "2023-01-01T12:00:00Z",
"cumulative_travel_duration": 0,
"duration": 10,
"end_time": "2023-01-01T12:00:10Z",
"start_time": "2023-01-01T12:00:00Z",
"stop": {
"id": "Arashiyama Bamboo Forest",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
},
{
"arrival_time": "2023-01-01T12:00:10Z",
"cumulative_travel_duration": 0,
"duration": 10,
"end_time": "2023-01-01T12:05:10Z",
"start_time": "2023-01-01T12:05:00Z",
"stop": {
"id": "Gionmachi",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0,
"waiting_duration": 290
}
],
"route_duration": 310,
"route_stops_duration": 20,
"route_travel_duration": 0,
"route_waiting_duration": 290
}
]
}
],
"statistics": {
"result": {
"custom": {
"activated_vehicles": 1,
"max_duration": 0.123,
"max_stops_in_vehicle": 2,
"max_travel_duration": 0.123,
"min_duration": 0.123,
"min_stops_in_vehicle": 2,
"min_travel_duration": 0.123,
"unplanned_stops": 2
},
"duration": 0.123,
"value": 0.123
},
"run": {
"duration": 0.123,
"iterations": 50
},
"schema": "v1"
},
"version": {
"sdk": "VERSION"
}
}
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
}
]
}
{
"options": {
"check": {
"duration": 30000000000,
"verbosity": "off"
},
"format": {
"disable": {
"progression": true
}
},
"model": {
"constraints": {
"disable": {
"attributes": false,
"capacities": null,
"capacity": false,
"distance_limit": false,
"groups": false,
"maximum_duration": false,
"maximum_stops": false,
"maximum_wait_stop": false,
"maximum_wait_vehicle": false,
"mixing_items": false,
"precedence": false,
"start_time_windows": false,
"vehicle_end_time": false,
"vehicle_start_time": false
},
"enable": {
"cluster": false
}
},
"objectives": {
"capacities": "",
"cluster": 0,
"distance": 0,
"early_arrival_penalty": 1,
"late_arrival_penalty": 1,
"min_stops": 1,
"stop_balance": 0,
"travel_duration": 0,
"unplanned_penalty": 1,
"vehicle_activation_penalty": 1,
"vehicles_duration": 1
},
"properties": {
"disable": {
"duration_groups": false,
"durations": false,
"initial_solution": false,
"stop_duration_multipliers": false
},
"maximum_time_horizon": 15552000
},
"validate": {
"disable": {
"resources": false,
"start_time": false
},
"enable": {
"matrix": false,
"matrix_asymmetry_tolerance": 20
}
}
},
"solve": {
"duration": 10000000000,
"iterations": 50,
"parallel_runs": 1,
"plateau": {
"absolute_threshold": -1,
"delay": 0,
"duration": 0,
"iterations": 0,
"relative_threshold": 0
},
"run_deterministically": true,
"solver": {
"plan_group_size": {
"delta": 0,
"delta_after_iterations": 1000000000,
"max_value": 2,
"min_value": 2,
"snap_back_after_improvement": true,
"start_value": 2,
"zigzag": true
},
"unplan_units": {
"delta": 2,
"delta_after_iterations": 125,
"max_value": -1,
"min_value": 2,
"snap_back_after_improvement": true,
"start_value": 2,
"zigzag": true
},
"unplan_weights": "Vehicle:3,Island:1,Location:293"
},
"start_solutions": 1
}
},
"solutions": [
{
"objective": {
"name": "1 * vehicles_duration + 1 * unplanned_penalty",
"objectives": [
{
"base": 1200,
"factor": 1,
"name": "vehicles_duration",
"value": 1200
},
{
"base": 20000,
"factor": 1,
"name": "unplanned_penalty",
"value": 20000
}
],
"value": 21200
},
"unplanned": [
{
"id": "Fushimi Inari Taisha",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
}
],
"vehicles": [
{
"id": "v1",
"route": [],
"route_duration": 0,
"route_travel_duration": 0
},
{
"id": "v2",
"route": [
{
"arrival_time": "2023-01-01T12:00:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:00:00Z",
"start_time": "2023-01-01T12:00:00Z",
"stop": {
"id": "Arashiyama Bamboo Forest",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
},
{
"arrival_time": "2023-01-01T12:00:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:20:00Z",
"start_time": "2023-01-01T12:20:00Z",
"stop": {
"id": "Kinkaku-ji",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0,
"waiting_duration": 1200
},
{
"arrival_time": "2023-01-01T12:20:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:20:00Z",
"start_time": "2023-01-01T12:20:00Z",
"stop": {
"id": "Kyoto Imperial Palace",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
},
{
"arrival_time": "2023-01-01T12:20:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:20:00Z",
"start_time": "2023-01-01T12:20:00Z",
"stop": {
"id": "Kiyomizu-dera",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
},
{
"arrival_time": "2023-01-01T12:20:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:20:00Z",
"start_time": "2023-01-01T12:20:00Z",
"stop": {
"id": "Nijō Castle",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
},
{
"arrival_time": "2023-01-01T12:20:00Z",
"cumulative_travel_duration": 0,
"end_time": "2023-01-01T12:20:00Z",
"start_time": "2023-01-01T12:20:00Z",
"stop": {
"id": "Gionmachi",
"location": {
"lat": 34.96714,
"lon": 135.77159
}
},
"travel_duration": 0
}
],
"route_duration": 1200,
"route_travel_duration": 0,
"route_waiting_duration": 1200
}
]
}
],
"statistics": {
"result": {
"custom": {
"activated_vehicles": 1,
"max_duration": 0.123,
"max_stops_in_vehicle": 6,
"max_travel_duration": 0.123,
"min_duration": 0.123,
"min_stops_in_vehicle": 6,
"min_travel_duration": 0.123,
"unplanned_stops": 1
},
"duration": 0.123,
"value": 0.123
},
"run": {
"duration": 0.123,
"iterations": 50
},
"schema": "v1"
},
"version": {
"sdk": "VERSION"
}
}