Advanced Time Features
Beyond basic time windows and scheduling, the VRP solver offers advanced time features for precise control over arrival times, service scheduling, and multi-day optimization. This guide covers snapUnit, job padding, overtime management, and traffic-aware routing.Time Snapping (snapUnit)
Round arrival times to specific intervals for cleaner schedules:How snapUnit Works
Snap Behavior: Arrival times are rounded UP to the nearest snapUnit interval.
- Actual arrival: 9:03 → Snapped to: 9:15
- Actual arrival: 9:15 → Stays at: 9:15
- Actual arrival: 9:16 → Snapped to: 9:30
Common snapUnit Values
- 5 Minutes
- 15 Minutes
- 30 Minutes
- 1 Hour
Impact on Routes
1
Calculate Natural Arrival
Solver determines optimal arrival time
2
Apply Snap Rounding
Round up to next snapUnit interval
3
Add Wait Time
Driver waits if arrived before snapped time
4
Start Service
Begin job at snapped arrival time
Job Padding
Delay the arrival at a job by a fixed buffer, for example to reserve time to park, check in, or prepare:Padding Use Cases
Setup Time
Setup Time
Customer Preparation
Customer Preparation
Safety Buffer
Safety Buffer
Padding vs snapUnit Interaction
Advanced Overtime Management
Configure flexible overtime with graduated penalties:Overtime Strategies
- Simple Overtime
- Graduated Penalties
- Hard Cutoff
Time-Dependent Routing
Travel times can depend on the time of day. Which behaviour you get is set byoptions.routingEngine:
Custom Distance Matrices
If you have pre-computed distance matrices, reference them withcustomDistanceMatrices instead of letting the solver call a routing engine. profileMatrices maps a vehicle profile (CAR, BIKE, TRUCK) to the matrix ID to use for each time slice, keyed by the start hour of the slice (6, 9, 12, 14, 16, 20):
Multi-Day ASAP Optimization
Schedule jobs as early as possible across multiple days:ASAP Scheduling Logic
There is no dedicated “earliest day” job field. Instead, the earliest day a job can be scheduled is expressed entirely through its
windows: a job’s first window determines when it becomes available, and jobs with no early window (like scheduled-later, whose earliest window starts on day 3) simply cannot be scheduled sooner.weights.asapWeight then creates pressure for the solver to prefer a job’s earliest available window over a later one, for any job that has more than one window to choose from.Complex Time Scenario
Combining all advanced time features:Expected Behavior
-
Morning appointment (first job of the trip, so its padding has no effect):
- Natural arrival: 8:12
- Snapped to: 8:15
- Service: 8:15-9:00
- Depart: 9:00
-
Afternoon installation (not first, so its padding delays the arrival):
- Natural arrival: 13:08
- Snapped to: 13:15
- Service: 13:25-15:25 (after 10 minutes of padding)
- Depart: 15:25
Performance Optimization
Time Feature Impact
Performance Considerations
Performance Considerations
Low Impact:
- snapUnit with reasonable intervals (≥300s)
- Simple padding values
- Basic overtime configuration
- Small snapUnit values (
< 300s) - Complex overtime structures
- Very small snapUnit (60s)
Best Practices
1
Choose Appropriate Precision
- Use 15-minute slots unless finer control needed
- Avoid snapUnit < 300 for large problems
2
Balance Features
- Don’t combine all features unless necessary
- Test impact of each feature separately
3
Monitor Wait Time
- Track wait time statistics
- Adjust snapUnit if excessive waiting
4
Validate Time Logic
- Ensure the arrival after padding, plus the duration, fits in the window
- Check overtime doesn’t conflict with shifts
Troubleshooting
Excessive Wait Times
Excessive Wait Times
Symptom: Drivers waiting long periodsCauses:
- snapUnit too large
- Poor alignment with job windows
- Suboptimal route sequencing
- Reduce snapUnit value
- Adjust time windows
- Increase waitTimeWeight
Jobs Not Fitting in Windows
Jobs Not Fitting in Windows
Symptom: Jobs unassigned due to timeCauses:
- Padding postpones the arrival past the end of the window
- snapUnit pushes beyond window
- Travel time underestimated
- Reduce padding
- Widen time windows
- Verify travel time accuracy
Unexpected Overtime
Unexpected Overtime
Symptom: Routes extending past regular hoursCauses:
- snapUnit delaying arrivals
- Padding accumulating
- Poor ASAP prioritization
- Increase overtimeWeight
- Review time feature combinations
- Adjust shift definitions
Related Features
Time Windows
Core time scheduling features
Cost Optimization
Overtime cost configuration
Break Management
How breaks interact with timing
Multi-Day Planning
Extended planning horizons