> ## 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.

# Explanation

The explanation endpoint returns the score and the constraints that are violated in the current solution.
It can give the insights into why a solve was like it is.

| Name           | Type                        | Description                                                    |
| -------------- | --------------------------- | -------------------------------------------------------------- |
| `score`        | [Score](#score)             | Score                                                          |
| `conflicts`    | [Conflict](#conflict)       | Conflicts                                                      |
| `unresolved`   | [Unresolved](#unresolved)   | Unresolved constraints                                         |
| `alternatives` | [Alternative](#alternative) | Alternative assignments when explanation is enabled (optional) |

Example:

```json explanation [expandable] theme={null}
{
  "score": {
    "hard": 0,
    "soft": -6924,
    "feasible": true
  },
  "unresolved": [
    {
      "constraint": "JOB_DAY_INDEX",
      "score": "-7soft"
    },
    {
      "constraint": "TRAVEL_TIME",
      "score": "-6917soft"
    },
    {
      "constraint": "UNUSED_RESOURCES",
      "score": "-25200medium"
    }
  ]
}
```

## Unresolved

| Name         | Type   | Description              |
| ------------ | ------ | ------------------------ |
| `constraint` | string | Routing constraint name  |
| `score`      | string | score of this constraint |

## Conflict

| Name         | Type                             | Description                    |
| ------------ | -------------------------------- | ------------------------------ |
| `constraint` | [RoutingConstraint](#constraint) | Routing constraint name        |
| `score`      | string                           | score of this constraint       |
| `job`        | string                           | job name in this conflict      |
| `resource`   | string                           | resource name in this conflict |
| `tag`        | string                           | tag name in this conflict      |

## Constraint

The following constraints can appear in the explanation response:

| Name                               | Description                                  | Impact |
| ---------------------------------- | -------------------------------------------- | ------ |
| `TRIP_CAPACITY`                    | Vehicle capacity exceeded for a trip         | hard   |
| `RESOURCE_CAPACITY`                | Resource capacity exceeded                   | hard   |
| `RESOURCE_CAPACITY2`               | Secondary resource capacity exceeded         | hard   |
| `TRAVEL_TIME`                      | Travel time optimization                     | soft   |
| `TYPE_REQUIREMENT`                 | Job type requirements not met by resource    | hard   |
| `TAG_SOFT`                         | Soft tag preference not satisfied            | soft   |
| `TAG_HARD`                         | Hard tag requirement not satisfied           | hard   |
| `TYPE_REQUIREMENT_SOFT`            | Soft type requirement not satisfied          | soft   |
| `END_LOCATION_TRAVEL_TIME`         | Travel time from last job to end location    | soft   |
| `TIME_WINDOW_CONFLICT`             | Job scheduled outside its time window        | hard   |
| `SHIFT_END_CONFLICT`               | Job extends beyond resource shift end time   | hard   |
| `OVERTIME_END_CONFLICT`            | Job extends beyond overtime limit            | hard   |
| `RESOURCE_USAGE`                   | Resource usage optimization                  | medium |
| `URGENCY`                          | Urgent job scheduling priority               | soft   |
| `PREFERRED_RESOURCE_CONFLICT`      | Job not assigned to preferred resource       | soft   |
| `ALLOWED_RESOURCES`                | Job assigned to non-allowed resource         | hard   |
| `DISALLOWED_RESOURCES`             | Job assigned to disallowed resource          | hard   |
| `REGION_TIME`                      | Regional time constraint violation           | soft   |
| `FAIR_WORK`                        | Work distribution fairness across resources  | soft   |
| `UNSERVED_JOBS`                    | Jobs that could not be scheduled             | medium |
| `RESOURCE_ACTIVATION`              | Resource activation cost                     | medium |
| `OPEN_DAYS`                        | Resource scheduled on non-working day        | hard   |
| `JOB_PRECEDENCE`                   | Job precedence order violated                | hard   |
| `JOB_DAY_INDEX`                    | Job not scheduled on required day            | soft   |
| `DATE_TIME_WINDOW_CONFLICT`        | Job scheduled outside date/time window       | hard   |
| `DATE_TIME_WINDOW_CONFLICT_SOFT`   | Soft date/time window preference not met     | soft   |
| `LINKED_JOB_CONFLICT`              | Linked jobs constraint violation             | hard   |
| `PLANNED_RESOURCE`                 | Job not assigned to planned resource         | soft   |
| `PLANNED_ARRIVAL`                  | Job arrival time differs from planned        | soft   |
| `PLANNED_DATE`                     | Job scheduled on different date than planned | soft   |
| `WORKING_TIME`                     | Total working time constraint                | soft   |
| `HARD_JOBS`                        | Hard job requirement not satisfied           | hard   |
| `MAX_DRIVE_TIME`                   | Maximum drive time per resource exceeded     | hard   |
| `MAX_DRIVE_TIME_JOB`               | Maximum drive time per job exceeded          | hard   |
| `FAIR_TOTAL_WORK`                  | Total work fairness across resources         | soft   |
| `RESOURCE_PERIOD_MAX_SERVICE_TIME` | Maximum service time per period exceeded     | hard   |
| `RESOURCE_PERIOD_MAX_DRIVE_TIME`   | Maximum drive time per period exceeded       | hard   |
| `RESOURCE_PERIOD_MAX_WORK_TIME`    | Maximum work time per period exceeded        | hard   |
| `RESOURCE_PERIOD_MIN_SERVICE_TIME` | Minimum service time per period not met      | soft   |
| `RESOURCE_PERIOD_MIN_DRIVE_TIME`   | Minimum drive time per period not met        | soft   |
| `RESOURCE_PERIOD_MIN_WORK_TIME`    | Minimum work time per period not met         | soft   |
| `MINIMISE_TRIP_USAGE`              | Trip usage minimization                      | soft   |
| `DELIVERY_NOT_ON_SAME_VEHICLE`     | Pickup and delivery not on same vehicle      | hard   |
| `DELIVERY_BEFORE_PICKUP`           | Delivery scheduled before pickup             | hard   |
| `SAME_TRIP`                        | Jobs must be on same trip                    | hard   |
| `SEQUENCE`                         | Job sequence constraint                      | hard   |
| `SAME_TIME`                        | Jobs must be at same time                    | hard   |
| `NEIGHBOR`                         | Jobs must be neighbors in sequence           | hard   |
| `DIRECT_SEQUENCE`                  | Jobs must be in direct sequence              | hard   |
| `SAME_RESOURCE`                    | Jobs must be assigned to same resource       | hard   |
| `WAIT_TIME`                        | Wait time optimization                       | soft   |
| `DRIVE_TIME`                       | Drive time optimization                      | soft   |
