Capacities and demand¶
~4 min · Recipe
Capacities stop the engine from overloading a vehicle. Each vehicle declares one or more named capacities; each task declares the demand it consumes. The engine keeps every route within its limits.
Single capacity¶
The demand array is positional — demand[0] maps to capacities[0].
Multiple capacities¶
Model several limits at once (e.g. count and weight). Keep the order identical on the vehicle and in every task's demand.
{ "id": 1, "capacities": [
{ "name": "parcels", "units": 40 },
{ "name": "weight_kg", "units": 800 }
] }
- A task whose demand can't fit any vehicle lands in
unassignedwith reasonCAPACITY. - For pickup-and-delivery, load is picked up and later dropped off, so capacity is only consumed between the pickup and its delivery.
Order is everything
demand is matched to capacities by position, not by name. If the orders differ, you'll silently constrain the wrong thing.
Related: Pickups and deliveries (PDPTW) · Skills and matching · The Problem object