Features

Vehicle initial stops

A how-to guide for using initial stops in vehicles 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
initial_stopsNoarray of initial_stopNAvehicle{"initial_stops": [{"id": "bar"}]}
  • initial_stop

    Field nameRequiredData typeDescriptionExample
    idYesstringUnique identifier for the stop.{"id": "foo"}
    fixedNoboolWhether the stop is fixed or not.{"fixed": true}

You can define the initial_stops on a vehicle which are a sequence of ordered stops that will be planned on the vehicle as the initial solution. These are also known as "backlogs". A stop in the initial_stops can be:

  • fixed = true
    • The stop will be planned on the vehicle and can not be unplanned from it.
    • The order of the initial stops (with fixed = true) will remain the same in the final solution.
    • New stops may be planned in between the initial ones.
  • fixed = false or undefined
    • The stop will be planned on the vehicle but can be unplanned and planned on any other vehicle, as long as it complies with all the constraints.
    • Initial stops may be re-ordered on their initial vehicle, if they are not unplanned from it.
    • New stops may be planned in between the initial ones.
    • If you want to allow re-ordering of the initial stops, but you don't want them to potentially be planned on another vehicle, you may use compatibility attributes. You can define an attribute such as the vehicle's ID on both the initial stop and the vehicle to tell the solver that the stop can only be planned on that vehicle, while allowing for flexible re-ordering.

The initial_stops are useful for cases such as:

  • Taking into account information from previous planning runs, such as which stops were allocated to which vehicles.
  • Providing a "warm start" to the solver which means starting from a pre-defined initial solution (such as previously planned routes). This can lead to better solutions in less time.

Please note the following when working with initial_stops:

  • All stops defined under initial_stops for the various vehicles must be present in the main array of stops.
  • If a sequence of initial stops on a vehicle is not feasible, the solver will remove stops causing a violation until the sequence is feasible. No stops marked as fixed = true will be removed. Removed stops may be re-planned on the same vehicle, on another vehicle or may not be planned at all.
  • In order to correctly consider the capacities of vehicles with initial_stops, it might be necessary to use the start_level feature for these vehicles. The start level for such a vehicle would then describe the used capacity at the time of planning.

Here is an example defining initial stops of various types on vehicles. A sample output obtained after solving the problem is also shown.

{
  "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",
      "start_location": { "lon": 135.672009, "lat": 35.017209 },
      "speed": 20,
      "initial_stops": [
        {
          "id": "Nijō Castle",
          "fixed": true
        },
        {
          "id": "Kyoto Imperial Palace",
          "fixed": true
        }
      ]
    },
    {
      "id": "v2",
      "start_location": { "lon": 135.772695, "lat": 34.967146 },
      "speed": 20,
      "initial_stops": [
        {
          "id": "Kiyomizu-dera"
        }
      ]
    }
  ]
}
Copy

Page last updated