Overview
This example demonstrates a complete last mile delivery scenario for an e-commerce fulfillment center. The solution handles multiple delivery vehicles, customer time windows, package capacities, priority deliveries, and driver shift constraints - all common requirements in modern last mile logistics.This example combines multiple VRP features including time windows, capacity management, priority handling, and route optimization to create a realistic delivery planning scenario.
Business Scenario
An e-commerce company operates a fulfillment center serving a metropolitan area. They need to:- Deliver 50+ packages daily using a fleet of delivery vans
- Meet customer-selected delivery time windows
- Prioritize premium customers and same-day deliveries
- Respect vehicle capacity limits (both weight and volume)
- Ensure drivers complete routes within their 8-hour shifts
- Minimize total delivery costs while maintaining service quality
Complete Implementation
Advanced Features Demonstrated
Multi-Dimensional Capacity
The example uses two-dimensional capacity constraints:Flexible Time Windows
Combining hard and soft windows provides delivery flexibility:Tag-Based Requirements
Special handling requirements use tag matching:Real-World Distance Calculation
Using OSM with traffic multiplier for accurate routing:Best Practices for Last Mile Delivery
1
Define accurate service times
Include realistic durations for parking, walking to door, and customer interaction. Urban deliveries often need 5-10 minutes per stop.
2
Use appropriate time windows
Balance customer preferences with operational efficiency. Offer 2-4 hour windows for residential deliveries.
3
Configure vehicle capacities
Track both volume and weight limits. Consider using 3D capacity for volume if needed.
4
Set priority levels strategically
Use priority 80-100 for same-day/express, 40-60 for standard, and 20-40 for economy deliveries.
5
Enable traffic consideration
Use real-time traffic data during peak hours. Set traffic multiplier between 1.2-1.5 for urban areas.
6
Plan for failed deliveries
Consider using
partialPlanning: true
and implement re-delivery logic for missed deliveries.Optimization Strategies
Customer Density Clustering
Group nearby deliveries to minimize travel:Dynamic Routing
Use the suggest API for same-day additions:Cost Optimization
Balance multiple cost factors:Route Timeline Visualization
Performance Metrics
Track these KPIs for last mile delivery:Metric | Target | Calculation |
---|---|---|
On-time delivery | > 95% | Deliveries within time window / Total deliveries |
Vehicle utilization | > 80% | Actual capacity used / Total capacity |
Cost per delivery | < $5 | Total route cost / Number of deliveries |
Average delivery time | < 8 min | Total service time / Number of stops |
First attempt success | > 90% | Successful deliveries / Total attempts |
Common Challenges and Solutions
High-density urban areas
High-density urban areas
Challenge: Parking difficulties and walking distances in city centersSolution:
- Increase service durations for urban postcodes
- Use smaller vehicles with “BIKE” category
- Add walking time to service duration
- Consider hub-and-spoke with cargo bikes for final delivery
Failed delivery handling
Failed delivery handling
Challenge: Customer not home or unable to deliverSolution:
- Implement re-delivery windows for next day
- Use job relations to link failed delivery with retry
- Add “delivery attempt” tags to track attempts
- Consider alternative delivery locations (lockers, neighbors)
Peak season capacity
Peak season capacity
Challenge: Holiday seasons with 2-3x normal volumeSolution:
- Add temporary resources with higher costs
- Extend delivery windows
- Use priority levels to ensure critical deliveries
- Enable partial planning to identify capacity needs
Integration Example
For production systems, integrate with your WMS/OMS for real-time order flow and delivery confirmation.