Keywords

1 Introduction

As an essential part of the last-mile distribution in the logistics chain, urban distribution plays a significant role in the entire supply chain. With the increasing prominence of urban governance problems, the role of urban distribution has become more prominent. Urban distribution is an important part of the Vehicle Routing Problem (VRP). Since Solomon and Desrosiers [1] put forward the concept of the time window in VRP, there is increasing research on Vehicle Routing Problem With Time Windows (VRPTW). Furthermore, Jabali [2] proposed the concepts of the soft time window and hard time window, and introduced the penalty function into the objective function to solve the VRPTW, thus giving birth to considerable research on urban distribution [3,4,5,6,7]. At the present stage, with the acceleration of the urban process, the road traffic conditions are becoming more and more complex, which puts forward higher requirements for urban distribution. The traditional path planning represented by Euclidean distance can no longer meet the current distribution demand. At this stage, urban distribution needs to consider the impact of road conditions and develop a more efficient algorithm to solve the problem of urban distribution better in reality.

In recent years, there has been more research on real-time road conditions. Some scholars consider the dynamics of travel time through the system’s design to receive real-time road network information in the distribution process, automatically adjust the distribution route and upload it to the distribution driver [8]. Thanks to the development of big data collection technology, obtaining historical road condition data is no longer challenging. We can collect real-time road condition information in the process of a vehicle driving through the electronic map platform [9]. By collecting road condition data in a specific time range, the designed algorithm is used to predict the driving speed of each road section [10] to realize the route change. As the problem becomes more and more complex, some scholars choose to design a more efficient algorithm [11] through reasonable planning of the departure time of each car to avoid congested roads [12] effectively.

In this paper, we use crawler technology to obtain the real travel time through Amap API and choose a hybrid algorithm (BSO-LNS) that combines brainstorming optimization algorithm (BSO) and large neighborhood search algorithm (LNS) to solve this kind of distribution optimization problem. The large neighborhood search algorithm is an excellent local search algorithm, which is proposed by Shaw [13] and is often used to solve VRPTW. Although the brainstorming algorithm is relatively young, it has received widespread attention since it was proposed by Shi [14] in 2011, and it has also been used to solve the VRPTW in recent years. However, few papers use BSO alone to solve VRPTW [15, 16], and more often, they are hybrids with other algorithms [17,18,19,20], all achieving better results than BSO algorithm.

The next section of this paper is organized as follows. Section 2 focuses on the basic process of combining the BSO and the LNS algorithm, Sect. 3 develops a VRPTW model to find the shortest total time spent, Sect. 4 gives the comparison results of the experiments, and the last section is used to conclude and look ahead.

2 BSO-LNS for VRPTW

2.1 Problem Description

Based on real-time road conditions, the urban distribution problem can be described as follows: a department store distribution center located in an urban area needs to deliver goods to several supermarkets in the surrounding area, and the geographic location information of the distribution point can be obtained from Amap, the number of goods required to be delivered by each supermarket on that day is prepared by the distribution center at least one day in advance, and the vehicles loaded with their respective responsibilities for the distribution of supermarkets set off from the distribution center toward the planned route, when arriving before the left time window of supermarkets, they need to wait until the service start time to unload the goods, and if they exceed the right time window, they will be penalized in the target function. At the same time, under the influence of considering the actual road conditions, the constant speed of each vehicle and the distance between the two is no longer assumed here to be counted as the Euclidean distance, still, the passage time and distance between the two are obtained in real-time through Amap, the corresponding passage time and distance matrix is obtained, aiming for the optimized delivery solution with the least total driving time to be closer to the actual delivery scenario under the urban congestion environment. In addition, the following assumptions are made for the problem to be solved.

  1. (1)

    Each vehicle serves only one route, each node can only be served once by one vehicle, the vehicle type is the same and the load capacity is known, the total number of vehicles, the maximum mileage is not limited.

  2. (2)

    The vehicle departs from the distribution center and finally returns to the distribution center within the time window.

2.2 Model Building

The VRPTW model considering the road conditions is constructed as follows:

$$\begin{aligned} \begin{array}{ll} \min Z = \sum \limits _{k = 1}^K {\sum \limits _{i = 0}^n {\sum \limits _{j = 0}^n {{x_{ijk}}{t_{ij}}} } } &{}+ \alpha \cdot \sum \limits _{k = 1}^K {\max [ (\sum \limits _{i = 0}^n {\sum \limits _{j = 0}^n {{x_{ijk}}} - G) ,0} ]} \\ &{}+ \beta \cdot \sum \limits _{i = 1}^n {\max [({l_{ik}} - {b_i}),0]} \end{array} \end{aligned}$$
(1)
$$\begin{aligned} \sum \limits _{k = 1}^K {\sum \limits _{i = 0}^n {{x_{ijk}} = 1;\mathrm{{ }}\forall } } j \in N \end{aligned}$$
(2)
$$\begin{aligned} \sum \limits _{i = 0}^n {{x_{0ik}}} = 1;\mathrm{{ }}\forall \mathrm{{k}} \in \mathrm{{K}} \end{aligned}$$
(3)
$$\begin{aligned} \sum \limits _{i = 0}^n {{x_{ijk}}} - \sum \limits _{i = 0}^n {{x_{ijk}}} = 0;\mathrm{{ }}\forall j \in n,k \in K \end{aligned}$$
(4)
$$\begin{aligned} \sum \limits _{i = 0}^n {{x_{i0k}}} = 1;\mathrm{{ }}\forall \mathrm{{k}} \in \mathrm{{K}} \end{aligned}$$
(5)
$$\begin{aligned} {a_0} \le {u_{0k}} \le {b_0};\mathrm{{ }}\forall k \in K \end{aligned}$$
(6)
$$\begin{aligned} {x_{ijk}} = 0\mathrm{{ }}or\mathrm{{ }}1\mathrm{{ }}i,j = 0,1,...n;\forall k \in K \end{aligned}$$
(7)

The variables used in the model are shown in Table 1.

Table 1. Variable description.

In the model, (1) is the objective function, which indicates the minimum total vehicle travel time and penalty cost for late arrival and overloading [17]; the constraint (2) indicates that each customer point can only be distributed by one vehicle; constraint (3) (4) (5) indicates that the input and output of distribution vehicles must satisfy the flow balance constraints; constraint (6) indicates that each vehicle starts from the distribution center and returns to the distribution center within the time window of the distribution center after completing the distribution; constraint (7) denotes the corresponding 0–1 constraint.

2.3 Coding Analysis

In this paper, integer coding is used for distribution schemes to code individuals. To indicate simplicity, if there are now nine supermarkets to be delivered and there are at most three vans available in the distribution center at present, the individual codable schemes can be roughly divided into three cases according to the number of vehicles used.

  1. (1)

    If three vehicles are dispatched to perform distribution tasks at the same time, one possible way for an individual to behave is as Fig. 1. Where numbers 1–9 denote supermarkets to be delivered, 10 and 11 denote distribution centers. Then, from Fig. 1, it can be seen that distribution centers 10 and 11 divide all individuals into 3 distribution routes and the distribution scheme can be expressed as follows, where 0 denotes the distribution center.

    Distribution route 1: \(\displaystyle 0\rightarrow 1\rightarrow 3\rightarrow 5\rightarrow 6\rightarrow 0\)

    Distribution route 2: \(\displaystyle 0\rightarrow 2\rightarrow 7\rightarrow 9\rightarrow 0\)

    Distribution route 3: \(\displaystyle 0\rightarrow 4\rightarrow 8\rightarrow 0\)

  2. (2)

    If only two vehicles are assigned to the distribution task, one possible representation of the individual is as Fig. 2 Then, as can be seen from the Fig. 2, the distribution scheme is expressed as follows.

    Distribution route 1: \(\displaystyle 0\rightarrow 1\rightarrow 3\rightarrow 5\rightarrow 6\rightarrow 0\)

    Distribution route 2: \(\displaystyle 0\rightarrow 2\rightarrow 7\rightarrow 9\rightarrow 8\rightarrow 4\rightarrow 0\)

  3. (3)

    If only 1 vehicle is assigned to the distribution task, one possible way for an individual to behave is as Fig. 3 Then, as can be seen from the Fig. 3, the distribution scheme is as follows.

    Distribution route: \(\displaystyle 0\rightarrow 3\rightarrow 5\rightarrow 6\rightarrow 1\rightarrow 2\rightarrow 7\rightarrow 9\rightarrow 8\rightarrow 4\rightarrow 0\)

Fig. 1.
figure 1

One of situation with three vehicles.

Fig. 2.
figure 2

One of situation with two vehicles.

Fig. 3.
figure 3

One of situation with one vehicle.

From the above coding method, it can be seen that if the number of supermarkets to be delivered is N and the distribution center can arrange at most K vehicles for delivery, then the individual coding can be expressed as a permutation of \(\displaystyle N + K - 1\) numbers. Next, a population consisting of individuals according to the above encoding can be randomly generated. The fitness function chosen for this algorithm is the reciprocal of the objective function value.

3 Brain Storm Optimization with Large Neighborhood Search

3.1 Brain Storm Optimization

Inspired by the brainstorming session, an act of human brainstorming and bursting with creative inspiration, the brainstorming optimization algorithm was first proposed by shi [14] in 2011. The algorithm received much attention once it was proposed because it has the advantages of simple structure and few hyperparameters, which are ideal for solving high-dimensional multi-peak problems.

The basic idea of the BSO algorithm is to map each person’s idea to each individual in the population and represent it as a feasible solution in the problem-solution set. The specific steps are as follows:

Step 1: Random initialization. Generate n individuals as the initial solution for the population. Step 2: Evaluation. The fitness function values are calculated for these n individuals. Step 3: Clustering. The initially generated populations are clustered and grouped into m categories using the K-means method. And each individual in these m categories is ranked according to the fitness function value, and the best individual in each category is selected as the class center. Step 4: Generate new individuals. The generated new individuals follow the Eqs. (8) and (9) are updated, and the better individuals among them are saved. Step 5: Update the population. Determine whether the iteration termination condition is satisfied. If not, continue iterating and updating until the loop termination condition is satisfied.

$$\begin{aligned} X_{new}^d = X_{select}^d + \xi f(\mu ,\sigma ) \end{aligned}$$
(8)
$$\begin{aligned} \xi = \log sig((0.5 \cdot \max \_iter - cur\_iter)/k) \cdot rand() \end{aligned}$$
(9)

where \(\displaystyle f(\mu ,\sigma )\) is the normal distribution function, \(\displaystyle \log sig\) is the logarithm of the sigmoid, and \(\displaystyle max\_iter\) and \(\displaystyle cur\_iter\) are the maximum number of iterations and the current number of iterations.

3.2 Large Neighborhood Search

Large Neighborhood Search(LNS) is an algorithm that uses two core ideas, “destroy” and “repair” [13]. The two core ideas of LNS are “destroy” and “repair”, which simply means that the destroy operator destroys some individuals in the current solution, and then the repair operator is used to repair the destroyed solution. The advantage is that after destroying and repairing, we can get the full ordering of the initial solution and traverse the solution space of more problems.

The destroy steps are as follows:

Step 1: Firstly, we construct two sets, one is the set S for storing customers of distribution routes, and the other is the set V for temporarily storing removed customers. Step 2: First select a customer i from the set S at random and deposit it in the set V. Step 3: Choose any customer j from the set V, and then calculate the correlation between the remaining customers in the set S (denoted as \(\displaystyle S'\)) and customer j are calculated separately, and then sorted according to the relevance from largest to smallest, and finally according to the formula \(\displaystyle {\rm int} (ran{d^D} \cdot S')\) to decide the next customer to move out, the general value of D between 5 and 20, used to control the value is not exactly the way to maximize relevance. This process is repeated until the number of customers removed reaches a predetermined value.

The repair steps are as follows:

Step 1: Each insertable customer has an uncertain number of insertion positions, and the fitness difference is calculated for each possible case and the solution after being destroyed, and recorded. Step 2: Sort the fitness difference from largest to smallest, choose the insertion position with the largest difference to insert the customer back, and repeat the process until all the removed customers are inserted back.

3.3 BSO-LNS

The basic idea of combining BSO and LNS algorithm is that after BSO performs the individual update operation, it selects some of the worse individuals to “destroy” and “repair” according to the fitness so that the selected solutions are at least no worse than the original ones. Finally, the two parts of individuals are merged and iterated until the end of the cycle. More details are shown in Algorithm 1.

figure a

4 Experiments

4.1 Experimental Description

The data used in this experiment are provided by a distribution company, as shown in Table 2 and Table 3 (the contents not listed in the table are the same as Table 2.), which represent the order data of two days, respectively, where node 1 denotes the distribution center and nodes 2 to node 21 denote the supermarkets to be delivered, and the delivery vehicles are known to have a capacity of 7 tons, allowing a maximum of 10 vehicles for delivery. All experiments were conducted using MATLAB (R2018b) on an Intel(R) Core(TM) i7-8565U CPU @ 1.80 GHz with 8.00 GB of RAM.

Table 2. Data set of Experiment 1.
Table 3. Data set of Experiment 2 and 3.

4.2 Experimental Setup and Analysis of Results

In order to study the effect of road conditions on distribution, three experiments were carried out. In Experiment 1 and Experiment 2, the asymmetric passage time matrices of vehicles between nodes were obtained from AMap via Python program at 6:00 pm on 5.28 and 6.10, respectively, under the scenario of considering road conditions, and the acquisition was set to consider road conditions; Experiment 3, on the other hand, did not consider road conditions, but used the traditional straight-line distance for calculation.

Meanwhile, to better reflect the performance of the BSO-LNS algorithm, the original BSO, GA-LNS and PSO-LNS algorithms are used for comparison in each experiment, and the common parameter settings for these experiments are shown in Table 4. The parameters in the BSO algorithm are set as follows: \(\displaystyle m=5, p1=0.1, p2=0.5, p3=0.5, p4=0.3, p5=0.2\). The parameters in the GA algorithm are set as follows: \(\displaystyle pc=0.9, pm=0.05\). The parameters in the PSO algorithm are set as follows: \(\displaystyle c1=1.5,c2=2.0,w=1\).

Table 4. Common parameter setting for these algorithms.
Table 5. Simulation results of BSO-LNS with BSO, GA-LNS and PSO-LNS of 10 runs.
Fig. 4.
figure 4

Experiment 1.

Fig. 5.
figure 5

Experiment 2.

Fig. 6.
figure 6

Experiment 3.

Table 6. Random result of experiment 1.of 10 runs.

We run the four algorithms each 10 times for each experiment, and show the results in Table 5. From Table 5, Fig. 4(b), Fig. 5(b) and Fig. 6(b), it can be seen that in the three experiments, the solution obtained by the BSO-LNS algorithm is the smallest and requires only a small number of iterations to converge to the optimal solution, and the variance of the results of the multiple experiments is 0 or very close to 0. This indicates that the performance and robustness of the BSO-LNS algorithm are very good, and compared with GA and PSO, the BSO is more suitable to be mixed with LNS algorithm to solve VRPTW.

Many experiments have found that the total delivery time of Experiment 2 is higher than that of Experiment 1, which shows that the road conditions under Experiment 2 conditions are more congested than Experiment 1, indicating that road conditions have an impact on urban distribution efficiency. The optimal solution of Experiment 3 is very different from Experiment 2, and combined with Fig. 5(a) and Fig. 6(a), BSO-LNS only needs to arrange 4 vehicles in Experiment 2, while the same distribution data needs to arrange 6 vehicles in Experiment 3, which shows that the traditional calculation of straight-line distance without considering road conditions does not have great reference significance for distribution in real scenarios.

From Table 6, it can be found that the solution obtained by the original BSO algorithm in Experiment 1 will have the situation that the actual vehicle load exceeds the rated vehicle load, such as route \(\displaystyle 0\rightarrow 16\rightarrow 10\rightarrow 1\rightarrow 8\rightarrow 0\) is a violation of the loading capacity constraint (the maximum vehicle load is 7 tons), which is undesirable in real life. This can be avoided by mixing LNS in the BSO algorithm, which makes the global search and local search capability of the hybrid algorithm further enhanced.

5 Conclusion

In this paper, based on the real time road conditions, we abandon the traditional VRPTW, which is often calculated by the straight line distance between two points and assuming a constant speed, and use a web crawler to automatically obtain the actual passage time of vehicles between two points from AMap. The efficient hybrid BSO-LNS algorithm is used for the solution and the results are compared with PSO-LNS, GA-LNS and the original BSO algorithm. The obtained results are better than the other three algorithms and are more robust. The experimental results also show that the impact on realistic urban distribution is significant in the case of considering road conditions and not considering road conditions. In future work, we will consider acquiring more real-time road condition data and taking travel time dynamics into account with time series prediction.