Features

Custom data

A how-to guide for using custom data with vehicle routing.

This feature is configurable via .json input, but it is targeted to be used with code customization. It 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
custom_dataNoanyNAinput{"custom_data": {"foo": "bar"}}
custom_dataNoanyNAvehicle{"custom_data": {"foo": "bar"}}
custom_dataNoanyNAstop{"custom_data": {"foo": "bar"}}

You can define custom_data on the input, vehicle, and stop. This is useful when you want to add custom data that can be used for internal tracking or defining a custom objective or custom constraint. There is no restriction on the data type of the custom_data, for it allows you to add fields outside of the features that are offered out of the box.

When adding custom_data to the stop and/or vehicle, it will be marshaled to the output stop and output vehicle, respectively. This makes it easier to add metadata to the entities that is preserved once the solution is obtained. In the case of stops, the data is added regardless of the stop being planned or not.

Here is an example input defining custom data for stops and vehicles. A sample output obtained after solving the problem is also shown.

{
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.772695, "lat": 34.967146 },
      "custom_data": {
        "foo": "bar",
        "baz": 0
      }
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 },
      "custom_data": {
        "foo": "bar",
        "baz": 1
      }
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 },
      "custom_data": {
        "foo": "bar",
        "baz": 2
      }
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 },
      "custom_data": {
        "foo": "bar",
        "baz": 3
      }
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 },
      "custom_data": {
        "foo": "bar",
        "roh": true
      }
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 },
      "custom_data": {
        "foo": "bar",
        "roh": false
      }
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 }
    }
  ],
  "vehicles": [
    {
      "id": "v1",
      "start_location": { "lon": 135.672009, "lat": 35.017209 },
      "speed": 20,
      "custom_data": {
        "lorem": "ipsum",
        "dolor": "sit amet"
      }
    }
  ]
}
Copy

Page last updated