Options
How to Use the Options Object
The options object belongs in the main request body and allows you to tweak how the Routing Engine runs. You can also include "cache": false outside the option object so that the engine will return a job_id
more quickly and an optional callback url where the solution can be sent once the computation is complete.
Options Object
Property
Type
Notes
polylines
Boolean
optional
max_iterations
Number
optional
squash_durations
Number (minutes)
optional
balance
Boolean
option
max_running_time
Number (seconds)
optional
polylines
: When setting this option to true, the API will respond with an encoded polyline representing each vehicle's route. The encoded polyline can be decoded into an array of latitude/longitude pairs with this library using precision level level 6.
max_iterations
: This specifies the maximum number of times the algorithm will run before it converges on a solution. For more difficult problems, higher numbers will lead to more optimal solutions. If not specified, the routing engine will use a default value of 10, which in practice gives a good balance between speed and accuracy.
squash_durations
: Useful when you have many stops at the same location, which could be an apartment complex. Normally, each stop has a duration value of e.g. 10 minutes, which accounts for parking and finding the entrance. If you had 6 stops assigned to a driver at the same time, using a duration value of 10 would mean you spend 10 x 6 = 60 minutes at this stop. Use this parameter to squash the durations of each subsequent delivery at the same address. If you set it to 1, it will squash it to 1 minute, so the total duration for the above 6 stops would be 10 + 5 x 1 = 15 minutes.
balance
: Setting this to true will force the algorithm to distribute the load as equally as possible, so you have maximum utilization across your entire fleet. By default, balance
is set to true.
Additional Configuration
Property
Type
Notes
cache
Boolean
optional
callback_url
Number
optional
cache
: When set to true, the route optimization API will run a quick check to see if the engine has encountered the exact same problem before, and if so, it will return the previously computed solution. Useful for applications such as rideshare dispatch where the multiple API calls are made in the span of a few seconds.
callback_url
: Lets you set an endpoint URL that can receive the route solution output as a webhook payload (structure of the webhook payload is identical to the output JSON returned by the routing engine). This way, you don't have to set up a polling loop to check if the route solution is done.
Last updated