Distance Matrix Integration

The VRP solver integrates with Solvice Maps to generate high-quality distance matrices before optimization begins. This integration ensures that routing solutions are based on real-world travel times and distances rather than simple geographic calculations.

Why Distance Matrices Matter

Accurate distance and travel time data is fundamental to creating realistic routing solutions: Without accurate distance data, optimization would be based on:
  • Euclidean (straight-line) distances
  • Uniform travel speeds
  • No traffic considerations
  • No route restrictions
This leads to solutions that look optimal on paper but fail in reality.

How It Works

Pre-Processing Phase

Before the VRP solver begins optimization, it analyzes your request to identify all unique locations and generates distance matrices through Solvice Maps:
1

Location Extraction

The solver scans all jobs and resources to create a comprehensive list of unique coordinates that need distance calculations.
// Example extracted locations from jobs and resources
{
  "locations": [
    [4.3517, 50.8503],  // Brussels depot
    [2.3522, 48.8566],  // Paris delivery
    [3.0686, 50.6365],  // Lille pickup
    [1.0952, 49.4431]   // Rouen service
  ]
}
2

Matrix Request Generation

Creates optimized distance matrix requests to Solvice Maps, automatically handling:
  • Request splitting for large location sets
  • Vehicle category mapping (CAR, TRUCK, BICYCLE, etc.)
  • Routing engine selection based on data availability
3

Distance Matrix Creation

Generates distance matrices containing:
  • Durations: Travel time between all location pairs in seconds
  • Distances: Road network distances in meters
  • Time-dependent data: Traffic-aware matrices when applicable

Available Routing Options

The VRP solver provides several options for distance calculation:

Euclidean vs Real Road Networks

{
  "options": {
    "euclidian": true  // Use straight-line distances
  }
}
When to use:
  • Fast prototyping and testing
  • Scenarios where road networks don’t matter significantly
  • Performance-critical applications with acceptable accuracy trade-offs
Characteristics:
  • Instant calculation
  • No external dependencies
  • Less accurate for real-world scenarios

Routing Engine Selection

The VRP solver supports multiple routing engines through Solvice Maps:
{
  "options": {
    "routingEngine": "OSM"
  }
}
Available Engines:
  • OSM: OpenStreetMap data - comprehensive global coverage
  • TOMTOM: Commercial routing with traffic data for enhanced accuracy
Routing engine selection is typically handled automatically based on your region and requirements. TomTom routing provides traffic-aware matrices that can vary throughout the day.

Traffic-Aware Routing

For time-sensitive routing, the system can leverage traffic data to create time-dependent distance matrices:

Traffic Multiplier

Simple traffic adjustment for all routes:
{
  "options": {
    "traffic": 1.2  // Increase all travel times by 20%
  }
}

Time-Dependent Matrices

Advanced traffic-aware routing uses SplineMatrix technology to provide smooth time-dependent travel times:
// Fixed travel times regardless of departure time
{
  "durations": [
    [0, 3420, 2100, 4320],    // From Brussels
    [3420, 0, 1800, 2400],    // From Paris  
    [2100, 1800, 0, 3600],    // From Lille
    [4320, 2400, 3600, 0]     // From Rouen
  ]
}
Week Slice Categories:
  • MIDWEEK: Monday through Friday traffic patterns
  • WEEKEND: Saturday and Sunday traffic patterns

Vehicle Categories

Different vehicle types have different routing characteristics:
{
  "resources": [
    {
      "name": "delivery_van",
      "category": "CAR"  // Standard vehicle routing
    },
    {
      "name": "freight_truck", 
      "category": "TRUCK"  // Truck-specific routing restrictions
    }
  ]
}
Supported Categories:
  • CAR: Standard vehicle routing with full road access
  • TRUCK: Heavy vehicle routing with restrictions and regulations
  • Additional categories available based on regional requirements

Integration with VRP Solving

The distance data seamlessly integrates with the optimization process:

Performance Considerations

Matrix Size Impact

Problem SizeLocationsMatrix PairsTypical Generation Time
Small< 502,500< 2 seconds
Medium50-20040,0005-15 seconds
Large200-500250,00030-60 seconds
Enterprise500+500,000+1-5 minutes
Performance Optimization Tips:
  • Use euclidian: true for rapid prototyping and testing
  • Enable real routing only for production scenarios
  • Consider geographic clustering for very large problems
  • Monitor matrix generation time as part of total solve time

Configuration Examples

Basic Configuration

Most common setup for real-world routing:
{
  "jobs": [
    {"name": "delivery_1", "location": [2.3522, 48.8566]},
    {"name": "pickup_1", "location": [3.0686, 50.6365]}
  ],
  "resources": [
    {"name": "van_1", "start": [4.3517, 50.8503], "category": "CAR"}
  ],
  "options": {
    "euclidian": false,       // Use real road networks
    "routingEngine": "OSM"    // OpenStreetMap routing
  }
}

Traffic-Aware Configuration

For time-sensitive routing with traffic considerations:
{
  "jobs": [
    {"name": "morning_delivery", "location": [2.3522, 48.8566], 
     "windows": [{"from": "2024-03-15T08:00:00", "to": "2024-03-15T10:00:00"}]},
    {"name": "afternoon_pickup", "location": [3.0686, 50.6365],
     "windows": [{"from": "2024-03-15T14:00:00", "to": "2024-03-15T16:00:00"}]}
  ],
  "resources": [
    {"name": "driver_1", "start": [4.3517, 50.8503]}
  ],
  "options": {
    "euclidian": false,
    "routingEngine": "TOMTOM",  // Traffic-aware routing
    "traffic": 1.1              // Additional 10% buffer
  }
}

Fast Prototyping Configuration

For quick testing and development:
{
  "jobs": [...],
  "resources": [...],
  "options": {
    "euclidian": true,    // Fast straight-line distances
    "traffic": 1.0        // No traffic adjustment
  }
}

Error Handling

The VRP solver includes robust fallback mechanisms when distance matrix generation encounters issues:

Automatic Fallback

If real routing data is unavailable, the system automatically falls back to euclidean calculations:
{
  "warnings": [
    "Routing engine unavailable, using euclidean distances as fallback",
    "Some locations may not be reachable via road network"
  ]
}

Validation Checks

Before optimization begins, the system validates:
  • All job and resource locations have valid coordinates
  • Selected routing engine is available for the request region
  • Matrix generation completed successfully
  • Fallback options are properly configured

Best Practices

Distance Matrix Best Practices:
  1. Development: Use euclidian: true for fast iteration and testing
  2. Production: Always use real road networks (euclidian: false) for accurate results
  3. Traffic-Sensitive: Use TomTom routing engine for time-critical deliveries
  4. Large Problems: Monitor matrix generation time and consider geographic clustering
  5. Reliability: Implement proper error handling for matrix generation failures
  6. Testing: Validate solutions with known routes to verify distance accuracy

Real-World Impact

Using Solvice Maps for distance matrices typically results in:

Accuracy Improvement

20-40% more accurate travel time estimates compared to euclidean calculations

Route Feasibility

Higher solution quality with routes that work on actual road networks

Traffic Awareness

Better timing by considering rush hour and traffic patterns

Operational Efficiency

Reduced delivery delays through realistic route planning