Grey Wolf Optimizer algorithm for solving the multi depot vehicle routing problem and its implementation

Multi Depot Vehicle Routing Problem (MDVRP) is one of Vehicle Routing Problem (VRP) variants. MDVRP is a VRP that uses more than one depot for the distribution process. In this paper, the MDVRP will be solved using the Grey Wolf Optimizer (GWO). This algorithm is inspired by hunting technique and hierarchy of grey wolves. The completion of MDVRP consists of two stages, they are grouping and routing. In the grouping stage, customers are grouped to nearest depot. In the routing stage, the route is determined at each depot using “route-first, cluster-second”. In the route-first phase a giant tour is formed by forming population array. In the cluster-second phase, a split will be conducted on the giant tour, so that a number of routes are formed with the total demand for each route does not exceed the vehicle capacity. The implementation of GWO algorithm for MDVRP was designed in Borland Delphi 7.0 programming language. The algorithm was tested using 2 depots and 9 customers formed 2 routes at each depot with a total distance of 833 km. Another test was carried out by comparing the GWO with the ACO using the Cordeau dataset. GWO gives the best result (shortest distance) than ACO.


Introduction
Distribution is an activity of sending goods to consumers. The length of the distribution route affects the total distribution cost, where the shorter the route, the smaller the costs incurred, and vice versa. Hence it needs the right design to optimize the distribution process. One application of graph theory that can be used in solving optimization problems is the Vehicle Routing Problem (VRP). The VRP problem is the search for the optimal vehicle route provided that it starts and ends at the same location [3]. VRP problems are developed into various variants, one of them is the Multi Depot Vehicle Routing Problem (MDVRP). According to [13] MDVRP is an expansion of the VRP problem, that determines routes to serve a group of customers from several depots, and each route starts and ends at the same depot without violating vehicle capacity constraints. Basically, it is set of multiple VRP (or CVRP, exactly).
MDVRP is a VRP problem with more than one depot, namely the depot ∈ {0, 1, … , }. The objective of MDVRP is to find a minimum number of routes for each depot with vehicles departing and returning to the same depot. Each customer ∈ { + 1, + 2, … , + } is served exactly once by a vehicle, where is the last depot and represents the number of customers. Total customer demands on each route must not exceed the vehicle capacity, with each vehicle is assumed having the same capacity. According to [13] MDVRP completion consists of two stages: grouping and routing. At the grouping stage, customers are grouped into the depot with the closest distance. Hence from the grouping stage solution, the MDVRP problem will become a VRP problem for each depot. In [8], a "route-first, cluster-second" strategy was developed in solving VRP problems. In the route-first phase, a giant tour will be formed, while in the cluster-second phase there will be a split on the giant tour by taking into account capacity constraints and customer demand.
One of the methods used in solving MDVRP problems is metaheuristic. One of the metaheuristic algorithms that has been used in solving MDVRP problems is the Greedy Randomized Adaptive Search Procedure (GRASP) [10]. This algorithm forms an initial solution by randomly selecting customers based on the Restricted Candidate List (RCL). The GRASP algorithm has been reviewed by [14] in finding a solution to the MDVRP problem by combining the Variable Neighborhood Descent (VND) algorithm. In addition, the Ant Colony Optimization (ACO) algorithm has also been applied in the search for solutions to the MDVRP problem studied by [2].
Another algorithm which is one of the metaheuristic methods is the Grey Wolf Optimizer (GWO) algorithm. The first GWO algorithm introduced by [7]. This algorithm is inspired by the hunting method and the gray wolf hierarchy. There are four stages of behavior of the gray wolf in hunting, namely chasing, surrounding prey, hunting and attacking prey. At the chasing stage, this algorithm states that α wolf to be the best solution, β wolf as the second-best solution, and δ wolf as the third best solution. At the stage of circling the prey, the gray wolf limits the prey by calculating the distance between the prey. Furthermore, the hunting stage is led by α wolves, while β and δ wolves contribute to helping α. In the last stage, the gray wolf will attack the prey, which means a solution has been found. The GWO algorithm has been applied in solving optimization problems, such as the Traveling Salesman Problem (TSP) by [11]. Shaheen et al. explained that the GWO algorithm solves TSP problems with good quality solutions and computational processes, because the search for solutions is done by forming possible solutions globally. The GWO algorithm is also used in solving the Capacitated Vehicle Routing Problem (CVRP) which has been studied by [5].
In addition to optimization problems, the GWO algorithm has also been applied to other problems, including the parameter estimation of surface waves [12]. According to Song et al. the application of the GWO algorithm can show a good balance and very fast convergence. They also explained that the GWO algorithm is an algorithm that is simple, flexible, and easy to implement. The GWO algorithm was also reviewed in [15] about economic delivery, presented that GWO provides very competitive results in terms of reducing transmission losses and minimizing total fuel costs. In other area, [4] implemented GWO for feature selection problem, for choosing the correct dataset in a certain situation, and in [9] that explained about forecasting of university students' weaknesses using neural network.
Based on the description above, this paper introduces the GWO algorithm in solving MDVRP problems and implementing the program. The implementation of the GWO algorithm for MDVRP is designed in the Borland Delphi 7.0 programming language. The program will be tested using the Cordeau dataset. The solution obtained will be compared with the ACO algorithm to see the performance of the GWO algorithm in solving MDVRP problems, where both algorithms are metaheuristic algorithms.

Research Method
This paper applies the GWO algorithm for MDVRP problem and is implemented in a computer program designed using the Borland Delphi 7.0 programming language running on a computer with an AMD A9-9425 Radeon R5 processor, with 4.00 GB RAM, and operating system Microsoft Windows 10. To test its performance used 4 datasets. The dataset is available from https://neo.lcc.uma.es/vrp/vrpinstances/multiple-depot-vrp-instances/. The properties of each data set used are presented in Table 1. To see the quality of the resulting solution, it will be compared with other metaheuristic algorithms, namely Ant Colony Optimization (ACO) algorithm, which has been studied by Demirel.

Description of Proposed GWO Algorithm for MDVRP
The solution to MDVRP problems using the GWO algorithm consists of 3 stages. The first stage is grouping. At the grouping stage, each customer is grouped into the depot with the closest distance. The second stage is the formation of a giant tour. In the formation of the giant tour, it is done by forming population arrays. The population array is formed by entering the depot (prey) point as the initial population array. Next, choose 3 customer points (gray wolves) at random and input them into the initial population array. Then find , , and in each population ( , , are the first, second, and third closest customer points from the last point in the population, respectively). Update the population by adding , , and to the population array. If all customer points are loaded in the population arrays, add depot points to each population array and calculate the cost of each population array.
GWO uses the same principle a "route-first, cluster-second" strategy as proposed in [8]. The solution at the stage of forming a giant tour is the population array with the smallest cost. The last stage is routing. At the routing stage, a split is carried out on the giant tour that has been formed, so that a number of routes will be formed where the total demand on each route does not exceed the vehicle capacity. Figure  1 is a flow chart for MDVRP completion using the GWO algorithm. The steps of the GWO algorithm in solving MDVRP problems are as follows.
Step 1: grouping Group customers to the nearest depot. The grouping process is done based on the calculation of and which is the distance between the th customer with the -depot or the -depot. initial population. For example, chosen points , ,and . After that, the population will be updated based on the three points that have been selected and two populations will be created. The total will be three populations as: Population [0] is the updated population, while population [1] and population [2] are the new population. In this case, Population [0] = [ , ] means that the population array 0 forms a tour from depot to customer . Likewise for population [1] and population [2]. Then calculate the total distance (cost) of each population.

• Iteration stage
Find , , and in each population ( , , are the first, second, and third closest points of the last point in the population, respectively). Update population, i.e.
Calculate the cost in each population array that has been formed. This process is carried out if the number of population (stored in array as array elements) does not exceed the population size. If the number of the population is more than population size, delete the population array that has the largest cost. How many elements are deleted depends on the population size (until the population array does not exceed the population size). The process is carried out until each population array contains all customers.
• Final stage Add a depot point to each population array. Calculate cost for all population arrays. Output: population array with the smallest cost. .
≤ ( is vehicle capacity) and −1 + < , then = −1 + = − 1 ( is the minimum cost of the paths connecting the depot to the th customer. The role of is to store the predecessor of node on the shortest path leading to ). d. Set = + 1 e. Back to step a • If > or > , then set = + 1.

Depot 1
The routing phase for depot 1 is the same as routing for depot 0 with = 5, = 70 and 1 = 7, 2 = 8, 3 = 6, 4 = 5 and 5 = 10. So that the routing stage solution obtained for depot 1 is as follows. Route 1: 1 − 7 − 8 − 1 a distance of 223 km Route 2: 1 − 6 − 5 − 10 − 1 a distance of 272 km The total distance traveled for each route in serving all customers in depot 1 is 495 km. So, the total distance traveled by depot 0 and depot 1 on the MDVRP using the GWO algorithm is 833 km.

Implementation of MDVRP-GWO
The implementation of the GWO algorithm in solving MDVRP problems is designed in the Borland Delphi 7.0 programming language. Figure 2 presents the pseudo-code for proposed MDVRP-GWO algorithm.     The MDVRP-GWO application is designed in Indonesian. Therefore, the following is a description of the MDVRP-GWO application in English.
• 'Input Titik' means input point. At the input point, there is 'Pilih Titik' which means selecting the point to be inputted, namely the point of the depot and the point of the customer. • In 'Input Data' there is 'Kapasitas Kendaraan', 'Iterasi', 'Permintaan Customer', and 'Tabel Jarak', which means vehicle capacity, iteration, customer demand, and distance table (the distance between the depot to the customer and the distance between the customer), respectively. In 'Input Data' there are also 5 buttons with different uses. 'Hasil' to start the search for a solution, 'Simpan' to save the data, 'Buka' to reopen the saved data, 'Baru' to start the program from scratch, and 'Keluar' to stop the program. • 'Hasil' means the solution obtained.
• 'Graph Hasil' is to display the route image formed from each depot point obtained from the search results for the program solution.
To test performance of the GWO algorithm, some datasets from [15] are used. For each dataset, the application is executed 10 times, and it is tested using 5, 10, 50, 100 dan 500 iterations, respectively. From the testing, number of iterations affects the result, as depicted in Figure 7. The best result (the shortest distance) of the testing comes from 500 iterations. It is expected that better result would be get if the more iterations are performed, since trends of the graphic declines as number of iterations arises. Another factor is generation of the initial population in GWO is in random order, hence the selected starting vertex is not necessarily the vertex that give the best solution. Thus, if the iteration used is greater, the more combination of solutions will be formed, so that the resulting solution will be better.
The solution of 500 iterations then compared to result of Demirel that used Ant Colony Optimization (ACO) with 2000 iterations on 10 time testing and using parameter = 45, = 1, = 1, = 0,10, 0 = 0,08 [6], which is the ACO algorithm is also a metaheuristic algorithm. Comparisons are made to see the best solution obtained from the two algorithms in solving MDVRP problems. Table 3  5703,20 4213,17 From the comparison in the table, GWO gives better result that ACO on all datasets. However, more tests should be held to compare GWO with other algorithm, where the total distance on all datasets using the GWO algorithm is shorter than ACO. More improvement of GWO itself will give better result, such as implements improvement algorithm and combine with other algorithm as a new hybrid algorithm.

Conclusion
This paper introduces the GWO algorithm for solving MDVRP. There are three stages at the completion of the MDVRP, namely grouping, forming a giant tour, and routing. At the grouping stage, customers are grouped into the depot with the nearest distance. In the next stage, each customer group at each depot that has been formed will be formed a giant tour by forming a population array. The optimal condition at the stage of forming a giant tour is when a population array has been formed which contains all the customers and ends with a depot point. The solution for this stage is the population array with the smallest cost. At the routing stage, a split on the giant tour is carried out by paying attention to vehicle capacity and customer demands. So that a number of routes will be formed at each depot, with the total demand on each route not exceeding the vehicle capacity. MDVRP-GWO application was test on different size of datasets. The test results show that the GWO algorithm provides a better solution with a shorter total distance when compared to the ACO algorithm on all datasets. In the ACO algorithm, the solution is determined by the parameter ( , , , , 0 ) values used. If the selected parameter value is not correct, the resulting solution is also not optimal.
For future work, the GWO can be improved to better performancee by implements improvement algorithm and combine with other algorithm as a new hybrid algorithm. Also, a comparison between GWO algorithm and other metaheuristics algorithm which are used to solve the MDVRP could be investigated.