#### Abstract

In the real world, the vehicle routing problem (VRP) is dynamic and variable, so dynamic vehicle routing problem (DVRP) has obtained more and more attentions among researchers. Meanwhile, due to actual constraints of service hours and service distances, logistics companies usually build multiple depots to serve a great number of dispersed customers. Thus, the research of dynamic multidepot vehicle routing problem (DMDVRP) is significant and essential. However, it has not attracted much attention. In this paper, firstly, a clustering approach based on the nearest distance is proposed to allocate all customers to the depots. Then a hybrid ant colony optimization (HACO) with mutation operation and local interchange is introduced to optimize vehicle routes. In addition, in order to deal with dynamic problem of DMDVRP quickly, a real-time addition and optimization approach is designed to handle the new customer requests. Finally, the* t*-test is applied to evaluate the proposed algorithm; meanwhile the relations between degrees of dynamism () and HACO are discussed minutely. Experimental results show that the HACO algorithm is feasible and efficient to solve DMDVRP.

#### 1. Introduction

In the history of VRP, the most original and famous routing problem is Traveling Salesman Problem (TSP) [1]. By transforming the TSP, a great number of different kinds of VRP are designed. Generally, VRP has been classified to the following several variants: Capacitated VRP (CVRP), VRP with time windows (VRPTW), VRP with Pickup and Delivery (VRPPD), multidepot VRP (MDVRP), and so on [2–6]. Most particularly, considering that many logistics companies are desirous to improve service quality and save time, the MDVRP receives more and more attentions.

In VRP models, most of the researchers usually define some basic information concerning customers’ locations and demands, available vehicles, etc., which are entirely known before carrying out service. However, VRP is dynamic in most of the actual situations; in other words, the arrangements of customers are changing gradually over time, although a part of customer requests may be known in advance. In recent years, due to the development of new technologies, such as Global Position System, Communication Technology, Information Technology, some researchers have studied DVRP. However, few researchers focus on DVRP with multiple depots, so this paper will study dynamic multidepot vehicle routing problem (DMDVRP) [7].

Comparatively, the number of research projects on the DMDVRP is fewer. T. C. Su introduced a dynamic vehicle control and scheduling of a multidepot physical distribution system in 1999 [8]. For solving dynamic multidepot pickup and delivery problem, T. Huth and D. C. Mattfeld proposed a framework to anticipate dynamic events by model adaptation in 2006 [9]. In 2008, A. Hadjar and F. Soumis introduced multidepot vehicle scheduling problem with time windows, which is a dynamic window reduction. Y. Kuo and C. C. Wang proposed an insertion heuristic to solve dynamic multidepot vehicle routing problem where the pick-up and delivery requests are both considered in 2014 [10]. Liu Y et al. proposed a method with three steps to solve the multiperiod and multidepot dynamic vehicle routing problem with time windows in 2016 [7].

In general, DMDVRP is a NP-hard problem [11], so some exact algorithms (branch and bound algorithm, linear programming, cutting plane algorithm, etc.) are almost impossible to solve it in finite time. However, modern heuristic algorithms, such as ant colony optimization (ACO) [12, 13], genetic algorithm (GA) [14–16], and particle swarm optimization (PSO) [17], have the ability to generate high quality solutions, although they may not search the best solution. In these approaches, ACO is widely applied to solve different types of VRP.

The original ACO was put forward by Dorigo in his Ph.D. Thesis [18], which is called ant system. However, it is nonconvergent and easy to fall into local optimization. To improve its weaknesses, many researchers have formed several variants of the ant system, such as the ant colony system, the elite ant system, and the largest ant system [19]. In addition, some new mechanisms are proposed to optimize the algorithm, such as enlarging the degree of random search [13], N-Opt local random search, and designing distributed control [20]. For DMDVRP, the objective of the algorithm is not only to search the optimal solution, but also to track the optimal solution through the information of the previous search space over time. Based on this consideration, a hybrid ACO is proposed to solve DMDVRP.

There are two main contributions in this paper. The first contribution of this paper is to use hybrid ACO algorithm to solve DMDVRP, and the method strives to improve the randomization and avoids falling into local search prematurely. In order to improve ACO, the following modifications of ACO are implemented:(1)Dividing region by the nearest distance cluster(2)Optimizing vehicle routes with mutation operation(3)Improving the solutions with local interchange operation

Hybrid ACO has shown its advantages through a large number of comparative experiments based on data sets of different scales.

The second contribution is that a real-time addition and optimization approach is designed to add new real-time customers to known routes and immediately optimize vehicle routes. The process of dynamic optimization can be accelerated.

The remainder of this paper is organized as follows. In Section 2, we describe DMDVRP model and define the problem. In Section 3, the details of hybrid ACO are shown. A real-time addition and optimization approach is introduced in Section 4. Experimental results are discussed in Section 5. Some conclusions are provided in Section 6.

#### 2. Dynamic Multidepot Vehicle Routing Problem

##### 2.1. The Description of DMDVRP

In the real world, MDVRP is affected by the dynamic environment. With the wide application of information technology and Global Positioning System (GPS) technology, the process of logistics service can be tracked and adjusted in real time. Due to the development of these new technologies, the service mode of plan-execute is replaced by the dynamic execution task [21].

Generally speaking, the dynamic nature of DMVRP mainly reflects the uncertainty of customer requests in the service process. Specifically, the type of request includes the uncertain quantity of goods [21–23] and the uncertain service time [24, 25]. This paper focuses on the change of service time and processing orders dynamically according to customer request time. A DMDVRP example is shown in Figure 1. In Figure 1(a), three different depots (red square) are responsible to serve the customers (black dots) which are allocated to them, and black and red lines represent initial routes. In Figure 1(b), some new customers (blue triangle) are added to system, and some new routes will be generated in time.

**(a) Initial routes**

**(b) Dynamic routes**

##### 2.2. The Formulation of DMDVRP

The DMDVRP can be formalized as follows. An undirected graph is established to describe mathematical model. In this model, represents the vertex set and is the edge set. is the set of customers and is the set of depots. In* E*, we get distance matrix by calculating the Euclidean distance of customers and . Every customer has a demand and needs to be visited once by only one vehicle. There is also a fleet of* K* identical vehicles, each with capacity* Q*.

In the mathematical formulation that follows, binary variable is equal to 1 when vehicle* k* visits node* j* immediately after node* i*.

subject toThe objective (1) minimizes the total cost. Constraints (2) and (3) guarantee that each customer is served by exactly one vehicle. Vehicle capacity constraint is found in (4). Finally, constraints (5) and (6) check vehicle availability.

##### 2.3. Measuring Dynamism

In most papers, three popular metrics of* degree of dynamism* [16],* effective degree of dynamism*, and* effective degree of dynamism with TW* [22] are introduced to describe dynamism concretely. In this paper, the metric of* degree of dynamism* () is selected to characterize the dynamical degree of DMDVRP, and the following is the calculation formula of* dod*. The range of* dod* is from 0 to 1 [16].

#### 3. A Hybrid Ant Colony Algorithm for DMDVRP

##### 3.1. Hybrid Ant Colony Optimization

By reviewing previous algorithms about solving VRP, we find that ant colony algorithm (ACO) is a common and effective algorithm. In this paper, the ant colony algorithm is improved by the nearest distance clustering, mutation operation, and 2-Opt algorithm to obtain better solutions. The flowchart of hybrid ant colony optimization (HACO) for the DMDVRP is shown in Figure 2. The details of HACO will be introduced in the following sections.

##### 3.2. The Nearest Distance Cluster Algorithm

Generally, in order to serve customers preferably, the depots are usually placed at the locations which are as close to customers as possible. Therefore, the nearest distance cluster algorithm is proposed to exactly allocate each customer to its nearest depot. By the nearest distance cluster algorithm, a whole DMDVRP is divided into several little DVRPs; meanwhile the whole service area is divided into a set of little regions. An example of the nearest distance cluster algorithm is in Figure 3; as shown, the black triangles are depots, and the different color points represent that customers are allocated to the nearest depot.

##### 3.3. Generate Initial Solutions

In ACO, each ant represents a vehicle and visits all customers once. The complete routes that ants have passed are initial solutions. The ants will decide to select the next customer by formula (8).

In formula (8), is the probability of selecting* j* as the next customer of* i*. and are the pheromone density of edge (*i, j*) and the relative influence of the pheromone trails, respectively. and are the visibility of edge (*i, j*) and the relative influence of the visibility values, respectively. is a list, which stores the unvisited nodes for the ant [12].

##### 3.4. Optimization Operation

###### 3.4.1. Mutation Operation

Mutation operation is derived from genetic algorithms (GA) primitively [23, 24], but it can be applied to fusing other optimization algorithms. For example, the optimization operation can help ACO get further solutions in the period of searching. The most important step of mutation operation is to randomly select a solution and exchange customers by mutation probability . Therefore, the operational process may produce new solutions and increase the likelihood of searching a better solution.

Generally, has influence on the performance in the mutation. If is so small it is not easy to produce the new individual. If is so large the algorithm becomes a purely random search algorithm. Therefore, the adaptive method is applied to change the mutation probability with the fitness. At the same time, considering the mutation coefficient* k*, it can also affect the performance of mutation. and* k* can be determined according to the following formulas.where is the largest fitness value, is average in groups, and is the fit value for mutation. , , , and are initial variables [25].

In most GA, considering that biological gene mutation is a small probability event, the mutation rate is less than 0.1. However, in view of the aim of exploring greater search space, a mutation operation with a larger mutation rate is introduced to optimize route. Figure 4 is a demo of mutation operation process. The red line route and the black line route are serviced by two different vehicles. By exchanging 4 and 6, two new routes (1-3-2-6-1 and 1-4-5-1) are generated and have more appropriate arrangements.

###### 3.4.2. Local Interchange Operation

In all local optimization algorithms, 2-Opt is a common and classical heuristic proposed by Croes [26] in 1958. The main idea is to try to choose a route and exchange two adjacent locations and calculate the results of new route. This operation may avoid local optimization and obtain a better route.

In this paper, the 2-Opt optimization is applied to improve the route. First, swapping the locations of all possible adjacent customers generates some new potential routes. Then we test each new route to see if this pair of exchanges can improve the quality of the route [27]. Finally, the best route will be selected to replace previous old route. Figure 5 is a demo of 2-Opt operation: (a) is the original route and (b) is the new route of implementing the operation of exchanging 2 and 7.

**(a) Route before 2-Opt**

**(b) Route after 2-Opt**

##### 3.5. Update of Pheromone Information

In ACO, the most important step is the update of ant pheromones, which is key to obtain high quality solution. In order to ensure that each link has the same advantages, the following formula will be implemented to update pheromones:

In formula (11), and are the new and initial pheromone concentration of link , respectively, is a constant and regulates the rate of evaporation, is the number of all routes, is the number of the routes in specific solution, and is the increased pheromone of link in route .

#### 4. A Real-Time Addition and Optimization Approach

In this section, a new real-time addition and optimization approach is applied to dynamically add new customer to known routes; meanwhile it can optimize the new generated route. The procedure of this approach is shown in Figure 6.

##### 4.1. The Strategy of Adding New Customers to Known Routes

In the strategy of adding new customers to known routes, a working day is split into 24 same length time slices, and the customer requests are occurring in each time slice. The distances between each new customer and the serving customers or just finished serving customers are computed and compared, and the new customer will be added to the route which is the nearest to the new customer. If the new customer demands exceed the vehicle capacity, they will be handled by arranging another vehicle, and an extra route will be formed.

An example of this strategy is shown in Figure 7; as shown, some customers (black dots) have been known in advance. Red lines and black lines represent initial designed routes to serve known customers. As time goes on, new customers (blue triangle N1, N2, N3) are added to system, and the distances between N1 and the serving or just finished serving customers (black dots 3, 5, 8) will be computed, respectively; then new customer (N1) is added to the nearest route (0-7-8-N1-9-0). Similarly, the new customers (N2, N3) are added to routes (0-1-2-3-N2-0, 0-4-5-N3-6-0), respectively. Although the new generated routes are not the best, the optimized operations will be conducted in the next section.

##### 4.2. Reoptimize Routes Dynamically

Due to adding some new customers to initial routes, the routes need to be reoptimized dynamically. Each new route is divided into two subroutes, and the first subroute which has been served remains unchanged; meanwhile, the remaining part is optimized by mutation and 2-Opt in Section 3.4.

#### 5. Experimental Results and Discussions

In this section, the performance of HACO algorithm solving for DMVVRP is evaluated strictly and completely. Through a series of experiments based on different data sets, the HACO will be analyzed by solution quality, running time, degrees of dynamism, and so on. The data sets are completely open and can be available at http://neo.lcc.uma.es/vrp/vrp-instances/multiple-depot-vrp-instances/. The detailed information of data sets is shown in Table 1. In this table, the numbers of depots, the numbers of customers, and the capacity are explained.

Table 2 shows that the parameters are used in HACO. The number of ants is 30; weight of pheromone is 2; weight of visibility is 1; evaporation rate of pheromone is 0.8; initial mutation rate is 0.8; number of iterations is 100. The algorithm implementation is based on the MATLAB (2010b) language, and the computer configuration is an Intel(R) Core (TM) i5-6500 3.19 GHz, 8 GB RAM running Windows 10(x64). All the results are averaged over 10 runs.

##### 5.1. Comparisons Based on Four Different ACO

The comparisons of the solution quality in terms of the route length and running time among four proposed ACO algorithms are implemented in this section, and the four algorithms are ACO, MACO, LACO, and HACO, respectively. The ACO is from Montemanni et al. [28]; MACO and LACO are basic ACO fusing mutation operation and 2-Opt, respectively; modifying ACO with mutation operation and 2-Opt forms the final HACO. In addition, the scale of experimental data sets is between 80 and 288, and the degree of dynamism is 0.3. Table 3 gives the route length and running time of four algorithms. In this paper, the best solutions are in bold entries. From the comparisons, MACO, LACO, and HACO are 3.25%, 0.73%, and 10.9% less than the ACO, respectively. The results indicate that the mutation operation and 2-Opt can improve ACO effectively, and HACO is effective algorithm for solving DMDVRP.

This result may be attributed to the fact that the introduction of 2-Opt algorithm and mutation operation can improve the randomization and avoid falling into local search prematurely, and make HACO obtain better solutions.

In addition, a paired* t*-test is performed to investigate whether there are statistically significant differences between HACO and other improved ACO algorithms. Since it is expected that the solution quality of HACO is better than other ACO, a one-sided alternative hypothesisis given below:where and are population mean for HACO and CA, respectively. CA refers to algorithm, which is compared with HACO. For example, if HACO is compared with MACO, the CA will refer to MACO.

Table 4 shows pairs, mean differences for instances, and* p* value at statistical level of . The mean differences of HACO* vs *ACO, MACO, and LACO are -370.11, -260.37, and -345.44 with* p* value of 0.083, 0.077, and 0.041, respectively. This indicates that HACO is statistically significantly different from other ACO; meanwhile HACO fusing mutation and 2-Opt can explore more possibilities and search better solutions.

##### 5.2. Comparisons Based on Different Degrees of Dynamism

In order to investigate the relation of degrees of dynamism () and HACO, the experiment based on different (0.3, 0.5, 0.7) is performed in this section. Table 5 gives the detailed routes length and running time of comparisons. In addition, we count the average value, number, and proportion of different in terms of the routes length and running time. When are 0.3, 0.5, and 0.7, the proportions of the best length are 78.95%, 5.26%, and 15.79%, respectively, and the proportions of the best time are 15.79%, 52.63%, and 31.58%, respectively. By the statistical data, the results reveal that is directly proportional to routes length. However, the running time of (0.5 and 0.7) is less than that of (0.3). This illustrates that the proposed real-time addition and optimization approach can reduce algorithm running time, along with the increase of .

##### 5.3. The Analyses of Real-Time Addition and Optimization Approach

In Table 6, the analyses of real-time addition and optimization approach are conducted, and the results are based on (0.3) in this section. In this table, the second, fourth, and fifth columns are the results of static routes length, additional extra routes length, and dynamic routes length, respectively; the third and sixth columns are static and dynamic running time; the seventh and eighth columns are the whole length and running time.

From the analyses of results based on average value, the average dynamic routes length is 2618.7, and it is 23.64% more than the average static routes length. Meanwhile, the average dynamic running time is 24.9 seconds, and it just accounts for 11.20% of the whole running time. These results reveal that the real-time addition and optimization approach can solve the DMDVRP efficiently. The strategy of adding new customers to the nearest known routes is feasible and efficient to solve dynamic problem.

##### 5.4. Comparisons Based on Other Two Algorithms

In order to better evaluate the performance of the proposed HACO in terms of solution quality in minimizing travel distance, HACO is compared with previously published algorithms. These algorithms are Wang et al.’s [29] genetic algorithm (GA) and Yao et al.’s [30] particle swarm optimization (PSO), respectively.

Table 7 gives the best solution length and running time of this comparison and counts the number and proportion of the best length of each algorithm. From Table 6, the proposed HACO based on DMDVRP finds 12 new best solutions in the 19 problems, accounting for 63.16% of the best, while GA and PSO reach 4 and 3 best possible solutions, accounting for 21.05% and 15.79%, respectively. The results indicate that the HACO is effective algorithm for solving DMDVRP.

#### 6. Conclusions

In the past few decades, few researchers focused on dynamic multidepot vehicle routing problem (DMDVRP). However, DMDVRP has wide application scenarios, so we have a research on DMDVRP. In order to improve the efficiency of ACO, we proposed a hybrid ant colony optimization algorithm (HACO) to solve DMDVRP. The HACO is based on fusion of ACO and the nearest distance cluster, meanwhile using mutation and 2-Opt to optimize routes further. In addition, a real-time addition and optimization approach is proposed to add customers and optimize routes dynamically.

In the experiments, the ACO, MACO, LACO, and HACO are compared directly. In order to demonstrate the efficiency of proposed algorithm, the* t*-test is applied to perform statistical analysis. But beyond that, the relations of HACO and degree of dynamism () are analyzed by a number of tests based on different . With the aim of testing the performance of real-time addition and optimization approach, the comparisons of static routes quality and dynamic routes quality are conducted. Experimental results show that the HACO algorithm is feasible and efficient to solve DMDVRP.

#### Data Availability

The initial data used to support the findings of this study have been deposited in the NEO repository (http://neo.lcc.uma.es/vrp/vrp-instances/). The data sets are valid and can be accessed.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported by Chinese National Natural Science Foundation (61572165) and Public Projects of Zhejiang Province (LGF18F030006).