VRP quickstart
Welcome to the VRP solver API! You can test our API in just one command:
curl https://api.solvice.io/v2/vrp/demo -H "Authorization: <<apiKey>>" | \
curl https://api.solvice.io/v2/vrp/solve -H "Authorization: <<apiKey>>" \
-X POST -H "Content-Type: application/json" -d @-
This will fetch a demo instance and solve it.
You can also solve your own instance by replacing the demo instance with your own instance.
Most of the time, you will want to solve your own instance.
In this case, you will need to create a VRP request
payload and send it to the /v2/solve
endpoint. You can find the
schema of the request in the Schemas section.
A VRP request will consist of resources (schema:resources) and
jobs (schema:jobs).
Postman Download postman collection
Underneath you can find an example request
, solution
and explanation
json.
{
"resources": [
{
"name": "Resource 1",
"start": {
"latitude": 51.0535,
"longitude": 3.7264
},
"shifts": [
{
"from": "2023-08-23T08:00:00",
"to": "2023-08-23T17:00:00"
}
]
}
],
"jobs": [
{
"name": "First job",
"location": {
"latitude": 50.8456,
"longitude": 4.3526
},
"duration": 20000
},
{
"name": "Second job",
"location": {
"latitude": 50.8456,
"longitude": 4.3526
},
"duration": 3600
}
]
}
{
"score": {
"hardScore": 0,
"mediumScore": 0,
"softScore": -1655,
"feasible": true
},
"trips": [
{
"visits": [
{
"arrival": "2023-08-23T08:27:32",
"job": "Second job",
"location": "50.8456;4.3526"
},
{
"arrival": "2023-08-23T09:27:32",
"job": "First job",
"location": "50.8456;4.3526"
}
],
"resource": "Resource 1",
"date": "2023-08-23",
"departureTime": "2023-08-23T08:00:00",
"waitTime": 0,
"travelTime": 1652,
"workTime": 25252,
"serviceTime": 23600
}
],
"totalTravelTimeInSeconds": 1652,
"totalServiceTimeInSeconds": 23600,
"workloadFairness": 1,
"status": "SOLVED"
}
{
"score": {
"hardScore": 0,
"mediumScore": 0,
"softScore": -1655,
"feasible": true
},
"unresolved": [
{
"constraint": "JOB_DAY_INDEX",
"score": "-2soft"
},
{
"constraint": "MINIMISE_TRIP_USAGE",
"score": "-1soft"
},
{
"constraint": "TRAVEL_TIME",
"score": "-1652soft"
}
]
}
After this, you can find more information about the different endpoints and how to use them in the API reference.
Updated 7 months ago