Overview
Time windows define when jobs can be serviced, ensuring resources arrive within specified time ranges. This feature enables you to meet customer expectations, comply with delivery agreements, and optimize routes while respecting temporal constraints.The VRP solver automatically ensures resources arrive at the beginning of time windows, eliminating early arrivals and unnecessary waiting.
Time Window Configuration
Basic Structure
Each job can have multiple time windows, providing flexibility for service scheduling:Window Properties
Start time of the window in ISO 8601 format. The resource cannot arrive before this time.
End time of the window in ISO 8601 format. The resource must arrive before this time.
Whether violating this window makes the solution infeasible. Hard windows must be respected.
Penalty weight applied when soft windows are violated. Higher values increase violation cost.
Complete Example
This example demonstrates time window usage with partial planning enabled, showing how some jobs may remain unassigned due to time constraints.Key Insights
Why JOB-1 Was Unassigned
JOB-1 required service between 09:00-10:00 on 2023-01-02, but the route structure made it impossible to reach this location within the time window while also servicing JOB-2 (09:30-10:30).
Route Optimization Strategy
The solver:- Grouped jobs without time windows on Day 1 for maximum flexibility
- Scheduled time-windowed jobs on Day 2 where feasible
- Optimized travel paths to minimize total distance
- Left JOB-1 unassigned rather than violating hard constraints
Time Window Patterns
Single Narrow Window
For strict appointment times:Multiple Windows
For flexible scheduling options:Soft Windows with Preferences
For preferred but flexible timing:Best Practices
1
Use realistic window sizes
Allow sufficient time for travel and service. Overly narrow windows reduce routing flexibility and may lead to unassigned jobs.
2
Combine hard and soft windows
Use soft windows for preferences and hard windows for absolute requirements. This provides flexibility while meeting critical constraints.
3
Consider travel time
Account for realistic travel times between locations when setting consecutive time windows.
4
Enable partial planning
Set
partialPlanning: true
when time windows might make complete assignment impossible. This prevents infeasible solutions.Common Pitfalls
Overlapping windows causing conflicts
Overlapping windows causing conflicts
When multiple jobs have overlapping time windows in the same area, ensure there’s enough capacity to service them all:
Impossible window sequences
Impossible window sequences
Avoid setting windows that are physically impossible to achieve: