Maximum Pickup and Dropoff Locations
In many logistics operations, efficiency is not just about the number of stops but about the distinct locations visited. To optimize routes effectively, you may want to limit the number of unique pickup or drop-off clusters a vehicle visits in a sequence, rather than just the total number of stops.
The Maximum Pickup and Dropoff Locations constraints allow you to set limits on how many distinct locations a vehicle can visit for pickups or drop-offs consecutively.
How It Works
This feature introduces two vehicle-level constraints:
max_pickup_locations: The maximum number of consecutive distinct pickup locations allowed.max_dropoff_locations: The maximum number of consecutive distinct drop-off locations allowed.
What is a "Location"?
A key aspect of this constraint is its definition of a "location". Unlike a simple count of booking nodes (where every stop counts as one), this constraint uses spatial grouping (often based on H3 indices or distance thresholds) to determine if multiple stops should be considered a single "location".
- Same Location: If a vehicle visits multiple pickup points that are very close to each other (e.g., different stores within the same shopping mall, or different entrances of a large complex), they may be grouped into a single Location.
- Distinct Locations: Stops that are geographically separated (e.g., two different towns or suburbs) are counted as separate locations.
This allows for more flexible operations where a driver can make multiple stops in a single area without exhausting their "stop limit", while still preventing them from driving to too many disparate regions.
Scenarios
Scenario 1: Retail Mall Pickups
Configuration: max_pickup_locations: 1
A driver is assigned to pick up orders from a large shopping mall.
- Pickup A: Fashion Store (North Wing)
- Pickup B: Electronics Shop (South Wing)
- Pickup C: Grocery (Basement)
Even though these are 3 distinct stops, they are geographically clustered. The optimizer treats this as 1 Pickup Location. The driver can perform all three pickups. However, if the driver were then asked to drive 5km away to a warehouse for a fourth pickup, that would count as a 2nd Location, and the assignment would be rejected if the limit is set to 1.
Scenario 2: Milk Run Deliveries
Configuration: max_dropoff_locations: 3
A vehicle picks up goods from a central depot and heads out for delivery. The vehicle has 5 packages.
- Dropoff 1 & 2: Residential Block A (Same H3 index) -> Counts as Location 1
- Dropoff 3: Office Tower B (Different H3 index) -> Counts as Location 2
- Dropoff 4 & 5: Industrial Park C (Different H3 index) -> Counts as Location 3
Total Locations used: 3. This route is valid. If a 6th package required a drop-off at a fourth distinct area, the constraint would prevent it.