Features

Capacity

A how-to guide for using capacity 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
capacityNoobject (string to float) or floatNAvehicle{"capacity": {"bar": 2.0}}
start_levelNoobject (string to float) or floatNAvehicle{"start_level": {"bar": 2.0}}
quantityNoobject (string to float) or floatNAstop{"quantity": -1.0}

If your vehicles need to transport something but have limited capacity, you need to use the following attributes of the input:

  • capacity on vehicles
  • quantity on stops

capacity defines how much of a certain type of commodity/thing a vehicle can carry at maximum. It is defined on the individual vehicle (or globally in the defaults.vehicles section). The capacity can be:

  • a single float value for specifying a single dimension of capacity.
  • a map of string to float values, when defining multiple dimensions that need to be considered.

You can also define the start_level of the vehicle's capacity, which can be different than zero. This is useful when you want to model a vehicle that starts with a certain amount (level) of capacity already used. Similar to the capacity, it can be defined as a single float value or a map of string to float values.

quantity defines how much a vehicle's capacity changes at a stop:

  • A negative (-) quantity consumes some of the available capacity and raises the level on the resource by the quantity at a stop (pickup operation),
  • A positive (+) quantity defines how much is replenished / returned (dropoff operation).

The quantity is defined on the individual stop (or globally in the defaults.stops section). In the same way as capacity, it can be defined as a single float value or a map of string to float values. You should only include positive quantity stops if it complements a negative quantity.

Here is an example input defining both types of capacities and quantities on vehicles and stops, respectively. A sample output obtained after solving the problem is also shown.

{
  "defaults": {
    "vehicles": {
      "speed": 20
    }
  },
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.772695, "lat": 34.967146 },
      "quantity": -1
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 },
      "quantity": -1
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 },
      "quantity": -1
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 },
      "quantity": {
        "pallets": -1,
        "bins": 1
      }
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 },
      "quantity": {
        "pallets": -1,
        "bins": -1
      }
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 },
      "quantity": {
        "pallets": -1,
        "bins": -1
      }
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 },
      "quantity": {
        "pallets": -1,
        "bins": 1
      }
    }
  ],
  "vehicles": [
    {
      "id": "v1",
      "capacity": 3,
      "start_level": 0,
      "start_location": { "lon": 135.772695, "lat": 34.967146 }
    },
    {
      "id": "v2",
      "capacity": {
        "pallets": 4,
        "bins": 2
      },
      "start_level": {
        "pallets": 0,
        "bins": 0
      },
      "start_location": { "lon": 135.728898, "lat": 35.039705 }
    }
  ]
}
Copy

Quantities of different dimensions do not count towards the same capacity, e.g., pallets and bins are capacitated independently of each other.

Page last updated