Features

Unplanned penalty

A how-to guide for using stop unplanned penalties 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
unplanned_penaltyNointNAstop{"unplanned_penalty": 123}

Vehicle routing problems are infeasible if no solution satisfies the set of considerations specific to the problem. For example, stop quantities may exceed a vehicle's capacity, in which case the vehicle can not service all stops. Another example is a vehicle having to fulfill start time windows but not being able to arrive at a certain stop in the desired time frame. When a problem is infeasible, no solution is returned.

The unplanned_penalty is defined on the stops. It is added to the objective (value function) for every stop that is not planned. It allows for a solution to be feasible by leaving stops unplanned. The solver will only plan stops if it will improve the objective score. For example if travel duration is the only objective the increase in travel duration should be less than the unplanned score.

If no penalty value is defined for a stop, a large value is used (1,000,000). This is set in place because if a stop has an unplanned_penalty equal to zero, the stop will never be planned. Any unplanned penalties added to the input (including the ones in the stop defaults section) override the generic default. It is important to make sure that the unplanned penalty is sufficiently large to avoid stops being unplanned due to other penalties dwarfing it (if that is not the intent).

Here is an example defining unplanned penalties. 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 },
      "unplanned_penalty": 10
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 },
      "unplanned_penalty": 10
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 },
      "unplanned_penalty": 10
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 },
      "unplanned_penalty": 500000
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 },
      "unplanned_penalty": 500000
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 },
      "unplanned_penalty": 500000
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 },
      "unplanned_penalty": 500000
    }
  ],
  "vehicles": [
    {
      "id": "v1"
    },
    {
      "id": "v2"
    }
  ]
}
Copy

Page last updated