workingTimeWindow. Nothing about this requires a dedicated field: it’s a modeling pattern built from capacities and stop kind, the same primitives covered in the data model.
The core mechanic: pair each delivery with its own depot pickup
Rather than pre-computing a fixed number of “reload rounds” per vehicle, pair every delivery with a pickup of the same cargo at the depot, inside the same order:- No fixed round count. The engine is free to chain any number of these pairs on a single resource, going back to the depot as many times as the schedule and capacity allow — you don’t need to guess in advance how many rounds each vehicle will need, or leave unused
"optional": truereload orders on the table. - No per-vehicle sizing. A pickup sized to one delivery’s own weight/piles fits any resource with that much spare capacity, heterogeneous fleet or not. There’s no need for a
skills/requiredSkillspair to reserve a reload for a specific vehicle — whichever resource ends up serving the delivery automatically picks up its own matching cargo first, because both stops belong to the same order.
If you also want to force or bias which stops happen before versus after each other (for example, a fixed morning sector followed by a fixed afternoon sector), combine this with tagged phases and the
maximizePrecedences objective. That’s a separate concern from the capacity mechanic above.Charging depot time once per visit, not once per pickup
With one pickup stop per delivery, a vehicle loading five deliveries’ worth of cargo before a round would otherwise payoperationDuration five times over for what is physically a single dock visit. Keep each pickup’s operationDuration negligible (as in the example above) and instead charge the real access time once per visit with the plan-level accessDurationsByStopTag field:
Limiting simultaneous depot visits
A physical depot usually has a limited number of loading docks or bays, and can’t serve every vehicle at once. Tag every pickup stop with a shared depot tag (as in the example above) and cap simultaneous presence withoverlappingCapacitiesByStopTag at the plan level:
depot:main to 2 — matching, for example, a depot with two loading docks. Because every load in this pattern is an explicit tagged stop that’s part of an order — including the first load of the day, not just later reloads — the limit applies uniformly from the very first pickup, with nothing left uncovered. departure and arrival (see Depot vs. position) are only used for the resource’s idle start/end-of-day position; they carry no cargo and no tag, so keep the actual loading out of them entirely.
See also
- Data model —
capacities, stopkind,accessDurationsByStopTag, and the rest of the constraints catalog referenced above. - Modeling advanced constraints — heterogeneous capacities, skills, breaks, and multiple time windows.
- Handling infeasibility — diagnosing a plan where demand still doesn’t fit even with multiple rounds.