Evaluating and Comparing VRP Solutions
This guide demonstrates how to use the VRP solver’s evaluation capabilities to assess existing routes and compare them with optimized solutions. This workflow is particularly useful when you want to:- Validate manual route assignments against optimal solutions
- Import routes from legacy systems and assess their efficiency
- Compare the impact of different business constraints
- Understand the cost of manual adjustments to optimized routes
Overview of the Evaluation Workflow
1
Generate an optimized solution
First, use the standard solve endpoint to get an optimal solution as your baseline.
2
Create alternative assignments
Make manual adjustments or import existing routes from another system.
3
Evaluate the alternative
Use the evaluate endpoint to assess the quality of your alternative solution.
4
Compare results
Analyze scores, constraint violations, and performance metrics between solutions.
Step 1: Generate an Optimized Solution
Start by creating an optimized solution using the standard solve endpoint:Save the job ID to retrieve the optimized solution later. The solve operation runs asynchronously.
Step 2: Retrieve the Optimized Solution
Once the job completes, retrieve the solution details:Step 3: Create an Alternative Solution
Now, let’s say you want to evaluate a different assignment - perhaps based on customer preferences or manual planning. Create an evaluation request with your alternative assignments:All jobs must have both
initialResource
and initialArrival
fields populated for the evaluate endpoint to work correctly.Step 4: Compare the Results
The evaluate endpoint returns a similar response structure, allowing direct comparison:Understanding the Comparison
Score Analysis
- Hard Score: 0 (all constraints satisfied)
- Soft Score: -15,420 (lower is better)
- Travel Time: 3,842 seconds
Key Metrics to Compare
Total Travel Time
The alternative solution requires 981 additional seconds (16 minutes) of travel time.
Distance Traveled
The alternative covers 7.4 km more distance due to less optimal routing.
Planned Deviation
When
plannedArrival
is provided, the solver tracks how much the actual arrival deviates.Resource Utilization
Compare how balanced the workload is across drivers in each solution.
Advanced Evaluation Features
Evaluating Partial Solutions
If you only want to fix some assignments and let the solver optimize the rest:Use the
suggest
endpoint instead of evaluate
when you have partially assigned solutions and want recommendations for unassigned jobs.Getting Detailed Explanations
Enable explanations to understand why certain assignments might be suboptimal:- Which constraints are causing score penalties
- Why certain assignments might be infeasible
- The relative importance of different optimization factors
Best Practices
When to Use Evaluation
When to Use Evaluation
- Validating manual route plans before execution
- Importing and assessing routes from legacy systems
- Understanding the impact of business rule changes
- Comparing different optimization strategies
Performance Considerations
Performance Considerations
- The evaluate endpoint has similar performance to solve
- Use the same distance matrix configuration for fair comparison
- Consider using synchronous endpoints for small instances
Common Pitfalls
Common Pitfalls
- Forgetting to set
initialResource
for all jobs - Using inconsistent time formats between requests
- Not accounting for distance matrix differences
- Comparing solutions with different constraint configurations
Next Steps
- Learn about constraint configuration to understand score components
- Explore job relations for complex routing scenarios
- Check out synchronous operations for real-time evaluation