Skip to main content

Capacity Management

The VRP solver provides comprehensive capacity management features to handle real-world loading constraints. From simple weight limits to complex multi-dimensional capacity tracking, this guide covers all capacity-related features.

Overview

Capacity management ensures that vehicles don’t exceed their loading limits while optimizing resource utilization. The solver supports:
  • Multi-dimensional capacity (weight, volume, pallets, etc.)
  • Dynamic capacity tracking for pickup/delivery operations
  • Capacity utilization optimization
  • Soft capacity constraints with violations

Basic Capacity Configuration

Single-Dimension Capacity

The simplest form uses a single capacity value:
Keep the dimension order identical across jobs and resources. If a resource has capacity: [1000, 50], job loads should look like load: [weight, volume]. A job load that is shorter than the resource capacity is treated as 0 in the missing dimensions. Loads and capacities are integers, so pick a unit that does not need decimals (grams, litres, items).

Multi-Dimensional Capacity

Handle multiple capacity constraints simultaneously:
The solver tracks all capacity dimensions independently. A vehicle can only accept a job if ALL capacity dimensions have sufficient remaining space.
Dimension Limit: A resource capacity supports a maximum of 5 dimensions. If you need to track more than 5 different capacity types, consider combining related dimensions.

Pickup and Delivery Capacity

For pickup and delivery operations, capacity changes dynamically during the route:

Capacity Flow Example

1

Initial State

Vehicle starts empty: 0 / 500 kg
2

After Pickup

Load increases: 50 / 500 kg
3

After Delivery

Load decreases: 0 / 500 kg

Dynamic Capacity Tracking for PDP

Pickup and Delivery Problems (PDP) require sophisticated capacity tracking as vehicle loads change throughout the route:

Real-Time Capacity Updates

1

Track Current Load

The solver keeps track of the running load of each vehicle in every dimension as it moves along the route. Pickups add to the load and deliveries remove from it.
2

Validate Each Stop

Before adding a job, the solver checks:
  • Can the vehicle handle the pickup load?
  • Will future deliveries free enough space?
  • Does the route respect capacity at all times?
3

Optimize Load Sequence

The solver may reorder stops to manage capacity:
  • Group pickups early when possible
  • Schedule deliveries to free space for later pickups
  • Balance load throughout the route

Complex PDP Example

Here’s a real-world scenario with multiple pickups and deliveries:

Capacity Timeline Visualization

Along one possible route for the example above, the load changes like this (times are illustrative):
The solver ensures that at no point does the current load exceed the vehicle’s capacity in any dimension.

Common Use Cases

1. Last-Mile Delivery

Standard parcel delivery with weight and volume constraints:

2. Waste Collection

Vehicles that fill up and need to visit disposal sites:

3. Mixed Fleet Optimization

Different vehicle types with varying capacities:

Best Practices

Capacity Planning Guidelines:
  1. Reserve Buffer: Keep 10-15% capacity buffer for unexpected additions
  2. Dimension Selection: Only use dimensions that actually constrain your operations
  3. Load Accuracy: Ensure load estimates include packaging and handling equipment
  4. Mixed Units: Keep units consistent (all kg or all lbs, not mixed)

Handling Overloading

When capacity constraints make problems infeasible:
1

Keep Partial Planning Enabled

partialPlanning is true by default, so jobs that do not fit are left unserved instead of making the whole problem fail. To list the reasons per job, also enable the explanation:
2

Check Unserved Jobs

Review unserved for jobs that couldn’t be assigned. With options.explanation.enabled, unservedReasons lists the constraints that blocked each job. TRIP_CAPACITY indicates a capacity conflict:
3

Add Resources or Adjust Loads

Either add more vehicles or review if load estimates are accurate.

Performance Considerations

Resources support at most 5 capacity dimensions. Only include dimensions that actually constrain your operations.

Optimization Tips

  1. Simplify When Possible: If volume rarely constrains, use weight only
  2. Round Values: Round loads to reasonable precision (1kg vs 1.234kg)
  3. Group Similar Items: Combine small items into single jobs when feasible

Capacity in Response

Capacity is enforced during planning. The response lists each trip’s visits in order, together with the jobs that could not be served: