- Developers
- Sygic Maps API
- Optimization API
- Examples
- Multi vehicle optimization
Please note Sygic does no longer issue new Sygic Maps API keys. This documentation is for existing customers only. If you wish to include maps & navigation into your project, please refer to Sygic Maps SDK.
Request
Example shows VRP case for delivery within city.
{
"locations": [
{
"location_id": "depot",
"coordinates": "48.212870,17.174013"
},
{
"location_id": "customer01",
"coordinates": "48.14713,17.0843",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T08:30:00"
}
},
{
"location_id": "customer02",
"coordinates": "48.15349,17.08556",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T08:30:00"
}
},
{
"location_id": "customer03",
"coordinates": "48.14932,17.21944",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
},
{
"location_id": "customer04",
"coordinates": "48.16555,17.13828",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
},
{
"location_id": "customer05",
"coordinates": "48.15032,17.15797",
"availability": {
"earliest_start": "2017-03-02T09:45:00",
"latest_end": "2017-03-02T18:00:00"
}
}
],
"vehicles": [
{
"vehicle_id": "vehicle1",
"cost_per_km": 1,
"cost_per_hour": 0,
"start_location_id": "depot",
"end_location_id": "depot",
"max_capacity": [
5
],
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
},
{
"vehicle_id": "vehicle2",
"cost_per_km": 10,
"cost_per_hour": 0,
"start_location_id": "depot",
"end_location_id": "depot",
"max_capacity": [
2
],
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
},
{
"vehicle_id": "vehicle3",
"cost_per_km": 100,
"cost_per_hour": 0,
"start_location_id": "depot",
"end_location_id": "depot",
"max_capacity": [
2
],
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
],
"tasks": [
{
"task_id": "task01",
"capacity": [
2
],
"activities": [
{
"activity_type": "pickup",
"location_id": "depot"
},
{
"activity_type": "delivery",
"location_id": "customer01",
"service_time": "00:00:00"
}
]
},
{
"task_id": "task02",
"priority": "critical",
"compatible_vehicles": [
"vehicle2"
],
"capacity": [
1
],
"activities": [
{
"activity_type": "pickup",
"location_id": "depot"
},
{
"activity_type": "delivery",
"location_id": "customer02"
}
]
},
{
"task_id": "task03",
"compatible_vehicles": [
"vehicle2",
"vehicle3"
],
"capacity": [
1
],
"activities": [
{
"activity_type": "pickup",
"location_id": "depot"
},
{
"activity_type": "delivery",
"location_id": "customer03"
}
]
},
{
"task_id": "task04",
"compatible_vehicles": [
"vehicle3"
],
"capacity": [
1
],
"activities": [
{
"activity_type": "pickup",
"location_id": "depot"
},
{
"activity_type": "delivery",
"location_id": "customer04",
"service_time": "00:00:00"
}
]
},
{
"task_id": "task05",
"capacity": [
1
],
"activities": [
{
"activity_type": "pickup",
"location_id": "depot"
},
{
"activity_type": "delivery",
"location_id": "customer05"
}
]
}
]
}
Response
{
"locations": [
{
"location_id": "depot",
"coordinates": "48.21287,17.17401"
},
{
"location_id": "customer01",
"coordinates": "48.14713,17.08430",
"availability": {
"earliest_start": "2017-03-02T08:00:00Z",
"latest_end": "2017-03-02T08:30:00Z"
}
},
{
"location_id": "customer02",
"coordinates": "48.15349,17.08556",
"availability": {
"earliest_start": "2017-03-02T08:00:00Z",
"latest_end": "2017-03-02T08:30:00Z"
}
},
{
"location_id": "customer03",
"coordinates": "48.14932,17.21944",
"availability": {
"earliest_start": "2017-03-02T08:00:00Z",
"latest_end": "2017-03-02T18:00:00Z"
}
},
{
"location_id": "customer04",
"coordinates": "48.16555,17.13828",
"availability": {
"earliest_start": "2017-03-02T08:00:00Z",
"latest_end": "2017-03-02T18:00:00Z"
}
},
{
"location_id": "customer05",
"coordinates": "48.15032,17.15797",
"availability": {
"earliest_start": "2017-03-02T09:45:00Z",
"latest_end": "2017-03-02T18:00:00Z"
}
}
],
"plan": [
{
"vehicle_id": "vehicle1",
"activities": [
{
"sequence": 0,
"timestamp": "2017-03-02T08:06:45Z",
"location_id": "depot"
},
{
"sequence": 1,
"timestamp": "2017-03-02T08:30:00Z",
"task_id": "task01",
"location_id": "customer01",
"travel_distance": 13945,
"travel_duration": "00:23:15",
"wait_duration": "01:00:02"
},
{
"sequence": 2,
"timestamp": "2017-03-02T09:45:00Z",
"task_id": "task05",
"location_id": "customer05",
"travel_distance": 8179,
"travel_duration": "00:14:58"
},
{
"sequence": 3,
"timestamp": "2017-03-02T10:01:29Z",
"location_id": "depot",
"travel_distance": 12518,
"travel_duration": "00:16:29"
}
],
"statistics": {
"travel_distance": 34642,
"travel_duration": "00:54:42",
"service_duration": "00:00:00",
"wait_duration": "01:00:02",
"total_duration": "01:54:44",
"served_tasks": 2
}
},
{
"vehicle_id": "vehicle2",
"activities": [
{
"sequence": 0,
"timestamp": "2017-03-02T08:00:00Z",
"location_id": "depot"
},
{
"sequence": 1,
"timestamp": "2017-03-02T08:23:57Z",
"task_id": "task02",
"location_id": "customer02",
"travel_distance": 14587,
"travel_duration": "00:23:57"
},
{
"sequence": 2,
"timestamp": "2017-03-02T08:46:08Z",
"task_id": "task03",
"location_id": "customer03",
"travel_distance": 15798,
"travel_duration": "00:22:11"
},
{
"sequence": 3,
"timestamp": "2017-03-02T09:06:59Z",
"location_id": "depot",
"travel_distance": 14986,
"travel_duration": "00:20:51"
}
],
"statistics": {
"travel_distance": 45371,
"travel_duration": "01:06:59",
"service_duration": "00:00:00",
"wait_duration": "00:00:00",
"total_duration": "01:06:59",
"served_tasks": 2
}
},
{
"vehicle_id": "vehicle3",
"activities": [
{
"sequence": 0,
"timestamp": "2017-03-02T08:00:00Z",
"location_id": "depot"
},
{
"sequence": 1,
"timestamp": "2017-03-02T08:15:44Z",
"task_id": "task04",
"location_id": "customer04",
"travel_distance": 9858,
"travel_duration": "00:15:44"
},
{
"sequence": 2,
"timestamp": "2017-03-02T08:30:23Z",
"location_id": "depot",
"travel_distance": 9276,
"travel_duration": "00:14:39"
}
],
"statistics": {
"travel_distance": 19134,
"travel_duration": "00:30:23",
"service_duration": "00:00:00",
"wait_duration": "00:00:00",
"total_duration": "00:30:23",
"served_tasks": 1
}
}
],
"statistics": {
"travel_distance": 99147,
"travel_duration": "02:32:04",
"service_duration": "00:00:00",
"wait_duration": "01:00:02",
"total_duration": "03:32:06",
"served_tasks": 5,
"dropped_tasks": 0,
"total_tasks": 5,
"used_vehicles": 3,
"total_vehicles": 3
},
"state": "Finished",
"status": "OK",
"copyright": "© 2017 Sygic a.s."
}
- Previous article: Single vehicle optimization