Skip to main content

Advanced Time & Scheduling Features

Beyond basic time windows, the VRP solver offers sophisticated time management capabilities for complex scheduling scenarios. This guide covers advanced features including multiple time windows, soft constraints, wait time optimization, and more.

Multiple Time Windows

Jobs can have multiple valid time slots, giving the solver flexibility to choose the most efficient option:
Multiple time windows are ideal for customers who offer morning OR afternoon availability. The solver automatically selects the window that optimizes the overall route.

Soft Time Windows

Allow time window violations with penalties instead of hard constraints:
boolean
default:"true"
When false, the time window becomes a soft constraint that can be violated with a penalty
integer
default:"1"
Penalty weight for violating the soft time window. Higher values make violations less likely.

Combining Hard and Soft Windows

Time Snapping (snapUnit)

Round arrival times to specific intervals for cleaner schedules:
How snapUnit works:
  • Arrival times are rounded UP to the nearest snapUnit
  • Example: With snapUnit: 300 (5 minutes)
    • Arrival at 9:02 → Snapped to 9:05
    • Arrival at 9:05 → Stays at 9:05
    • Arrival at 9:07 → Snapped to 9:10

Use Cases for snapUnit

Perfect for service businesses that book in standard time slots.

Job Padding

Postpone the arrival at a job by a fixed buffer, for example to reserve time to park or check in:
Padding is applied AFTER snap unit calculations. If arrival is snapped to 9:00 and padding is 300 seconds, the actual arrival becomes 9:05.Padding delays the arrival at the job after travel, so it has no effect on the first job of a trip. No padding is added after the service ends.

Duration Squash

Reduce service time for consecutive jobs at the same location:
1

First Job at Location

Full duration applies: 600 seconds (10 minutes)
2

Subsequent Jobs

If travel time < 1 minute, duration becomes durationSquash: 120 seconds (2 minutes)

Resumable Jobs

Allow an UNAVAILABILITY break to interrupt a long service job:
With resumable: true, the 5-hour job can be split around the UNAVAILABILITY break:
  • 8:00-12:00: Work 4 hours
  • 12:00-13:00: Unavailable
  • 13:00-14:00: Resume and complete
resumable only has an effect over UNAVAILABILITY breaks. WINDOWED breaks are placed between jobs and never interrupt one. See Resumable Jobs.

Wait Time Optimization

Control how the solver handles waiting time at locations:

Wait Time Scenarios

Best for: Delivery services where drivers should stay productive

Overtime Management

Handle shift extensions with soft or hard constraints:
Overtime Behavior:
  • Regular shift: 8:00-17:00 (no penalty)
  • Overtime zone: 17:00-19:00 (penalized but allowed)
  • After overtimeEnd: Not allowed (hard constraint)

Multi-Day ASAP Scheduling

Optimize job scheduling across multiple days:
asapWeight is a soft, per-day preference: the solver favours earlier days when it can, but it trades this off against travel time and the other weights. Raise it to pull work earlier.

Complex Example: Field Service

Combining multiple time features for realistic field service:

Performance Tips

Time Feature Performance Impact:
  1. Multiple Windows: Each additional window increases complexity
  2. Soft Constraints: More flexible but requires more computation
  3. Small snapUnit: More precision = more possible solutions
  4. Resumable Jobs: Only mark jobs resumable when an UNAVAILABILITY break may interrupt them
For best performance, use only the time features you actually need.