> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Solution Quality Metrics

> Evaluate and optimize the quality of your VRP solutions

# Solution Quality Metrics

Understanding solution quality goes beyond simple feasibility. This guide explains the key metrics for evaluating VRP solutions, how to interpret them, and strategies for improvement.

## What Makes a Good Solution?

A high-quality VRP solution balances multiple objectives:

```mermaid theme={null}
mindmap
  root((Solution Quality))
    FEASIBLE
      All jobs assigned
      Capacity respected
      Time windows met
    EFFICIENT
      Minimize travel time
      Minimize wait time
      Short routes
    BALANCED
      Fair work distribution
      Good occupancy
      High utilization
    CUSTOMER FOCUSED
      On-time delivery
      Respect preferences
      Handle priorities
    COST EFFECTIVE
      Minimize fleet size
      Minimize hours
      Minimize overtime
```

## Core Quality Metrics

### 1. Feasibility Rate

The percentage of jobs successfully assigned:

```
Feasibility Rate = (Assigned Jobs / Total Jobs) × 100%
```

<Tabs>
  <Tab title="Perfect (100%)">
    ```json theme={null}
    {
      "totalJobs": 50,
      "assignedJobs": 50,
      "unassigned": [],
      "feasibilityRate": 100
    }
    ```

    Ideal scenario - all jobs scheduled.
  </Tab>

  <Tab title="Good (95%+)">
    ```json theme={null}
    {
      "totalJobs": 50,
      "assignedJobs": 48,
      "unassigned": ["job-23", "job-47"],
      "feasibilityRate": 96
    }
    ```

    Acceptable with partial planning enabled.
  </Tab>

  <Tab title="Poor (<90%)">
    ```json theme={null}
    {
      "totalJobs": 50,
      "assignedJobs": 42,
      "unassigned": [...],
      "feasibilityRate": 84
    }
    ```

    Indicates capacity or constraint issues.
  </Tab>
</Tabs>

### 2. Occupancy

How full the schedule is in terms of work time versus available time:

```
Occupancy = (Total Work Time / Total Available Time) × 100%
```

<Info>
  **Work Time includes**:

  * Travel time
  * Service time
  * Wait time (if any)

  **Available Time**:

  * Shift duration minus breaks
</Info>

```json theme={null}
{
  "occupancy": 0.78,  // 78% utilized
  "totalWorkTimeInSeconds": 28080,
  "totalAvailableTimeInSeconds": 36000,
  "breakdown": {
    "travelTime": 14400,  // 40%
    "serviceTime": 12600,  // 35%
    "waitTime": 1080       // 3%
  }
}
```

**Interpreting Occupancy**:

* **\< 60%**: Underutilized - consider reducing fleet
* **60-85%**: Optimal range - good efficiency with buffer
* **> 85%**: High utilization - limited flexibility
* **> 95%**: Over-stretched - risk of delays

### 3. Workload Fairness

Measures how evenly work is distributed across resources:

```
Fairness = 1 - (Standard Deviation / Mean Work Time)
```

```mermaid theme={null}
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#ff6b6b', 'primaryTextColor':'#fff', 'primaryBorderColor':'#ff8787', 'lineColor':'#5c7cfa', 'secondaryColor':'#339af0', 'tertiaryColor':'#51cf66'}}}%%
gantt
    title Workload Distribution Comparison
    dateFormat HH:mm
    axisFormat %H:%M
    
    section Unfair (0.45)
    Resource 1    :done, r1a, 00:00, 8h
    Resource 2    :done, r2a, 00:00, 1h
    Resource 3    :done, r3a, 00:00, 2h
    Resource 4    :done, r4a, 00:00, 8h
    
    section Fair (0.92)
    Resource 1    :active, r1b, 00:00, 4h
    Resource 2    :active, r2b, 00:00, 3h 30m
    Resource 3    :active, r3b, 00:00, 4h
    Resource 4    :active, r4b, 00:00, 3h 30m
```

```json theme={null}
{
  "workloadFairness": 0.85,
  "resourceWorkloads": [
    {"resource": "driver-1", "workTime": 420, "deviation": 15},
    {"resource": "driver-2", "workTime": 390, "deviation": -15},
    {"resource": "driver-3", "workTime": 405, "deviation": 0}
  ],
  "averageWorkTime": 405,
  "standardDeviation": 15
}
```

### 4. Travel Efficiency

Multiple metrics evaluate routing efficiency:

#### Total Distance & Time

```json theme={null}
{
  "totalTravelDistanceInMeters": 245000,
  "totalTravelTimeInSeconds": 28800,
  "averageSpeed": 30.6  // km/h
}
```

#### Distance per Job

```
Efficiency = Total Distance / Number of Jobs
```

Lower values indicate better clustering and routing.

#### Circuity Factor

```
Circuity = Actual Distance / Direct Distance
```

Values close to 1.0 indicate direct routes.

### 5. Time-Based Metrics

#### On-Time Performance

```json theme={null}
{
  "onTimeDeliveries": 47,
  "lateDeliveries": 3,
  "onTimeRate": 0.94,
  "averageDelay": 780  // seconds
}
```

#### Wait Time Analysis

```json theme={null}
{
  "totalWaitTimeInSeconds": 3600,
  "jobsWithWaitTime": 8,
  "averageWaitPerJob": 450,
  "waitTimePercentage": 0.05  // 5% of total time
}
```

<Warning>
  High wait times indicate:

  * Poor time window alignment
  * Suboptimal route sequencing
  * Need for dynamic scheduling
</Warning>

## Advanced Quality Indicators

### Service Level Metrics

<Tabs>
  <Tab title="Priority Fulfillment">
    ```json theme={null}
    {
      "priorityLevels": {
        "high": {"total": 10, "assigned": 10, "rate": 1.0},
        "medium": {"total": 25, "assigned": 23, "rate": 0.92},
        "low": {"total": 15, "assigned": 12, "rate": 0.8}
      },
      "weightedFulfillment": 0.93
    }
    ```
  </Tab>

  <Tab title="Customer Preferences">
    ```json theme={null}
    {
      "preferredResourceMatches": 35,
      "totalPreferences": 40,
      "preferenceRate": 0.875,
      "tagMatchRate": 0.95
    }
    ```
  </Tab>

  <Tab title="Time Window Compliance">
    ```json theme={null}
    {
      "hardWindowViolations": 0,
      "softWindowViolations": 5,
      "averageArrivalDeviation": -300,  // 5 min early on average
      "windowComplianceRate": 0.95
    }
    ```
  </Tab>
</Tabs>

### Cost Effectiveness

<CodeGroup>
  ```json Fleet Utilization theme={null}
  {
    "totalResources": 10,
    "activeResources": 7,
    "utilizationRate": 0.7,
    "costPerJob": 45.20,
    "costPerKm": 2.10
  }
  ```

  ```json Overtime Analysis theme={null}
  {
    "regularHours": 280,
    "overtimeHours": 15,
    "overtimeRate": 0.051,
    "overtimeCost": 450,
    "percentOfTotalCost": 0.08
  }
  ```

  ```json Resource Efficiency theme={null}
  {
    "revenuePerRoute": 850,
    "costPerRoute": 320,
    "profitMargin": 0.624,
    "jobsPerResourceHour": 2.3
  }
  ```
</CodeGroup>

## Comparing Solutions

When evaluating alternative solutions:

### Multi-Criteria Comparison

```mermaid theme={null}
graph LR
    subgraph "Solution Comparison Matrix"
        subgraph "Solution A"
            A1["Feasibility: 100%<br/>Travel: 4.2h<br/>Fleet: 5<br/>Fairness: 0.85<br/>Cost: $1,250<br/>Score: 8.2/10"]
        end
        
        subgraph "Solution B ⭐"
            B1["Feasibility: 95%<br/>Travel: 3.8h<br/>Fleet: 4<br/>Fairness: 0.92<br/>Cost: $1,180<br/>Score: 8.7/10"]
        end
        
        subgraph "Solution C"
            C1["Feasibility: 100%<br/>Travel: 4.5h<br/>Fleet: 6<br/>Fairness: 0.78<br/>Cost: $1,320<br/>Score: 7.5/10"]
        end
    end
    
    style A1 fill:#e3f2fd,stroke:#1976d2
    style B1 fill:#c8e6c9,stroke:#388e3c
    style C1 fill:#ffecb3,stroke:#f57c00
```

### Pareto Optimization

Often no single "best" solution exists. Consider Pareto-optimal solutions:

<Tip>
  A solution is Pareto-optimal if improving one metric necessarily worsens another. Keep multiple Pareto-optimal solutions for different scenarios.
</Tip>

### Weighted Scoring

Create a composite score based on business priorities:

```javascript theme={null}
const weights = {
  feasibility: 0.3,
  efficiency: 0.25,
  cost: 0.25,
  service: 0.2
};

const compositeScore = 
  (feasibilityRate * weights.feasibility) +
  (efficiencyScore * weights.efficiency) +
  (costScore * weights.cost) +
  (serviceScore * weights.service);
```

## Improvement Strategies

### For Low Feasibility

<Steps>
  <Step title="Enable Partial Planning">
    ```json theme={null}
    {"options": {"partialPlanning": true}}
    ```
  </Step>

  <Step title="Relax Constraints">
    Convert hard constraints to soft where possible
  </Step>

  <Step title="Add Resources">
    Increase fleet size or extend shifts
  </Step>

  <Step title="Review Requirements">
    Check if all constraints are necessary
  </Step>
</Steps>

### For Poor Efficiency

<Tabs>
  <Tab title="Reduce Travel">
    ```json theme={null}
    {
      "weights": {
        "travelTimeWeight": 5,
        "regionMinimisationWeight": 10
      }
    }
    ```
  </Tab>

  <Tab title="Minimize Wait">
    ```json theme={null}
    {
      "weights": {
        "waitTimeWeight": 20
      },
      "options": {
        "snapUnit": 900  // 15-min slots
      }
    }
    ```
  </Tab>

  <Tab title="Optimize Routes">
    ```json theme={null}
    {
      "options": {
        "distanceMatrix": {
          "enabled": true,
          "traffic": true
        }
      }
    }
    ```
  </Tab>
</Tabs>

### For Imbalanced Workload

```json theme={null}
{
  "options": {
    "fairWorkloadPerResource": true,
    "workloadSensitivity": 0.1,  // 10% tolerance
    "weights": {
      "workloadSpreadWeight": 100
    }
  }
}
```

## Monitoring Quality Over Time

Track metrics to identify trends:

<CodeGroup>
  ```json Daily Metrics theme={null}
  {
    "date": "2024-03-15",
    "metrics": {
      "feasibilityRate": 0.96,
      "occupancy": 0.78,
      "onTimeRate": 0.94,
      "costPerJob": 42.50
    }
  }
  ```

  ```json Weekly Trends theme={null}
  {
    "week": "2024-W11",
    "trends": {
      "feasibility": "+2%",
      "efficiency": "-5%",
      "cost": "+3%",
      "satisfaction": "stable"
    }
  }
  ```

  ```json Monthly KPIs theme={null}
  {
    "month": "2024-03",
    "kpis": {
      "avgFeasibility": 0.95,
      "avgOccupancy": 0.76,
      "fleetUtilization": 0.82,
      "customerSatisfaction": 4.2
    }
  }
  ```
</CodeGroup>

## Quality Benchmarks

Industry standards for different sectors:

| Sector            | Feasibility | Occupancy | On-Time | Fairness |
| ----------------- | ----------- | --------- | ------- | -------- |
| Parcel Delivery   | 98%+        | 75-85%    | 95%+    | 0.80+    |
| Field Service     | 95%+        | 65-75%    | 90%+    | 0.85+    |
| Food Delivery     | 99%+        | 70-80%    | 98%+    | 0.75+    |
| Medical Transport | 100%        | 60-70%    | 99%+    | 0.90+    |

<Note>
  Benchmarks vary by region, business model, and service level agreements. Use these as starting points and adjust based on your specific requirements.
</Note>

## Best Practices

<Check>
  **Quality Management Guidelines**:

  1. **Define Success Metrics**: Establish clear KPIs before optimization
  2. **Regular Monitoring**: Track metrics daily/weekly
  3. **Iterative Improvement**: Make small, measured changes
  4. **Balance Trade-offs**: No solution is perfect in all dimensions
  5. **Document Decisions**: Record why certain trade-offs were made
  6. **Benchmark Regularly**: Compare against historical performance
</Check>

## Related Topics

<CardGroup cols={2}>
  <Card title="Scoring System" icon="star" href="/guides/vrp/concepts/scoring-explanation">
    Understand score components
  </Card>

  <Card title="Performance Guide" icon="gauge" href="/guides/vrp/concepts/performance-guide">
    Optimize solution speed
  </Card>

  <Card title="Cost Optimization" icon="dollar" href="/guides/vrp/features/cost-optimization">
    Minimize operational costs
  </Card>

  <Card title="Unassigned Reasons" icon="wrench" href="/guides/vrp/features/unassigned-reasons">
    Fix quality issues
  </Card>
</CardGroup>
