Overview

When the VRP solver cannot assign certain jobs to any resource, it can now provide detailed reasons explaining why each job remains unassigned. This feature helps identify scheduling conflicts and constraints preventing job assignments.

Enabling Unassigned Reasons

To receive unassigned reasons in your response, enable the explanation feature with the onlyUnassigned option:

{
  "options": {
    "explanation": {
      "enabled": true,
      "onlyUnassigned": true
    }
  }
}

Example Request

Here’s an example where jobs cannot be assigned due to time window conflicts:

{
 "resources": [
    {
      "name": "R-1",
      "start": {
        "latitude": 50.9712020025867901,
        "longitude": 3.86665669380
      },
      "shifts": [
        {
          "from":
        }
      ]
    }
  ],
  "jobs": [
    {
      "name": "J-1",
      "location": {
        "latitude": 50.98178504860948,
        "longitude": 3.5914227684018565
      },
      "duration": 3456
    },
    {
      "name": "J-2",
      "location": {
        "latitude": 51.088727780102886,
        "longitude": 3.695412188048855
      },
      "duration": 3090
    }
  ],
  "options": {
    "partialPlanning": true,
    "explanation": {
      "enabled": true,
      "onlyUnassigned": true
    }
  }
}

Example Response

The response includes an unservedReasons map that explains why each unassigned job could not be scheduled:

{
  "solution": {
    "routes": [
      {
        "resource": "worker1",
        "jobs": ["job2"]
      }
    ]
  },
  "unserved": ["job1"],
  "unservedReasons": {
    "job1": [
      "DATE_TIME_WINDOW_CONFLICT",
      "SHIFT_TIME_CONFLICT"
    ]
  }
}

Common Unassigned Reasons

ReasonDescription
DATE_TIME_WINDOW_CONFLICTJob’s time window doesn’t overlap with any available resource shift
SHIFT_TIME_CONFLICTResource shift cannot accommodate the job duration
TRIP_CAPACITYVehicle capacity exceeded
TAGSResource lacks required tags for the job

Use Cases

  1. Capacity Planning: Identify when you need more resources or extended shifts
  2. Schedule Optimization: Understand which constraints are most restrictive
  3. Customer Communication: Provide clear explanations for service limitations
  4. System Debugging: Quickly identify configuration issues preventing assignments

Performance Considerations

  • Setting onlyUnassigned: true improves performance by only analyzing unassigned jobs
  • For large problems, consider using this feature selectively during debugging
  • The explanation process runs after the main optimization, so it doesn’t impact solution quality. It impacts latency however.