How to plan delivery routes

Vasily
Efidgy
Published in
5 min readSep 16, 2021
Photo by Brandable Box on Unsplash

I’d like to talk about vehicle routing problem and how to solve it using our software. Consider we own a store or maybe a warehouse and we need to deliver our products from this store to our customers. In the beginning all we have is a list of addresses:

Morning (8:00 AM - 12:00 PM)
1608 14th St, Oakland, CA 94607, USA
2273 E 23rd St, Oakland, CA 94606, USA
6501 San Pablo Ave, Oakland, CA 94608, USA
780 58th St, Oakland, CA 94609, USA
550 Jean St, Oakland, CA 94610, USA
882 Prospect Ave, Oakland, CA 94610, USA
3334 Over St, Oakland, CA 94619, USA
2440 25th Ave, Oakland, CA 94601, USA
2956 55th Ave, Oakland, CA 94605, USA
6344 Telegraph Ave, Oakland, CA 94609, USA
285 Lenox Ave, Oakland, CA 94610, USA
460 Crescent St, Oakland, CA 94610, USA
15 Entrada Ave, Oakland, CA 94611, USA
1839 9th Ave, Oakland, CA 94606, USA
2644 Havenscourt Blvd, Oakland, CA 94605, USA
275 Vernon St, Oakland, CA 94610, USA
Afternoon (12:00 PM - 4:00 PM)
1450 Westview Dr, Berkeley, CA 94705, USA
5917 Balboa Dr, Oakland, CA 94611, USA
1834 107th Ave, Oakland, CA 94603, USA
9954 MacArthur Blvd, Oakland, CA 94605, USA
8354 Ney Ave, Oakland, CA 94605, USA
1511 Jefferson St, Oakland, CA 94612, USA
3986 Adeline St, Oakland, CA 94608, USA
918 88th Ave, Oakland, CA 94621, USA
3252 Prentiss St, Oakland, CA 94601, USA
3245 Suter St, Oakland, CA 94602, USA
1427 Magnolia St, Oakland, CA 94607, USA
1015 Galvin St, Oakland, CA 94602, USA
546 Zorah St, Oakland, CA 94606, USA
996 40th St, Oakland, CA 94608, USA
1029 Arlington Ave, Oakland, CA 94608, USA
Evening (4:00 PM - 7:00 PM)
3221 Hamline Ave, Oakland, CA 94602, USA
4715 Park Blvd, Oakland, CA 94602, USA
315 Pershing Dr, Oakland, CA 94611, USA
6152 Ocean View Dr, Oakland, CA 94618, USA
565 Bellevue Ave, Oakland, CA 94610, USA
5425 Shattuck Ave, Oakland, CA 94609, USA
1631 41st Ave, Oakland, CA 94601, USA
400 40th St, Oakland, CA 94609, USA
4021 Bayo St, Oakland, CA 94619, USA
675 Fairmount Ave, Oakland, CA 94611, USA
1767 Indian Way, Oakland, CA 94611, USA
81 Echo Ave, Oakland, CA 94611, USA
525 Mandana Blvd, Oakland, CA 94610, USA
1512 Campbell St, Oakland, CA 94607, USA
3218 Market St, Oakland, CA 94608, USA
6768 Banning Dr, Oakland, CA 94611, USA
2201 West St, Oakland, CA 94612, USA
176 Maggiora Dr, Oakland, CA 94605, USA
6133 Broadway Terr., Oakland, CA 94618, USA

Each address represents a single customer. For this article all addresses are randomly generated so no personal data was used. The task is to find delivery routes that will fit time windows, cover all addresses and minimize costs. First of all we need to upload this data to the system.

Let’s start from creating a new empty project:

New project form
New project form

Now we need to import the data somehow, so first I’m gonna download template file (template.xlsx), then I will fill it with our data and import it into my project. Here it is. An excel file with three sheets: stores, vehicles, and our orders:

demo.xlsx

In vehicles sheet it is possible to set costs individually, but for demonstration I will use same values:

Fuel Consumption = 12.00 mpg
Fuel Price = 4.51 USD/gal
Salary Per Mile = 00.60 USD/mi
Salary Per Hour = 25.86 USD/h

You can download this file here: demo.xlsx. So now we can import our data set and see what will happen.

Order details
Order details

First of all we can find our orders on the map. And this is already good. We can click on each order and see the details. It’s time to find vehicle routes so let’s solve our case. Just click on Solve button and after a couple of minutes you will see the results.

Three routes
Three routes

Now you can see vehicle routes. A timeline in the bottom shows that only three vehicles are used. All orders are delivered just in time and delivery cost is just 400$. We can inspect each vehicle individually, see statistics, the route, and its schedule.

Now let’s say that 25 orders for a single vehicle is too much for us. So let’s setup some limits and see what will happen. Since we have 50 orders and five vehicles let’s set boxes limit to 10 boxes so all vehicles will be used.

Five routes
Five routes

As you can see all five vehicles are used. And it costs 70$ more.

Now we understand the price of our decision!

Finally I’d like to export my solution to an excel file (schedule.xlsx). Now we can continue our work with the schedule as we want.

Schedule

You can reproduce this demo and find out if it is possible to deliver these orders with just two vehicles.

Find out more at efidgy.com

--

--