Keywords

1 Introduction

India has an Internet user base of over 460 MillionFootnote 1 (as per Statista) with approximately 6 million new users being added every month. This huge inflow of internet users has opened several business avenues. The buying and selling of products and services over the internet is often referred to as e-commerce. The buying and selling of goods have seen some tremendous growth in past decades. The number of e-commerce consumers is exponentially increasing day by day. Further, the growth of smart phones and internet is contributing to this exponential growth in this e-commerce sector. In emerging economy like India, China, Indonesia and Brazil amongst others, the e-commerce presence is expanding every year as the consumer is becoming comfortable in online shopping.

Apart from online payments made towards these purchases, cash on delivery is a dominating payment method especially in India [1]. The retail market of India is expecting growth of from 2.5% in 2016 to 5% in 2020 [2]. Further, the total valuation of e-commerce market in India was estimated at 27.5 billion USD in 2016 and the expected growth of e-commerce industry is at a CAGR of 31% which can touch 30 billion USD in 2020 [3]. As per the Indian e-commerce industry analysis the e-commerce industry of India is going upward and it is expected to surpass the US in 2034. It is expected to become the second largest next only to China. The growth is triggered by the surrounding ecosystem. Increase in the internet reach and smart phone penetration enables the Indian users to take this leap.

For any e-commerce company, customer satisfaction and service level is determined by three important decisions including facility location decision, inventory decision and transportation decision [4]. The current study, however, caters primarily to the strategic warehouse location and transportation optimization. The study focuses on a combination of location inventory problem, location routing problem and the inventory routing problem. The advancement of information technology with information capturing as the focus that is available during real-time operations opens several new research directions [5].

Machine learning in the current scenario, is often used in interpreting huge volume of data and is proven to be very helpful in decision making [6]. Thus, the current study also explores swarm intelligence in context of online retail logistic operation optimization. Swarm intelligence algorithms are inspired by social insects such as honey bees, bird flocks, ants or any other social animal. For the dynamicity of routing in e-commerce, this study specifically focuses on ant colony optimization for solving the Location based Inventory Routing Problem (LIRP). These swarm based approaches have found applications in domains as varied as energy [7], wireless networks [8], social media content popularity [9] and spam [10], scheduling and resource management [11] amongst others. The subsequent subsections focus on the review of existing literature, the research methodology adopted and the findings of the study.

2 Related Work

The academic literature illustrates on several approaches that have been proposed for the Vehicle Routing Problem (VRP). These can be broadly classified as classical heuristics, these are exact solutions and were developed mostly from 1960–1990, and meta-heuristics that provide approximate solutions and have become popular over the last few decades [12, 13]. Literature also highlights the emerging importance of vehicle routing and meta-heuristics, specifically in the form of nature inspired and swarm intelligence algorithms.

This section discusses the literature surrounding heuristic solutions to routing problems and applications of swarm intelligence in various domains. The solutions to vehicle routing problems were available as early as 1960s [13]. The classical heuristics follow a merging and assigning process, where the technique merges existing routes using savings criteria where the aim is to minimize the route length followed by the assignment of vertices to routes using insertion cost [14]. Other methods include the sequential improvement [15, 16], the sweep algorithm [17], petal algorithms [18] and clusterfirst, route-second approach [19]. Other existing studies with exact solutions were using mathematical models like spanning tree [20]. Gendreau et al. [21] proposed a Tabu search heuristic approach for solving the same.

The exact mathematical and heuristic solutions for vehicle routing problems were followed by meta-heuristics, probabilistic models like meta-strategy simulated annealing is also used for approximating to a globally optimum solution for the problem [22]. Bio-inspired computing algorithms are being popularly used in various case scenarios including classification, clustering, regression and outlier detection problems [23,24,25,26]. Further, literature also has evidences of theories inspired from nature, an ant based system is used for finding the shortest path for the vehicle for routing [27]. The literature has proposed hybrid meta-heuristic approaches to solve hard combinatorial optimization problems like the ones under consideration in this study. Studies also focus on Genetic Algorithms and many of its hybrid variants with and without trip delimiters for solving the problem at hand [28]. Any feasible chromosome sequence is an optimal route that can be used by the vehicle.

This study focuses on using the existing ant colony optimization for routing [29] in the e-commerce domain. With the current explosion in the e-commerce sector, the need to provide an optimal route for delivery through the same warehouse is a great example of the existing Travelling Salesman Problem. This can be used to solve logistic problems optimally. The subsequent section discusses the proposed approach, the dataset used and the findings of the study.

3 Research Methodology

For the purpose of simplicity the current study works on some assumptions that only one vehicle will do the delivery, only Delhi and Gurgaon is used as the location, a warehouse captures the Delhi and Gurgaon location and that the vehicle returns back to warehouse. For capturing the address location as latitude and longitude, the Google Maps API is used. Further, ant colony optimization is applied for the current Travelling Salesman Problem (TSP) [30]. The algorithm is adopted with slight modification for the current vehicle routing problem since routing has to start from the warehouse and not randomly. Figure 1 illustrates the process followed for getting the best route for solving the location based inventory problem in the study.

Fig. 1.
figure 1

Diagrammatic representation of ACO based vehicle routing

3.1 Data Description

Online Retail data has been adopted from University of California machine learning repository. The data contain record of 293 days sales record with 541909 entries as represented in Table 1. Further, an extra column has been added to data file with the Delhi and Gurgaon addresses. A total of 468 addresses have been chosen and mapped to online retail data. For Delhi, North, South, East and West Delhi has been considered. Similarly, for Gurgaon, the areas have been divided in urban and rural.

Table 1. Snapshot of dataset and mapped reference address

The subsequent subsection discusses the ACO engine and how the routing can be modeled mathematically.

3.2 Mathematical Model

The ACO is a probabilistic meta-heuristic technique which can be used for identifying an optimal path in the graph based on behavior of ants travelling a path between the ant colony and the food source. The current study passes the distance metrics for vehicle routing to the ACO engine and the mathematical formulation/model for the same is elaborated in the current sub-section. The section discusses how ACO’s pheromone trail update process can be utilized for seeking an optimal path from the warehouse to different destinations.

For the purpose of analysis, historical data is used to find the area which has received maximum number of orders which is basically the mode in the data. This helps in identifying the location where the warehouse can be established. Now, for the purpose of vehicle routing, the Google Maps API is used to identify the latitude (LAT) and longitude (LNG) of the address location that is further converted in meters for computing the distance between the two address i and j using the Haversine Formula [31] as per Eqs. 13.

$$ {\rm X} = \,\sin^{2} \left( {\frac{\Delta LAT}{2}} \right) + \,\cos \,LAT_{1} \cdot \cos \,LAT_{2} \cdot \sin^{2} \left( {\frac{\Delta LNG}{2}} \right) $$
(1)
$$ Y = 2 \cdot X \cdot \tan 2\left( {\sqrt X ,\sqrt {\left( {1 - X} \right)} } \right) $$
(2)
$$ Distance = R \cdot Y, $$
(3)

where R is the radius of the earth (Mean Radius = 6,371 km).

After calculating the distance between addresses we need to construct the distance graph so that every demand point is represented by a variable V1, V2, V3, … … … Vn with variable Vi having values Value1, Value2, Value3, … … … Valuen. The graph thus constructed would be G = (V, n) and the total number of vertices in the graph becomes n * (n − 1)/2. Each variable Vi vertex vi,j having value Valueij. The graph has a single root node (warehouse) from where the routing run is initiated leading to creation of a bidirectional symmetric graph.

The current study uses the ant system algorithm which is the first variant of ACO algorithm [32, 33]. The ant system works on pheromone values that are updated by all the ants completing their tour. The problem comprises of a network flow model where the ants have a probability (Probx,y) that helps them to choose the path to be taken. This path is from a node x to node y in the flow network. Every path has a probability associated with it which is given by Eq. 4.

$$ Prob_{x,y} = \frac{{\left( {\tau_{x,y}^{\alpha } } \right)\left( {\varphi_{x,y}^{\beta } } \right)}}{{\sum {\left( {\tau_{x,y}^{\alpha } } \right)\left( {\varphi_{x,y}^{\beta } } \right)} }}, $$
(4)

where τx,y is the pheromone amount present on path from node x to node y.

φx,y, represents the desirability of the path from node x to node y and is often the inverse of the distance between x and y i.e. lesser the distance (often Euclidean distance), greater is the path desirability as expressed in Eq. 5.

$$ \varphi_{x,y} = \frac{1}{{dist_{x,y} }} $$
(5)

Lastly, α is a constant representative of the importance given to a particular pheromone trail and β is a constant which represents the importance given to the vision/ant memory. To find the appropriate values for α and β, a sensitivity analysis is conducted for achieving optimum results.

Further, once the probability for each path is computed, the pheromone trails need to be updated after every iteration depending on the paths chosen by the traveling ants. These trails are updated by the ants that have updated their tour as per Eq. 6.

$$ \tau_{x,y} = \left( {1\, - \,\rho } \right).\tau_{x,y} + \sum\nolimits_{z = 1}^{i} {\Delta \tau_{x,y}^{z} } , $$
(6)

where i represents the number of ants in the colony, ρ is the evaporation rate of the pheromone and \( \Delta \tau_{x,y}^{z} \) is indicative of the amount of pheromone deposited by zth ant on the path from node x to node y (i.e. edge (x, y) in the flow network (Eq. 7).

$$ \Delta \tau_{x,y}^{z} = \left\{ {\begin{array}{*{20}c} {\frac{1}{{LenTour_{z} }}} & {if\,an\,ant\,z\,travels\,path\,x\,to\,y} \\ 0 & {otherwise} \\ \end{array} } \right\}, $$
(7)

where LenTourz is the length of the tour of ant z.

In the current sceanrio of online retail, the source will always be the warehouse and destinations would be the addresses on which the packages are to be delivered. The result of the above ACO engine gives the optimal path for routing which is used for location based inventory delivery. To achive optimal results, certain metrics in the ACO model need to be fixed for which a sensitivity analysis is conducted.

4 Sensitivity Analysis

For the purpose of finding out the optimal vehicle route the ACO is used which is able to find a sub-optimal path. As discussed in the mathematical model, the importance of visibility of pheromone trails can be controlled via Alpha (α), Beta (β) and Rho (ρ), these values need to be identified for optimal results. Further, the ACO engine runs for a particular number of iterations updating the paths in very iteration. The optimization is often directly proportional to the number of ant agents and number of iterations. However, the same needs to be identified and set. This section also explores various combinations of number of ant and number of iterations to achieve the most optimal routing path. Figure 2 represents the plots for all coefficients for sensitivity analysis.

Fig. 2.
figure 2

Sensitivity analysis of ACO engine coefficients

The current study uses ACO to solve the location based inventory routing problem for delivery of packages for an online retail firm. The study uses a sensitivity analysis to identify values for coefficients that result in the most optimal route for delivering the inventory. Table 2 summarizes the coefficients used in the ACO engine to generate the path.

Table 2. Coefficient values for ACO engine

The above variables are fed into the model for routing the vehicle from the warehouse to the destinations. Figure 3 illustrates the optimal path generated from the ACO engine in terms of longitude and latitude coordinates.

Fig. 3.
figure 3

Optimal routing vehicle path using ACO

The total number of locations are 346 and the total distance to be travelled is 690.29 km as identified through the sensitivity analysis.

5 Conclusion and Future Scope

Ant colony optimization is one of the possible solution of location based inventory routing problem. It is able to find the sub-optimal route in dynamic routing as compared to any static algorithm like Dijkstra, Prim’s or Kruskal. This study analyzes ordinal data find the Sub optimal path. The optimization increases as the number of ants and number of iterations increased. The ACO engine can be used in various machine learning applications including both supervised an unsupervised techniques and proves to be reusable in variety of applications. ACO has the ability to adapt to the situation at hand and take corrective action and thus it is well suited for solving problems in dynamic environments like online retail.

This study highlights how powerful ACO is and how the positive feedback system can be used as an optimization tool. ACO can also be used as a broader class of problems. The computation power required for application of the algorithm in case scenarios is quite high. Other possible applications of ACO could be an integration with neural network [34], immune network [35], evolution strategies [36], genetic algorithms [37], job scheduling and project scheduling among others.

We believe there is further scope of the optimization and further work can be done in area of improvement of ACO. The approach can be combined with other static algorithms for taking advantage of the benefits of both for dynamicity of the problems. For a multi-warehouse problem, a clustering algorithm can also be integrated to cluster the delivery locations keeping the warehouse as centroids and then using ACO for generating the routes and assigning suitable delivery agents.