Skip to main content

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:
cURL
Success Response
Save the job ID to retrieve the optimized solution later. The solve operation runs asynchronously, and the millis query parameter sets the solve time budget in milliseconds. The status moves from QUEUED to SOLVING to SOLVED (or ERROR).

Step 2: Retrieve the Optimized Solution

Once the job completes, retrieve the solution details:
cURL
Optimized Solution

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:
cURL
All jobs must have both initialResource and initialArrival fields populated for the evaluate endpoint to work correctly.

Step 4: Compare the Results

Evaluate is asynchronous like solve. Retrieve the result with GET /v2/vrp/jobs/{id}/solution; it has the same structure as the optimized solution, allowing direct comparison:
Alternative Solution Evaluation

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.

Resource Utilization

Compare how balanced the workload is across drivers in each solution.

Advanced Evaluation Features

Evaluating Partial Solutions

The evaluate endpoint scores a complete plan, so every job must carry initialResource. If you only want to fix some assignments and let the solver place the rest, use the suggest endpoint instead: it takes one unassigned job and returns ranked insertion options into your existing schedule.
See Suggest for how to request insertion options for a single unassigned job.

Getting Detailed Explanations

Set options.explanation.enabled to true on the request to understand why certain assignments might be suboptimal, then fetch the explanation:
cURL
This returns detailed constraint violation information, helping you understand:
  • Which constraints are causing score penalties
  • Why certain assignments might be infeasible
  • The relative importance of different optimization factors

Best Practices

  • Validating manual route plans before execution
  • Importing and assessing routes from legacy systems
  • Understanding the impact of business rule changes
  • Comparing different optimization strategies
  • The evaluate endpoint has similar performance to solve
  • Use the same distance matrix configuration for fair comparison
  • Consider using synchronous endpoints for small instances
  • Leaving a job without initialResource (use suggest for a single unassigned job)
  • Using inconsistent time formats between requests
  • Not accounting for distance matrix differences
  • Comparing solutions with different constraint configurations

Next Steps