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

> Contains the explanation, once solved.



## OpenAPI

````yaml vrp GET /v2/vrp/jobs/{id}/explanation
openapi: 3.1.0
info:
  description: |2-

                Welcome to the Solvice API! You can use our API to access Solvice API endpoints,
                which can get information on your solved jobs,
                their statuses and of course post new solve jobs.
            
  title: VRP API
  version: '2.0'
servers:
  - url: https://api.solvice.io
    description: Production API
security:
  - apikey: []
tags:
  - name: VRP API
    description: VRP API
paths:
  /v2/vrp/jobs/{id}/explanation:
    get:
      tags:
        - Info
      summary: Explanation
      description: Contains the explanation, once solved.
      operationId: getVRPExplanation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingExplanation'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '427':
          description: Too many requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    RoutingExplanation:
      type: object
      required:
        - score
      examples:
        - score:
            hard: -2000
            soft: -15000
            feasible: false
          conflicts:
            - constraint: TIME_WINDOW_CONFLICT
              score: '-1000'
              job: Job-1
              resource: vehicle-1
            - constraint: TAG_HARD
              score: '-1000'
              job: Job-2
              resource: vehicle-1
              tag: electrical
          unresolved:
            - constraint: TRAVEL_TIME
              score: '-15000'
          alternatives:
            Job-1:
              - job: Job-1
                resource: vehicle-2
                suggestedArrival: '2023-01-13T09:30:00Z'
                latestArrival: '2023-01-13T10:00:00Z'
                executedAfter: Job-0
                score:
                  hard: 0
                  soft: -1500
                  feasible: true
      description: >-
        Explains the conflicts of a certain routing solution and the unresolved
        constraints.
      properties:
        score:
          $ref: '#/components/schemas/Score'
          type: object
          description: Score of the solution.
        conflicts:
          type:
            - array
            - 'null'
            - object
          required:
            - constraint
            - score
          examples:
            - constraint: TIME_WINDOW_CONFLICT
              score: '-1000'
              job: Job-1
              resource: vehicle-1
          items:
            $ref: '#/components/schemas/RoutingConflict'
          description: Conflicts in the solution
          properties:
            constraint:
              type: string
              description: Constraint type.
            score:
              type: string
              description: Score impact of this conflict.
            job:
              type:
                - string
                - 'null'
              description: Job id.
            resource:
              type:
                - string
                - 'null'
              description: Resource id.
            tag:
              type:
                - string
                - 'null'
              description: Tag id.
            relation:
              type:
                - string
                - 'null'
        unresolved:
          type:
            - array
            - 'null'
            - object
          required:
            - constraint
            - score
          examples:
            - constraint: TRAVEL_TIME
              score: '-1500'
          items:
            $ref: '#/components/schemas/Unresolved'
          description: Unresolved constraints in the solution
          properties:
            constraint:
              $ref: '#/components/schemas/OnrouteConstraint'
              type: string
              description: Constraint type.
            score:
              type: string
              description: Score impact of this conflict.
        alternatives:
          type:
            - object
            - 'null'
          examples:
            - Job-1:
                - job: Job-1
                  resource: vehicle-2
                  suggestedArrival: '2023-01-13T09:30:00Z'
                  latestArrival: '2023-01-13T10:00:00Z'
                  executedAfter: Job-0
                  score:
                    hard: 0
                    soft: -1500
                    feasible: true
          additionalProperties:
            type: object
          description: >-
            When `options.explanation.enabled` is set to `true`, this field will
            contain the alternatives for the solution.The key is the job name
            and the value is the list of assignments. Each assignment contains
            the resource, the date, and the score. In this way, you can check
            the impact of the alternative on the score.
    ErrorMessage:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          description: Message
        status:
          $ref: '#/components/schemas/Status'
          type: string
          description: HTTP status
    Score:
      type: object
      description: >-
        The score of a solution shows how good this solution is w.r.t all the
        constraints. All solvers try to maximize the score.
      properties:
        hardScore:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The score of the constraints that are hard. This should be 0 in
            order to be feasible.
        mediumScore:
          type:
            - integer
            - 'null'
          format: int64
          description: The score of the constraints that are medium.
        softScore:
          type:
            - integer
            - 'null'
          format: int64
          description: The score of the constraints that are soft.
        feasible:
          type:
            - boolean
            - 'null'
    RoutingConflict:
      type: object
      required:
        - constraint
        - score
      examples:
        - constraint: TIME_WINDOW_CONFLICT
          score: '-1000'
          job: Job-1
          resource: vehicle-1
      description: Conflicts in the solution
      properties:
        constraint:
          type: string
          description: Constraint type.
        score:
          type: string
          description: Score impact of this conflict.
        job:
          type:
            - string
            - 'null'
          description: Job id.
        resource:
          type:
            - string
            - 'null'
          description: Resource id.
        tag:
          type:
            - string
            - 'null'
          description: Tag id.
        relation:
          type:
            - string
            - 'null'
    Unresolved:
      type: object
      required:
        - constraint
        - score
      examples:
        - constraint: TRAVEL_TIME
          score: '-1500'
      description: Unresolved constraints in the solution
      properties:
        constraint:
          $ref: '#/components/schemas/OnrouteConstraint'
          type: string
          description: Constraint type.
        score:
          type: string
          description: Score impact of this conflict.
    OnrouteConstraint:
      type: string
      enum:
        - TRIP_CAPACITY
        - RESOURCE_CAPACITY
        - RESOURCE_CAPACITY2
        - TRAVEL_TIME
        - TYPE_REQUIREMENT
        - TAG_SOFT
        - TAG_HARD
        - TYPE_REQUIREMENT_SOFT
        - END_LOCATION_TRAVEL_TIME
        - TIME_WINDOW_CONFLICT
        - SHIFT_END_CONFLICT
        - OVERTIME_END_CONFLICT
        - RESOURCE_USAGE
        - URGENCY
        - PREFERRED_RESOURCE_CONFLICT
        - ALLOWED_RESOURCES
        - DISALLOWED_RESOURCES
        - REGION_TIME
        - FAIR_WORK
        - UNSERVED_JOBS
        - RESOURCE_ACTIVATION
        - OPEN_DAYS
        - JOB_PRECEDENCE
        - JOB_DAY_INDEX
        - DATE_TIME_WINDOW_CONFLICT
        - DATE_TIME_WINDOW_CONFLICT_SOFT
        - LINKED_JOB_CONFLICT
        - PLANNED_RESOURCE
        - PLANNED_ARRIVAL
        - PLANNED_DATE
        - WORKING_TIME
        - HARD_JOBS
        - MAX_DRIVE_TIME
        - MAX_DRIVE_DISTANCE
        - MAX_DRIVE_TIME_JOB
        - FAIR_TOTAL_WORK
        - RESOURCE_PERIOD_MAX_SERVICE_TIME
        - RESOURCE_PERIOD_MAX_DRIVE_TIME
        - RESOURCE_PERIOD_MAX_WORK_TIME
        - RESOURCE_PERIOD_MIN_SERVICE_TIME
        - RESOURCE_PERIOD_MIN_DRIVE_TIME
        - RESOURCE_PERIOD_MIN_WORK_TIME
        - MINIMISE_TRIP_USAGE
        - DELIVERY_NOT_ON_SAME_VEHICLE
        - DELIVERY_BEFORE_PICKUP
        - SAME_TRIP
        - SEQUENCE
        - SAME_TIME
        - NEIGHBOR
        - DIRECT_SEQUENCE
        - SAME_RESOURCE
        - WAIT_TIME
        - DRIVE_TIME
        - HOURLY_COST
        - RANKING_SOFT
        - FAIR_COMPLEXITY_PER_TRIP
        - FAIR_COMPLEXITY_PER_RESOURCE
        - RESOURCE_PERIOD_MIN_COMPLEXITY
        - RESOURCE_PERIOD_MAX_COMPLEXITY
        - RESOURCE_COMPATIBILITY
        - LOAD_COMPATIBILITY
        - JOBTYPE_VIOLATION
        - GROUP_SEQUENCE
        - JOB_PROXIMITY
        - DEPOT_COST
        - DEPOT_CAPACITY
        - DEPOT_TIME_WINDOW
      examples:
        - TRAVEL_TIME
      description: Types of constraints that can be violated in a routing solution
    Status:
      type: string
      enum:
        - OK
        - CREATED
        - ACCEPTED
        - NO_CONTENT
        - RESET_CONTENT
        - PARTIAL_CONTENT
        - MULTIPLE_CHOICES
        - MOVED_PERMANENTLY
        - FOUND
        - SEE_OTHER
        - NOT_MODIFIED
        - USE_PROXY
        - TEMPORARY_REDIRECT
        - PERMANENT_REDIRECT
        - BAD_REQUEST
        - UNAUTHORIZED
        - PAYMENT_REQUIRED
        - FORBIDDEN
        - NOT_FOUND
        - METHOD_NOT_ALLOWED
        - NOT_ACCEPTABLE
        - PROXY_AUTHENTICATION_REQUIRED
        - REQUEST_TIMEOUT
        - CONFLICT
        - GONE
        - LENGTH_REQUIRED
        - PRECONDITION_FAILED
        - REQUEST_ENTITY_TOO_LARGE
        - REQUEST_URI_TOO_LONG
        - UNSUPPORTED_MEDIA_TYPE
        - REQUESTED_RANGE_NOT_SATISFIABLE
        - EXPECTATION_FAILED
        - PRECONDITION_REQUIRED
        - TOO_MANY_REQUESTS
        - REQUEST_HEADER_FIELDS_TOO_LARGE
        - UNAVAILABLE_FOR_LEGAL_REASONS
        - INTERNAL_SERVER_ERROR
        - NOT_IMPLEMENTED
        - BAD_GATEWAY
        - SERVICE_UNAVAILABLE
        - GATEWAY_TIMEOUT
        - HTTP_VERSION_NOT_SUPPORTED
        - NETWORK_AUTHENTICATION_REQUIRED
  securitySchemes:
    apikey:
      type: apiKey
      description: Api Key based authentication (apikey)
      name: Authorization
      in: header

````