Depot Selection
The VRP solver can dynamically select the best depot for each trip based on proximity, cost, waste stream compatibility, and operating hours. Instead of pre-assigning fixed locations, the solver evaluates multiple candidate sites and picks the optimal one per trip.Overview
Depot selection is essential for waste collection, logistics with intermediate stops, and any scenario where vehicles must visit a facility mid-route to unload. The solver supports:- Multiple depots with different locations, costs, and capacities
- Operating hours as time windows on each depot
- Per-dimension capacity for selective unloading (e.g., tip only one compartment)
- Cost-based trade-offs between routing efficiency and cost
Depots are optional. When no
depots are provided, the solver operates in standard routing mode. Adding depots enables the solver to automatically insert depot visits into routes where beneficial.Basic Configuration
Define your depot in thedepots array of the request. Each depot has a location, service duration, and capacity:
When you omit
capacity, the depot defaults to unlimited capacity across all load dimensions — vehicles unload all compartments. To restrict which compartments are unloaded, provide an explicit capacity array where 0 means “do not unload this dimension”.Depot Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique identifier for the depot (max 255 characters) |
location | object | Yes | Geographic coordinates (latitude, longitude) |
duration | integer | No | Service/unloading time in seconds (default: 0) |
capacity | array | No | Multi-dimensional capacity matching job load dimensions |
cost | number | No | Per-visit cost in EUR (default: 0) |
windows | array | No | Operating hours as time windows |
Operating Hours
Restrict when depots accept visits by adding time windows. The solver treats depot time window violations as hard constraints — it avoids scheduling visits outside operating hours.Cost-Based Depot Selection
Assign a per-visit cost to each depot to model disposal fees. The solver balances routing efficiency against disposal cost — it may choose a more distant but cheaper depot when the savings justify the extra travel.Tuning the Cost Trade-Off
Control how aggressively the solver avoids expensive depots using thedepotCostWeight in the weights configuration:
| Value | Behavior |
|---|---|
1 (default) | Balanced trade-off between travel time and depot cost |
> 1 | Stronger preference for cheaper depots, even at the expense of extra travel |
0 | Depot cost is ignored; selection is based only on proximity and constraints |
Multi-Compartment Unloading
Depots support per-dimension capacity, enabling selective unloading. When a vehicle visits a depot, only the load dimensions where the depot has capacity (> 0) are reset.- general-waste-tip only accepts dimension 0 (general waste). When a vehicle visits, only the first compartment is unloaded.
- recycling-center accepts dimensions 1 and 2 (recyclables). The vehicle keeps its general waste loaded.
A depot with
capacity: [0, 0, 0] for a given dimension means that compartment is not unloaded at that depot. This enables independent compartment tipping.Constraints
The solver enforces three depot-related constraints:| Constraint | Type | Description |
|---|---|---|
Depot Time Window | Hard | Depot visits must occur within the depot’s operating hours |
Depot Capacity | Hard | Total load delivered to a depot across all vehicles during the planning period must not exceed its capacity |
Depot Cost | Soft | Per-visit cost penalizes expensive depots, weighted by depotCostWeight |
violations section of the response when active.
Real-World Example: Waste Collection
A complete waste collection request with 3 waste streams, strict load compatibility, and geographically distributed depots:Related Features
Load Compatibility
Restrict which load types can coexist on a vehicle per trip
Capacity Management
Configure multi-dimensional vehicle capacity constraints
Cost Optimization
Set up cost-based optimization with financial trade-offs
Break Management
Configure driver breaks and rest periods