1. Introduction
Over the past five years, the global logistics industry has undergone a revolutionary digitalization transformation. According to Statista (2024) [
1], the global parcel delivery quantity exceeded 150 billion in 2024, with an annual growth rate of 18.7%, and is projected to surge to 350 billion by 2030. In this trend, the optimization goals of logistics systems have shifted from traditional large-scale transportation to high-precision resource coordination [
2]. The logistics industry now needs to improve the loading efficiency of individual delivery vehicles while optimizing delivery routes, as the synergy between these two factors directly impacts cost-saving potential.
The parcels delivery problem is a common problem of logistics task in factories, hospitals, universities, communities, etc. Raw materials, medicines, and commodities need to be duly and correctly delivered to their destination by a delivery vehicle. Since the capacity and quantity of the delivery vehicles in a delivery center is limited, the delivery scheme should be properly planned to achieve a high delivery efficiency, especially when the parcels are numerous. Generally, as the shape, size, and destination of parcels are different, it is difficult to fully utilize the volume of the delivery vehicle while making sure the vehicle is driving along the shortest delivery route. Therefore, the capacitated vehicle routing problem with three-dimensional loading constraints (3L-CVRP) is an NP-hard problem [
3].
The 3L-CVRP research dates back to 2006 when Gendreau et al. [
4] proposed a two-stage tabu search algorithm to introduce the rule of last-in-first-out (LIFO) and stability of parcels into route planning. The core value of 3L-CVRP research is achieving Pareto optimality in resource efficiency with limited space and time, and many researchers focused on this point from the aspects of three-dimensional (3D) loading and vehicle route planning. Chi et al. [
5] developed two improved relocation constraints to achieve the balance between transportation cost and operational complexity in 3L-CVRP, and the results demonstrate the significance of relocation allowances in reducing overall costs and improving the capacity utilization of the delivery vehicle. Jiang et al. [
6] utilized a deep reinforcement learning (DRL) approach to solve the 3D bin packing problem, meaning the parcels loading problem can be solved by sequence, orientation, and position, independently. Similarly, Que et al. [
7] proposed a DRL approach to solve the 3D packing problem, and presented a novel state representation of a packing environment. Küçük et al. [
8] proposed an approach to program constraints in 3L-CVRP, and improved the results of 36 of 93 benchmark problems. Ribeiro et al. [
9] developed a software toolbox to assist in solving the 3D bin packing problem in some specific industries. Li et al. [
10,
11] deemed that the routing problem is superior to the packing problem, and proposed an adaptive genetic algorithm with elastic strategy to solve the 3L-CVRP for many dynamic demands.
The 3L-CVRP research is significant in the logistics industry, and many constraints can be considered, such as time windows [
12,
13,
14], resource sharing [
15], the stability of parcels [
16], the heterogeneity of parcels [
17], etc. These constraints affect the loading scheme and route planning. Therefore, to simplify the modeling and computing process, many researchers adopt a step-by-step optimization strategy of route planning followed by parcels loading [
5] or parcels loading followed by route planning [
18]. However, the traditional step-by-step optimization strategy exhibits low efficiency in both steps and low global suboptimality in high-density delivery scenarios (e.g., campus logistics), as the loading sequence and the route topology are nonlinearly correlated [
19]. Thus, 3L-CVRP is a multidimensional coupled optimization problem influenced by multiple constraints, and requires a dynamic balance between physical feasibility in 3D space and economic efficiency in the time dimension [
20]. Moreover, the complexity of the 3L-CVRP mathematical model grows as O(
n3) with the number of customers
n. Existing heuristic algorithms face a dilemma: enhancing global search capabilities (e.g., expanding population size) increases the number of 3D packing verifications, while focusing on local search efficiency (e.g., strengthening mutation operators) risks premature convergence. To address 3L-CVRP challenges, existing approaches can be broadly categorized into metaheuristics and hybrid algorithms. The artificial bee colony (ABC) algorithm [
21], as a representative swarm intelligence method, has demonstrated promising performance in vehicle routing problems due to its strong global exploration capability. However, its convergence speed tends to degrade when handling multi-layer constraints. Another notable approach is the GA-TS hybrid algorithm, which combines genetic algorithms’ evolutionary mechanisms with tabu search’s local intensification [
22]. While this integration improves solution quality, it introduces increased computational complexity that may hinder real-time applications. These inherent limitations in current methodologies motivate our development of the RSO-IGA framework, which aims to synergize the explorative strengths of swarm intelligence with adaptive local search mechanisms while maintaining computational efficiency. Therefore, RSO-IGA is compared with these two algorithms in the following case analysis. The results show that RSO-IGA performs better in express delivery scenarios.
Although the solution set of path length and loading rate can be obtained by using multi-objective optimization, and the internal relationship between path length and loading rate can be clearly seen, the efficiency of this method is low and the calculation time is long. In the actual logistics scenario, we need to obtain a specific optimal delivery scheme (path scheme and packing scheme) in an acceptable calculation time, especially in the circumstances in which the customers have individual requirements. Therefore, this paper adopts the method of multi-objective normalization to solve the problem. This method has a short calculation time and accurate optimal solution, which is suitable for the problem to be solved in this paper. To address these challenges, this study proposes a collaborative optimization framework based on the residual space optimization (RSO) strategy and an improved genetic algorithm (IGA). The innovations of this research are as follows: (1) Introducing a linear weighting method to construct a multi-objective transformation model that integrates packing and route topology features, balancing route economy and loading efficiency. (2) Designing a three-layer encoding system that includes route layer R_chrom, loading layer L_chrom, and orientation layer P_chrom, combining an improved Clarke–Wright algorithm to generate initial solutions and using the Gaode Maps API to obtain real road network distances instead of Manhattan distances. (3) Enhancing the RSO packing scheme through dynamic space partitioning rules and the LIFO constraint reverse verification to ensure the feasibility of 3D loading. Two experiments are conducted based on 22 extended test cases derived from the Cordeau standard dataset and the real logistics data of a Chinese university on a shopping festival. The results show that the proposed approach to 3L-CVRP has practical value in large-scale scenarios.
3. Hybrid Algorithm—RSO-IGA
The RSO-IGA algorithm establishes an intrinsic connection between the two subproblems of 3D bin packing and route planning, enabling a more holistic solution for 3L-CVRP. Initially, an improved Clarke–Wright savings algorithm generates route set Pt with 3D constraints as the initial population for the IGA. This enhanced CW algorithm accelerates convergence to optimal solutions, thereby improving computational efficiency.
Set
g = 1. Use the roulette wheel selection method in the IGA algorithm to perform selection operations. The selected solutions undergo crossover with probability
Pe. The crossed solutions are then subjected to 3D constraint validation. If the constraints are not satisfied, the crossover is repeated; if satisfied, mutation is performed with probability
Pm. After mutation, another 3D constraint validation is conducted. Note that the 3D constraints here are distinct from 3D loading constraints. Even if a path plan satisfies Equations (9)–(12), it may not guarantee that all the packages can fit into the delivery vehicle. Therefore, after crossover and mutation in the IGA algorithm, the RSO method is applied to validate 3D loading constraints and eliminate invalid solutions. This step enhances algorithm efficiency by avoiding infeasible solutions that fail loading requirements. The offspring population
Ot is merged with parent population
Pt, followed by objective function evaluation. An elitism selection mechanism then identifies
N elite individuals to form the new parent population. Then, set
g =
g + 1, and the process iterates until termination criterion
g ≤
gmax is met, ultimately outputting the optimized solution. This dual-phase validation mechanism and elite retention strategy effectively balance solution quality and computational efficiency while maintaining 3D feasibility constraints, and the algorithm flow is illustrated in
Figure 3.
The specific pseudo-code steps of the hybrid Algorithm 1 are shown below.
Algorithm 1 RSO-IGA Hybrid Algorithm for 3L-CVRP |
Input: Customer points D, vehicle dimensions (L, W, H), AHP weights (w1, w2) Genetic params: pop_size, max_gen, Pc, Pm |
Output: Optimized routes R_best with feasible 3D packing schemes |
1: | Initialize: |
2: | Generate initial population P0 using Improved CW savings algorithm (Algorithm 3) |
3: | Decode each individual to routes R_chrom and packing layers (L_chrom, P_chrom) |
4: | Validate packing feasibility via RSO Algorithm (Algorithm 2) |
5: | for gen = 1 to max_gen do: |
6: | # IGA Phase |
7: | Elite selection: Preserve top 10% individuals unchanged |
8: | Crossover: Improved Order Crossover on P_gen → offspring_Q |
9: | Mutation: Swap mutation on offspring_Q → mutated_Q |
10: | # RSO Validation Phase |
11: | for each individual in mutated_Q: |
12: | Decode R_chrom to routes |
13: | Apply RSO Algorithm (Algorithm 2) to validate 3D packing feasibility |
14: | If infeasible: discard or repair by re-generating L_chrom/P_chrom |
15: | # Fitness Evaluation |
16: | Calculate fitness via weighted sum: |
17: | Fitness = w1 × (normalized_distance) + w2 × (loading_rate) |
18: | # Environmental Selection |
19: | Combine P_gen + mutated_Q → select next_gen via tournament selection |
20: | Return: Best fitness |
3.1. Three-Dimensional Bin Packing Algorithm Based on the Residual Space Optimization Strategy
The purpose of three-dimensional bin packing is to verify whether the goods at customer points along the planned route can be loaded into the vehicle under the LIFO constraint. This paper adopts a three-dimensional bin packing algorithm based on the residual space optimization strategy for verification. The packing rules are as follows:
1. Residual space segmentation: As shown in
Figure 4, the red dashed lines represent the cutting planes. When horizontal or vertical cutting is applied, the remaining three subspaces are independent of each other. Among them, the subspace
Space1 remains the same under both cutting methods, while
Space2 and
Space3 are subspaces with equal height. The optimization of the residual space segmentation method can be equivalent to the optimization of the residual space in two-dimensional bin packing with height constraints.
2. Parcel placement rules: placing boxes with larger base areas at the bottom ensures better loading capacity for subsequent items. Therefore, under the premise of optimizing residual space, the placement rules are described as follows:
- (1)
Sort the parcels based on the size of their base area in descending order, prioritizing the loading of parcels with larger base areas;
- (2)
When selecting a placement space, ensure that the space can fully accommodate the parcel, and the difference between the base area of the parcel and the base area of the space should be as small as possible;
- (3)
If multiple spaces have base areas similar to that of the current parcel, choose the space that, after accommodating the current parcel, can be divided into the largest possible subspace.
A comprehensive evaluation metric for (2) and (3) is proposed as shown in the following equation:
Equation (21) indicates that the placement space must be able to accommodate the box. In Equation (22), γ is a correction parameter for the comprehensive evaluation metric, and its value is a positive number significantly smaller than the shortest edge of the smallest parcel. This parameter is introduced to avoid the situation where the comprehensive evaluation metric cannot be optimized when any edge of the placement space equals any edge of the box.
As shown in
Figure 5, two identical parcels,
bi and
bj, are loaded into a delivery vehicle. Without the correction parameter, the comprehensive evaluation metrics
f(
bj,
Space1) and
f(
bj,
Space3) would both be 0. According to placement rule (3), the spatial configuration shown in
Figure 5a is obtained.
When the correction parameter is included, the comprehensive evaluation metrics are calculated as
f(
bj,
Space1) = −
γ2 and
f(
bj,
Space3) = −
γ∙(
Space3 (
l) −
bj(
l)). Clearly, the former is larger, resulting in the spatial configuration shown in
Figure 5b. From
Figure 5, it is evident that the corrected residual space set provides more valuable reference for subsequent packing.
The specific pseudocode steps of the remaining space optimization Algorithm 2 are as follows:
Algorithm 2 RSO 3D Packing Validation |
Input: Route R, parcels list with dimensions, LIFO stack order |
Output: Packing feasibility (True/False), loading rate V |
1: | Initialize: |
2: | Residual spaces: [Space0 = (L, W, H, corner = (0,0,0))] |
3: | Space_avi = True # Space availability flag, initially True |
4: | Plan_list = [] # List to store packing plans, initially empty |
5: | Sort parcels by base area (largest-first) and push to LIFO stack |
6: | Sort parcels: Sort by base area descending order, then push to LIFO stack |
7: | Update residual spaces and total space count: |
8: | Update Space_list (list of available spaces) |
9: | Total number of available spaces: num_S |
10: | Main Packing Loop: |
11: | while parcels exist in LIFO stack: |
12: | a. Pop the next parcel p from stack |
14: | b. For each Space in residual_spaces: |
15: | Calculate placement score f(p, Space) based on Equations (15) and (16) |
16: | f(p, Space) represents the placement score, a measure of how well parcel p fits in the given space |
17: | c. If f > 0: # Placement is feasible |
18: | Place parcel p in the space with the highest f value |
19: | Split residual space into 3 subspaces (based on current parcel placement) |
20: | Update residual_spaces with new subspaces (Figure 4) |
21: | Increment placement counter (s = s + 1) |
22: | d. If no further feasible placements are found for parcel p in the current residual spaces: |
23: | Break out of the loop (to check the next parcel) |
24: | If no feasible placement (space) is found for a parcel: |
25: | Return False (packing not possible) |
26: | If all parcels are successfully placed: |
27: | Calculate the loading rate V = total_parcel_volume/(L × W × H) |
28: | Return True (packing is successful), V (loading rate) |
29: | End Algorithm |
3. LIFO constraint: campus parcel delivery must consider the order of customer logistics distribution, so it is not possible to sort all goods uniformly. The path plan is reversed and then sequentially pushed onto a stack. When popping elements from the stack, they are removed starting from the top element, ensuring that the order of elements popped matches the sequence of customer points in the path plan.
3.2. IGA Algorithm
3.2.1. Encoding and Decoding
- (1)
Encoding
The encoding part requires that the chromosome contains all the basic information of an individual. Currently, the most common encoding method for solving vehicle routing problems is real-number encoding, which encodes the visiting sequence of customer points. The solution space is the full permutation of the visiting sequence, and the corresponding space complexity is related to the number of customer points. However, this paper also needs to consider three-dimensional loading constraints and the practical conditions of campus delivery. Therefore, while considering the route as the visiting sequence, a three-layer real-number encoding method is adopted. As shown in
Figure 6, a simple schematic diagram of the three-layer encoding method is provided.
The first layer, R_chrom, represents the route encoding. The sequence reflects the order in which the delivery vehicle visits the customer points, and the numbers correspond to the sequential indices of the customer points.
The second layer, L-chrom, represents the loading sequence. The sequence indicates the order in which parcels are loaded, and the numbers correspond to the parcel demand indices associated with R_chrom.
The third layer, P_chrom, represents the parcel placement encoding. The numbers correspond to the placement methods of the parcels in the vehicle, where only two placement methods are considered for the parcels in the vehicle.
- (2)
Decoding
The decoding process involves transforming the solution represented by the encoding into specific executable operational steps. For the three-layer encoding method proposed in this paper, since the R_chrom layer represents the vehicle’s visiting sequence, the legality of the route must be ensured during the decoding of the R_chrom layer. This requires considering the impact of three-dimensional constraints on the route. Therefore, under loading constraints, the route needs to be divided into multiple sub-routes, and a “0 gene” is added at the beginning and end of each sub-route to represent a complete delivery route for the delivery vehicle. Additionally, to obtain valid solutions, the L_chrom and P_chrom layers must undergo three-dimensional constraint verification during each decoding step.
As shown in
Figure 7, the red dashed line represents the pass segmentation. The first route is “0→6→1→2→4→0,” and the second route is “0→3→5→7→0.” By repeating the above decoding process, the route plan for each trip of the delivery vehicle under this individual can be restored.
3.2.2. Introduction of the Improved CW Savings Algorithm
To more effectively converge to the optimal solution, the CW savings algorithm is introduced, and the solution generated by the CW savings algorithm is used as the initial solution. The core idea of the CW algorithm is to calculate and compare the “savings” between different customer points, which refers to the distance saved by merging two customer points into the same route, thereby gradually constructing the optimal route. The initial solution is direct delivery, where a single vehicle serves each customer point separately. Although the initial solution can meet the required cargo demands, it results in excessive vehicle trips, long delivery routes, and low loading rates.
In the CW Algorithm, the “savings” are illustrated in
Figure 8. Customer points
s and
t are served by the distribution center o. Here,
l(
o,
s) and
l(
o,
t) represent the shortest feasible distances from the distribution center to customer points
s and
t, respectively, and
l(
s,
t) represents the shortest feasible distance between customer points
s and
t. The savings from merging customer points
s and
t is calculated as |
l(
s,
t) +
l(
o,
s) +
l(
o,
t) − 2(
l(
o,
s) +
l(
o,
t))|.
In the traditional CW savings algorithm, l(o, s), l(o, t), and l(s, t) are calculated using the Manhattan distance equation. However, in the context of a campus environment, the routes are more complex. Therefore, this paper utilizes the Gaode Maps API to calculate the actual road distances based on latitude and longitude rather than simple straight-line distances. The improved CW savings algorithm is implemented as follows:
- (1)
Initialization: calculate the distance matrix D for all customer points and set the initial solution as individual routes containing the distribution center and each customer point;
- (2)
Calculate savings: based on the distance matrix D, compute the savings between all customer points and construct the savings matrix S;
- (3)
Sort savings: sort the savings matrix S in descending order to obtain the savings list L;
- (4)
Merge savings: randomly select a customer point and, following the order of the savings list L, sequentially check whether merging the next customer point satisfies the three-dimensional constraints. If not, skip that customer point and proceed to the next;
- (5)
Update routes: after each successful merge, update the current route and the set of unvisited customer points;
- (6)
Termination: the algorithm terminates when all customer points have been visited.
The improved CW savings algorithm generates feasible solutions during the route merging process and evaluates the distance savings. Simultaneously, it assesses the feasibility of merging routes based on three-dimensional constraints. As a result, the initial solutions generated by the improved CW savings algorithm are feasible and stable, facilitating the optimization of feasible solutions in the second stage using the improved GA.
Unlike the traditional GA, which employs a random strategy to generate the initial population, the introduction of the CW savings algorithm provides better initial solutions, aiding convergence to the optimal solution. Additionally, the elite retention strategy is incorporated to ensure that a certain number of elite individuals are preserved during the iteration process, thereby improving the accuracy of the optimization results. Therefore, compared to the traditional GA, the proposed IGA combines the improved CW savings algorithm and the elite retention strategy, enhancing the stability of the hybrid algorithm and its global search capability for finding optimal solutions.
The specific pseudocode of the improved CW savings Algorithm 3 is as follows:
Algorithm 3 Improved CW-Savings Algorithm |
1: | Calculate real-road distances using Gaode Maps API |
2: | Initialize: Each customer as separate route [0, i, 0] |
3: | Compute savings S_ij = distance(0,i) + distance(0,j) − distance(i,j) |
4: | Sort S_ij in descending order |
5: | For each S_ij in sorted list: |
6: | Merge routes containing i and j if: |
7: | Capacity constraint satisfied (Equation (8)) |
8: | 3D packing validated by RSO (Algorithm 2) |
9: | Return: Feasible initial routes |
Fitness Function Construction: The optimization objectives in this study are to minimize the route length and maximize the average loading rate. During the population iteration process, the route length is expected to decrease gradually until the optimal solution is reached. In the population evolution process, individuals with higher fitness values are more likely to be retained. The fitness function is defined as in Equation (23):
3.2.3. Crossover
This paper employs an improved order crossover method. The specific steps are as follows:
- (1)
Select the same region on two parent chromosomes, P1 and P2;
- (2)
Copy the genes from the selected region of P1 and P2 to the end of P1 and P2, respectively, resulting in P1′ and P2′;
- (3)
Exchange the genes in the selected regions of P1′ and P2′, resulting in P1″ and P2″;
- (4)
Remove the duplicate genes outside the selected regions in
P1″ and
P2″, yielding two offspring chromosomes,
F1 and
F2. The specific operation is illustrated in
Figure 9.
In
Figure 9, the red arrow represents the segmentation of chromosome fragments, and the white arrow represents the change process of chromosome. After completing the crossover operation, it is necessary to verify whether the loading plan of the delivery vehicle satisfies the three-dimensional constraints. If not, the crossover operation is repeated.
3.2.4. Mutation
A chromosome is randomly selected from the population generated after the crossover operation for mutation. The mutation process is illustrated in
Figure 10, the red arrow indicates the exchange of fragments of two chromosomes, and the white arrow indicates the change process of the whole chromosome. The steps are as follows:
- (1)
Select some chromosomes from the parent generation based on the mutation probability;
- (2)
Randomly select two genes from the parent chromosome and exchange them to produce a new offspring chromosome;
- (3)
Verify whether the loading plan of the delivery vehicle after the mutation operation satisfies the three-dimensional constraints. If not, the mutation operation is repeated.
The offspring generated after crossover and mutation are validated using the residual space-optimized three-dimensional bin packing algorithm to determine whether the plan can accommodate all parcels along the route. If successful, subsequent operations are performed; otherwise, the crossover and mutation operations are repeated.
3.3. Algorithm Comparison
This paper further modifies the experimental data based on the following instances designed by Cordeau:
- (1)
The number of customer points is increased;
- (2)
The types of boxes are expanded;
- (3)
Time windows are removed, and the modified data are shown in
Table 2.
The RSO-IGA algorithm is then compared with the artificial bee colony algorithm and the GA-TS algorithm.
Table 2 presents the experimental data, and
Table 3 shows the comparison results of the algorithms. The results indicate that the proposed RSO-IGA algorithm outperforms the others in terms of route length and average loading rate. In
Table 3,
f represents the shortest route length in meters (m) and
V represents the average loading rate. This index can show the stability of the packing., and
T indicates the algorithm’s running time in seconds (s).
3.4. Statistical Significance Analysis
In order to better reflect the evaluation effect of the RSO-IGA algorithm, ABC algorithm, and GA-TS algorithm, the Wilcoxon test is carried out, and the evaluation index includes the transportation distance (
f) and loading rate (
V). The test results are shown in
Table 3, and the detailed analysis
Table 4, is as follows:
Based on the Wilcoxon test results, the RSO-IGA algorithm showed statistically significant advantages in both aspects (all p < 0.01): In the optimization of transportation distance, RSO-IGA has extremely significant improvement compared with ABC algorithm and GA-TS algorithm (p = 2.384 × 10−6), indicating that its path planning ability is significantly better than the two comparison algorithms. In terms of loading rate, the difference between RSO-IGA and ABC algorithm was extremely significant (p = 1.6689 × 10−6), while the improvement between RSO-IGA and GA-TS algorithm was small but still significant (p = 0.0057). These results prove that RSO-IGA achieves statistically significant performance improvements on both key metrics of the logistics optimization problem. The distance optimization is more consistent (reaching 1 × 10−6 level significance in both comparisons), while the loading rate optimization is significant, but the difference is relatively limited in the GA-TS algorithm comparison.