A 3D Offline Packing Algorithm considering Cargo Orientation and Stability

,


Introduction
The bin packing problem has a long history and has been extensively studied by scholars Fazili et al. [1], such as the one-dimensional bin packing problems represented by resource scheduling, time scheduling, and load management, the two-dimensional bin packing problem represented by fabric cutting and sheet processing, and the threedimensional bin packing problem represented by container loading and vehicle loading. Among them, threedimensional bin packing problem is one of the most concerned combinatorial optimization problems Sridharan and Domnic [2]. The main goal is to find a space allocation method that can achieve the highest space utilization or the lowest cost [3], which can be divided into container packing problem, box packing problem, and back packing problem (Kyungdaw et al. [4]; Mhand et al. [5]).
At present, the algorithms for solving the bin packing problem include precise algorithms, heuristic algorithms, intelligent optimization algorithms, and other algorithms. The exact algorithm uses the upper and lower limits of each parameter to guide the search in feasible solutions and find the optimal solution. Commonly used precise algorithms are as follows [6,7]: branch pricing algorithm [8], branch solution price cutting algorithm [9], and backtracking method [10]. For the classic combinatorial optimization problem, the precise algorithm can accurately obtain the global optimal solution in the bin packing problem; it is only suitable for small packing cases. When the complexity of the problem increases exponentially as the number of cargos in the problem becomes larger, the traversal search process cannot be implemented in a limited time.
Therefore, heuristic algorithm has become one of the important ways to solve this series of problems. The heuristic algorithm is a method constructed based on human experience, which includes the order of cargos packing and the rules of space allocation in the box [11]. Common methods include layered method, wall method, stacked tower method, composite block method, stacking method, and hole degree method [12,13]. The number of iterations of the heuristic algorithm is proportional to the number of construction elements of the problem solution but has nothing to do with the size of the solution space, so its calculation speed is usually very fast. However, the heuristic information introduced by the general heuristic algorithm depends on personal experience and also cannot effectively avoid the combinatorial explosion problem. More artificial intelligence algorithm has achieved great results in many fields, including solving combinatorial optimization problems [14,15]. The intelligent optimization algorithm is an algorithm inspired by a certain phenomenon in nature, which mainly includes genetic algorithm [16], particle swarm algorithm [17], simulated annealing algorithm [18], and ant colony algorithm [19]. The artificial intelligence algorithm can cope with large bin packing problems and find better optimal solutions with low requirements for the expertise of the algorithm designer, but the convergence speed of the intelligent optimization algorithm is greatly affected by the initial solution and encoding method.
In addition to the above three types of algorithms, deep learning and reinforcement learning have been applied in the bin packing problem. Wang et al. proposed a cooperative memetic algorithm [20], and Pan et al. proposed a knowledge-based two-population optimization algorithm [21] to minimize total energy consumption and total tardiness simultaneously. Zhao et al. proposed the mixedinteger linear programming model to produce an effective constructive heuristic [22] and a hyperheuristic with Qlearning to address the energy-efficient distributed blocking flow shop scheduling problem [23]. These methods have better performance than traditional algorithms, but the use of these methods requires a large data set to train the model, and the computational speed is slower than traditional algorithms and requires more computer hardware.
Suppose to pack the cuboid cargos of different sizes, direction constraints, and stability constraints into boxes with the same type and unlimited quantity, the paper establishes the objective function with the least number of boxes and designs a hybrid genetic algorithm (HGA) that combines genetic algorithm, tabu search algorithm, and heuristic algorithm. The paper focuses on the 3D offline bin packing problem that requires multiple boxes to complete loading in practical situations. Our main research work includes as follows: (1) We model the bin packing problem by identifying six rotational states of the cargos and constraints (2) We design a two-segment real number encoding method and decoding method based on a random key to determine the packing order of the cargos (3) We design the HGA to improve the space utilization of boxes (4) We design comparison experiments on the BR data to verify the rationality of the proposed algorithm The remainder of the paper is structured as follows. In Section 2, we simplify the three-dimensional offline bin packing problem and establish the mathematical model through the rotational states of the cargos and the constraints. In Section 3, we divide the HGA into three parts for detailed analysis. In Section 4, we present and discuss experimental results. In Section 5, we conclude our work.

Problem Description
There are n cuboid cargos of different sizes, which are packed into a set of boxes with a fixed size of length L, width W, and height H. Some cargos have orientation requirements.

Related Assumptions
(1) All cargos are cuboids, and the density of each part is equal. In order to facilitate modeling and analysis, the actual weight distribution is assumed to be uniform weight distribution (2) There are no cargos that cannot be load bearing, or cargos that need to be loaded separately, or cargos that cannot be squeezed (3) The size of any cargo is smaller than the size of the box, and the weight of any cargo is within the load range of the box (4) The cargos are in the box, and the direction of placement must be consistent with the direction of the box (5) The priority of the cargo is the same, there is no cargo that needs to be loaded or unloaded first, and the loading order of the cargo is only related to the calculated packing plan

Constraints
(1) Volume Constraint. The box has a shell with a fixed size (2) Guillotine Constraint. If the cargos are not allowed to be separated, the cargos are regarded as an inseparable whole. Any one item can only be placed in one 2 International Journal of Distributed Sensor Networks box. As shown in equation (1), for the cargos with serial number i, in N boxes, only one yij is 1 where yij indicates whether the cargos with the serial number are placed in the box with the serial number j; if the cargos with the serial number i are placed in the box with the serial number j, yij = 1; otherwise, yij = 0 (3) Load Constraint. Each box has a load limit, and the total weight of the cargos in the box cannot exceed the upper limit. The sum of the weights of the cargos loaded in each box is less than the upper limit of the box, as shown in the following equation: where M is the upper limit of the load of the box, which represents the weight of the jth cargo in the cargo that needs to be loaded in the kth box in the loading plan (4) Rotation Constraint. Some cargos have restrictions on the way they are placed, so when designing a packing plan, the rotation constraints of the cargos should be met. For example, there is an upward sign on the package of glassware; that is, during the loading process, the sign can only be vertically upward but can be rotated in the horizontal direction (5) Center of Gravity Constraint. After packing the cargos, the center of gravity of the box should be within a certain range (6) Stability Constraint. During the loading process, the cargos must be placed on the bottom of the box or on top of other cargos. According to the size of the supported area on the bottom surface of the cargos, the stability can be divided into partial support and complete support. Among them, partial support means that at least part of the bottom of the cargo needs to be supported (as shown in Figure 1), and full support means that the bottom of the cargo needs to be fully supported (as shown in Figure 2) (7) Placement Constraint. The placement of the cargos in the box can only be orthogonal to the box; the six sides of the cargos are parallel to or overlap with the six sides of the box. The situation where the cargos and the box are crossed is not allowed; each side of the cargos should be parallel to one of the sides of the box as shown in Figure 3) To maximize the loading capacity of the box and reduce the number of boxes used, the cargos can be placed in the box only in an orthogonal way to the box, where each side of the cargos should be parallel to one of the sides of the box. l xi + l yi + l zi = 1, In the equation, l xi indicates whether the length of the ith cargo is parallel to the x-axis of the box; if it is parallel, the value is 1; otherwise, it is 0. l yi , l zi , w xi , w yi , w zi , h xi , h yi , and h zi are similar to l xi .
For the cuboid cargo and the cuboid box, there are six relative rotation states between the two. If the length, width, and height of the cargos are l, w, and h, respectively, and the length, width, and height of the box are x, y, and z, then there are six states of relative rotation between the two, i.e., ðx − l, y − w, z − hÞ, ðx − l, y − h, z − wÞ, ðx − w, y − l, z − hÞ, ðx − w, y − h, z − lÞ, ðx − h, y − l, z − wÞ, and ðx − h, y − w, z − lÞ. The volume constraint that the cargo in the rotating state should satisfy is shown in equation (4). The rotation constraints for the other five rotation states are similar to In the equation, x i , y i , and z i are the coordinate points of the ith cargo placed in the loading plan; the length of the cargo is l i , the width is w i , and the height is h i , where i = 1 , 2, ⋯n. It can be seen that the placement direction of the cargos is determined by these six state values.
In the equation, v i is the volume of the ith cargo, and V is the volume of the box, N is the number of bins used in the packing scheme, and num j represents the number of cargos loaded in the jth box in the loading scheme.

HGA for 3D Offline Binning Problem
This paper proposes a HGA that combines the genetic algorithm and the tabu search algorithm to solve the threedimensional offline bin packing problem, as shown in Figure 4. This paper also designs a corner-occupancy heuristic loading algorithm (COHLA) based on the division and merging of the remaining space, which converts the solution in the intelligent search algorithm into a packing scheme that conforms to the mathematical model. After combining the hybrid genetic algorithm with the heuristic loading algorithm, the HGA for solving the three-dimensional offline bin packing problem is formed.
HGA is designed under the basic framework of genetic algorithm, including coding method, population initialization, fitness value calculation, selection, crossover and mutation, and other processes. This paper makes corresponding changes to the three-dimensional offline bin packing problem, designs a two-stage real number encoding method (TSRNEM) based on random keys, calculates the fitness value according to the heuristic loading algorithm, and chooses to use the roulette method and the best preservation method. For the hybrid selection operation of the strategy, a crossover operation based on partial random key and uniform crossover is designed, and the tabu search algorithm is used as the mutation operation.
3.1. Encoding Method. Common coding methods in genetic algorithms include binary coding, Gray code coding, real number coding, and integer or alphabetical arrangement coding [24]. Aiming at the three-dimensional offline bin packing problem, this paper designs a TSRNEM based on random keys as the encoding method.
For the packing problem of n-cargos to be loaded, the two-segment real number code contains real n + n numbers, each real number is a random number between 0 and 1, and  International Journal of Distributed Sensor Networks each real number has nothing to do with the box serial number and box type. The first n real numbers are the packing sequence S, in which the ith real number s i represents the packing sequence value of the cargos with the item number i; the second n real numbers are the rotation state R, of which the ith real number r i represents the rotation state of the cargos with the item number i. As shown in Table 1, to get the packing order of the cargos, the algorithm will sort the cargo numbers according to the size of each real value in the packing sequence, and the resulting sequence of cargos numbers is the rotation state. For cuboid cargos and cuboid boxes, there are six relative rotation states between the two, and each state is marked with 1 to 6. In this algorithm, each cargo data contains a rotation state table T i that records the allowed rotation state of the cargo. In order to meet the rotation constraints and obtain the rotation state of the cargos when they are packed, this paper multiplies the rotation state r i of the cargos number by the rotation state table size T i s contained in the corresponding cargos and rounds up to obtain an integer T i j; the T i jth rotation state in the rotation state table of the corresponding cargos is the rotation state of the cargos. As shown in Table 2, the packing state value r 2 of cargo 2 is 0.66, and the rotation state table T 2 in cargo 2 is 1, 2, 4, and 6, and the size T 2 s of the rotation state table is 4. According to equation (6), the value of T 2 s can be obtained as 3, the rotation state of the cargo 2 is the third rotation state in the rotation state table T 2 , which is the rotation state 4, and the corresponding rotation state of the cargo 2 in this packing scheme is ðx − w, y − h, z − lÞ.
3.2. Heuristic Loading Algorithm. In the genetic algorithm, in order to evaluate the pros and cons of individuals in the population, the objective function of the problem is converted into a fitness function, and the fitness function value of each individual represents the survival probability of the individual. At the same time, by decoding individual chromosomes, only the order and placement direction of the cargos can be obtained. To obtain an effective loading plan and fitness value, it is necessary to design an appropriate loading algorithm. A good loading algorithm needs to consider positioning rules, space selection rules, space division rules, and remaining space merging rules [25]. In this paper, the COHLA based on remaining space division and merging is designed.

Positioning Rules and Spatial Selection Rules.
In the process that the cargos are loaded into the boxes one by one according to a certain loading order, there should be a suitable positioning rule to clarify the placement position of each cargos in the box space. In order to meet the stability requirements and improve the utilization of space, this paper chooses to use the corner occupation strategy as the positioning rule (as shown in Figure 5). The basic idea of the corner strategy is as follows: first, place the cargos in a corner of the box, then place it along the edge of the box, and finally fill the box.
In each cuboid space, there are 8 corner areas, namely, the lower left corner, the lower left corner, the lower right corner, the lower right rear corner, the upper left corner, the upper left corner, the upper right corner, and the upper right rear corner. In order to meet the stability of the cargos, the cargos are selected to be placed in the lower four corners of the space; considering the actual loading process, the cargos are selected to be placed in the lower left corner and the lower right corner of the space. Due to the division of the remaining space, the bottom surface of each remaining space is the top surface of other cargos or the bottom surface of the box, which can ensure that the new cargos have support and ensure stability constraints. Therefore, this paper chooses the left rear lower corner rule as the positioning rule, that is, placing the cargos in the left rear lower corner in the space [26].
After constant refilling, there may be scattered remaining spaces in the box. Therefore, when a certain cargo to be loaded is to be loaded into the box, it is necessary to first select the available remaining space from all the remaining spaces and then select a remaining space from the available remaining spaces as the loading space of the cargo.
First, based on the size of the cargo, how it is rotated, its weight, and the size of each remaining space, the remaining space that can be fully loaded is picked.
For example, the length, width, height, and weight of the cargos are l b , w b , h b , and m b ; the rotation state is ðx − w, y − h, z − lÞ; the length, width, and height of a certain remaining space are L, W, and H, respectively; and the total weight of the loaded cargos in the box is m s ; if it satisfies equation (7), the size of the remaining space is larger than the size of the cargos and does not exceed the upper limit of the load of the box; the cargos can be loaded into the remaining space; otherwise, the remaining space is unavailable space. Then, to reduce the division of large space and improve the utilization rate of space, this paper selects the space with the smallest volume from the remaining spaces that can be loaded as the loading space.
3.2.2. Remaining Space Division Rules. Remaining space refers to the space in the box that is not occupied by cargos.
To ensure the stability of the cargos in the box, when the cargos are in the box, the cargos must be placed in parallel or orthogonal to the coordinate axis of the container, and no inclined placement is allowed. Therefore, after the cargos are loaded into the box for many times, the phenomenon of cutting the remaining space in the box into complex irregularshaped spaces occurs. For a longer cuboid space, it is more difficult to select the position of the cargos in the complex irregular shape space, and the amount of calculation required to complete the loading is larger.
To solve the complex irregular-shaped space problem, this paper chooses to divide the space when the first cargos are loaded into the box. When a cargo is loaded into the cuboid space, the cuboid space can be divided into four parts, namely, the space occupied by the cargo, the upper space, the front space, and the right space. Due to stability constraints and positioning rules for the lower left rear corner, the cargo can only be placed on the bottom of the box or on the cargo already packed in the box. Therefore, the upper space can only be the space directly above the cargos, and there are two division methods for the right space and the front space, such as vertical division and horizontal division. During the loading process, it is not desirable that the box space is divided into a large number of narrow and long thin strip-shaped residual spaces. Therefore, in the process of dividing the remaining space, the judgment will be made according to equation (8). If the value d is greater than 0, the vertical split is selected; otherwise, the horizontal split is selected.
In equation (8), s:l and s:w represent the length and width of the remaining space, respectively, g:l and g:w represent the length and width of the cargo, respectively, and d represents the difference between the bottom area of the right space divided vertically and the bottom area of the front space divided horizontally.

3.2.3.
Remaining Space Merge Rules. The residual space designed in this paper for the residual space merging operation is the abandoned space, the small space that cannot be put into any cargo. During the remaining space merging operation, the two spaces being operated should meet the following requirements before proceeding: (1) The two abandoned spaces are adjacent, adjacent to left and right or adjacent to front and rear (2) The two abandoned spaces need to have one side coplanar (3) The size of the new space generated after being merged is larger than the size of the original space (4) According to the merging conditions of the abandoned space, there are two merging methods: front and rear merging (as shown in Figure 6) and left and right merging (as shown in Figure 7). In order to make full use of the space in the box, after each item is put in, the space merging operation is performed on all the abandoned spaces until it cannot be merged 3.2.4. Heuristic Loading Algorithm Flow. In this paper, a COHLA based on the division and merging of the remaining space is designed (as shown in Figure 8); the heuristic loading algorithm will maintain a space list for each box. The list records the length, width, height, coordinates of the lower left corner, and other information of each remaining space in the box. The initial remaining space in the list is the box.
3.3. Selection, Crossover, and Mutation Operations. The HGA proposed in this paper is developed based on the framework of genetic algorithm, and selection, crossover, and mutation are the main processes in genetic algorithm. Aiming at the three-dimensional offline bin packing problem and the TSRNEM based on random keys, this paper chooses to use the roulette method and the mixed selection operation of the best preservation strategy, designs a crossover based on random and uniform crossover of partial keys operation, and uses the tabu search algorithm as the mutation operation.

Select Operation.
In the genetic algorithm, the selection operation embodies the idea of survival of the fittest and survival of the fittest in the theory of evolution and simulates the process of species selection in nature. The selection operation is to screen out a part of individuals from the parent generation to generate offspring. The higher the fitness value of the individual is, the greater the probability of being selected. On the contrary, the lower the fitness value of the individual is, the lower the probability of being selected.  The selection operation can make the population develop in the direction of higher fitness. In this process, the excellent genes and performance are preserved; it can ensure that the population can converge to the optimal solution range during the search process, but the selection operation method is not suitable. Now, there are the following 3 ways of selection operation that are proposed and verified. The roulette method is based on the fitness value f i of each individual and the sum f = ∑f i of the fitness values of all individuals and can obtain the probability P i = f i /f of each individual being selected; in the selection process, the program will automatically generate a random value λ between 0 and 1. If there is an individual i which satisfies P 1 + P 1 + ⋯+P i ≤ λ < P 1 + P 1 +⋯+P i + P i+1 , the individual i is selected to enter the next link. The roulette method gives each individual a chance to be selected, and it has the characteristics of random sampling and has better global search ability, but it also leads to a decrease in the convergence speed of the algorithm and even makes it impossible to find the optimal solution.
The optimal preservation strategy is to sort all individuals in the population according to the fitness value from high to low and select the top individuals from the sorting to enter the next link, while other individuals will be eliminated. This method can ensure that the genes of the optimal individual will be inherited, but if the chromosomes of multiple individuals in the selected K individuals are consistent, it will easily lead to a local optimal solution, so that the algorithm cannot find the global optimal solution untie.
Tournament method randomly selects a certain amount of individuals from the parent generation, selects the individual with the best fitness value from this amount of individuals into the offspring, and repeats the process until the selection is full. The tournament method will be both selective and deterministic, a method between the roulette method and the optimal preservation strategy.
In this paper, the parent individuals selected in the selection operation are directly regarded as the offspring individuals. Moreover, in the early stage of the genetic algorithm, when the iteration g is less than the predetermined value g 0 , the roulette method is selected as the selection operation method, so that the search can be carried out in a wider range and the global search ability is maintained; in the later stage, when the iteration g is greater than the predetermined value g 0 , the optimal preservation strategy is used as the selection method. The operation method enhances the search ability of the algorithm in the optimal solution range and accelerates the convergence speed.
In equation (9), G is the number of iterations.

Crossover Operation.
In the genetic algorithm, the crossover operation simulates the genetic recombination process in genetics, which reflects the characteristics of gene exchange in biology. It is an important operation in the genetic algorithm and the main way to form a new individual in the genetic algorithm. Crossover operation is to take the individuals in the parent as parents and exchange the genes in the chromosomes of the parents according to certain rules, so as to generate a new individual with a combination of traits of the two parents. Commonly used crossover  Aiming at the TSRNEM based on random key, this paper designs a crossover operation method based on partial random key and uniform crossover. In this paper, we first choose to use two individuals to generate child individuals through crossover operation. These two individuals are called parent individuals. One of the parent individuals is derived from the individuals selected by the selection operation, and the other is randomly selected from the parent population. Compared with other methods, this method is easier to converge and can improve the quality of individuals in the population; then, along the gene locus in the chromosome, select the gene from the chromosomes of the two parent individuals as the gene of the offspring at that locus; the selection method is to generate a random number between 0 and 1. If the random number is less than the crossover probability, the gene in the chromosome of the first parent individual is selected; otherwise, the gene in the chromosome of the second parent individual is selected.
As shown in Figure 9, chromosome 1 is derived from individuals randomly selected in the selection operation, and chromosome 2 is derived from randomly selected individuals in the parent population. Assuming that the   International Journal of Distributed Sensor Networks crossover probability is 0.65, for the first gene, the random number generated by the uniform distribution as the probability distribution function is 0.44, which is less than the crossover probability, so the first gene selection of the offspring is inherited from the first gene of chromosome 1. In the second gene, the random number is 0.72, which is greater than the crossover probability, so the second gene of the offspring is selected to inherit the second gene of chromosome 2. The latter genes in the progeny chromosomes are also generated according to this method.

Mutation Operation.
In genetics, genes mutate in the process of inheritance, producing new genes, which in turn give individuals new shapes. In the genetic algorithm, mutation operation is to simulate the phenomenon of gene mutation in genetics, which is to change a certain segment of genes in an individual's chromosomes through a certain mutation method to generate a new individual. Although it is the same as the crossover operation to generate new individuals, the mutation operation is mainly to prevent and avoid the phenomenon of local optimum or precociousness and to ensure the diversity of the population and the auxiliary crossover operation to ensure the global search ability of the algorithm. At the same time, local search within the range of excellent solutions can be realized. In genetic algorithm, mutation probability affects the performance of the algorithm. Although the mutation operation can generate new individuals, it cannot guarantee the pros and cons of the generated new individuals. If the mutation probability value is relatively large, the probability of the mutation operation to generate new individuals increases, which expands the global search ability of the algorithm but, at the same time, reduces the convergence ability of the algorithm. If the mutation probability value is relatively small, the probability of the mutation operation to generate new individuals decreases, which reduces the global search ability of the algorithm, and the phenomenon of precociousness or local optimization is prone to occur.
Genetic algorithm has the characteristics of weak local search ability, while tabu search algorithm can be used as a local search algorithm with strong local search ability, short solution speed, and fast convergence speed. Therefore, the tabu search algorithm is selected as the mutation operation of the genetic algorithm.
In this paper, mutation will be performed on all individuals in the offspring population produced by selection and crossover operations. The mutation operation process is as follows: first, for individual A, a random number between 0 and 1 is randomly generated, and the random number conforms to the average distribution. If the random number is less than the mutation probability, individual A will proceed to the next step; otherwise, keep individual A and perform mutation operation on the next individual; then, the chromosome of individual A is used as the initial solution of the tabu search algorithm, and the tabu search is performed; then, the optimal solution obtained through the tabu search is used as the chromosome to obtain the individual B, and the individual B is used to replace A; all individuals perform the previous steps and finally obtain a new population after mutation and continue to perform the genetic algorithm-related steps on the new population.

Test Practice
In order to test the HGA proposed in this paper to solve the three-dimensional offline packing problem, this paper uses the classical test data and actual container packing data to test the proposed algorithm. The proposed HGA is implemented on MATLAB and realizes three-dimensional stereo display. The proposed algorithm runs in the following configuration environment: Running software: MATLAB R2014a Operating system: Windows 7 64 bit Processor: Intel fourth-generation Core i5-4200 U dualcore Memory: Hynix 8G Hard disk: Toshiba MQ01ABF505 (500 GB/5400 rpm) The proposed HGA includes parameters such as population size, iteration times, crossover probability, mutation probability, candidate solution set size, and tabu list length. Through multiple simulation verifications, this paper chooses to set the population size to 100, the number of iterations to 100, the number of elites to 50, the crossover probability to be 0.7, the mutation probability to be 0.1, the candidate solution size to be 30, and the tabu length to be 100.

Testing Based on Classic Test Data.
To test the proposed algorithm, this paper adopts the BR data set recognized by domestic and foreign scholars. The BR dataset was proposed by Bischoff in 1995 [27,28], which contains 15 sets of data, namely, BR1-BR15; each set of data has 100 test data, and with the increase of the set number, the variety increases and the heterogeneity of data increases.
Among them, BR1-BR7 are weakly heterogeneous datasets: the cargo data consists of only a few different cargo types, BR8-BR15 are strongly heterogeneous datasets: there are many different cargo types in the cargo data, but each type is only a small amount of individual cargos. For convenience, the data in the first group of data is denoted as BRi-1; for example, the first data in the third group of data is BR3-1.
Each set of data includes a box and its size, as well as a variety of cargos of different sizes, and records the size, quantity, and supported rotation of each type of cargos. As shown in Table 3, the size of the box in the BR3-1 data is 587 × 233 × 220, and there are 8 kinds of cargos, the sizes of the 8 kinds of cargos are different, and there are respective quantities of cargos and supported rotation methods.
However, the BR dataset is designed for the single box loading problem with the goal of maximizing the output, and it is used to test the performance of related algorithms applicable to this problem. Therefore, in order to make the BR dataset suitable for the multibox feature in the 3D offline packing problem proposed in this paper, the test is performed after the number of cargos in the dataset is changed to 5 times the original number and compared with the 9 International Journal of Distributed Sensor Networks genetic algorithm, genetic simulated annealing algorithm, hierarchical heuristic algorithm, and other algorithms.

Testing Based on Weakly Heterogeneous
Data. BR1-BR7 are data with weak heterogeneity in the BR dataset. Therefore, in the testing process based on weak heterogeneous data, this paper chooses to use BR1-1, BR3-1, and BR5-10 in the BR dataset as the test data. Among them, there are 3 cargo types in BR1-1, 8 cargo types in BR3-1, and 12 cargo types in BR5-10. And when the number of cargos in the three data becomes 5 times the original data, it is compared with the genetic algorithm, genetic simulated annealing algorithm, hierarchical heuristic algorithm, and other algorithms [29][30][31].
The test results are shown in Tables 4 and 5. In the test of BR1-1 under 5 times, the algorithm proposed in this paper, the genetic algorithm, and the genetic simulated annealing algorithm can all fully load all the cargos in 7 boxes, and the hierarchical heuristic algorithm needs 8 boxes, and in the packing scheme obtained by the algorithm proposed in this paper, the space utilization rate of other boxes except no. 7 box is above 69%, and the highest is 85.6%, while the space utilization rate of the boxes in the other three algorithms is lower than that proposed algorithm in this paper. In the test of BR3-1 at 5 times, the algorithm proposed in this paper and the genetic simulated annealing algorithm can all load all the cargos in 6 boxes, while the genetic algorithm and the hierarchical heuristic algorithm need 7 boxes. In the packing scheme obtained by the proposed algorithm, the space utilization rate of other boxes except box 6 is above 72%, and the highest is 83.2%, which is better than the other three algorithms. In the test of BR5-10 under 5 times, the algorithm proposed in this paper and the genetic simulated annealing algorithm can all load all the cargos in 7 boxes, while the genetic algorithm and the hierarchical heuristic algorithm need 8 boxes. In the packing scheme obtained by the proposed algorithm, the space utilization rate of other boxes except box 7 is above 74%, and the highest is 85.3%, which is better than the other three algorithms.
To sum up, in the test of weak heterogeneous data, the HGA proposed in this paper is not only better than other algorithms in the number of boxes but also better than other algorithms in the space utilization of boxes, and the stronger the heterogeneity is, the better the packing scheme is.

Testing Based on Strongly Heterogeneous Data.
In the testing process based on strongly heterogeneous data, this paper chooses to use BR8-1, BR9-1, and BR10-1 in the BR dataset as the test data. Among them, there are 30 types of cargos in BR8-1, 40 types of cargos in BR9-1, and 50 types of cargos in BR10-1. And in the case that the number of cargos in the three data becomes 5 times, it is compared with the genetic algorithm, genetic simulated annealing algorithm, hierarchical heuristic algorithm, and other algorithms.  Figure 9: Schematic diagram of crossover operation.  The test results of the three groups of strongly heterogeneous test data are shown in Tables 6 and 7. In the test of BR8-1 at 5 times, both the algorithm proposed in this paper and the genetic simulated annealing algorithm can fully load all the cargos in 7 boxes. The packing scheme obtained by the genetic algorithm and the hierarchical heuristic algorithm needs to be 8 boxes, and the space utilization rate of the other boxes in the packing scheme obtained by the algorithm proposed in this paper is more than 78%, and the highest is 84.6%, while the space utilization rate of the boxes in the other three algorithms is lower than the algorithm proposed in this paper. In the test of BR9-1 under 5 times, the algorithm proposed in this paper can fully load all the cargos with 7 boxes, while the other three algorithms need 8 boxes. In the scheme, the space utilization rate of other boxes except box 7 is above 74%, and the highest is 85.7%, which is better than the other three algorithms. In the test of BR10-1 under 5 times, the algorithm proposed in this paper can fully load all the cargos with 7 boxes, but the other three algorithms need 8 boxes. The space utilization rate of all boxes except box 7 in the scheme is above 70%, and the highest is 83.2%, which is better than the other three algorithms.
To sum up, the test results on strong heterogeneous data are similar to those on weak heterogeneous data. The HGA proposed in this paper is not only better than other algorithms in terms of the number of boxes but also better than other algorithms in terms of box space utilization.

Testing
Based on Actual Packing Data. The actual packing case used in this paper is the actual packing data of a logistics transportation company. The company is mainly responsible for providing transportation services for enterprises in the industrial park and transporting cargos in the park to other urban logistics bases in the province. Since there are dozens of types and large quantities of cargos produced by enterprises in the park, the company needs to optimize the loading process of vehicles, reduce the number of transport vehicles, reduce transport costs, and improve transport capacity.
Logistics transportation company A needs a cargo packing plan. The overall goal is to complete the transportation of all cargos with the least number of trucks and to use the least number of trucks to complete the loading of all cargos. At the same time, the volume constraints, guillotine constraints, and load constraints must be satisfied during the loading process, such as the cargo in the truck box cannot be operated with the height limit of the truck, and the total weight of the cargo in the truck cannot exceed the weight limit of the truck; the cargo cannot be divided.
Two of the service companies of logistics transportation company A are major customers, and they are replaced by B and C, respectively. Company B mainly produces 8 kinds of cargos, and company C mainly produces 12 kinds of cargos (the relevant parameters of cargos produced by companies B and C are shown in Table 8).
The logistics transportation company A mainly uses vans. The size of the vans is 8200 × 2400 × 2400 mm, and the maximum load is 10000 kg. According to the actual transportation case of logistics transportation company A, this paper selects case A and case B as the test cases of this paper. Case A (as shown in Table 9) transports a batch of cargos produced by company B to other places. The cargo data in the case is cargos produced by company B; case B   Table 10) is to transport a batch of cargos produced by company C to other places, and the cargo data in the case are cargos produced by company C.
For case A, we use the optimization model and proposed hybrid genetic algorithm to optimize the packing. After optimization, it is obtained that 2 vehicles are required to load all the cargos in case A. In the original packing process based on workers' packing experience, three trucks are required to complete case A, and the space utilization rate of each truck is about 65%. As shown in Table 11, the space utilization rate of both vehicles is more than 80%, especially the space utilization rate of car 1 is more than 90% after using the proposed algorithm. The packing scheme obtained by the hybrid genetic algorithm reduces the use quantity of the truck by one and consequently reduces the number of trucks, fuel consumption, driver wages, maintenance, and other costs and improves the company's interests.
For case B, the optimization model and proposed hybrid genetic algorithm are used for packing optimization. After optimization, it is obtained that 3 vehicles are required to load all the cargos in case A. The space utilization rate of each vehicle in the packing plan is shown in Table 12. The compartments of vehicle 1 and vehicle 2 are filled with cargos, and their space utilization rate is more than 80%, especially the space utilization rate of vehicle 1 is 92.1%. The vehicle 3 has a small amount of cargos to be loaded, which leads a low level of the space utilization rate. The situation that the space utilization rate of vehicle 1 > the space utilization rate of vehicle 2 > the space utilization rate of vehicle 3 is due to the proposed hybrid genetic algorithm. The algorithm will give priority to loading the cargos into the frontmost compartment, so the rear compartment may not be full, which will reduce the space utilization.
According to the survey of the packing workers, case B requires 4 to 5 vehicles to load in the packing process. There is a large waste of space in the compartment of each vehicle, and the space utilization rate is about 60%. Compared with the original scheme, the proposed hybrid genetic algorithm increases the space utilization rate of each vehicle, reduces the number of vehicles required, and greatly reduces the cost of logistics transportation company A.   Table 9: The data of cargos in case A.

Conclusion
Aiming at the direction and stability of the loaded cargos, this paper designs a heuristic loading algorithm using the positioning rule of the left rear bottom corner. The HGA combining genetic algorithm and tabu search algorithm are designed to make up for the weak local search ability and slow convergence speed of genetic algorithm. In order to test the performance of the HGA, this paper uses 3 sets of weakly heterogeneous data and 3 sets of strong heterogeneous test data for testing. The algorithm can not only implement a packing scheme with a smaller number of boxes, but also more space utilization per box.

Conflicts of Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.  The serial number  1  2  3  4  5  6  7  8  9  10  11  12  The quantity of required cargos  9  16  20  17  14  15  20  8  16  18 16 10