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 name | Required | Data type | SI Unit | Defined on | Example | Configurable via defaults |
---|---|---|---|---|---|---|
target_arrival_time | No | timestamp | NA | stop | {"target_arrival_time": "2023-01-01T00:00:00Z"} | ✅ |
early_arrival_time_penalty | No | float | NA | stop | {"early_arrival_time_penalty": 1.23} | ✅ |
The early_arrival_time_penalty
is a cost applied to the objective (value function) when a vehicle arrives at a stop before the given target_arrival_time
. These fields are defined on stops, and are useful for discouraging behavior such as ride sharing vehicles arriving too early for an airport pickup.
The value added to the objective is calculated as follows:
For example, if a vehicle arrives at a stop 60 seconds before a target arrival time and the penalty is set to 10, 600 seconds are added to the value function.
Please note that:
- The time duration given by
target_arrival_time - arrival_time
is inseconds
. - When defining an
early_arrival_time_penalty
on a stop, you must also define atarget_arrival_time
for that stop. - Specifying
early_arrival_time_penalty
andtarget_arrival_time
on a stop brings additional information on the output. For example, theearly_arrival_duration
of the stop defines the time duration given bytarget_arrival_time - arrival_time
in seconds, when greater than zero.
Here is an example defining penalties for all stops. A sample output obtained after solving the problem is also shown.