Cost Optimization
The VRP solver provides comprehensive cost modeling to optimize your routing operations based on real business constraints. This guide covers various cost types, urgency handling, and optimization strategies.Cost Types Overview
The solver considers multiple cost components when optimizing routes:Total Cost = Fixed Costs + Variable Costs + Penalty Costs
- Fixed Costs: Activation costs for using resources
- Variable Costs: Time-based costs (hourly rates, overtime)
- Penalty Costs: Violations of soft constraints
Resource Cost Configuration
Hourly Costs
Configure time-based costs for resources:Hourly costs apply to the entire shift duration, not just driving time. Consider using activation costs if you only want to charge for actual usage.
Activation Costs
Fixed costs incurred when a resource is used:Cost Calculation Examples
Travel Cost Optimization
Travel Time Weights
Control the importance of minimizing travel time:Multiplier for travel time in the objective function. Higher values prioritize shorter travel times.
Multiplier for travel distance. Set > 0 to optimize for distance instead of time.
Balancing Travel vs Other Objectives
Urgency-Based Optimization
Basic Urgency Scoring
Prioritize time-sensitive jobs:Priority score from 0-100. Higher values are scheduled earlier.
Urgency Calculation Formula
Urgency Impact = urgency × urgencyWeight × time_until_scheduledThis creates increasing pressure to schedule urgent jobs sooner.
ASAP Scheduling
Schedule jobs as soon as possible across multiple days:DayIndex Strategy
1
Set dayIndex
dayIndex: 0
= available immediately
dayIndex: 1
= available from day 2
dayIndex: 2
= available from day 32
Configure Weight
Higher
asapWeight
= stronger preference for early scheduling3
Combine with Urgency
Optimization Strategies
Strategy 1: Cost Minimization
Focus on reducing operational costs:Strategy 2: Service Level Optimization
Prioritize customer satisfaction:Strategy 3: Balanced Optimization
Cost Analysis in Results
The solution provides detailed cost breakdowns:Understanding Cost Components
Fixed Costs
Fixed Costs
- Resource activation costs
- Daily vehicle fees
- Equipment rental charges
- Base operating costs
Variable Costs
Variable Costs
- Hourly labor costs
- Fuel costs (via travel time)
- Overtime premiums
- Distance-based charges
Penalty Costs
Penalty Costs
- Soft time window violations
- Preference violations
- Workload imbalance penalties
- Capacity overages (if allowed)
Advanced Cost Scenarios
Peak Hour Pricing
Different costs for different times:Multi-Objective Optimization
Balance competing objectives:Performance Tips
Cost Calculation Performance:
- Complex cost models increase computation time
- Many soft constraints require more iterations
- Large weight differences can cause instability
- Keep weights in reasonable ratios (1:100 max)
- Use hard constraints where possible
- Profile different weight combinations
Best Practices
1
Start with Defaults
Begin with default weights and adjust based on results
2
Measure Impact
Track these metrics:
- Total operational cost
- Cost per delivery/service
- Resource utilization rates
- Customer satisfaction scores
3
Iterate and Refine
- Adjust weights based on business priorities
- Monitor unintended consequences
- Document weight configurations
4
Consider Trade-offs
- Lower costs vs better service
- Fewer vehicles vs more overtime
- Urgency vs efficiency
Troubleshooting
Unexpected High Costs
Unexpected High Costs
Check:
- Overtime penalties being triggered
- Excessive activation of resources
- Long travel times due to poor clustering
- Soft constraint violations
- Review shift definitions
- Adjust activation costs
- Modify territory assignments
- Convert critical soft constraints to hard
Poor Route Quality
Poor Route Quality
Check:
- Weight balance between objectives
- Conflicting constraints
- Insufficient resources
- Reduce focus on cost minimization
- Increase service-related weights
- Add resources or extend shifts
Urgency Not Respected
Urgency Not Respected
Check:
- urgencyWeight value
- Competing objectives
- Time window conflicts
- Increase urgencyWeight significantly
- Reduce other weight values
- Review job time windows