Analysis of the problem
The known values which including the truck total quantity, each truck maximum load, each truck maximum distance for distribution, the geographic information of intersection and delivery and pickup cargoes, volume and weight of cargoes were defined based on the information system of distribution center.
The specific conditions of the model were as follows:

(1)
Each truck started from the distribution center and reached each customer along a route back to the distribution center.

(2)
Delivery cargo trucks followed the road that is not across the building.

(3)
The road was a twoway road.

(4)
The cargo volume was less than the rated load capacity of the truck (considering the load condition of flexibility, the rated load capacity of the truck would be multiplied by the factor 0.8).

(5)
The cargo weight was less than the rated load of delivery trucks not including the driver weight (assuming the driver weight is 60 kg).

(6)
The total volume and weight of the cargoes were less than the rated capacity of all the trucks.

(7)
The number of express staff was greater than or equal to the number of delivery trucks.

(8)
According to the separation principle of delivery and pickup parcels, it was possible to carry out the pickup cargoes’ work only when the spare capacity of the delivery truck exceeded half of its rated load capacity.
Establishment of mathematical model
Determination of objective function
The objective function was proposed to minimize the sum of transportation costs and time costs in the case of ensuring constraints.
$$ \mathrm{m}\;\mathrm{in}\;Z=O+P $$
where O is the transportation cost in the distribution process and P is the total time cost.
The transport cost function was as follows:
$$ O=\sum \limits_{i\in S}\;\sum \limits_{j\in H}\;\sum \limits_{k\in V}\kern0.24em {C}_{ij k}\;{X}_{ij k}\;{d}_{ij} $$
where S is the location set, H is the customer location set, V is the truck set, X_{ijk} means truck k was from location i to customer j, C_{ijk} means unit transport cost of truck k from location i to location j, and d_{ij}means the shortest distance between location i and location j.
The time penalty function was as follows:
$$ {p}_k\;\left({t}_i\right)=\left\{\begin{array}{l}{c}_1,{t}_i\le {T}_3\\ {}{a}_1\left({T}_1{t}_i\right),{T}_3<{t}_i\le {T}_1\\ {}0,{T}_1<{t}_i\le {T}_2\\ {}{a}_2\left({t}_i{T}_2\right),{T}_2<{t}_i\le {T}_4\\ {}{c}_2,{T}_4<{t}_i\end{array}\right. $$
The time cost was:
$$ P=\sum \limits_{i\in H}\;\sum \limits_{k\in V}\;{p}_k\;\left({t}_i\right) $$
The variables in the model were explained as follows: p_{k} (t_{i}) is the penalty cost because truck k serviced customer i on time t_{i}; t_{i} is the time when the truck actually arrived at the customer site; c_{1},c_{2} were the maximum penalty cost because the truck k was early or late to service customer i; a_{1},a_{2} are the positive coefficients of the penalty cost of the early or late arrival of the truck, which reflected the importance of time to customers; T_{1} is the starting point of time window when customer i was served; T_{2} is the end point of time window when customer i was served.
Constraint description
Each customer was serviced by only one truck.
$$ \sum \limits_{i\in S}\;\sum \limits_{k\in V}\;{X}_{ijk}=1,j\in H $$
(1)
When the free volume of the truck exceeded half of its rated load capacity, it could only carry out the service of pickup cargoes.
$$ {W}_k\sum \limits_{i\in S}\;\sum \limits_{j\in Q}\;{q}_j\;{X}_{ijk}\ge \frac{1}{2}\;{W}_k,k\in V $$
(2)
The delivery cargoes’ volume could not exceed the rated load capacity.
$$ \sum \limits_{i\in S}\;\sum \limits_{j\in N}\;{q}_j\;{X}_{ijk}\le {W}_k,k\in V. $$
(3)
The delivery cargoes’ weight should not exceed the rated load capacity.
$$ \sum \limits_{i\in S}\;\sum \limits_{j\in N}\;{h}_j\;{X}_{ijk}\le {M}_k,k\in V. $$
(4)
The volume of the delivered cargoes should not exceed the rated load capacity.
$$ \sum \limits_{i\in S}\;\sum \limits_{j\in F}\;{q}_j\;{X}_{ijk}\le {W}_k,k\in V. $$
(5)
The weight of the pickup cargoes should not exceed the rated load capacity.
$$ \sum \limits_{i\in S}\;\sum \limits_{j\in F}\;{h}_j\;{X}_{ijk}\le {M}_k,k\in V. $$
(6)
Each truck only reached one customer at one time.
$$ \sum \limits_{i\in S}\;{X}_{ijk}={Y}_{ik},j\in H,k\in V $$
(7)
It was not allowed that the truck returned to the distribution to pick up the cargoes during the delivery.
$$ {U}_{ik}{U}_{jk}+{NX}_{ijk}\le N1,i\in S,j\in H,k\in V $$
(8)
It was ensured that the total distance of the truck did not exceed its maximum driving range.
$$ \sum \limits_{i\in S,j\in H}\;{X}_{ij k}\;{d}_{ij}\le {D}_k,k\in V. $$
(9)
$$ {X}_{ijk}=0,1,i\in S,j\in H,k\in V $$
(10)
$$ {Y}_{ik}=0,1,i\in S,k\in V. $$
(11)
The variables in the model were explained as follows:
Q is the distribution address set before the start of the pickup cargoes, E is the distribution address set after the pickup cargoes, N is the distribution address set, F is the pickup address set, X_{ilk}presents whether the cargoes were transported from location i to location l by truck k, h_{j} is the cargoes’ quality of customer j, q_{j} is the cargoes’ volume of customer j, M_{k} is the maximum load capacity of truck k, W_{k}is the load space of truck k, Y_{ik} is whether truck k serviced the distribution point, U_{ik} is the access order of customer i on the driving route of truck k, U_{ik} is the access order of customer j on the driving route of truck k, and D_{k} is the maximum driving distance of truck k.
Solution of model
Algorithm for solving the problem
Step structure of algorithm solution is shown in Fig. 1. Firstly, the Floyd Algorithm was adopted to determine the shortest distance path of any two points under the road restraints using address information. Meanwhile, we adopted the 01 integer programming to combine the truck and goods information to determine the realtime truck usage, which we called it kl.
Secondly, the access from one distribution center back to the same distribution center was calculated by a tabu search algorithm for the first time with the target of minimizing the driving distance.
Thirdly, the access was randomly divided to match kl parts; each part must ensure that the corresponding truck could load the delivery goods and pickup goods separately. By calculating the numerical value of the distance between the first item of subsequence and the distribution center by adding the distance between subsequence tail and the distribution center and subtracting the distance between each subsequence, the minimum numerical value condition was selected as the optimal grouping.
Then, in consideration of the delivery and pickup rule and the time window, the second time tabu search algorithm was used to optimize each sequence in the optimal group with the fixed distribution center as the first and last member of the sequence aiming at minimizing the cost.
Finally, we examined whether the total distance of the traveling path to each sequence exceeded the rated driving limit of the truck. If it exceeded, we increased the quantity of truck used by one and the solution should be replanned. Else, the optimization result will be displayed.
Initial optimization of distribution path
Step 1: Reading the coordinate information of cargo address and road intersections was marked as distribution path points by the Arabic numeral. The distance was calculated between cargo address and other cargo address, cargo address and intersection, and intersection and another intersection.
Step 2: The shortest driving distance was calculated and the driving path was recorded.

(1)
Determine the shortest driving distance.
The matrix path represented the shortest distance between any two points of the n × n matrix. The shortest distance between two points was calculated by the Floyd Algorithm. If the shortest distance between two points was not past the third point, the corresponding element of the matrix was the column number. If the shortest distance between two points passed through the third point, it was a number value of the third point. For example, path(i,j) = j meant i,j points were directly connected along the road. Path(i,j) = k meant the shortest distance between point i and j should pass point k.

(2)
Determine the driving path.
The path router was defined as an n × n cell array; router{i,j} represented the shortest path from point i to j. If i was equal to j, router{i, i} = [i]. If i and j were not equal, when path(i,j) = j, router{i,j} = [i,j] or when path(i,j) = k, path(i,j) = [i, k, j].
Step 3: The number and specification of the truck were determined.

(1)
Determine the truck quantity.
According to the load weight and volume of the truck, the order was from large to small. The minimum number of vehicles for kl was determined based on the weight and volume requirements of the delivery cargoes.

(2)
Determine the truck specification.
01 integer algorithm was used to determine the truck specification. The minimum rated capacity of all trucks was set as the target function. kl is the upper limit of the number of trucks, so as to ensure that the cargoes could be fully loaded as the constraint conditions.
Design of the distribution path algorithm based on the pickup cargo information
Step 1: Initial planning. In the case of only considering the minimum distance, tabu search algorithm was used to calculate the optimal sequence based on the shortest distance matrix of all the cargo addresses. Address information of cargo and distribution center was randomly selected as the initial solution.The neighborhood search was made by pairwise interchange. The round number of \( \sqrt{a} \) (a was the sequence number) was set as the tabu length. 50a was set as the maximum iterations to calculate the optimized sequence.
Step2: Sequence division. th groups of sequences were randomly generated. The initial route S was divided into kl variety groups. t feasible solutions were found out based on the volume and weight of truck load capacity. Then, the least increase distance (the distance between the distribution center and subsequence header + the distance between the distribution center and subsequence tail − the distance between two subsequences) was made as the target to determine the optimal grouping situation, adjust the sequence order of optimal grouping, and form the initial solution which meets the service process.
Step 3: Optimize again. kl sequences were optimized with a minimum target function of time cost and transportation cost. The minimum cost was set as the target based on the time window and the rules of the pickup cargoes. The tabu search algorithm was used to readjust each sequence to obtain the optimal sequence. The first element of the initial solution was distribution center, the others was the sequence gotten from the second step. After the first element was fixed in the sequence, neighborhood search was made by pairwise interchange. Neighborhood space constraints included two conditions. One was that when the free space of the truck was more than half of the truck load, the pickup cargo business started. The other was that before the delivery cargo business was completed, the pickup cargoes should not be more than half of the truck load.
Inspection and display
Inspection included whether distance traveled was more than the rated distance traveled. If not, it was displayed that black lines were road routes, the yellow point was the distribution center, and the red line was the driving route, or else the truck number was added once more and grouping planning was made again. If the truck did not meet the requirements, it indicated “the existing equipment cannot meet the requirements, please add new equipment.”