Optimization

Overview

Sygic’s Route Optimization is optimization that helps to find optimal waypoint sequence for route with up to 200 stops. This service can calculate optimal waypoint sequence for one or more vehicles without consideration of truck attributes.

Live Example

This simple example demonstrates the use of the Optimization service. Click on icons to see code on Github or play with it in JSFiddle:

Request

API Reference

https://optimization.api.sygic.com/v0/api/optimization?key=yourAPIkey

Request authentication is done via parameter key, which must be included in the request URL.

Methods

Method

Description

POST

Initiate optimization.

GET

Monitor status and receive a response.

Parameters

Required Parameters

Parameter

Data type

Description

locations

array

Array of locations to be visited.

vehicles

array

Array of available vehicles for tasks execution.

tasks

array

Array of task objects.

Optional Parameters

Parameter

Data type

Description

settings

object

Additional optimization settings.

Locations

Locations are defined by the following parameters:

Required parameter

Data type

Description

location_id

string

This specifies id of location. Id must be unique.

coordinates

string

This specifies coordinates of location in format:

latitude,longitude

Optional parameter

Data type

Description

availability

array or object*

This specifies availability of location, defined as array of non-overlapping time windows. Availability is optional and doesn't need to be specified for all locations.

*for compatibility reasons, API accepts both single time window object and array of time window objects

Time windows specify hard limits for location, task activity or vehicle availability, task must be fully finished within given time frame (including service time), e.g. imagine following time window for task location having service_time 30 minutes:

Vehicle can start fulfilling the task no earlier than 13:00. Before time window opens, vehicle can perform other tasks or simply wait (depending on problem structure). Having service_time 30 minutes means, that vehicle must arrive 16:30 at latest, to be able to complete the task until 17:00.

Time windows can also be half-open, i.e. arriving no earlier than 13:00 and not caring about departure:

{
"earliest_start": "2018-01-01T13:00:00Z"
}

or not constraining arrival time but leaving no later than 17:00:

{
"latest_end": "2018-01-01T17:00:00Z"
}

Availability specification

Availability is simply union of non-overlapping time windows, during which the location, task activity or vehicle is available for operation.

For example, location could be opened between 08:00 - 09:00 in the morning or 13:00 - 14:00 in the afternoon:

Specifies id of location to which task is assigned. Specifying more than one location defines alternatives to perform the task, e.g. delivery at customer home or work address, pickup at DepotA or DepotB, etc.

Combined availability
Location and activity availability can be specified independently, effective availability is calculated as intersection of time window intervals.
For example, let's have a location opened in the morning 08:00 - 12:00 and afternoon 13:00 - 16:00:

Specifies capacity vector of the vehicle. Multiple capacity dimensions can be defined for vehicle.

profile

string

Vehicle profile to be used.

Available values:
car
truck

max_total_duration

string

Specifies maximum total duration of vehicle operations (sum of travel, service and wait durations).

Format: hh:mm:ss

fixed_cost

double

Cost for vehicle being in use. Vehicle is in use, when it fulfils at least one task.

max_travel_distance

int

Specifies limit for distance traveled by vehicle (in meters).

availability

array or object*

Specifies availability of vehicle, defined as array of non-overlapping time windows. Availability is optional and doesn't need to be specified. When multiple time window intervals are specified, vehicle performs multiple tours returning to depot in period of inactivity.

*for compatibility reasons, API accepts both single time window object and array of time window objects