Features

Minimum route stops

A how-to guide for using minimum route stops 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
min_stopsNointNAvehicle{"min_stops": 8}
min_stops_penaltyNofloatNAvehicle{"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:

penalty_applied = (min_stops - route_stops)^2 * min_stops_penalty
Copy

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.

{
  "options": {
    "min_stops": 1.0
  },
  "defaults": {
    "vehicles": {
      "speed": 20,
      "min_stops": 3,
      "min_stops_penalty": 1000
    },
    "stops": {
      "unplanned_penalty": 200000
    }
  },
  "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"
    },
    {
      "id": "v2"
    }
  ]
}
Copy

Page last updated