Prepare the framework for Vehicle Routing / Traveling Salesman solver

A while back, I had announced the creation of a Vehicle Routing Problem solver to manage delivery operations with ERPNext, and to this day, it has served us very well for the last 3 months in production and allowed us to expand our operations to different cities with relative ease.

During that work, we heavily hacked on the Vehicle doctype in order to amend it with the metadata and constraints necessary for the solver to find optimal global delivery paths.

It quickly became apparent how the Vehicle doctype has stayed in its initial conception as an accounting- & inventory-oriented doctype to manage the static aspects of a fleet. It became clear that the dynamic perspective that comes with a VRP solver requires a different angle.

Based on this experience, I had started to amend the docytpe in an improvement PR and would be happy to continue this work in order to open up the possibility of ā€” maybe one day ā€” publishing a VRP suite to the ecosystem.

Iā€™d be grateful for any feedback and help to push this to completion! :handshake: :heart:

2 Likes

The VRP has provided us with a valuable opportunity to optimize our in-house logistics, and we are now leveraging its capabilities to extend our operations. Hereā€™s a breakdown of how this tool functions:

  1. Bulk Action Creation: From the delivery notes list, a bulk action allows the creation of a new VRP document, incorporating the selected delivery notes.
  2. Configuration Steps:
  • Specify the ā€œdepot addressā€, define the time lapse, and set the ā€œobjectivesā€ that the VRP calculation should consider.
  • Choose all ā€œavailableā€ vehicles suitable for the routing.
  1. Routing Calculation:
  • Upon selecting ā€œsaveā€, the tool computes the routing, displaying it on a map.
  • It generates a delivery trip for each route and assigns the corresponding delivery notes.

Moreover, successful implementation of the VRP necessitates advance configuration in the following areas:

  • Vehicles: In our business case, vehicles are assigned to specific delivery zones.
  • Vehicle Types: Assigning vehicle capacities (loading capacity) and vehicle capabilities (e.g., ability to navigate slopes) is crucial.
  • Drivers: Ensuring that drivers are appropriately configured and available for assigned routes.

For a visual representation, hereā€™s an example of a VRP document in the ā€œsolvedā€ status: