- Developers
- Sygic Maps API
- Optimization API
- Examples
- Single vehicle optimization
Single 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 body
{
"locations": [
{
"location_id": "depot",
"coordinates": "48.21287,17.17401"
},
{
"location_id": "customer01",
"coordinates": "48.14713,17.08430"
},
{
"location_id": "customer02",
"coordinates": "48.15349,17.08556"
},
{
"location_id": "customer03",
"coordinates": "48.14932,17.21944"
},
{
"location_id": "customer04",
"coordinates": "48.16555,17.13828"
},
{
"location_id": "customer05",
"coordinates": "48.15032,17.15797"
}
],
"vehicles": [
{
"vehicle_id": "vehicle",
"cost_per_km": 1,
"cost_per_hour": 0,
"start_location_id": "depot",
"end_location_id": "depot",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
],
"tasks": [
{
"task_id": "task01",
"activities": [
{
"activity_type": "visit",
"location_id": "customer01",
"service_time": "00:05:00",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T08:30:00"
}
}
]
},
{
"task_id": "task02",
"activities": [
{
"activity_type": "visit",
"location_id": "customer02",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
]
},
{
"task_id": "task03",
"activities": [
{
"activity_type": "visit",
"location_id": "customer03",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
]
},
{
"task_id": "task04",
"activities": [
{
"activity_type": "visit",
"location_id": "customer04",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
]
},
{
"task_id": "task05",
"activities": [
{
"activity_type": "visit",
"location_id": "customer05",
"availability": {
"earliest_start": "2017-03-02T08:00:00",
"latest_end": "2017-03-02T18:00:00"
}
}
]
}
]
}
Response body
{
"locations": [
{
"location_id": "depot",
"coordinates": "48.21287,17.17401"
},
{
"location_id": "customer01",
"coordinates": "48.14713,17.08430"
},
{
"location_id": "customer02",
"coordinates": "48.15349,17.08556"
},
{
"location_id": "customer03",
"coordinates": "48.14932,17.21944"
},
{
"location_id": "customer04",
"coordinates": "48.16555,17.13828"
},
{
"location_id": "customer05",
"coordinates": "48.15032,17.15797"
}
],
"plan": [
{
"vehicle_id": "vehicle",
"activities": [
{
"sequence": 0,
"timestamp": "2017-03-02T08:00:00Z",
"location_id": "depot"
},
{
"sequence": 1,
"timestamp": "2017-03-02T08:23:16Z",
"task_id": "task01",
"location_id": "customer01",
"travel_distance": 13938,
"travel_duration": "00:23:16",
"service_duration": "00:05:00"
},
{
"sequence": 2,
"timestamp": "2017-03-02T08:31:22Z",
"task_id": "task02",
"location_id": "customer02",
"travel_distance": 950,
"travel_duration": "00:03:06"
},
{
"sequence": 3,
"timestamp": "2017-03-02T08:47:09Z",
"task_id": "task05",
"location_id": "customer05",
"travel_distance": 8520,
"travel_duration": "00:15:47"
},
{
"sequence": 4,
"timestamp": "2017-03-02T08:58:08Z",
"task_id": "task03",
"location_id": "customer03",
"travel_distance": 6383,
"travel_duration": "00:10:59"
},
{
"sequence": 5,
"timestamp": "2017-03-02T09:11:23Z",
"task_id": "task04",
"location_id": "customer04",
"travel_distance": 7888,
"travel_duration": "00:13:15"
},
{
"sequence": 6,
"timestamp": "2017-03-02T09:26:02Z",
"location_id": "depot",
"travel_distance": 9275,
"travel_duration": "00:14:39"
}
],
"statistics": {
"travel_distance": 46954,
"travel_duration": "01:21:02",
"service_duration": "00:05:00",
"wait_duration": "00:00:00",
"total_duration": "01:26:02",
"served_tasks": 5
}
}
],
"statistics": {
"travel_distance": 46954,
"travel_duration": "01:21:02",
"service_duration": "00:05:00",
"wait_duration": "00:00:00",
"total_duration": "01:26:02",
"served_tasks": 5,
"dropped_tasks": 0,
"total_tasks": 5,
"used_vehicles": 1,
"total_vehicles": 1
},
"state": "Finished",
"progress": 100,
"status": "OK",
"copyright": "© 2018 Sygic a.s."
}
- Next article: Multi vehicle optimization