Skip to content

Reloading

When the total delivery demand exceeds a vehicle's capacity, a single delivery trip is not enough. Reloading allows a vehicle to visit a depot mid-route to empty and reload, enabling it to serve more tasks in a single route. Let's look at an example.

Example

A delivery vehicle based in Utrecht must serve four tasks: Amsterdam (5 units), Lelystad (5), Groningen (3), and Leeuwarden (5). The total demand is 18 units, but the vehicle's capacity is only 10. Two reload depots are available, in Utrecht and Zwolle. Each depot has a load_duration of 30 minutes, representing the time needed to load goods. The reload_depots field on the vehicle type lists which depots it may visit to reload. Optionally, max_reloads can be set to restrict how many times a vehicle may reload per route.

request.json
{
  "locations": [
    {
      "id": "loc-Utrecht",
      "latitude": 52.0907,
      "longitude": 5.1214
    },
    {
      "id": "loc-Zwolle",
      "latitude": 52.5168,
      "longitude": 6.0830
    },
    {
      "id": "loc-Amsterdam",
      "latitude": 52.3676,
      "longitude": 4.9041
    },
    {
      "id": "loc-Lelystad",
      "latitude": 52.5083,
      "longitude": 5.4750
    },
    {
      "id": "loc-Groningen",
      "latitude": 53.2194,
      "longitude": 6.5665
    },
    {
      "id": "loc-Leeuwarden",
      "latitude": 53.2014,
      "longitude": 5.8086
    }
  ],
  "tasks": [
    {
      "id": "task-Amsterdam",
      "location": "loc-Amsterdam",
      "delivery": [5]
    },
    {
      "id": "task-Lelystad",
      "location": "loc-Lelystad",
      "delivery": [5]
    },
    {
      "id": "task-Groningen",
      "location": "loc-Groningen",
      "delivery": [3]
    },
    {
      "id": "task-Leeuwarden",
      "location": "loc-Leeuwarden",
      "delivery": [5]
    }
  ],
  "depots": [
    {
      "id": "depot-Utrecht",
      "location": "loc-Utrecht",
      "load_duration": "PT1800S"
    },
    {
      "id": "depot-Zwolle",
      "location": "loc-Zwolle",
      "load_duration": "PT1800S"
    }
  ],
  "vehicle_types": [
    {
      "id": "vehicle_type",
      "start_depot": "depot-Utrecht",
      "end_depot": "depot-Utrecht",
      "num_available": 1,
      "capacity": [10],
      "reload_depots": ["depot-Utrecht", "depot-Zwolle"],
      "max_reloads": 2,
      "shift": {
        "earliest_start": "2025-01-01T08:00:00",
        "latest_end": "2025-01-01T18:00:00"
      }
    }
  ],
  "options": {
    "stop": {
      "seconds": 1,
      "type": "max_runtime"
    }
  }
}

Because no single trip can carry all 18 units, the vehicle must reload mid-route. FastVRP picks which reload depot to visit and when, based on what minimises the total cost. Here, Zwolle is chosen because it is conveniently located on the way to the northern tasks.

The vehicle first loads 10 units at Utrecht and delivers to Amsterdam and Lelystad. After those deliveries, it is empty and visits Zwolle to reload 8 units for the remaining tasks. It then continues to Groningen and Leeuwarden before returning to Utrecht.

The solution contains detailed information for each activity along the route. The route has 7 activities in total: 3 depot activities (start, reload, end) and 4 task activities.

{
  "id": "depot-Utrecht",
  "type": "depot",
  "start_time": "2025-01-01T08:00:00",
  "end_time": "2025-01-01T08:30:00",
  "duration": "PT1800S",
  "wait_duration": "P0D",
  "travel_duration": "P0D",
  "distance": 0
}
{
  "id": "task-Amsterdam",
  "type": "task",
  "start_time": "2025-01-01T09:13:51",
  "end_time": "2025-01-01T09:13:51",
  "duration": "P0D",
  "wait_duration": "P0D",
  "travel_duration": "PT2631S",
  "distance": 44198
}
{
  "id": "task-Lelystad",
  "type": "task",
  "start_time": "2025-01-01T10:03:16",
  "end_time": "2025-01-01T10:03:16",
  "duration": "P0D",
  "wait_duration": "P0D",
  "travel_duration": "PT2965S",
  "distance": 56947
}
{
  "id": "depot-Zwolle",
  "type": "depot",
  "start_time": "2025-01-01T10:47:45",
  "end_time": "2025-01-01T11:17:45",
  "duration": "PT1800S",
  "wait_duration": "P0D",
  "travel_duration": "PT2669S",
  "distance": 51557
}
{
  "id": "task-Groningen",
  "type": "task",
  "start_time": "2025-01-01T12:42:53",
  "end_time": "2025-01-01T12:42:53",
  "duration": "P0D",
  "wait_duration": "P0D",
  "travel_duration": "PT5108S",
  "distance": 105516
}
{
  "id": "task-Leeuwarden",
  "type": "task",
  "start_time": "2025-01-01T13:37:44",
  "end_time": "2025-01-01T13:37:44",
  "duration": "P0D",
  "wait_duration": "P0D",
  "travel_duration": "PT3291S",
  "distance": 63652
}
{
  "id": "depot-Utrecht",
  "type": "depot",
  "start_time": "2025-01-01T15:44:42",
  "end_time": "2025-01-01T15:44:42",
  "duration": "P0D",
  "wait_duration": "P0D",
  "travel_duration": "PT7618S",
  "distance": 160900
}

Notice that loading duration is incurred at the start depot (Utrecht, 30 minutes) and at the reload activity (Zwolle, 30 minutes), but not when returning to the end depot.

Conclusion

In this tutorial you learned how to set up depot reloading so that a vehicle can replenish its load mid-route. This is useful when the total demand exceeds the vehicle's capacity, for example in waste collection or multi-trip delivery scenarios.