The blog is dedicated to offering technical routing optimization solutions for grocery delivery apps. It covers understanding and solving the routing problem of the grocery delivery industry’s users, delivery executives, and restaurants. We would like to address the challenges and undermine our solutions by using the most valuable optimization techniques; assignment and routing optimization solution.

Our Goal

The goal is to find the optimal route through a Routing Optimization Solution for a set of orders in real-time and deliver the groceries on time within the minimum delivery charge.

Routing Issues in Grocery Delivery Systems

For businesses, it becomes a vital problem to handle the routing problem which affects the efficiency of the operational grocery delivery business. 

The industry has faced situations like; 

  • The audience wants to get their order delivered on time.
  • The rider or delivery executive wants to be free from any hassle, rescue his issues, and get a more per delivery cost and additional fare for extra mile delivery. 
  • The restaurants want to get a profit from the delivery business and serve better facilities to the customers and riders. 
  • Simple planning of the daily routes is big hectic! 
  • The system is affected by routing, cost, number of vehicles, and time issues. 

Also Read: How to Start Online Grocery Business – Grocery Business Model

And our goal is to minimize the problem. 

To understand more about the hierarchy, let’s start with the routing problem and then how we solve it. 

What is the Vehicle Routing Problem (VRP)?

vehicle routing problem

The vehicle routing problem is defined as the challenge faced by the delivery executives (DE) to reach their destination delivery locations within the time constraints, under the budget, and with efficiency. 

Vehicle Routing Problem with the Time Windows

In the grocery delivery system, the DE has been allotted multiple orders to deliver at the scheduled time by the restaurants. The DE must pick up and deliver the order in the estimated time slot.

Here we discuss the vehicle routing problem for the multiple DEs and routes that occur in different time windows. 

The time windows restricted the delivery executives to reach them at the crucial time bounds to sustain the high quality and freshness of the groceries. If somehow the rider fails to meet the timely delivery or arrive before the time scheduled then how cautiously the customer will satisfy their demands? 

Customer satisfaction is very important to cater to business profits and losses. For this context, it is important to serve the orders in the time scheduled while maintaining cost efficiency. 

  • For Multiple Windows: It is a set of non-overlapping windows with different lengths. The deliveries are ordered in the mutual combination of soft and hard time windows. The DE faces high pressure to carry both types of deliveries on time. 
  • Disjoint Time Window: If the DE has reached before the time scheduled or the time window. Hence he has to wait for the next time window. 
  • Soft Time Windows: The soft time window is flexible but some penalties are charged. For example, the order is scheduled to arrive between the range of working days from Monday to Friday between the time 1 pm to 10 pm.  
  • Hard Time Windows: This is the restricted time-bound window where the DE is short with the time and arrives to reach the customer at the scheduled time. Here no time violations are allowed and for any mismatch of the scheduled time, the rider has to wait.   

The vehicle routing for time windows is picked to solve for multiple places like groceries or supermarkets, schools, bus routing, restaurants, banks, etc. 

To resolve the problem, we have used the routing optimization solution. The DE finds the optimal path with the help of routing optimization and assignment and travels the shortest optimal distance without recurring the hefty or complex paths. 

Read More: How to Develop 10 Min Grocery Delivery App like Zepto

More Understanding by the Real-Life Scenarios

Let’s understand what problems the grocery businesses have been going through. Let’s discuss this here. 

1. The reality in the real-life scenario 

In the day-to-day scenario, the DE has to face a complex situation to travel through a set of routes. The condition could be miserable for the DE to reach the customer in real-time within the optimal time and cost. The DE has faced several factors like saving fuel costs, minimizing the distance, deadly peak time deliveries, querying delays in depots, customer disrespect, cost cutting by restaurants, etc. They undergo serious hazards while keeping the baggage of instant deliveries to secure their careers.

To make them active in the deliveries, the restaurant has defined some solutions. 

Blinkit (acquired by Zomato), one of the top-rated grocery delivery ecosystems, uses the technique of over-the-road vehicles with DE for the distribution of groceries in quick deliveries. Blinkit connects with the stores which have multiple times pallets to cater to the different deliveries at different locations. Each order has to be delivered on time. 


The solutions become possible when delivery businesses integrate feasible technology in their deliveries. Only a highly agile application can do this. 

2. Approach to solve the problem

To fulfill customer satisfaction, we have to solve the problem. The solution which we account for contains several individual factors: 

  • To minimize the buffer time and actual distance time, the number of halts on the route 
  • Save the price of fuel 
  • Automated algorithm using the optimization tools 
  • To serve orders for multiple depots with limited DE in restricted time windows
  • Different capacities of every vehicle 

Checkout More: Best Payment Gateway for Ecommerce

How do we solve the problem?

We keep in mind the most crucial factor to assign the batches to the DE and make the deliveries in the least efficient time to maintain the price distribution as well. The algorithm is addressed to solve adequate problems and rescue the DE from any misery to lead to on-time deliveries using the least distance paths. 

In the growing market of grocery buying and deliveries, there is a need to address cost, speed, and convenience. And to deal with the major complexity of the business one has to adopt the integrations of deep machine learning algorithms that provide solid benchmarks. 

Let’s discuss the assignment and routing algorithm.

Also, look at – Online Grocery Delivery Business Challenges & Solutions

Our Solutions for Routing Problems by Assignment and Routing Optimization Solutions in the Groceries Delivery Industry

One challenge that occurs when the delivery executives (DE) start their deliveries is how the DE starts its journey to reach the desired customers in an accurate time. This is the whole difficulty. 

VRP is a world-known problem recognized by many industries and especially the delivery industry does face bad tide with it. We understand the problem of the grocery business and we want to cater our specialized solutions with the integration of top-rated machine learning algorithms for resolving this issue. At Octal IT Solution, you can find robust in-house solutions by our expert developers.

The need for customized and highly scalable solutions not only reflects with desired outcomes and builds an edge over your nearest competition. 

So here we further interrogate the routing optimization solution as follows. 

Google Optimization Tools: Open Source Toolkit for the Routing Problems 

We have used some heavily loaded tools that garner the necessity of the users, restaurants, and business multi-aligned purposes. 

  • Geocoding API: it helps to find the distance matrix of the different locations by latitude and longitude. 
  • Google Maps API and Direction API: it is the free API that is required by the enterprise for viable hassle-free solutions to the grocery delivery app. 

In this section, we focus to break the problem into two stages; the last mile (LM) and the first mile (FM). The former is used for routing the DE’s path into batches and the latter is used to find the nearest DE in Just-In-Time (JIT). 

The combined stages would solve the purpose. To handle more orders in a cluster and allot DE such that no DE remains with unbalanced orders and distances. JIT helps to minimize the waiting time of the DE for the food to be prepared. 

Related Post: Automotive Mobile App Development

Let’s discuss both of them one by one. 

Grocery Delivery App Development

Last Mile Optimization to solve the Assignment and Routing Problem

The demand and needs in the delivery industry have soared a huge amount increment in the last mile deliveries. As per the estimate, it is expected to tough a 78% growth rate. The rate is heavily dependent on major factors like; 

  • 10% increase in the online grocery store by 2023. 
  • 10% increase rate in the instant delivery.
  • Nearby 2B of global people are expected to deliver their products to their doorstep. 
  • The most important is development in the technology each and every day with the immigration to fulfillment centers, and speed the delivery from the logistics centers. 
  • Alibaba invests million of money to sustain a fully automated logistic center. 

Source: World Economic Forum 

Last Mile (LM)

  • Solved based on: Multi-Depot Pick-Up delivery problem with time windows (MDPDPTW). 
  • Constraints and function objectives are used to solve the problem
    • Weight, volume, and capacity constraints are decided. 
    • Last-in-first-out order (LIFO): the groceries or items which can decay soon should be delivered first. 
    • Dynamic VRP: it creates the batches of incoming orders. 
    • Other constraints like the earliest pickup time, the latest pick-up time, the earliest drop time, and the latest drop time. 
Routing Optimization Solution
Process View of Grocery Delivery Optimization

Let’s understand the above problem with the scenario

For example; the store has confirmed the order from customer A1 and then there is another order from the same nearby location where the last order is requested.

Generally, the selection of the path is; 

DE-> Store -> A1 -> Store -> B1

Or, DE-> Store -> B1 -> Store -> A1

But this way the cost per delivery is increased and the time to dispatch and deliver the order has been high. 

To find the solution in order to solve the last mile problem; we have adopted dynamic pickup and delivery problems with time windows (DPDPTW) in a two-phase method; construction heuristic and meta-heuristic. 

Related Post: How to develop a grocery market app like BigBasket

In this model, the DE is allotted with batches, including the past and new orders, till the time the order is picked up by the DE. This model facilitates the new batching of orders and freezes the path to deliver just a single order. 

Select the routing path like; 

DE-> Store-> A1-> B1

DE-> Store -> B1 -> A1

For example; suppose for one order let the DE travel 1KM, then the LM is 1/1= Rs 1. However, if for 2 orders from the same corresponding nearby locations the DE has to travel 1KM, then the LM = ½= Rs 0.5. 

Hence, the more we batch, the less we have to pay for the orders. This would result in a better optimal routing optimization solution. 

These above batches, once decided, are assigned to the DE, this decrease the cron time (time required to execute the task at the server) of the algorithm and passes on to the next stage, which is First Mile. 

Read More: Food Delivery App Development Company

First Mile Optimization to solve the Assignment and Routing Problem

First Mile (FM)

In the first-mile optimization algorithm, the deliveries are assigned to nearby DEs. Here, the batch once created in the last mile is timely delivered to reduce the distance and cost per delivery.  

First Mile is very important in order to assign the orders to the delivery executive. Here the Google Map API is used to help the DE to find the customer’s location. The latitude and longitude matrices help to fetch the exact location of the customer. 

We have to find the nearby DE instantly with the help of algorithms internal and external heuristic. The methods define to take the further decision for the order to assign(O2A) the DE, and which DE will assign with which batch. 

Now let’s understand the most crucial part of the algorithm in FM. 

  1. External JIT Heuristic Model: This method helps in delaying the pickup time of batches to predict the better optimized batching for more orders and form more efficient routes. 

For example, the order to assign takes = 2 minutes, the first mile takes = 3 minutes of halt. Let the batch pickup time = 15 minutes, then the batch wait time = 15-3-2= 10 minutes. 

  1. Internal JIT Heuristic Model: this method is helpful in order to understand the algorithm and the routing and assignment algorithm will be helpful. 
Routing Optimization Solution

Let’s first see the objective functions and model constraints; 

  • One DE is assigned to one batch or vice-versa. 
  • Cost (batch, DE) = cost per delivery (batch, DE) + cost as func.f of delay time (batch, DE)

Hence, the Cost to Assign the DE to a batch, min Z = {summation for batch to single DE} Cost * (X) + summation of cost of not assigning batch * (1- X)

The Z objective function assures the optimized cost per delivery parameter and customer experience. The customer experience is decided based on the time delay. The smaller the delay, the more they are satisfied and the better they experienced. 

Process: Order is confirmed -> groceries are packed as an order-to-pack -> searching for the DE -> order assign to the DE -> first mile time (FM) -> wait time for orders, then assign to DE -> last mile time to collect the orders from the restaurants -> deliver the order to A1 customer -> deliver the order to B1, once the A1 is delivered. 

For a better understanding, we take two examples; 


Suppose individual DEs say DE1 and DE2 are assigned at time 10:15 am. They have to wait for 2 minutes for their orders which they have to deliver, 10:17 am the orders have been assigned to them from customers A and B respectively. Both of the customers are situated 4KMs away from the same store and have a middle separation of 2 KM amongst both customers. 

Now the cost for individual deliveries by the DE1 and DE2 to their respective customers A and B = 

=Rs 20 (cost of grocery) + Rs 10(delivery cost) = Rs 30 to deliver to customer A and the same cost for customer B’s delivery.  

So the total cost to deliver the grocery to A and B customers is = 30 + 30= Rs 60. 

Related Post: How Much Does It Cost to Develop Grocery Delivery Mobile App


Suppose the same orders are been placed by customers A and B from the same store. Here, if we used the assignment and routing optimization model, the cost for deliveries and batch creation is minimized. 

Using the algorithm, we assign only one DE for both of the orders. It helps the DE to earn some extra commission in delivery within a radius of 1km to 4km while keeping the other DEs available for the other batches, this helps to free the resources for other orders and make their proper allotment.  

Now the cost for the order of deliveries of the customer’s A and B = 20 (cost of grocery) + 10 (delivery cost) + 10 (2nd order cost for grocery) + 5 (extra distance travelled cost) = Rs 45. 

In the above example1, the cost to deliver is Rs 60 while when using the heuristics approach in example2 the cost is minimized to Rs 45. 

So, a total of Rs 15 can be saved for each delivery. 

What do We conclude?

To resolve the above problem, the assignment and routing optimization solution is a very important trade-off that balances the assignment of orders to the DE and finds the least time taking a path to reach within the time. The purpose of the FM and LM is to deliver the order to the desired customer within a promised slot. Hence, we minimize the buffer time and actual distance time to reach the destination. 

What Octal would serve to the Grocery Delivery businesses?

We understand the situation everyone is facing in the niche industry. To surface the problem our team is ready to understand and overview the high-level integration of the machine learning solutions explained in the two stages in the blog. In the first stage, the problem is modeled with the LM optimization to create batches for multiple orders, and in the later stage, the problem is solved with the heuristics designed for delivery and pickup. That’s how the problem is solved.  Get trusted and affordable grocery delivery app development services from top mobile app development company.

Our grocery app developers invent a new set of algorithms that would help grocery businesses to meet their service commitments by Routing Optimization Solutions for the deliveries to make quick decisions for buying. The solutions are valid for a large volume of data and under the least RAM size systems or interfaces. You can connect with our expert developers who are able to design the algorithm which gives you the results more quickly. 

Grocery Delivery businesses Routing Optimization Solution
Managing Director

Arun Goyal is a passionate technology enthusiast and a seasoned writer with a deep understanding of the ever-evolving world of tech. With years of experience in the tech industry, Arun has established himself as a prominent figure in the field, sharing his expertise and insights through his engaging and informative blog posts.

Previous Post Next Post

Octal In The News

Octal IT Solution Has Been Featured By Reputed Publishers Globally

Let’s build something great together!

Connect with us and discover new possibilities.

    Gain More With Your Field Service

    We’re always keeping our finger on the pulse of the industry. Browse our resources and learn more.

    Let's schedule a call
    Mobile App Development Mobile App Development