← All cases

case() // logistics · algorithms

Smart delivery routing

Routing algorithms on a microservice architecture: fewer delays, lower courier costs, happier customers.

// demo

// brief

challenge

The delivery department had no flexibly configurable system for assigning orders to couriers automatically. Available routing systems distributed orders suboptimally and did not account for courier constraints such as weight or travel range.

goal

Shorten the delivery time of a group of orders and minimise the number of orders delivered late or past the deadline, while testing whether the routing algorithms agreed with the customer can deliver that optimisation.

approach

A pipeline of algorithms that finds suboptimal routes for a group of orders, exposed as a routing microservice and validated with a simulation module on production data.

// key results

−37%

route distance

−25%

route duration

−40%

late deliveries

−15%

courier time on route

// what we did

Scope of work

01

Route calculation core

Off-the-shelf order distribution between couriers is far from optimal and leaves many orders late.

  • One-month research phase with a PoC that proved the required optimisation is achievable.
  • Won the contractor race with the best solution and the contract to develop it further.
  • Clustering with DBSCAN, initial routes with Clarke-Wright savings, then simulated annealing and 2-opt.
  • Route generator of maximum size honouring individual courier limits and transport types.
  • Support for several pickup points, pickups between deliveries and return-to-depot routes.
metricYandexOur systemΔ
Parcels distributed116121+4.3%
Couriers involved1525+66.7%
Late orders8853−37.6%
02

Simulation and benchmark against Yandex Routing

No way to prove the new routes are better than the incumbent routing service on real orders.

  • Simulation module to test the solution on production data.
  • Comparison tool that puts routes from our system next to routes from Yandex Routing.
  • Reference courier route: shorter, faster, no self-intersections and no outlier points 25 minutes away.
  • Unit and integration testing of the service.
metricYandexOur systemΔ
Parcels1010
Distance, m27 68017 422−37.1%
Duration, s7 5025 656−24.6%
Late parcels53−40%
03

Routing microservice and map visualisation

The algorithms had to plug into the customer's delivery system and be debuggable by its team.

  • Microservices for each stage of route calculation behind one API.
  • Route visualisation on Yandex Maps and OpenStreetMap for testing and debugging.
  • Handling of several non-standard parcel types.

// business value

  • Savings on local logistics and delivery from local warehouses to the end customer.
  • Couriers spend 15% less total time on route.
  • Delivery order prioritised by the properties of both the order and the courier.
  • Applicable to marketplaces, delivery services and humanitarian-aid logistics.

// stack

  • Python
  • DBSCAN
  • Clarke-Wright savings
  • Simulated annealing
  • 2-opt
  • Microservices
  • REST API
  • Yandex Maps
  • OpenStreetMap
  • Agile / Scrum

Got an X?

Start with the free discovery. In a week you'll know where your Z is.

Start discovery