Vehicle Routing Problem (VRP)¶
The Vehicle Routing Problem (VRP) is the everyday problem of a dispatcher: you have n vehicles and m stops, and you need to decide which vehicle takes which stops, and in what order — while respecting vehicle capacity, time windows and working hours. The VIETMAP VRP API solves it on the real Vietnamese road network, so the plan it returns accounts for one-way streets, restricted roads and actual driving times rather than straight-line distance.
Doing this by hand does not scale: with 3 vehicles and 30 stops there are more possible assignments than a person can compare, and a plan built by intuition typically drives 15–30% more kilometres than one that is optimised.
TSP, VRP or Matrix — which one do I need?¶
| Your question | API |
|---|---|
| "One vehicle, many stops — what order should it visit them in?" | TSP |
| "Several vehicles and many stops — who takes what, in what order?" | VRP (this page) |
| "How long does it take between each pair of points?" (you do the planning yourself) | Distance Matrix |
| "I already know the stop order — give me the road path and toll cost." | Routing |
VRP is the whole plan; TSP is one vehicle's leg of it; Matrix is the raw travel-time input if you run your own solver.
What you can build with it¶
| Use case | What VRP decides for you |
|---|---|
| Last-mile delivery | Split today's orders across the riders on shift, ordered so each route stays inside its time window. |
| Wholesale distribution | Load trucks up to capacity and route them without exceeding weight limits on restricted roads. |
| Field service / maintenance | Assign job tickets to technicians by location, skill route and appointment window. |
| Cash & goods collection | Round trips from a depot that return before closing time. |
| Cold-chain delivery | Shortest total time on the road, so goods spend less time in the truck. |
Costing¶
A VRP request is billed as vehicles × stops transactions — 3 vehicles across 20 stops costs 60 transactions. See How Pricing Works before you size a daily plan.
URL¶
The apikey query parameter is required. Register here to get one.
Method¶
POST
Parameters¶
| Key | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| jobs | array | yes | none | Array of Job objects. Each job is a single place to visit (e.g. a delivery or pickup stop). At least one job is required. | |
| vehicles | array | yes | none | Array of Vehicle objects describing the fleet available to serve the jobs. At least one vehicle is required. |
Job Object (accept goods | release goods)¶
| Key | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| id | integer | yes | none | 1 | Unique identifier of the job. Must be unique across all jobs in the request. |
| location | array, double | yes | none | [106.112456,10.684922] | Coordinates of the job, in [longitude, latitude] order. |
| service | integer | no | 0 | 1 | Time spent servicing the job once the vehicle arrives, in seconds. Defaults to 0. |
| delivery | array | no | none | [1,2] | Goods loaded at the vehicle's start and dropped off at this job. Array of integers describing multidimensional quantities (e.g. [items, weight, volume]); the number and order of dimensions must match the vehicle's capacity. |
| pickup | array | no | none | [1,2] | Goods collected at this job and carried back to the vehicle's end. Array of integers describing multidimensional quantities; same dimension order as delivery and the vehicle's capacity. |
| skills | array | no | none | [1] | Array of integers listing the skills this job requires. The job can only be served by a vehicle whose skills include all of these values. |
| priority | integer | no | 0 | 1 | Priority of including this job in the solution. Integer in the range [0, 10]; higher values make the job more likely to be served when not all jobs can be assigned. |
| time_windows | array | no | none | [[0,1400]] | Array of [start, end] windows during which the service may start. Times are in seconds — either relative to the planning horizon or absolute Unix timestamps (see Note). Omitting it means the job can be served at any time. |
Vehicle Object (type of the vehicle)¶
| Key | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| id | integer | yes | none | 1 | Unique identifier of the vehicle. Must be unique across all vehicles in the request. |
| start | array, double | conditional | none | [106.112456,10.684922] | Coordinates where the vehicle begins its route, in [longitude, latitude] order. Optional, but at least one of start / end must be provided (see Note). |
| end | array, double | conditional | none | [106.112456,10.684922] | Coordinates where the vehicle ends its route, in [longitude, latitude] order. Optional, but at least one of start / end must be provided. Use the same value as start for a round trip. |
| capacity | array | no | none | [0,3] | Maximum load the vehicle can carry, as an array of integers describing multidimensional quantities (e.g. [items, weight, volume]). The dimension order must match the jobs' delivery / pickup arrays. |
| skills | array | no | none | [1] | Array of integers listing the skills this vehicle has. A job is eligible only if all of its required skills are present here. |
| time_windows | array | no | none | [[0,14400]] | Working hours of the vehicle as [start, end] (in seconds). Times follow the same convention as job time_windows (see Note). Omitting it means the vehicle has no time constraint. |
Note¶
- Key start and end are optional for a vehicle, as long as at least one of them is present.
- If end is omitted, the resulting route will stop at the last visited job, whose choice is determined by the optimization process.
- If start is omitted, the resulting route will start at the first visited job, whose choice is determined by the optimization process.
- To request a round trip, just specify both start and end with the same coordinates.
- Use amounts (capacity for vehicles, delivery and pickup for jobs) to describe a problem with capacity restrictions. Those arrays can be used to model custom restrictions for several metrics at once, e.g. number of items, weight, volume etc. A vehicle is only allowed to serve a set of jobs if the resulting load at each route step is lower than the matching value in capacity for each metric. When using multiple components for amounts, it is recommended to put the most important/limiting metrics first.
- It is assumed that all delivery-related amounts for jobs are loaded at vehicle start, while all pickup-related amounts for jobs are brought back at vehicle end.
- Use skills to describe a problem where not all jobs can be served by all vehicles. Job skills are mandatory, i.e. a job can only be served by a vehicle that has all its required skills. In other words: job j is eligible to vehicle v iff j.skills is included in v.skills.
- In order to ease modeling problems with no skills required, it is assumed that there is no restriction at all if no skills keys are provided.
- Useful in situations where not all jobs can be performed, to gain some control on which jobs are unassigned.
- Setting a high priority value for some jobs will tend as much as possible to have them included in the solution over lower-priority jobs.
It is up to users to decide how to describe time windows:
- Relative values, e.g. [0, 14400] for a 4 hours time window starting at the beginning of the planning horizon. In that case all times reported in output with the arrival key are relative to the start of the planning horizon;
- Absolute values, "real" timestamps. In that case all times reported in output with the arrival key can be interpreted as timestamps. The absence of a time window in input means no timing constraint applies.
- In particular, a vehicle with no time_window key will be able to serve any number of jobs, and a job with no time_windows key might be included at any time in any route, to the extent permitted by other constraints such as skills, capacity and other vehicles/jobs time windows.
Example¶
Body
{
"vehicles": [
{
"id": 1,
"start": [
106.5983012,
10.8879148
],
"end": [
106.5983012,
10.8879148
],
"profile": "bike",
"time_window": [
1685953800,
1686418200
],
"skills": [
1,
1000
],
"breaks": [
{
"id": 1000,
"time_windows": [
[
1685966400,
1685970000
]
],
"service": 3600
},
{
"id": 1,
"time_windows": [
[
1685986200,
1685988000
]
],
"service": 54000.0
},
{
"id": 2000,
"time_windows": [
[
1686052800,
1686056400
]
],
"service": 3600
},
{
"id": 2,
"time_windows": [
[
1686072600,
1686074400
]
],
"service": 54000.0
},
{
"id": 6000,
"time_windows": [
[
1686398400,
1686402000
]
],
"service": 3600
}
],
"speed_factor": 0.6
},
/// More objects should be add to here
{
"id": 7,
"start": [
106.7086064,
10.814915
],
"end": [
106.7086064,
10.814915
],
"profile": "bike",
"time_window": [
1685953800,
1686418200
],
"skills": [
1,
7000
],
"breaks": [
{
"id": 1000,
"time_windows": [
[
1685966400,
1685970000
]
],
"service": 3600
},
{
"id": 5,
"time_windows": [
[
1686331800,
1686333600
]
],
"service": 54000.0
},
{
"id": 6000,
"time_windows": [
[
1686398400,
1686402000
]
],
"service": 3600
}
],
"speed_factor": 0.6
}
],
"jobs": [
{
"id": 1001,
"description": "HOME",
"location": [
106.5983012,
10.8879148
],
"service": 0,
"priority": 3,
"time_windows": [
[
1685986200,
1685988000
]
],
"skills": [
1000
]
},
{
"id": 304,
"description": "CO.OP FOOD NGUYỄN VĂN QUÁ",
"location": [
106.6287481,
10.8362058
],
"service": 1800,
"time_windows": [
[
1685948400,
1685980800
],
[
1686034800,
1686067200
],
[
1686121200,
1686153600
],
[
1686207600,
1686240000
],
[
1686294000,
1686326400
],
[
1686380400,
1686412800
]
],
"skills": [
1
]
},
/// More objects should be add to here
{
"id": 337,
"description": "CO.OP FOOD TỈNH LỘ 15-1031",
"location": [
106.513876765966,
11.0885457429547
],
"service": 1800,
"time_windows": [
[
1685948400,
1685980800
],
[
1686034800,
1686067200
],
[
1686121200,
1686153600
],
[
1686207600,
1686240000
],
[
1686294000,
1686326400
],
[
1686380400,
1686412800
]
],
"skills": [
1
]
}
]
}
Request body description¶
Vehicles¶
| Parameter | Type | Description |
|---|---|---|
| id | number | Unique identifier of the vehicle. |
| start | array | Coordinates where the vehicle begins its route, in [longitude, latitude] order. |
| end | array | Coordinates where the vehicle ends its route, in [longitude, latitude] order. Use the same value as start for a round trip. |
| profile | string | Routing profile that determines speed and allowed roads (e.g. bike, car, truck). |
| time_window | array | Working hours of the vehicle as [start, end] (in seconds, Unix timestamps in this example). The vehicle only operates within this window. |
| skills | array | Array of integers listing the skills the vehicle has. A job is eligible only if all of its required skills are present here. |
| breaks | array | List of mandatory breaks the vehicle must take. Each break is an object with id, time_windows (allowed [start, end] slots, in seconds) and service (break duration, in seconds). |
| speed_factor | number | Multiplier applied to the profile's default speed. < 1 slows the vehicle down, > 1 speeds it up (e.g. 0.6 = 60% of the default speed). |
Jobs¶
| Parameter | Type | Description |
|---|---|---|
| id | number | Unique identifier of the job. |
| description | string | Free-text label for the job, returned as-is to help identify the stop. |
| location | array | Coordinates of the job, in [longitude, latitude] order. |
| service | number | Time spent servicing the job once the vehicle arrives, in seconds. |
| priority | number | Priority of including the job in the solution, in the range [0, 10]. Higher values make the job more likely to be served. |
| time_windows | array | Array of [start, end] windows (in seconds) during which the service may start. The job can have several disjoint windows. |
| skills | array | Array of integers listing the skills the job requires. The job can only be served by a vehicle that has all of these skills. |
Response
{
"code": 0,
"summary": {
"cost": 12400,
"unassigned": 0,
"service": 196200,
"duration": 12400,
"waiting_time": 237145,
"priority": 3,
"distance": 109272,
"computing_times": {
"loading": 37,
"solving": 61,
"routing": 11
}
},
"unassigned": [],
"routes": [
{
"vehicle": 1,
"cost": 12400,
"service": 196200,
"duration": 12400,
"waiting_time": 237145,
"priority": 3,
"distance": 109272,
"steps": [
{
"type": "start",
"location": [
106.5983012,
10.8879148
],
"arrival": 1685956255,
"duration": 0,
"distance": 0
},
/// More object will response here
{
"type": "break",
"id": 6000,
"service": 3600,
"waiting_time": 177741,
"arrival": 1686220659,
"duration": 12400,
"distance": 109272
},
{
"type": "end",
"location": [
106.5983012,
10.8879148
],
"arrival": 1686402000,
"duration": 12400,
"distance": 109272
}
],
"geometry": "ipmaA}|riSsAHGpB?\\ExC?l@CnBC`@OrAENK?EBCJ@FcBtBm@x@{B|CY^U`@GPG\\e@nCSp@uAlCWd@{C|F_AjBcAfB{AvCS^w@|A[j@Ub@INo@nAm@jAk@fAq@tAwBfEy@zAyAvCqAfCe@~@[j@c@z@mDxGs@vAOVw@dBw@xAi@fAOXs@rAKPyApCGLwA~CMXcUrNi@\\iHnEy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n@pAd@dAzAbDrAvC`@v@t@pAl@bAj@|@lAjBFJbErGpApB`BjCrCtEl@~@n@bA`A|Az@tAXb@hAhBzBrDxA|B|BrDh@x@Vn@Hf@r@xDt@hEt@bEX|AV`Ah@vAjAjCzA`D`@`Af@rATfAt@vGBf@E~@GlCBlAFj@ThCT|ENpAL|@Tz@d@rAd@rAXl@JNa@`BGl@EXEnCAdAA`AMdCg@zDAd@Cr@rAI"
}
]
}
Response body description¶
| Parameter | Type | Description |
|---|---|---|
| code | number | Status code of the response. 0 indicates the problem was solved successfully. |
| summary | object | Aggregated metrics across all routes in the solution. |
| summary.cost | number | Total cost of the solution (the objective value the solver minimizes, derived mainly from travel time). |
| summary.unassigned | number | Number of jobs that could not be assigned to any vehicle. |
| summary.service | number | Total service time spent at all visited jobs, in seconds. |
| summary.duration | number | Total travel (driving) time across all routes, in seconds. |
| summary.waiting_time | number | Total time vehicles spend waiting for time windows to open, in seconds. |
| summary.priority | number | Sum of the priority values of all assigned jobs. |
| summary.distance | number | Total distance covered by all routes, in meters. |
| summary.computing_times | object | Time the solver spent in each phase, in milliseconds. |
| summary.computing_times.loading | number | Time spent loading and preparing the input, in milliseconds. |
| summary.computing_times.solving | number | Time spent optimizing the routes, in milliseconds. |
| summary.computing_times.routing | number | Time spent computing the route geometries, in milliseconds. |
| unassigned | array | List of jobs that could not be served, with their id and location. Empty when every job is assigned. |
| routes | array | One entry per vehicle that is used in the solution. |
| routes[].vehicle | number | id of the vehicle that performs this route. |
| routes[].cost | number | Cost contribution of this route to summary.cost. |
| routes[].service | number | Total service time at the jobs on this route, in seconds. |
| routes[].duration | number | Total travel (driving) time of this route, in seconds. |
| routes[].waiting_time | number | Time the vehicle waits for time windows on this route, in seconds. |
| routes[].priority | number | Sum of the priority values of the jobs on this route. |
| routes[].distance | number | Distance covered by this route, in meters. |
| routes[].steps | array | Ordered list of stops the vehicle makes along the route. |
| routes[].steps[].type | string | Type of the step: start, job, pickup, delivery, break, or end. |
| routes[].steps[].id | number | id of the job or break this step refers to (present for job, pickup, delivery and break steps). |
| routes[].steps[].location | array | Coordinates of the step, in [longitude, latitude] order (present for start, end and job steps). |
| routes[].steps[].service | number | Service or break duration at this step, in seconds. |
| routes[].steps[].waiting_time | number | Time the vehicle waits at this step before service can start, in seconds. |
| routes[].steps[].arrival | number | Time the vehicle arrives at this step, in seconds (relative to the planning horizon or as a Unix timestamp, matching the input time_windows). |
| routes[].steps[].duration | number | Cumulative travel time from the start of the route up to this step, in seconds. |
| routes[].steps[].distance | number | Cumulative distance from the start of the route up to this step, in meters. |
| routes[].geometry | string | Full route geometry as a google polyline 5 encoded string. |
Frequently asked questions¶
What is a VRP API?¶
A VRP (Vehicle Routing Problem) API takes a fleet and a list of stops and returns a plan: which vehicle serves which stops, and in what order. VIETMAP solves it on the real Vietnamese road network, honouring capacity and time windows, so the plan is drivable rather than theoretical.
What is the difference between TSP and VRP?¶
TSP orders the stops of a single vehicle. VRP first decides how to split stops across several vehicles and then orders each vehicle's route. If you have one rider, you want TSP; if you have a fleet, you want VRP.
What constraints can VRP handle?¶
Vehicle capacity and delivery time windows are the two that change a plan the most, alongside the vehicle profile itself — routing a truck or container respects weight limits and restricted roads that a motorbike route ignores.
How many transactions does one VRP call cost?¶
vehicles × stops. Three vehicles across twenty stops is 60 transactions. See How Pricing Works.
