Skip to content

Start and end locations

Vehicles typically start and end their routes at a depot. FastVRP supports assigning different depots to different vehicle types, and also allows open routes where vehicles don't have to start from, or return to, a depot.

Multiple depots

A delivery company operates two warehouses: one in Utrecht and one in Zwolle. Each warehouse has its own vehicle. Each vehicle references a different depot as its start_depot and end_depot. There are four tasks to deliver to: Amsterdam, Lelystad, Groningen, and Leeuwarden.

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"
    },
    {
      "id": "depot-Zwolle",
      "location": "loc-Zwolle"
    }
  ],
  "vehicle_types": [
    {
      "id": "vehicle-Utrecht",
      "start_depot": "depot-Utrecht",
      "end_depot": "depot-Utrecht",
      "num_available": 1,
      "capacity": [10],
      "shift": {
        "earliest_start": "2025-01-01T08:00:00",
        "latest_end": "2025-01-01T18:00:00"
      }
    },
    {
      "id": "vehicle-Zwolle",
      "start_depot": "depot-Zwolle",
      "end_depot": "depot-Zwolle",
      "num_available": 1,
      "capacity": [10],
      "shift": {
        "earliest_start": "2025-01-01T08:00:00",
        "latest_end": "2025-01-01T18:00:00"
      }
    }
  ],
  "options": {
    "stop": {
      "seconds": 1,
      "type": "max_runtime"
    }
  }
}

The vehicle in Utrecht serves Amsterdam and Lelystad, while the vehicle in Zwolle handles Groningen and Leeuwarden.

Open routes

Now suppose the delivery drivers don't need to return to the warehouse at the end of the day - they go home directly from their last task. We model this by setting start_depot but omitting end_depot, so that each route ends at its last task location.

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"
    },
    {
      "id": "depot-Zwolle",
      "location": "loc-Zwolle"
    }
  ],
  "vehicle_types": [
    {
      "id": "vehicle-Utrecht",
      "start_depot": "depot-Utrecht",
      "num_available": 1,
      "capacity": [10],
      "shift": {
        "earliest_start": "2025-01-01T08:00:00",
        "latest_end": "2025-01-01T18:00:00"
      }
    },
    {
      "id": "vehicle-Zwolle",
      "start_depot": "depot-Zwolle",
      "num_available": 1,
      "capacity": [10],
      "shift": {
        "earliest_start": "2025-01-01T08:00:00",
        "latest_end": "2025-01-01T18:00:00"
      }
    }
  ],
  "options": {
    "stop": {
      "seconds": 1,
      "type": "max_runtime"
    }
  }
}

Because there is no end depot, each route ends at its last task rather than returning to the depot.

Tip

You can also omit start_depot to have a vehicle start at its first task location instead of a depot.

Conclusion

In this tutorial you learned how to assign different depots to different vehicle types, and how to create open routes by omitting start or end depots.