Introduction

Simple, easy to use route optimization API

The Afi Routing Engine API is the easiest way to automate and optimize your routing and scheduling operations. Send our API the location of your visits (also knows as "stops") and starting positions of your driver fleet. We will return the optimal assignment of drivers to visits and the sequence in which each driver should go to the stops in his route.

The routing engine is hosted on your infrastructure (contact us for a demo and pricing), so it can be scaled to handle whatever volume your business needs it to. There are no pay as you go or monthly recurring fees, aside from what you'd pay your cloud provider e.g. Amazon Web Services or web hosting company.

If you run a logistics company, there are only two routing scenarios you need to consider:

  1. If you only do deliveries (e.g. if you deliver meal kits from a central kitchen), you need to use the /vrp-long (vehicle routing problem) endpoint.

  2. If you do both pickups and deliveries (e.g. if you run a ride sharing company), the /pdp-long (pickup and delivery problem) endpoint is for you.

How it Works

The routing engine communicates with your application via an API layer (accessed by way of two endpoints, /vrp-long or /pdp-long). You'll send it a JSON payload of {visits, fleet} (see the next section for a detailed example) and the API passes this to the routing engine, which immediately returns a job_id. The optimization job might take several minutes to finish so this job_id is like a queue number that lets you access the route solution when it's ready.

On the backend, the routing engine uses Open Street Maps Routing Machine (OSRM) to obtain the driving distance (or drive time) between each visit to generate a distance matrix that is then fed into the routing engine's optimization solver. The solver, loosely based on the open source jsprit project, quickly and intelligently finds the assignment of drivers to visits that minimizes the overall driving distance (or drive time) for the entire fleet.

This optimal assignment is called a route solution and is returned as a {solution} JSON object when you call the /jobs/:job_id endpoint. You can also configure a webhook endpoint to receive route solutions as they are produced by the routing engine, by specifying a URL in the options object of your input.

Last updated