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

> Contains the actual solution, once solved.



## OpenAPI

````yaml vrp GET /v2/vrp/jobs/{id}/solution
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}/solution:
    get:
      tags:
        - Info
      summary: Solution
      description: Contains the actual solution, once solved.
      operationId: getVRPSolution
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OnRouteResponse'
        '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:
    OnRouteResponse:
      type: object
      required:
        - trips
      examples:
        - id: 0000-00000-00000-0000
          status: SOLVED
          score:
            hard: 0
            soft: -12345
            feasible: true
          trips:
            - resource: vehicle-1
              date: '2023-01-13T00:00:00Z'
              departureTime: '2023-01-13T08:00:00Z'
              visits:
                - job: Job-1
                  arrival: '2023-01-13T08:30:00Z'
                  serviceTime: 600
                  travelTime: 1800
                  distance: 15000
                  location:
                    latitude: 51.0543
                    longitude: 3.7174
                  waitTime: 0
              waitTime: 0
              travelTime: 3600
              distance: 30000
              workTime: 4200
              serviceTime: 600
              occupancy: 0.47
          totalWaitTimeInSeconds: 0
          totalTravelTimeInSeconds: 3600
          totalTravelDistanceInMeters: 30000
          totalServiceTimeInSeconds: 600
          occupancy: 0.47
          workloadFairness: 0.95
          unserved: []
          suggestions: []
          messages:
            - Solution found in 2.5 seconds
      description: OnRoute response from solve
      properties:
        id:
          type:
            - string
            - 'null'
          examples:
            - 0000-00000-00000-0000
          description: Id of the solve job
        status:
          type:
            - string
            - 'null'
          examples:
            - SOLVED
          description: Status of the Response
          anyOf:
            - $ref: '#/components/schemas/SolviceStatus'
            - type: 'null'
        score:
          type:
            - object
            - 'null'
          description: Score tells you how good a solution is.
          anyOf:
            - $ref: '#/components/schemas/Score'
            - type: 'null'
        unresolved:
          description: Constraints that are violated
        trips:
          type: array
          items:
            $ref: '#/components/schemas/Trip'
          description: 'Actual solution: trips per shift/day and per resource'
        totalWaitTimeInSeconds:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Wait time for all resources
        occupancy:
          type:
            - number
            - 'null'
          format: double
          examples:
            - 0.8
          description: >-
            How full this schedule is in terms of work time (incl travel) over
            capacity. Eg 80%
        totalTravelDistanceInMeters:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Travel distance for all resources in meters
        totalTravelTimeInSeconds:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Travel time for all resources
        totalServiceTimeInSeconds:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Service time for all resources
        unserved:
          type:
            - array
            - 'null'
          examples:
            - '[job-1]'
          items:
            type: string
          description: Unserved jobs
        unservedReasons:
          type:
            - object
            - 'null'
          examples:
            - job-1:
                - DATE_TIME_WINDOW_CONFLICT
                - TRIP_CAPACITY
          additionalProperties:
            type: object
          description: Reasons why jobs could not be served, mapped by job name
        suggestions:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/SuggestionDto'
          description: List of suggested assignments returned by suggest api call
        messages:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Events and warnings generated during the solver execution
        estimatedCost:
          type: object
          description: >-
            Financial cost breakdown of the solution. Only populated when costs
            configuration is provided in the request.
          anyOf:
            - $ref: '#/components/schemas/CostBreakdown'
            - type: 'null'
        violations:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ViolatedConstraint'
        workloadFairness:
          type:
            - number
            - 'null'
          format: double
    ErrorMessage:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          description: Message
        status:
          $ref: '#/components/schemas/Status'
          type: string
          description: HTTP status
    SolviceStatus:
      type: string
      enum:
        - ERROR
        - QUEUED
        - SOLVING
        - SOLVED
      description: Status of the solve job.
    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'
    Trip:
      type: object
      required:
        - visits
      examples:
        - resource: vehicle-1
          date: '2023-01-13T00:00:00Z'
          departureTime: '2023-01-13T08:00:00Z'
          visits:
            - job: Job-1
              arrival: '2023-01-13T08:30:00Z'
              serviceTime: 600
              travelTime: 1800
              distance: 15000
              location:
                latitude: 51.0543
                longitude: 3.7174
              waitTime: 0
            - job: Job-2
              arrival: '2023-01-13T09:45:00Z'
              serviceTime: 900
              travelTime: 900
              distance: 8000
              location:
                latitude: 51.05
                longitude: 3.72
              waitTime: 0
          waitTime: 0
          travelTime: 2700
          distance: 23000
          workTime: 4200
          serviceTime: 1500
          polyline: _p~iF~ps|U_ulLnnqC_mqNvxq`@
          occupancy: 0.47
      description: Trip for a resource. Holds a list of visits for a resource and a date.
      properties:
        visits:
          type: array
          items:
            $ref: '#/components/schemas/Visit'
          description: List of visits for a resource and a date.
        resource:
          type:
            - string
            - 'null'
          examples:
            - resource-1
          description: Resource
        date:
          type:
            - string
            - 'null'
          format: ISO8601 date string
          examples:
            - '2021-01-01'
          description: Date
        departureTime:
          type:
            - string
            - 'null'
          format: ISO8601 datetime string
          examples:
            - '2021-01-01T08:00:00'
          description: Departure date-time
        waitTime:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 0
          description: Wait time in seconds
        travelTime:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Travel time in seconds
        workTime:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Work time in seconds
        serviceTime:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 123
          description: Service time in seconds
        polyline:
          type:
            - string
            - 'null'
          examples:
            - polyline
          description: Polyline of the trip
        occupancy:
          type:
            - number
            - 'null'
          format: double
          examples:
            - 0.8
          description: How full this trip is in terms of work time over capacity. Eg 80%
        start:
          anyOf:
            - $ref: '#/components/schemas/Visit'
            - type: 'null'
        end:
          anyOf:
            - $ref: '#/components/schemas/Visit'
            - type: 'null'
        distance:
          type:
            - integer
            - 'null'
          format: int64
    SuggestionDto:
      type: object
      required:
        - score
        - assignments
      properties:
        score:
          $ref: '#/components/schemas/Score'
        assignments:
          type: array
          items:
            $ref: '#/components/schemas/JobAssignment'
    CostBreakdown:
      type: object
      examples:
        - totalCostEur: 450.75
          travelTimeCostEur: 125.5
          distanceCostEur: 87.5
          waitTimeCostEur: 15
          laborCostEur: 200
          activationCostEur: 50
          penaltyCostEur: 27.25
      description: >-
        Financial cost breakdown of the optimized solution. Only populated when
        costs configuration is provided in the request.
      properties:
        totalCostEur:
          type: number
          format: double
          examples:
            - 450.75
          description: Total estimated cost of the solution in EUR
        travelTimeCostEur:
          type: number
          format: double
          examples:
            - 125.5
          description: Cost attributed to travel time (driving hours * hourly rate)
        distanceCostEur:
          type: number
          format: double
          examples:
            - 87.5
          description: Cost attributed to distance traveled (km * per-km rate)
        waitTimeCostEur:
          type: number
          format: double
          examples:
            - 15
          description: Cost attributed to idle/waiting time
        laborCostEur:
          type: number
          format: double
          examples:
            - 200
          description: Cost attributed to labor (work hours * resource hourly cost)
        activationCostEur:
          type: number
          format: double
          examples:
            - 50
          description: Fixed costs for activating resources (vehicles)
        penaltyCostEur:
          type: number
          format: double
          examples:
            - 27.25
          description: Cost from constraint violations (time windows, preferences, etc.)
    ViolatedConstraint:
      type: object
      required:
        - name
        - value
        - level
      description: >-
        A constraint that is broken in the current solution with a certain value
        (penalty) and a certain level (hard, soft, medium).
      properties:
        name:
          type:
            - string
            - 'null'
          examples:
            - maxDistance
          description: Name of the constraint.
        value:
          type:
            - integer
            - 'null'
          format: int32
          examples:
            - 100
          description: >-
            Value of the unresolved constraint. The higher, the more deviation
            from perfection this constraint has.
        level:
          type:
            - string
            - 'null'
          examples:
            - '[HARD, MEDIUM, SOFT]'
          description: Level of unresolved constraint.
          anyOf:
            - $ref: '#/components/schemas/Level'
            - type: 'null'
    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
    Visit:
      type: object
      examples:
        - job: Job-1
          arrival: '2023-01-13T08:30:00Z'
          serviceTime: 600
          travelTime: 1800
          distance: 15000
          activity: service
          location:
            latitude: 51.0543
            longitude: 3.7174
          latlng:
            - 51.0543
            - 3.7174
          breakTime: 0
          waitTime: 0
      description: >-
        Single visit for a resource. Holds information of the actual arrival
        time, the job, the location and the latlng.
      properties:
        arrival:
          type:
            - string
            - 'null'
          description: Actual arrival date-time
          anyOf:
            - $ref: '#/components/schemas/ZonedDateTime'
            - type: 'null'
        serviceTime:
          type:
            - integer
            - 'null'
          format: int64
          description: Total service time of that job in seconds
        travelTime:
          type:
            - integer
            - 'null'
          format: int64
          description: Total travel time to that job in seconds
        distance:
          type:
            - integer
            - 'null'
          format: int64
          description: Total travel distance to that job in meters
        job:
          type:
            - string
            - 'null'
          description: Job
        activity:
          type:
            - string
            - 'null'
          description: 'The activity to '
        location:
          type:
            - object
            - 'null'
          description: Location with lat/lon
          anyOf:
            - $ref: '#/components/schemas/Location'
            - type: 'null'
        latlon:
          type:
            - array
            - 'null'
          items:
            type: number
            format: double
          description: >-
            Snapped Latlng. When we get your lat/lon in input, we snap it on our
            map to a valid point in the graph. We return all snapped points.
        snappedLocation:
          type:
            - object
            - 'null'
          description: >-
            Snapped location. When we get your lat/lon in input, we snap it on
            our map to a valid point in the graph. We return all snapped points.
          anyOf:
            - $ref: '#/components/schemas/Location'
            - type: 'null'
        breakTime:
          type:
            - integer
            - 'null'
          format: int32
          description: Break time in seconds
        waitTime:
          type:
            - integer
            - 'null'
          format: int64
          description: Wait time in seconds
    JobAssignment:
      type: object
      required:
        - job
        - resource
        - executedAfter
      examples:
        - job: Job-1
          resource: vehicle-1
          suggestedArrival: '2023-01-13T09:30:00Z'
          latestArrival: '2023-01-13T10:00:00Z'
          executedAfter: Job-0
          suggestedInitialArrival: '2023-01-13T09:00:00Z'
          score:
            hard: 0
            soft: -1500
            feasible: true
          violations:
            - constraint: TRAVEL_TIME
              score: '-1500'
      description: >-
        Assignment for a job to a resource. Holds information of the actual
        arrival time, the job, the resource and the suggested arrival time.
      properties:
        job:
          type: string
          description: Job
        resource:
          type: string
          description: Resource
        suggestedArrival:
          type:
            - string
            - 'null'
          format: ISO8601 datetime string
          examples:
            - '2022-03-10T12:15:50-04:00'
          description: Suggested arrival date-time
        latestArrival:
          type:
            - string
            - 'null'
          format: ISO8601 datetime string
          examples:
            - '2022-03-10T12:15:50-04:00'
          description: Latest arrival date-time
        executedAfter:
          type: string
          description: Executed after date-time
        score:
          type:
            - object
            - 'null'
          description: Score of the assignment
          anyOf:
            - $ref: '#/components/schemas/Score'
            - type: 'null'
        scoreExplanation:
          type: object
          required:
            - constraint
            - score
          examples:
            - constraint: TRAVEL_TIME
              score: '-1500'
          description: Unresolved constraints in this alternative solution
          properties:
            constraint:
              $ref: '#/components/schemas/OnrouteConstraint'
              type: string
              description: Constraint type.
            score:
              type: string
              description: Score impact of this conflict.
        suggestedInitialArrival:
          anyOf:
            - $ref: '#/components/schemas/ZonedDateTime'
            - type: 'null'
        violations:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Unresolved'
    Level:
      type: string
      enum:
        - HARD
        - SOFT
        - MEDIUM
    ZonedDateTime:
      type: string
      format: date-time
      examples:
        - '2022-03-10T12:15:50-04:00'
    Location:
      type: object
      description: Geographical Location in WGS-84
      properties:
        latitude:
          type: number
          format: double
          examples:
            - 50.0987624
          description: Latitude
        longitude:
          type: number
          format: double
          examples:
            - 4.93849204
          description: Longitude
        h3Index:
          type:
            - integer
            - 'null'
          format: int64
          examples:
            - 617700169958293500
          description: H3 hexagon index at resolution 9 (optional)
    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
    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.
  securitySchemes:
    apikey:
      type: apiKey
      description: Api Key based authentication (apikey)
      name: Authorization
      in: header

````