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 name | Required | Data type | SI Unit | Defined on | Example | Configurable via defaults |
---|---|---|---|---|---|---|
min_stops | No | int | NA | vehicle | {"min_stops": 8} | ✅ |
min_stops_penalty | No | float | NA | vehicle | {"min_stops_penalty": 1000} | ✅ |
It may be useful to impose a minimum number of stops in a route to avoid routes that may be too short. This encourages higher vehicle utilization. This limit can be set via the min_stops
feature on vehicles. The vehicle's starting and ending locations are not counted as stops. For every stop below the min_stops
limit set on the vehicle, we incur a penalty as set by the min_stops_penalty
.
The penalty is set using the following logic:
Please note that the difference between the number of stops in the route and the minimum number of stops is squared. This is to ensure that the penalty increases exponentially as the number of stops decreases.
Here is an example defining minimum stops for vehicles. A sample output obtained after solving the problem is also shown.