Skip to main content

Vehicles

A vehicle represents a driver or truck with a start location, optional end location, capacity, and working shifts.
{
  "id": "truck-1",
  "start": [4.3517, 50.8503],
  "end": [4.3517, 50.8503],
  "shifts": [
    {
      "from": "2026-04-01T08:00:00+02:00",
      "to": "2026-04-01T17:00:00+02:00"
    }
  ],
  "capacity": [100],
  "skills": ["refrigerated"],
  "max_duration": 28800
}
  • start / end — depot locations as [longitude, latitude]. If end is omitted, the vehicle returns to start.
  • shifts — working time windows (ISO 8601). At least one shift is required.
  • capacity — per-dimension limits, e.g. [100] for weight or [50, 30] for weight + volume.
  • skills — capability tags. A vehicle can only serve jobs whose required skills are a subset of the vehicle’s skills.
  • max_distance / max_duration — optional route length limits.

Jobs

A job is a task to be performed at a location — a delivery, pickup, or service visit.
{
  "id": "delivery-1",
  "location": [4.7005, 50.8798],
  "demand": [10],
  "service_duration": 300,
  "time_windows": [
    {
      "from": "2026-04-01T09:00:00+02:00",
      "to": "2026-04-01T12:00:00+02:00"
    }
  ],
  "skills": ["refrigerated"]
}
  • location[longitude, latitude] (GeoJSON order)
  • demand — capacity consumed per dimension
  • service_duration — time in seconds spent at the location
  • time_windows — when the job can be served (ISO 8601 from/to pairs)
  • skills — required vehicle capabilities
  • committed_vehicle — optionally lock a job to a specific vehicle ID

Distance matrices

V3 automatically fetches road-network distance and duration matrices from Solvice Maps. You don’t need to provide a matrix unless you have custom distances. To supply a custom matrix, include it in options.matrix:
{
  "options": {
    "matrix": {
      "distances": [
        [0, 1500, 3200],
        [1400, 0, 2100],
        [3100, 2000, 0]
      ],
      "durations": [
        [0, 600, 1200],
        [550, 0, 900],
        [1150, 850, 0]
      ]
    }
  }
}
Both matrices must be square N×N with matching dimensions. Values are distances in metres and durations in seconds. Note that road-network matrices are typically asymmetric (A→B ≠ B→A).

Constraints

The solver respects these constraints (hard — never violated):
ConstraintDescription
CapacityVehicle load never exceeds capacity on any dimension
Time windowsJobs served within their allowed time windows
SkillsVehicle must have all skills required by the job
Vehicle rangeMaximum distance or duration per route
SequenceJob A must be served before job B on the same route
First jobA job must be the first stop on its route
Committed vehicleA job must be assigned to a specific vehicle

Objective

The solver minimizes a lexicographic objective:
  1. Minimize unassigned jobs (highest priority — assign as many jobs as possible)
  2. Minimize cost (weighted sum of travel time or distance, and number of vehicles)
The number-of-vehicles cost defaults high so the solver naturally minimizes fleet size before optimizing route efficiency.

Relations

Relations express ordering or grouping constraints between jobs:
{
  "relations": [
    {
      "type": "SEQUENCE",
      "jobs": ["pickup-A", "delivery-A", "delivery-B"]
    }
  ]
}
TypeMeaning
SEQUENCEJobs must appear in the listed order on the same route
FIRST_JOBEach listed job must be the first stop on its route