How to Solve Vehicle Routing Problem: Last-Mile Delivery Optimization with AI

How to Solve Vehicle Routing Problem: Last-Mile Delivery Optimization with AI

Dorota Owczarek - April 19, 2022

In a world where online shopping has become the norm, timely and accurate last-mile delivery is more critical than ever. Unfortunately, this final stage of the delivery process is also one of the most expensive and challenging. Luckily, artificial intelligence is here to help. AI is already revolutionizing logistics and supply chain management, and it can help optimize last-mile logistics and reduce costs. In this article, we will discuss why last-mile delivery is so expensive and how machine learning solutions can benefit route and scheduling optimization. We will also provide a few case studies that showcase successful AI-based last mile solutions implementations.

Why Is Last-Mile Delivery So Expensive?

A few factors contribute to the high costs of last-mile delivery. One primary reason is that last-mile logistics is a very complex process. There are many variables to consider, such as traffic congestion, route restrictions, and customer preferences. In addition, the last mile is often the most expensive part of the delivery process due to fuel costs and labor expenses.

Total delivery cost and the impact of last mile delivery cost

Total delivery cost and the impact of last mile delivery cost

Finally, companies must also factor in the cost of failed deliveries, returns, and reverse logistics when planning a shipment. These factors make it challenging to optimize last-mile delivery and reduce costs.

The Growth of E-commerce and Food Delivery

The growth of e-commerce has only made last-mile delivery more challenging. With the increase in online sales, there is a greater demand for timely and accurate deliveries. Customers expect options for same-day delivery and even one-hour delivery.

Food delivery is another sector that is experiencing rapid growth. In the US, food delivery orders are expected to grow at a rate of 20% per year through the 2020s. This high demand for food delivery has put a lot of pressure on last-mile logistics providers to improve their efficiency and reduce costs.

Seasonal Logistics Challenges

Another challenge that last-mile delivery providers face is the seasonal nature of their business. The demand for deliveries can vary significantly from month to month or even week to week, with the highest peaks close to globally celebrated holidays (e.g., Christmas, Chinese New Year, Diwali) as well as commercial holidays (e.g., Black Friday). This makes it difficult for companies to plan resources and schedule their deliveries efficiently for specific shopping periods.

How Do You Optimize Delivery Operations?

To optimize delivery operations, you need a system that can efficiently manage all of the variables involved in the process. That’s where machine learning comes in. Machine learning algorithms can learn from data and improve over time. This makes them a perfect tool for optimizing complex processes like last-mile delivery.

There are several different machine learning algorithms, but some of the most commonly used in logistics are deep learning models based on neural networks and decision trees. Neural networks are good at handling complex data sets, while decision trees are good at identifying patterns in data. Both of these algorithms have been successfully used to optimize last-mile delivery operations.

Machine learning can optimize last-mile delivery by predicting customer preferences and routing vehicles accordingly. Artificial intelligence algorithms can also predict traffic patterns and congestion levels, allowing companies to plan their routes accordingly. With the help of machine learning, you can also cut parcel shipping costs.

In addition, ML can help identify when a delivery is likely to fail or be returned. This information can then improve the scheduling process and reduce costs.

Route Optimization

One of the most critical aspects of last-mile delivery is route optimization. A well-optimized route can save time and money. There are a number of factors that you need to take into account when planning a delivery route, such as traffic congestion, customer preferences, and the availability of resources.

Machine learning algorithms can be used to optimize delivery routes. For example, a route planning deep learning model could be trained on historical data from a company’s order management system to propose the most efficient route for a given set of deliveries and accompanying variables. This data could include information on customer addresses, order details, and delivery times. The model would then use this information to generate suggestions for route optimization.

Delivery Scheduling

Another vital factor in last-mile delivery is scheduling logistics operations. Scheduling affects everything from how many delivery drivers are needed to how many vehicles are required. It’s essential to schedule deliveries to use resources efficiently, and customers get their orders on time.

AI can be applied to optimize delivery schedules. For example, a decision tree could be trained on historical data from a company’s order management system. This data could include information on customer addresses, order details, and delivery times. The tree would then use this information to generate suggestions for optimized schedules.

How delivery scheduling software works - gathering data on orders and planning accordingly deliveries - from arrival at transportation hub, through delivery scheduling to loading and finding optimal routs for final delivery

How delivery scheduling software works - gathering data on orders and planning accordingly deliveries - from arrival at transportation hub, through delivery scheduling to loading and finding optimal routs for final delivery

Vehicle Routing Problem

The Vehicle Routing Problem (VRP) is a common problem in logistics that involves planning routes for a fleet of vehicles. The goal is to minimize the total cost of the journey while considering factors like vehicle capacity, distance, time, and traffic congestion. There are many methods to solve vehicle routing problems, but the most common approach is to use a mathematical optimization algorithm like a heuristic or a genetic algorithm.

Factors to consider when planning last mile delivery in scheduling and route optimization of vehicle routing problem

Factors to consider when planning last mile delivery in scheduling and route optimization of vehicle routing problem

Recently, there has been a growing interest in using machine learning algorithms to solve VRP problems and finding the best route for the whole vehicle fleet. Advanced artificial neural networks models have shown to be effective at optimizing route plans. In particular, deep learning models have shown great promise for solving complex VRP problems and cutting operational costs.

Automated Visual Inspection Upon Truck Loading

As the last step before a truck leaves for its final destination, a visual inspection is often carried out to check that the goods have been loaded correctly. This process can be time-consuming and error-prone, especially if there are a lot of items to inspect.

Recently, there has been growing interest in using machine learning algorithms for automating visual inspections. Advanced artificial neural networks models have shown to be effective at detecting errors in loading operations. In particular, deep learning models have shown great promise for automating complex visual inspections. The models can identify defective parcels in an image and mark them for review by a human inspector. This solution saves time and money by automating the visual inspection process.

Dynamic Pricing

Another challenge in last-mile delivery is pricing. It’s essential to price orders correctly so that you’re making a profit while still providing excellent value to the customer. Brokers are being phased out in favor of automatic machine learning algorithms that assist businesses in choosing the finest possible carrier for operational efficiency and reduced delivery costs. Dynamic pricing in logistics is a subject we thoroughly described in our previous article.

Autonomous Deliveries

The final frontier in last-mile delivery is autonomous deliveries. With the rise of self-driving cars, it’s only a matter of time before we see autonomous trucks or dedicated robots making deliveries. Autonomous delivery vehicles can navigate streets on their own and deliver packages to customers’ homes. This technology has the potential to revolutionize how we do last-mile delivery. There are many challenges to overcome before this becomes a reality, but there is no doubt that autonomous deliveries will play a significant role in the future of logistics.

Many companies are working on developing autonomous delivery vehicles. Some notable examples include Amazon, UPS, and Google. We’ll likely see more companies enter this space in the coming years.

Chatbots for Improved Customer Experience

Chatbots are commonly used to provide customer support or sell products and services. Recently, there has been a growing interest in using chatbots for last-mile delivery.

Chatbots can be used to provide customers with information about their orders. For example, a chatbot could give the customer a tracking number for their order. This would allow the customer to track the progress of their order online.

Chatbots can also be used to answer questions from customers about their orders. For example, a chatbot could help the customer resolve a problem with their order. This would help improve customer satisfaction with the company’s delivery service.

AI in Last-Mile Logistics - Case Studies

Now that we’ve seen how machine learning can optimize last-mile delivery let’s take a look at some case studies where AI has been successfully used in this area.

Scheduling Deliveries by Predicting an Optimal Time of Delivery for Last-Mile Logistics

A company operating in the last-mile logistics sector was struggling with high failed delivery rates due to non-optimal scheduling of deliveries.

nexocode engineering team proposed a data-driven optimization approach that combines artificial intelligence modeling with fleet management optimization to tackle this challenge. The solution we developed focused on delivering a predictive scheduling model integrated with a deliveries scheduler and route planner.

The ML model predicts the probability of delivery success as a function of inputs such as time, region, address, weekday, vehicle, weather, has doorman/receptionist, building type, parking difficulty, real-time traffic data, etc. The predictive scheduling module optimizes routes and ordering of the deliveries to ensure that the driver delivers the order at the right moment.

The solution reduced failed delivery rates by 60% by predicting the optimal time of delivery and scheduling deliveries accordingly. You can read more about this case study here.

Scheduling deliveries by predicting an optimal time of delivery for last-mile logistics

Scheduling deliveries by predicting an optimal time and planning delivery routes for last-mile delivery problem

How Amazon Forecasts Demand to Allow For 1-Hour Deliveries

To offer one-hour delivery, Amazon has to predict demand for a particular product and plan stock-ups at local depots. This is a difficult task, but Amazon has been able to do it through machine learning algorithms.

Amazon’s forecasting system considers a number of factors, including past sales data, customer ratings, and inventory levels. The system also uses machine learning models to predict how much demand will increase during busy periods, such as Christmas or Black Friday.

This system allows Amazon to offer one-hour delivery for many products. You can read more about it here.

Route Optimization Algorithm That Lowers Operational Costs and the Environmental Impact of Deliveries

Greenplan, a DHL-financed start-up, is driving sustainable logistics by developing a route optimization model that targets the reduction of CO2 emissions.

The algorithm developed by Greenplan is called a “last-mile” algorithm, as it is designed to optimize the routing and scheduling of deliveries in the last mile of a supply chain. The algorithm uses a number of inputs, including customer demand data, delivery data, traffic data, and weather data.

The results of using this algorithm have been impressive. In tests, it was found that the costs of deliveries could be reduced by up by 20%, compared to standard route optimization solutions, simply by lowering kilometers driven and thus lowering the carbon footprint. You can read more about it here.

Off-The-Shelf Route Optimization Solutions

Many off-the-shelf solutions can help route planning and optimize your last-mile deliveries. Route optimization solution uses a variety of algorithms to optimize delivery routes. Usually, route optimization software is available as a SaaS product so that you can get started quickly without a lot of investment.

Each of these solutions has its own strengths and weaknesses. You will need to evaluate them carefully to see which one is the best fit for your organization. Additionally, these generic solutions often do not consider the company’s specific needs. As a result, these solutions may not be as effective as they could be.

Bringing Last-Mile Delivery Efficiency With Tailored Machine Learning Models

To get the most out of last-mile delivery, it is often necessary to tailor a machine learning model specifically for the company’s needs. This involves understanding the company’s business and understanding how machine learning can be used to improve its operations. A tailored model will take into account the company’s specific needs and the available data.

Once a suitable machine learning model has been found, it is necessary to implement it into the company’s systems. This can be a difficult task, as it often requires changes to the company’s IT infrastructure. It is crucial to have a team of experts who can implement the model and ensure it is working correctly.

Custom machine learning solutions for improvement of last mile delivery processes

Custom machine learning solutions for improvement of last mile delivery processes

Advantages of Custom AI-based Software for Optimizing Delivery Process

There are several advantages to using custom AI-based software for optimizing delivery processes:

  • Increased accuracy - model, trained on specific company data will be a more optimal solution than a generic one.
  • Increased efficiency - a machine learning algorithm tailored for your company will be more efficient than a generic solution. Custom-built solutions for logistics can provide complex functional features and link into your system to offer insight and comprehensive data on your distribution process.
  • Increased flexibility - custom AI-build solutions in logistics are more flexible; as the company decision-maker, you decide how and where to integrate it with other systems, which features should be built on top of the solution, and how to alter ML outcomes depending on the environment.
  • Increased scalability - a custom last-mile delivery solution tailored for your company will be able to handle more significant amounts of data than an off-the-shelf solution. It can be scaled in various directions depending on the current needs.
  • Increased ROI - the return on investment for AI for custom build solutions is usually higher as they target the most critical business processes.

These are just a few advantages of using custom AI-based software for optimizing delivery processes. To get the most out of last-mile delivery, it is important to implement it strategically into the company’s systems. With the right tools in place, last-mile delivery can be more efficient and cost-effective than ever before.

Best Practices for Optimizing Last-Mile Delivery Services

While best management techniques can vary from business to business, the practices below can be applied across a whole logistics & supply chain business.

Leverage Modern Technologies That Fit Your Business Needs

Many modern technologies available today could help logistics companies improve their delivery services last mile. And businesses looking to avoid hiring software engineering professionals in their company to save money can opt for outsourced, customized, final mile delivery systems. The same is true for delivering last-mile software solutions by hiring offshore tech firms. Custom-built solutions for logistics can offer advanced functional features and integrate with your system to provide visibility and detailed data about your distribution process. Look for companies that have experience not only in specific technology but also a portfolio that showcases other successful implementations for the logistics industry. Check out nexocode’s portfolio and reach out to us if you’re interested in building a custom AI-based solution.

Analyze & Assess Data

If the software for your delivery last mile is developed or implemented, the data available for analysis can identify gaps in your delivery last mile plan. Make sure to invest in professional data science analysis for your last-mile delivery problem. A good AI provider will suggest a data collection strategy that will improve the accuracy of your model and provide better value for your company. With your data house in order and a straightforward process for data management, you will be able to shape your data into an actual business asset and supercharge your analytics. A customized last-mile solution integrating business intelligence can help determine where cost savings could happen or be achieved.

Establish Standard Procedures

Once you have base-level historical information, you can analyze this information for improved procedures within your company. A data-depth analysis is a crucial element for designing highly engineered plans. The best logistics companies leverage such plans for their own operations by identifying and setting up standards of operations as well.

Monitor Driver, Not Just the Vehicle

Many logistics businesses focus purely on deliveries and vehicles rather than drivers. Maintaining a close eye on your drivers is one of the best ways to improve safety and efficiency during last-mile delivery. This can be done by using a combination of advanced data analytics and AI, which will help identify unsafe driving habits or areas where improvement is needed. In addition, this type of system can also optimize routes for each driver, taking into account their skills and working schedules.

Observe Your Customers as Well

It’s not just about the deliveries and the drivers. You also need to keep a close eye on your customers, including their changing needs. Keeping an eye on customer satisfaction and ordering trends can be handy. Maintaining records of the customer’s transactions is essential for identifying customer expectations and possible problems. By using a combination of AI-based analytics and customer feedback, you can improve your delivery last-mile process to meet customer demands better. This will help keep them happy while ensuring that your company is able to stay ahead of the competition.

The Future of Last-Mile Delivery

The future of last-mile delivery is a bright one. With the help of artificial intelligence, logistics professionals can optimize their routes and schedules in a way never before possible. With its ability to analyze large amounts of data and identify patterns, machine learning can help companies optimize their routes and schedules, something that humans could never do alone.

When it comes to your last-mile problem, don’t wait until it’s too late. Contact nexocode today! Our team of AI experts has extensive experience in developing AI-based software solutions for logistics & supply chains.

About the author

Dorota Owczarek

Dorota Owczarek

AI Product Lead & Design Thinking Facilitator

Linkedin profile Twitter

With over ten years of professional experience in designing and developing software, Dorota is quick to recognize the best ways to serve users and stakeholders by shaping strategies and ensuring their execution by working closely with engineering and design teams.
She acts as a Product Leader, covering the ongoing AI agile development processes and operationalizing AI throughout the business.

Would you like to discuss AI opportunities in your business?

Let us know and Dorota will arrange a call with our experts.

Dorota Owczarek
Dorota Owczarek
AI Product Lead

Thanks for the message!

We'll do our best to get back to you
as soon as possible.

This article is a part of

AI in Logistics
51 articles

AI in Logistics

Artificial Intelligence is becoming an essential element of Logistics and Supply Chain Management, where it offers many benefits to companies willing to adopt emerging technologies. AI can change how companies operate by providing applications that streamline planning, procurement, manufacturing, warehousing, distribution, transportation, and sales.

Follow our article series to find out the applications of AI in logistics and how this tech benefits the whole supply chain operations.

check it out


Insights on practical AI applications just one click away

Sign up for our newsletter and don't miss out on the latest insights, trends and innovations from this sector.


Thanks for joining the newsletter

Check your inbox for the confirmation email & enjoy the read!

This site uses cookies for analytical purposes.

Accept Privacy Policy

In the interests of your safety and to implement the principle of lawful, reliable and transparent processing of your personal data when using our services, we developed this document called the Privacy Policy. This document regulates the processing and protection of Users’ personal data in connection with their use of the Website and has been prepared by Nexocode.

To ensure the protection of Users' personal data, Nexocode applies appropriate organizational and technical solutions to prevent privacy breaches. Nexocode implements measures to ensure security at the level which ensures compliance with applicable Polish and European laws such as:

  1. Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data, and repealing Directive 95/46/EC (General Data Protection Regulation) (published in the Official Journal of the European Union L 119, p 1); Act of 10 May 2018 on personal data protection (published in the Journal of Laws of 2018, item 1000);
  2. Act of 18 July 2002 on providing services by electronic means;
  3. Telecommunications Law of 16 July 2004.

The Website is secured by the SSL protocol, which provides secure data transmission on the Internet.

1. Definitions

  1. User – a person that uses the Website, i.e. a natural person with full legal capacity, a legal person, or an organizational unit which is not a legal person to which specific provisions grant legal capacity.
  2. Nexocode – NEXOCODE sp. z o.o. with its registered office in Kraków, ul. Wadowicka 7, 30-347 Kraków, entered into the Register of Entrepreneurs of the National Court Register kept by the District Court for Kraków-Śródmieście in Kraków, 11th Commercial Department of the National Court Register, under the KRS number: 0000686992, NIP: 6762533324.
  3. Website – website run by Nexocode, at the URL: whose content is available to authorized persons.
  4. Cookies – small files saved by the server on the User's computer, which the server can read when when the website is accessed from the computer.
  5. SSL protocol – a special standard for transmitting data on the Internet which unlike ordinary methods of data transmission encrypts data transmission.
  6. System log – the information that the User's computer transmits to the server which may contain various data (e.g. the user’s IP number), allowing to determine the approximate location where the connection came from.
  7. IP address – individual number which is usually assigned to every computer connected to the Internet. The IP number can be permanently associated with the computer (static) or assigned to a given connection (dynamic).
  8. GDPR – Regulation 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of individuals regarding the processing of personal data and onthe free transmission of such data, repealing Directive 95/46 / EC (General Data Protection Regulation).
  9. Personal data – information about an identified or identifiable natural person ("data subject"). An identifiable natural person is a person who can be directly or indirectly identified, in particular on the basis of identifiers such as name, identification number, location data, online identifiers or one or more specific factors determining the physical, physiological, genetic, mental, economic, cultural or social identity of a natural person.
  10. Processing – any operations performed on personal data, such as collecting, recording, storing, developing, modifying, sharing, and deleting, especially when performed in IT systems.

2. Cookies

The Website is secured by the SSL protocol, which provides secure data transmission on the Internet. The Website, in accordance with art. 173 of the Telecommunications Act of 16 July 2004 of the Republic of Poland, uses Cookies, i.e. data, in particular text files, stored on the User's end device.
Cookies are used to:

  1. improve user experience and facilitate navigation on the site;
  2. help to identify returning Users who access the website using the device on which Cookies were saved;
  3. creating statistics which help to understand how the Users use websites, which allows to improve their structure and content;
  4. adjusting the content of the Website pages to specific User’s preferences and optimizing the websites website experience to the each User's individual needs.

Cookies usually contain the name of the website from which they originate, their storage time on the end device and a unique number. On our Website, we use the following types of Cookies:

  • "Session" – cookie files stored on the User's end device until the Uses logs out, leaves the website or turns off the web browser;
  • "Persistent" – cookie files stored on the User's end device for the time specified in the Cookie file parameters or until they are deleted by the User;
  • "Performance" – cookies used specifically for gathering data on how visitors use a website to measure the performance of a website;
  • "Strictly necessary" – essential for browsing the website and using its features, such as accessing secure areas of the site;
  • "Functional" – cookies enabling remembering the settings selected by the User and personalizing the User interface;
  • "First-party" – cookies stored by the Website;
  • "Third-party" – cookies derived from a website other than the Website;
  • "Facebook cookies" – You should read Facebook cookies policy:
  • "Other Google cookies" – Refer to Google cookie policy:

3. How System Logs work on the Website

User's activity on the Website, including the User’s Personal Data, is recorded in System Logs. The information collected in the Logs is processed primarily for purposes related to the provision of services, i.e. for the purposes of:

  • analytics – to improve the quality of services provided by us as part of the Website and adapt its functionalities to the needs of the Users. The legal basis for processing in this case is the legitimate interest of Nexocode consisting in analyzing Users' activities and their preferences;
  • fraud detection, identification and countering threats to stability and correct operation of the Website.

4. Cookie mechanism on the Website

Our site uses basic cookies that facilitate the use of its resources. Cookies contain useful information and are stored on the User's computer – our server can read them when connecting to this computer again. Most web browsers allow cookies to be stored on the User's end device by default. Each User can change their Cookie settings in the web browser settings menu: Google ChromeOpen the menu (click the three-dot icon in the upper right corner), Settings > Advanced. In the "Privacy and security" section, click the Content Settings button. In the "Cookies and site date" section you can change the following Cookie settings:

  • Deleting cookies,
  • Blocking cookies by default,
  • Default permission for cookies,
  • Saving Cookies and website data by default and clearing them when the browser is closed,
  • Specifying exceptions for Cookies for specific websites or domains

Internet Explorer 6.0 and 7.0
From the browser menu (upper right corner): Tools > Internet Options > Privacy, click the Sites button. Use the slider to set the desired level, confirm the change with the OK button.

Mozilla Firefox
browser menu: Tools > Options > Privacy and security. Activate the “Custom” field. From there, you can check a relevant field to decide whether or not to accept cookies.

Open the browser’s settings menu: Go to the Advanced section > Site Settings > Cookies and site data. From there, adjust the setting: Allow sites to save and read cookie data

In the Safari drop-down menu, select Preferences and click the Security icon.From there, select the desired security level in the "Accept cookies" area.

Disabling Cookies in your browser does not deprive you of access to the resources of the Website. Web browsers, by default, allow storing Cookies on the User's end device. Website Users can freely adjust cookie settings. The web browser allows you to delete cookies. It is also possible to automatically block cookies. Detailed information on this subject is provided in the help or documentation of the specific web browser used by the User. The User can decide not to receive Cookies by changing browser settings. However, disabling Cookies necessary for authentication, security or remembering User preferences may impact user experience, or even make the Website unusable.

5. Additional information

External links may be placed on the Website enabling Users to directly reach other website. Also, while using the Website, cookies may also be placed on the User’s device from other entities, in particular from third parties such as Google, in order to enable the use the functionalities of the Website integrated with these third parties. Each of such providers sets out the rules for the use of cookies in their privacy policy, so for security reasons we recommend that you read the privacy policy document before using these pages. We reserve the right to change this privacy policy at any time by publishing an updated version on our Website. After making the change, the privacy policy will be published on the page with a new date. For more information on the conditions of providing services, in particular the rules of using the Website, contracting, as well as the conditions of accessing content and using the Website, please refer to the the Website’s Terms and Conditions.

Nexocode Team