You are viewing Nextmv legacy docs. ⚡️ Go to latest docs ⚡️

Features

Alternates

You will learn the basics of using alternate stops on cloud.

Overview

The alternate_stops option can be used to define a set of suitable locations for a given stop for each vehicle (e.g., for a break, or for an item pick up at a grocery store), of which exactly one will be added to the vehicle's route automatically.

Alternate stops are defined with the alternate_stops attribute on root level of the input file. They have the same fields as a normal stop and adhere to the same constraints like, e.g. quantity or time windows. This can be used to introduce a break at a specific time and location (for scheduled breaks) or just location (for flexible breaks). A vehicle can reference one or more alternate stops with the alternate_stops field. The vehicle will be assigned exactly one stop from the list of alternate stops and, in addition, may be assigned normal stops.

As opposed to using backlogs and regular stops (where one stop can only be serviced by one vehicle), one alternate stop can be serviced by many different vehicles.

Example

Here is an example of how to configure an input file with alternate stops:

{
  "defaults": {
    "vehicles": {
      "shift_start": "2021-08-24T09:00:00-06:00",
      "speed": 10
    }
  },
  "vehicles": [
    {
      "id": "vehicle-1",
      "alternate_stops": ["as-1", "as-2"]
    },
    {
      "id": "vehicle-2",
      "alternate_stops": ["as-1", "as-2"]
    }
  ],
  "stops": [
    {
      "id": "location-1",
      "position": {
        "lon": 7.6129,
        "lat": 51.957
      }
    },
    {
      "id": "location-2",
      "position": {
        "lon": 7.6166,
        "lat": 51.9635
      }
    },
    {
      "id": "location-3",
      "position": {
        "lon": 7.6258,
        "lat": 51.9624
      }
    },
    {
      "id": "location-4",
      "position": {
        "lon": 7.6386,
        "lat": 51.9449
      }
    },
    {
      "id": "location-5",
      "position": {
        "lon": 7.5896,
        "lat": 51.9486
      }
    },
    {
      "id": "location-6",
      "position": {
        "lon": 7.5965,
        "lat": 51.9455
      }
    },
    {
      "id": "location-7",
      "position": {
        "lon": 7.5921,
        "lat": 51.9573
      }
    },
    {
      "id": "location-8",
      "position": {
        "lon": 7.6048,
        "lat": 51.9492
      }
    }
  ],
  "alternate_stops": [
    {
      "id": "as-1",
      "position": {
        "lon": 7.5921,
        "lat": 51.9573
      }
    },
    {
      "id": "as-2",
      "position": {
        "lon": 7.6048,
        "lat": 51.9492
      }
    }
  ]
}
Copy

Using alternate stops for breaks

Vehicle breaks represent periods of time when a vehicle is offline during its shift, and vehicles can be permitted to take scheduled or flexible breaks, with or without items on board.

  • Scheduled breaks - Requires knowledge of exact start time of breaks. Knowledge of where a break will occur is not required.
  • Flexible breaks - Requires knowledge of where the break will occur, as well as a time window or target time for when that break will happen.
    • Items allowed - Implies that a vehicle has orders onboard during its break. e.g. a vehicle delivering electronics can take a break with some orders onboard.
    • Items not allowed - Implies that a vehicle must be empty during its break.

For scheduled and flexible breaks, use the alternate_stops option and set the appropriate time settings for stops to specify when a break can occur or how long a break should be. For example: To ensure a break location is visited during a specified time window for a scheduled break use hard_windows (hard constraint) or target_time and earliness/lateness penalties (soft constraint). Or, to set the length of a vehicle break, use stop_duration.

Items allowed

For each stop in a set of alternate stops where items are allowed onboard during a stop, set the quantity to 0 (see the example below). This will allow the vehicle to keep items while offline.

Items not allowed

For each stop in a set of alternate stops where items are not allowed onboard during a stop, set the quantity to the negative value of the vehicle capacity (see the example below). This forces the vehicle to have not items while offline.

Breaks example

Here is an example of how to configure an input file using alternate stops for scheduled vehicle breaks:

{
  "defaults": {
    "vehicles": {
      "shift_start": "2021-08-24T09:00:00-06:00",
      "speed": 10,
      "capacity": 5
    }
  },
  "vehicles": [
    {
      "id": "vehicle-1",
      "alternate_stops": ["as-1", "as-2"]
    },
    {
      "id": "vehicle-2",
      "alternate_stops": ["as-1", "as-2"]
    }
  ],
  "stops": [
    {
      "id": "location-1",
      "position": {
        "lon": 7.6129,
        "lat": 51.957
      }
    },
    {
      "id": "location-2",
      "position": {
        "lon": 7.6166,
        "lat": 51.9635
      }
    },
    {
      "id": "location-3",
      "position": {
        "lon": 7.6258,
        "lat": 51.9624
      }
    },
    {
      "id": "location-4",
      "position": {
        "lon": 7.6386,
        "lat": 51.9449
      }
    },
    {
      "id": "location-5",
      "position": {
        "lon": 7.5896,
        "lat": 51.9486
      }
    },
    {
      "id": "location-6",
      "position": {
        "lon": 7.5965,
        "lat": 51.9455
      }
    },
    {
      "id": "location-7",
      "position": {
        "lon": 7.5921,
        "lat": 51.9573
      }
    },
    {
      "id": "location-8",
      "position": {
        "lon": 7.6048,
        "lat": 51.9492
      }
    }
  ],
  "alternate_stops": [
    {
      "id": "as-1",
      "position": {
        "lon": 7.5921,
        "lat": 51.9573
      },
      "hard_window": [
          "2021-08-24T10:00:00-06:00",
          "2021-08-24T12:00:00-06:00"
      ],
      "stop_duration": 3600
    },
    {
      "id": "as-2",
      "position": {
        "lon": 7.6048,
        "lat": 51.9492
      },
      "hard_window": [
          "2021-08-24T10:00:00-06:00",
          "2021-08-24T12:00:00-06:00"
      ],
      "stop_duration": 3600
    }
  ]
}
Copy

Page last updated

Go to on-page nav menu