Scoring & Explanation System
Understand how the VRP solver evaluates solutions and provides detailed explanations
Scoring & Explanation System
The VRP solver uses a sophisticated three-level scoring system to evaluate and optimize solutions. This guide explains how scoring works, how to interpret results, and how to use the explanation system to understand and improve your solutions.
Three-Level Scoring System
The solver evaluates solutions using three distinct score levels:
Score levels hierarchy: Hard constraints must be satisfied, then medium, then soft
Score Components
The score object in the response contains:
Understanding Constraint Levels
Hard Constraints (Must Satisfy)
Hard constraints represent inviolable business rules:
Arriving outside this window makes the solution infeasible.
Arriving outside this window makes the solution infeasible.
Overloading vehicles violates hard constraints.
Missing required skills makes assignment impossible.
Medium Constraints (Important)
Medium constraints are strongly preferred but can be violated:
- Overtime limits (when not strict)
- Preferred time windows
- Some job relations
Soft Constraints (Optimize)
Soft constraints improve solution quality:
- Minimize travel time
- Minimize wait time
- Balance workload
- Customer preferences
Weight Configuration
Control the importance of different objectives using weights:
Weight Parameters
Base weight for travel time. Other weights are relative to this.
Penalty for idle time at locations. Set >0 to minimize waiting.
Importance of scheduling urgent jobs early. Higher = more urgent jobs first.
Ensures high-priority jobs are included when capacity is limited.
Balances work across resources. Higher = more equal distribution.
Cost of using additional vehicles. Set to hourly cost equivalent (e.g., 3600 = 1 hour travel time).
Weight Tuning Strategy:
- Start with default weights
- Identify which objectives aren’t meeting expectations
- Increase weights for underperforming objectives
- Test with 2-5x increases to see impact
- Fine-tune based on results
Explanation API
Get detailed insights into constraint violations and alternative assignments:
Request Explanation
Analyze Results
The explanation response includes:
- Constraint violations
- Score breakdown
- Alternative assignments
- Unassigned job reasons
Explanation Response Structure
Constraint Types Reference
Hard Constraints
Constraint | Description | Common Cause |
---|---|---|
TIME_WINDOW_CONFLICT | Job scheduled outside time window | Tight schedules, too many jobs |
TRIP_CAPACITY | Vehicle capacity exceeded | Underestimated loads, few vehicles |
TAG_HARD | Missing required skill/tag | Skill mismatch |
SHIFT_END_CONFLICT | Work extends past shift end | Long routes, late starts |
MAX_DRIVE_TIME | Legal driving limit exceeded | Long distances |
DISALLOWED_RESOURCES | Job assigned to blacklisted resource | Configuration error |
Medium Constraints
Constraint | Description | Impact |
---|---|---|
OVERTIME_END_CONFLICT | Work extends into overtime | Additional costs |
DATE_TIME_WINDOW_CONFLICT_SOFT | Soft time window violated | Customer dissatisfaction |
SAME_TRIP | Related jobs on different trips | Inefficiency |
Soft Constraints
Constraint | Description | Optimization Goal |
---|---|---|
TRAVEL_TIME | Total travel time | Minimize |
WAIT_TIME | Idle time at locations | Minimize |
RESOURCE_ACTIVATION | Number of vehicles used | Minimize |
RANKING_SOFT | Resource preference score | Match preferences |
FAIR_WORK | Workload imbalance | Equalize |
Unassigned Jobs Analysis
When jobs can’t be assigned, the response includes detailed reasons:
Common Unassigned Reasons
TIME_WINDOW_CONFLICT
TIME_WINDOW_CONFLICT
Problem: No vehicle can reach the job within its time window.
Solutions:
- Widen time windows
- Add more vehicles
- Start shifts earlier
- Reduce service times
TRIP_CAPACITY
TRIP_CAPACITY
Problem: Job’s load exceeds all available vehicle capacities.
Solutions:
- Use larger vehicles
- Split large deliveries
- Add more vehicles
- Review load calculations
TAG_HARD
TAG_HARD
Problem: No available vehicle has required skills/equipment.
Solutions:
- Add qualified resources
- Train existing resources
- Review skill requirements
- Use soft tags for preferences
SHIFT_END_CONFLICT
SHIFT_END_CONFLICT
Problem: Job can’t be completed within working hours.
Solutions:
- Extend shifts
- Add overtime allowance
- Reduce job count
- Optimize route order
Alternative Assignments
The explanation API can suggest alternative assignments:
Understanding Alternatives
Each alternative shows:
- Resource: Which vehicle could take the job
- Position: Where in the route (after which job)
- Timing: Suggested arrival time
- Score Impact: How it affects the overall score
Alternatives are particularly useful for:
- Manual adjustments
- Understanding trade-offs
- Identifying bottlenecks
- Customer negotiations
Improving Solutions
Strategy 1: Fix Infeasibilities First
Identify Hard Violations
Check the conflicts array for hard constraints
Address Root Causes
- Add resources
- Adjust time windows
- Modify capacity
- Update skills
Re-solve
Submit updated request
Strategy 2: Optimize Quality
Once feasible, improve soft score:
Strategy 3: Use Partial Planning
When full assignment is impossible:
With partial planning, focus on:
- High-priority jobs getting assigned
- Understanding why others failed
- Planning follow-up solutions
Best Practices
Score Interpretation Guidelines:
- Feasibility First: Always achieve hardScore = 0 before optimizing
- Baseline Comparison: Save scores from good solutions as benchmarks
- Incremental Changes: Adjust one weight at a time to understand impact
- Document Weights: Record why specific weights were chosen
- Monitor Trends: Track how scores change with different inputs
Performance Considerations
The explanation API adds computational overhead:
Use for production routing
Use for production routing
Use for analysis and debugging