Introduction

With the global development of digitization, technologization, and urbanization, online shopping has propelled the rapid growth of the logistics and transportation systems. For example, the global logistics market was valued at 103 billion USD in 2017, with a projected growth of 129 billion USD by 2023 at an annual rate of 3.5% [1]. However, amidst this opportunity and rapid progress, logistics and transportation systems face significant difficulties and challenges. Especially for the core field of logistics and transportation systems, namely the three-dimensional bin packing problem. The rising quantity of transported cargoes has raised the complexity and difficulty of cargo loading. According to the Pitney Bowes Parcel Shipping Index, across 13 major markets with a total population of 3.7 billion, an average of 23 parcels were shipped per person, equivalent to 2760 parcels shipped every second. Additionally, projections indicate that the global volume of transported parcels is expected to hit 200 billion by 2025 [2]. On the other hand, with the increasing variety of vehicle types for cargo transport, the company faces difficulties in efficiently selecting the optimal combination of vehicle types for delivery. For example, according to a survey by Eurostat, one-fifth of freight vehicles in the EU operate while empty [3]. These circumstances not only exacerbate traffic congestion and reduce the efficiency of cargo delivery, but also lead to increase transportation costs for the company. Therefore, it is imperative to improve the methods and technologies used in the field of three-dimensional bin packing problem to adapt to the rapid development of current logistics and transportation systems. This will improve the efficiency and cost-effectiveness of the cargo loading process.

Scholars typically employ operations research techniques to optimize the three-dimensional bin packing problem. This involves formulating a mathematical model for the three-dimensional bin packing problem and constructing the corresponding algorithms to solve the model. At present, research on the three-dimensional bin packing problem can be categorized into two subproblems: the Three-Dimensional Single Bin-Size Bin Packing Problem (3D-SBSBPP) and the Three-Dimensional Multiple Bin-Size Bin Packing Problem (3D-MBSBPP). Significant progress has been made in the research of the former [4]. Scholars are primarily focused on continuously refining the models and solution algorithms for this subproblem. For example, Martínez et al. [5] introduced two stability indicators to enhance the precise assessment of cargo stability during transportation: the number of fallen boxes and the number of boxes likely to be damaged in case of acceleration. These two indicators effectively ensure the security of cargoes in transit. Yang et al. [6] and Que et al. [7] introduced machine learning algorithms into the solution of 3D-SBSBPP.

However, with the rising quantity of transported cargoes and types of containers, the company prefers to choose the combination of container types that can reduce container usage costs and increase the rate of space utilization. Consequently, scholars have begun to focus their studies on the solution and optimization of the 3D-MBSBPP. The definition of the 3D-MBSBPP can be described as follows: given the information of a batch of cargoes, there is a group of limited container types with different sizes and costs, and therefore it is necessary to select several different types of containers, load all cargoes and meet the set goals, such as maximizing the container space utilization rate and minimizing the container usage cost. The difference between 3DSBSBPP and 3DMBSBPP is that the former uses only one type of container to load cargo. However, the latter chooses to use different types of containers to load cargo, ensuring that while making full use of the container space utilization rate, the container usage cost is reduced. The difference between 3D-MBSBPP and 3D-SBSBPP is shown in Fig. 1.

Fig. 1
figure 1

Difference between 3D-MBSBPP and 3D-SBSBPP

Currently, the study of mathematical models for the 3D-MBSBPP is primarily focused on minimizing the number or usage cost of containers used, incorporating practical constraints such as stability [8]. Hence the scholars lack extensive research on the construction of the multiple objective functions of 3D-MBSBPP. Besides, the selection of appropriate container types is crucial to ensure the efficient loading of cargo when solving the 3D-MBSBPP. However, there are fewer studies involving the selection of different container types. Existing studies have determined the type of container before the cargo is loaded [4], which may lead deficiencies in the initially designed container types as the loading of the cargo is completed. In conclusion, there are still the following difficulties in the current research on the three-dimensional bin packing problem:

  1. (1)

    The three-dimensional bin packing problem itself is a non-deterministic polynomial hard (NP-hard) problem with high complexity.

  2. (2)

    The mathematical model of the 3D-MBSBPP has difficulties in meeting the diversified needs of the company. Since the existing mathematical model of the 3D-MBSBPP is mainly based on single objective function, it has difficulties in realizing the multiple objective requirements of the company.

  3. (3)

    The timely optimization of container types presents difficulties. The adjustments of container types in the existing study are determined before cargo loading, thus making it difficult to dynamically optimize container types based on feedback from the results.

These difficulties make the study of the 3D-MBSBPP complex and challenging. Generally heuristic algorithms are mostly used to solve the 3D-MBSBPP and its design is mainly divided into two stages: construction methods stage and improvement methods stage (we will introduce them in detail in “Literature reviews”). We notice that the current methods for these two stages present certain challenges: first, for the design of methods in the construction methods stage, the primary purpose is to find suitable placements for the cargoes, thereby effectively utilizing the remaining space within the containers. However, existing construction methods still lack sufficient strategies for reducing gaps between layers and enhancing the balance of upper-layer cargo placements. Second, for the design of methods in the improvement methods stage, the current methods are deficient in local search capability and are prone to premature convergence, leading to less pronounced optimization effects on the solutions.

Therefore, in this paper, we overcome all the above difficulties and challenges. For the 3D-MBSBPP, this paper establishes a mixed-integer programming mathematical model to maximize the container space utilization rate and cargo load balance and minimize the container usage cost, and incorporates some practical constraints in the model. Meanwhile, given the complexity of the 3D-MBSBPP under study, a dynamic feedback algorithm based on spatial corner fitness (SCF_DFA) is proposed to solve the model. Our proposed algorithm consists of three components: the heuristic algorithm based on spatial corner fitness (SCF_HA), the container type selection algorithm (CTSA), and the improved genetic algorithm (IGA). Specifically, during the cargo loading stage, the SCF_HA is constructed to load the cargo. Its goals are to optimize cargo placement, reduce the gaps between the cargoes, and improve the space utilization rate. Based on the feedback of the results after loading the cargoes, we design a CTSA to dynamically adjust and optimize container types, helping the company to reduce costs, improving the space utilization rate, and enhancing the balance of container loading. Finally, we employ an IGA to optimize the container loading results generated in the first two stages, aiming to improve the quality of solutions.

In the experimental analysis, we test our algorithm on the standard benchmark instances proposed by Bischoff and Ratcliff. Compared to several state-of-the-art algorithms, the experimental results demonstrate that our algorithm can increase the average container space utilization rate by 1.79%, which confirms the effectiveness of our algorithm. Based on this foundation, the algorithm proposed in this paper is applied to solve the real-life instance for the 3D-MBSBPP. We compare the proposed algorithm with the most widely used container type selection algorithm (as the baseline method). The results show that our proposed algorithm improves the container space utilization rate by 1.48% and the loading results obtained are more balanced, indicating the superiority of our algorithm in solving the 3D-MBSBPP. Besides, to further analyze the effectiveness of our proposed algorithm, an ablation experiment is conducted. The main purpose of this experiment is to comprehensively evaluate the role of each component in the algorithm and exhibit their contribution to the performance of the algorithm.

The remainder of this paper is structured as follows. In “Literature reviews”, related works about the three-dimensional bin packing problem are analyzed. In “Construction of the 3D-MBSBPP model”, the problem statement and modeling are explained. Then, in “Dynamic feedback algorithm based on spatial corner fitness”, a detailed description of the proposed dynamic feedback algorithm based on spatial corner fitness is presented. “Computational experiments” reports the computational experiments. Finally, “Conclusion and future works” concludes the paper and provides some future work.

Literature reviews

The three-dimensional bin packing problem is characterized by high complexity and strong practical application value, which has been widely studied by scholars and numerous works in this field have been published [1, 9, 10]. The study of the three-dimensional bin packing problem can be broadly categorized into two main aspects: the construction of mathematical models and the design of solution methods. We conduct a review on the construction of mathematical models for the three-dimensional bin packing problem in “Mathematical model for the three-dimensional bin packing problem”. We review and categorize the methods for solving the three-dimensional bin packing problem in “Solving methods”, and final we summarize the literature reviews on the three-dimensional bin packing problem in “Summary of literature reviews”.

Mathematical model for the three-dimensional bin packing problem

The construction of mathematical models for the three-dimensional bin packing problem primarily includes formulating objective functions and constraints. Specifically, when formulating the mathematical model for the three-dimensional bin packing problem with a single objective function, most scholars adopt the maximization of space utilization rate as their objective function. For example, Eley [11] established an objective function dominated by the maximum volume utilization rate of the container and proposed an algorithm to form homogeneous blocks to improve the volume utilization rate of the container. Araya et al. [12] innovatively proposed a new evaluation function to rank loaded boxes to ensure that the packed boxes could maximize the use of the remaining space. The results showed that the proposed method could solve the three-dimensional bin packing problem efficiently. Oliveira et al. [13] established the maximization of the space utilization rate as the objective function, and to increase the stability of cargo loading, integrated cutting planes into the traditional branch-and-bound method to better locate the optimal positions for cargo stability. These objective functions are set for single-container type, but as for the 3D-MBSBPP, most scholars primarily focus on minimizing the number of containers used or minimizing container usage costs as the single objective function. For example, Wei et al. [4] used the minimization of total transportation costs as the objective function of the 3D-MBSBPP and designed a new parameter to estimate the gross space utilization rate of containers. Che et al. [14] based on the previous study by Eley [11], constructed an objective function for the 3D-MBSBPP that focused on minimizing the container usage costs. However, with the increase in the number of cargoes and container types, the formulation of a single objective function cannot meet the needs of the company for multiple objectives. Scholars have begun to study the construction of a multiple objective mathematical model for the three-dimensional bin packing problem. For the formulation of mathematical models with multiple objective functions, extensive studies have been conducted for single-container types [15, 16]. However, for the 3D-MBSBPP, there have been relatively fewer studies involving multiple objective functions in the mathematical model. The main reasons are that the 3D-MBSBPP is an NP-hard problem and also requires solving multiple objective functions, which makes the complexity of the model grow exponentially. The research closest to our study was conducted by Kurpel et al. [17], where they established an upper-level model to minimize container usage volume and a lower-level model to maximize container space utilization rate. They employed exact algorithms to solve the models. However, our study differs from theirs in two aspects: (i) we introduce the maximization of cargo load balance as the third objective function in the model to enhance cargo loading safety; (ii) we use a heuristic algorithm to solve the constructed model.

Regarding the constraints on the three-dimensional bin packing problem are mainly included: weight limit constraints [4, 18, 19], volume constraints [20,21,22], orientation constraints [23,24,25], and overlap constraints [26,27,28,29]. Among them, the weight limit constraints refer mainly to the fact that the total weight of the cargo cannot exceed the maximum load of the container. Volume constraints mainly ensure that the volume of the cargo placed does not exceed the capacity of the entire container. Orientation constraints have strict limitations for some cargoes, such as wine bottles and other fragile cargoes. Overlap constraints indicate the placement of cargoes without overlapping. The above are the general constraints of the three-dimensional bin packing problem. To simulate real-life packing processes more accurately, some scholars have introduced practical constraints into the mathematical models. For example, stability constraints refer to the requirement that upper-layer cargo receive sufficient support from lower-layer cargo during placement [13, 26]. Allocation constraints define those different types of cargoes cannot be placed in the same container, such as food and gasoline, they will affect each other’s quality [30, 31]. Center of gravity constraints refer that the center of gravity of the container is within the safety interval [32, 33]. Complexity constraints refer to the complexity of cargoes placement [34, 35]. However, fewer studies have been conducted on the setting of practical constraints for 3D-MBSBPP, especially for the setting of some practical constraints jointly. This circumstance makes it more challenging to meet the various constraints set by the company for the loading process.

Solving methods

The solution of the three-dimensional bin packing problem is mainly categorized into the exact algorithm and the heuristic algorithm. The latter can be widely used mainly for the following reasons. First of all, since the three-dimensional bin packing problem belongs to an NP-hard problem, the exact algorithm can only solve the small-scale instances. Secondly, when the mathematical model of the three-dimensional bin packing problem becomes complicated, the exact algorithm may fail to find a solution. Thirdly, logistics and supply chain managers require a short time to perform the cargo loading stage, while the exact algorithm needs a longer time to solve the problem. Therefore, most scholars use heuristic algorithms to solve the three-dimensional bin packing problem. By summarizing the current heuristic algorithms used to solve the three-dimensional bin packing problem, they can be primarily categorized into two stages: construction methods and improvement methods [36]. The primary purpose of construction methods is to load the cargoes into the containers, whereas improvement methods aim to enhance the quality of the solution generated in the previous stage.

For the design of construction methods, scholars mainly developed heuristic algorithms based on specific placement criteria. Among them, a classical construction method is the wall-building approach, first proposed by George et al. [37]. The core idea of this algorithm is that the available space within the container is formed by the walls created by the surfaces of the cargoes inside the container. Influenced by this concept, Pisinger et al. [38] introduced layer-building strategies. This strategy mainly involves filling the bottom layer of the container first before placing the cargoes in the second layer. However, when faced with an increasing number of cargoes, these methods could increase gaps within the container. Therefore, some scholars incorporated a preprocessing stage before employing layer-building strategies, which involved grouping identical cargoes into blocks before loading [12, 39]. The second classic construction method is the maximal-space strategy, first proposed by Lai et al. [40]. Its primary purpose is to guide current cargo placement based on the cargo arrangement within the container. On this basis, Parreño et al. [41] extended it by adding a block heuristic algorithm to better obtain cargo placement information. The last classic construction method is the corner points, first proposed by Martello et al. [42]. These corner points represent the ideal positions for placing cargoes in the space. As the cargoes are loaded into the container, the positions of these corner points are updated. Expanding on the concept of corner points, Crainic et al. [43] introduced the concept of extremal points, which are generated by projecting cargo onto the inner walls of the container or adjacent cargo surfaces. In conclusion, the primary purpose of these heuristic algorithms based on specific placement criteria is to best use the remaining space inside the container. However, as the number and variety of cargoes increase, it may lead to more significant gaps between layers, consequently reducing the performance of these algorithms.

The design of improvement methods consists mainly of some intelligent algorithms. For example, local search [44], tabu search [45, 46], ant colony optimization [47, 48], and so forth. Iori et al. [49] compared the previously proposed tabu search, guided tabu search, and ant colony optimization, concluding that the ant colony optimization exhibited the most effective in improving the quality of the solution. Based on the foundation of interval graphs introduced by Fekete et al. [50], Trivella et al. [44] incorporated multiple local search stages to optimize solutions. Ramos and Silva et al. [51] used an improved genetic algorithm to optimize the solution in the improvement stage. Additionally, to enhance the stability of cargoes during transportation, they integrated a stability evaluation strategy into the fitness function. The same authors, Ramos and Silva et al. [3] improved the previously designed fitness function by multiplying the center of gravity of the container with the density of the box as the fitness function. Eventually, they drew an important conclusion: for stable transportation, it is advisable to position the heaviest cargoes closer to the rear axle of the vehicle. The greedy randomized adaptive search procedure (GRASP) was first proposed by Moura et al. [52]. This algorithm also generates the corresponding solution from the construction methods stage and then conducts a local search algorithm to explore the neighborhood of the current solution. If a superior solution is found, it replaces the previous one. Correcher et al. [21] incorporated a ruin-and-recreate strategy into the GRASP algorithm. This strategy involves removing previous containers and generating new ones to optimize the solution. In conclusion, the primary purpose of these algorithms in the improvement methods stage is to improve the quality of the solutions. However, the high complexity of the problem and the poor quality of the initial solutions make these algorithms face the drawbacks such as poor local search ability and insignificant improvement effect on the quality of the solutions.

Because of various types of containers in 3D-MBSBPP, selecting the better combination of container types can improve the cost-effectiveness of the company. Scholars usually design a container type selection algorithm as a new stage to adjust and optimize the combination of container types. Currently, there are few studies on container type selection algorithms for the 3D-MBSBPP. Scholars primarily focus on loading cargoes into different containers with less emphasis on selecting different container types [53]. The studies closest to the container type selection algorithm we proposed were Li et al. [54], Piyachayawat et al. [55], and Han [56]. However, the container type selection algorithms they proposed had determined the type of container before loading the cargo. They were unable to dynamically adjust and optimize container types based on the results after loading the cargoes.

Summary of literature reviews

In summary, some research results have been achieved with the three-dimensional bin packing problem, but they are limited to the single-container type. There are fewer studies on the 3D-MBSBPP and the main aspects for improvement in the study are as follows.

  1. (1)

    Mathematical model construction of the 3D-MBSBPP. The mathematical model of the 3D-MBSBPP cannot satisfy the requirements of the company with multiple objectives in the loading process, such as the space utilization rate, the usage cost, and the cargo load balance. Also, the model contains fewer practical constraints.

  2. (2)

    The solution methods of the 3D-MBSBPP. For the design of algorithms in the construction methods stage, they cannot effectively reduce the gaps in the remaining space. For the design of algorithms in the improvement methods stage, these algorithms are weak in local search. For the design of container type selection algorithms, these methods lack the ability to dynamically adjust and optimize container types based on the feedback from the loading results.

Therefore, considering practical constraints in the real-life loading process, this paper establishes a mixed integer programming mathematical model to maximize container space utilization rate and cargo load balance and minimize container usage cost. A SCF_DFA is proposed to solve the model. In this algorithm, the SCF_HA optimizes the search for the remaining space. At the same time, based on the characteristics of 3D-MBSBPP, a CTSA is proposed to dynamically adjust the selection of container types. Finally, the IGA improves the quality of the solutions generated in the first two stages.

Construction of the 3D-MBSBPP model

We describe the parts included in the study of 3D-MBSBPP in “Description of the problem”, and then make some assumptions and explain the variables that will appear in the model in “Variables and symbols description”. We introduce the rules for placing the cargoes and the pretreatment before packing in “Placement rules and preprocessing of cargo”, and finally formulate a multiple objective mixed-integer programming model for 3D-MBSBPP in “Model building”.

Description of the problem

The 3D-MBSBPP studied in this paper is divided into four parts: establishing the mathematical model, determining the cargo placement state, selecting the container type, and improving the solutions. Establishing a mathematical model mainly involves the establishment of assumptions, constraints, and objective functions. The determination of the cargo placement state mainly involves finding the optimal orientation and position of cargo in the container to ensure complete use of the container’s space. For the selecting of container types, the single-container type only needed to calculate the number of containers that could be fully loaded, while 3D-MBSBPP not only needed to ensure that the cargoes were fully loaded, but also needed to optimize the container types to ensure the low cost of the combination of container types. Improving the quality of the solutions is mainly the optimization of the previously generated solutions.

Variables and symbols description

Considering the complexity of 3D-MBSBPP, it is necessary to make some assumptions before establishing the mathematical model:

  1. (1)

    The cargoes to be loaded are cuboids with a uniform texture and the barycenter coincides with its geometric center;

  2. (2)

    The extrusion of external force between cargoes is negligible;

  3. (3)

    Cargo is not allowed to be placed in suspension or an oblique position;

  4. (4)

    Cargo is not prone to deformation due to squeezing;

  5. (5)

    The length of any single cargo should not exceed the length of the container.

Table 1 shows the symbols used in the mathematical model of the 3D-MBSBPP established in this paper.

Table 1 Symbols and names

Placement rules and preprocessing of cargo

  1. (1)

    The orientation of cargo. Under normal circumstances, based on the relevant relationship between the cargo side and the container side, there are six placement methods, as shown in Fig. 2. If some cargoes have special requirements (such as not being allowed to be placed backward), determine the placement orientation according to the relevant regulations.

  2. (2)

    The placement sequence of the cargo. At present, the settings of the sequence of cargo placement mainly include descending sequence of volume size, sequence of arrival of cargo, random arrangement, and so forth. Considering that large-volume cargoes occupy more surplus space and to avoid excessive gaps caused by large volume differences between cargoes placed, this paper adopts the descending sequence of volume size for the cargoes placed.

  3. (3)

    Pretreatment of cargo. To reduce the generation of gaps in the remaining space, this paper first forms homogeneous blocks of the same type of cargo before loading. The combination of homogeneous blocks has mainly three forms, as shown in Fig. 3. Cargoes of the same type are closely arranged in a matrix. At the same time, the volume of homogeneous blocks increases with increasing construction dimension. To avoid the large volume and verbosity of the homogeneous block, which causes inconvenience of loading, method (a) in Fig. 3 is used to construct the homogeneous block.

Fig. 2
figure 2

Orientation of cargo

Fig. 3
figure 3

Three combinations of homogeneous blocks

Model building

With the objective functions of maximizing the container space utilization rate (Eqs. 1 and 2), minimizing the container usage cost (Eq. 3), and maximizing the container load balance (Eq. 4), and combined with the constraints in the actual loading process, the corresponding mathematical model of the 3D-MBSBPP is established. The specific mathematical expression is as follows:

$$ \max \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\frac{{\sum\nolimits_{i = 1}^{n} {v_{i} \alpha_{i}^{kj} } }}{{V_{kj} }}} } , $$
(1)
$$ \max \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\frac{{\sum\nolimits_{i = 1}^{n} {g_{i} \alpha_{i}^{kj} } }}{{G_{kj} }}} } , $$
(2)
$$ \min \sum\limits_{k = 1}^{c} {C_{k} \times N_{k} } , $$
(3)
$$ \max \frac{{\sum\limits_{u = 1}^{r} {S_{u} } }}{{N_{s} }}, $$
(4)
$$ \begin{array}{*{20}c} {{\text{s}}{\text{.t}}{.}} & {\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\alpha_{i}^{kj} } } = 1} \\ \end{array} , $$
(5)
$$ \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {g_{i} \alpha_{i}^{kj} } } } \le G_{kj} , $$
(6)
$$ \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {v_{i} \alpha_{i}^{kj} } } } \le V_{kj} , $$
(7)
$$ S_{u} = \frac{{x_{u} y_{u} }}{{\sum\nolimits_{p = 1}^{f} {x_{p} y_{p} } }}, $$
(8)
$$ \begin{array}{*{20}c} {x_{i}^{\prime} \times \alpha_{i}^{kj} \le L_{k} } & {y_{i}^{\prime} \times \alpha_{i}^{kj} \le W_{k} } & {z_{i}^{\prime} } \\ \end{array} \times \alpha_{i}^{kj} \le H_{k} , $$
(9)
$$ \left\{ \begin{gathered} \hfill ValX_{1}^{k} \le \frac{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {X_{i} g_{i} \alpha_{i}^{kj}} } } }}{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {g_{i} } \alpha_{i}^{kj}} } }} \le ValX_{2}^{k} \\ \hfill ValY_{1}^{k} \le \frac{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {Y_{i} g_{i} } \alpha_{i}^{kj} } } }}{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {g_{i} \alpha_{i}^{kj}} } } }} \le ValY_{2}^{k} \\ \hfill 0 \le \frac{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {Z_{i} g_{i} }\alpha_{i}^{kj} } } }}{{\sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\sum\limits_{i = 1}^{n} {g_{i} } \alpha_{i}^{kj}} } }} \le ValZ_{2}^{k} \\ \end{gathered} \right., $$
(10)
$$ l_{i}^{x} + l_{i}^{y} + l_{i}^{z} = 1, $$
(11)
$$ w_{i}^{x} + w_{i}^{y} + w_{i}^{z} = 1, $$
(12)
$$ h_{i}^{x} + h_{i}^{y} + h_{i}^{z} = 1, $$
(13)
$$ l_{i}^{x} + w_{i}^{x} + h_{i}^{x} = 1, $$
(14)
$$ l_{i}^{y} + w_{i}^{y} + h_{i}^{y} = 1, $$
(15)
$$ l_{i}^{z} + w_{i}^{z} + h_{i}^{z} = 1, $$
(16)
$$ \beta_{1} + \beta_{2} + \beta_{3} = 1. $$
(17)

Among them: Equation 5 indicates that cargo \(i\) can only be loaded into one of the containers. Equations 6 and 7 indicate that the total weight and volume of cargoes loaded in each container should not exceed the limit weight and volume of the container. Equation 8 indicates whether the total area of contact between the upper cargo and lower cargoes is greater than the set threshold \(\gamma \). Equation 9 indicates that all the cargoes loaded in the container should not exceed the length, width, and height limit of the container. Equation 10 indicates that the center of gravity of the container after it is fully loaded should be within the specified safety range; Eqs. 1116 indicate that the cargoes can be placed in six orientations. Equation 17 indicates that no overlap is allowed between cargoes.

Dynamic feedback algorithm based on spatial corner fitness

As for 3D-MBSBPP, the selection of different cargo placement positions will significantly influence the subsequent loading of cargoes and the space utilization rate within the container. Moreover, when facing multiple types of containers, the company prefers to choose the cost-effective container type combinations for transporting cargoes. For these reasons, we propose a dynamic feedback algorithm based on spatial corner fitness (SCF_DFA) to solve the 3D-MBSBPP. The proposed algorithm consists of three components: the heuristic algorithm based on spatial corner fitness (SCF_HA), the container type selection algorithm (CTSA), and the improved genetic algorithm (IGA). Among them, the SCF_HA aims to find a better placement for the cargoes, the CTSA aims to optimize the container types and reduce their usage costs, and the IGA aims to improve the quality of the solutions. The flowchart of the proposed algorithm in this paper is shown in Fig. 4 and the symbolic definitions of the relevant variables are shown in Table 2.

Fig. 4
figure 4

Flowchart of the proposed SCF_DFA

Table 2 Symbolic definition of related variables

As shown in Fig. 4, the SCF_HA is employed to load the cargoes into containers in Stage 1 and output the solutions V with fully loaded cargoes. Subsequently, based on the feedback of solutions V, a decision is made regarding whether to proceed to the second stage. Stage 2 uses the CTSA to adjust the container types within solutions V and output the adjusted solutions V'. Stage 3 adopts the IGA to optimize the solutions V' generated through the first two stages or the solutions V generated in the first stage, thereby enhancing the quality of the solutions. The optimized solutions V'' is judged to determine whether further adjustment and optimization of the container types are needed. If not needed, the final solutions \({V}_{{\text{best}}}\) is output directly. If needed, then V'' is backtracked to the second stage to adjust the container types and output the final solutions \({V}_{best}\). We introduce the SCF_HA and explain how it finds the optimal placement of cargoes in “Heuristic algorithm based on spatial corner fitness”, describe the CTSA in “Container type selection algorithm”, and specifically explain how the IGA optimizes the solutions in “Improved genetic algorithm”.

Heuristic algorithm based on spatial corner fitness

From the introduction of construction methods in “Solving methods”, it is evident that these heuristic algorithms based on specific placement criteria primarily conduct a search for placement positions within the residual space defined by the shapes of the cargoes. However, as the types and shapes of cargoes increase, the height of the remaining space is diversified. In such cases, these algorithms may struggle to effectively utilize the remaining space, consequently increasing the gaps between layers and wasting the remaining space. Besides, these construction methods lack consideration of the reasonableness of cargo placement positions. For example, when placing cargo along the Z-axis, these algorithms may fail to select positions that provide sufficient support for the center of gravity of the cargo.

To overcome the weaknesses of the existing algorithms, we propose a heuristic algorithm based on spatial corner fitness (SCF_HA) to reduce the gaps in the remaining space and ensure the balance of the upper cargo. Specifically, this algorithm divides the cargo load process into four different directions. The spatial corners in each direction mainly refer to the left bottom point in the remaining space. In the first two directions, the cargo is placed close to the inner wall of the container. In the latter two directions, the current cargo is placed in advance at each spatial corner of the remaining space, while the fitness values of these spatial corners are calculated based on different assessment operators designed for each direction. For example, when loading cargoes in the X–Y-axis direction, the assessment operators mainly calculate the fitness value of the spatial corners from two aspects: the height difference between the adjacent cargoes and the contact area between the adjacent cargoes. These two assessment operators help the cargo find the most suitable remaining space, and reduce the gaps between layers. When loading in the Z-axis direction, the assessment operators mainly calculate whether the center of gravity of the cargo is sufficiently supported and the contact area with the lower-layer cargoes. These two assessment operators ensure the balance of the upper-layer cargoes. The higher the fitness value of the spatial corner, the stronger the fit degree between cargoes with the remaining space and finally the spatial corner with the highest fitness is the best position to place the current cargo. The specific steps of the algorithm are as follows.

  1. (1)

    X-axis direction loading

    Loading in the first direction is carried out in the positive direction of the X-axis according to the sequence of cargoes placed in \({U}_{d}\). The initial spatial corner is the bottom left point of the container, the origin \({S}_{0}=(\mathrm{0,0},0)\). The loading constraints Eqs. (5) to (17) should be satisfied by the cargoes in the loading process; if the cargo \(i\) do not satisfy the container's loading constraints, it will be added to \({U}_{n}\) and traverse the next cargo \(i+1\). The position selected for loading each time is the corner where the remaining space falls on the X-axis, as shown in Fig. 5, that is, \({S}_{i}^{X}=({l}_{i-1},\mathrm{0,0})+({l}_{i},\mathrm{0,0})\). Until \({U}_{d}=\varnothing \) is satisfied, discontinue loading in the X-axis direction, update \({U}_{a}\), and assign the value \({U}_{d}={U}_{n}\). Finally, initialize \({U}_{n}=\varnothing \) and begin loading in the next direction.

  2. (2)

    Y-axis direction loading

    The loading process in the Y-axis direction is carried out in the positive direction of the Y-axis according to the sequence of the cargoes in \({U}_{d}\). The initial spatial corner is \({S}_{1}^{Y}=(0,{w}_{i},0)\), as shown in Fig. 6. Each time load the cargo at the location of the spatial corner where the remaining space falls on the Y-axis. The loading process is performed in the same manner as in (1). Until \({U}_{d}=\varnothing \) is satisfied, stop loading the Y-axis direction, update \({U}_{a}\), and assign the value \({U}_{d}={U}_{n}\). Finally, initialize \({U}_{n}=\varnothing \) and begin loading in the next direction.

  3. (3)

    X–Y-axis direction loading

    The goal of loading in the X–Y axis direction is to enable the cargo to cover the entire bottom surface while reducing the excessive gap generated when loading in the Z-axis direction and avoiding the waste of remaining space. Therefore, based on the above objectives, we design two spatial corner fitness assessment operators in the direction of the X–Y axis, which are \({\delta }_{1}^{XY}\) adjacent cargoes contact area assessment operator and \({\delta }_{2}^{XY}\) adjacent cargoes height difference assessment operator. The specific calculation formula is shown in Eqs. 1820.

    $$\begin{aligned} \delta_{1}^{XY} &= \frac{1}{n} \times \left( {\frac{{\sum\nolimits_{{d_{X} = 1}}^{n} {L_{{d_{X} }}^{X} \times H_{{d_{X} }}^{X} } }}{{l_{i} \times h_{i} }}} \right)\\ & \quad + \frac{1}{m} \times \left( {\frac{{\sum\nolimits_{{d_{Y} = 1}}^{m} {L_{{d_{Y} }}^{Y} \times } H_{{d_{Y} }}^{Y} }}{{w_{i} \times h_{i} }}} \right),\end{aligned} $$
    (18)
    $$\begin{aligned} \delta_{2}^{XY} &= \left[ {\frac{1}{n} \times \sum\limits_{{d_{X} = 1}}^{n} {\frac{{\min (H_{{d_{X} }}^{X} ,h_{i} )}}{{\max (H_{{d_{X} }}^{X} ,h_{i} )}}} } \right]\\ & \quad + \left[ {\frac{1}{m} \times \sum\limits_{{d_{Y} = 1}}^{m} {\frac{{\min (H_{{d_{Y} }}^{Y} ,h_{i} )}}{{\max (H_{{d_{Y} }}^{Y} ,h_{i} )}}} } \right],\end{aligned} $$
    (19)
    $$ {\text{Score}}_{p}^{XY} = \sigma_{1}^{XY} \delta_{1}^{XY} + \sigma_{2}^{XY} \delta_{2}^{XY} . $$
    (20)
Fig. 5
figure 5

Spatial corner in the X-axis direction

Fig. 6
figure 6

Spatial corner in the Y-axis direction

Put the current cargo i into each spatial corner, calculate the fitness value of cargo i in each spatial corner (the calculation formula is shown in Eq. 20, where \({\sigma }_{1}^{XY},{\sigma }_{2}^{XY}\) represent the weight of each assessment operator), select the corner with the highest fitness value as \({S}_{best}\) and put the current cargo into it, as shown in Fig. 7. If the cargo cannot be loaded without satisfying the constraints, it will be added to the \({U}_{n}\) set. Until \({U}_{d}=\varnothing \) is satisfied, discontinue loading in the X–Y axis direction, update \({U}_{a}\), and assign the value \({U}_{d}={U}_{n}\). Finally, initialize \({U}_{n}=\varnothing \) and begin loading in the next direction.

Fig. 7
figure 7

Cargo i placed at the spatial corner \({S}_{3}\) in the X–Y-axis direction

  1. (4)

    Z-axis direction loading

    When loading in the Z-axis direction, it is necessary to ensure that the center of gravity of the cargo is fully supported and that the cargoes between the layers have sufficient contact area to avoid the suspension of the cargo and ensure the stability of the transportation process. On this basis, two spatial corner fitness assessment operators about the Z-axis direction are designed, which are \({\delta }_{1}^{Z}\) cargoes contact area assessment operator and \({\delta }_{2}^{Z}\) current cargo center of gravity assessment operator. The calculation formula of \({\delta }_{1}^{Z}\) is shown in Eq. 21.

    $$ \delta_{1}^{Z} = \frac{{\sum\nolimits_{v = 1}^{t} {S_{v}^{Z} } }}{{l_{i} \times w_{i} }}. $$
    (21)

The position of the center of gravity of the upper cargo n may have the following three cases, as shown in Fig. 8. The first case indicates that the center of gravity of cargo n can be fully supported by the lower cargo m. The second case indicates that the center of gravity of cargo n falls on the edge of cargo m and can be partially supported. The third case indicates that the center of gravity of cargo n is not supported at all by cargo m. Therefore, \({\delta }_{2}^{Z}\) and the fitness value of the spatial corners in the direction of the Z-axis is calculated using Eqs. 2223.

$$ \delta_{2}^{Z} = \left\{ \begin{gathered} \begin{array}{*{20}c} {\theta_{1} ,} & {\text{The center of gravity of the upper cargo is fully supported}} \\ \end{array} \hfill \\ \begin{array}{*{20}c} {\theta_{2} ,} & {\text{The center of gravity of the upper cargo is partially supported}} \\ \end{array} \hfill \\ \begin{array}{*{20}c} {\theta_{3} ,} & {\text{The center of gravity of the upper cargo is not supported}} \\ \end{array} \hfill \\ \end{gathered} \right., $$
(22)
$$ {\text{Score}}_{p}^{Z} = \sigma_{1}^{Z} \delta_{1}^{Z} + \sigma_{2}^{Z} \delta_{2}^{Z} . $$
(23)
Fig. 8
figure 8

Distribution of the center of gravity of the upper cargo

Put the current cargo j in each spatial corner in turn, calculate the fitness value of each spatial corner (the calculation formula is shown in Eq. 23, where \({\sigma }_{1}^{Z}\) and \({\sigma }_{2}^{Z}\) represent the weight of each assessment operator), select the corner with the highest fitness value as \({S}_{best}\) and put the current cargo into it, as shown in Fig. 9. If the cargo cannot be loaded without satisfying the constraints, it will be added to the \({U}_{n}\) set. Until \({U}_{d}=\varnothing \) is satisfied, discontinue loading the Z-axis direction, update \({U}_{a}\), and assign the value \({U}_{d}={U}_{n}\). Finally, initialize \({U}_{n}=\varnothing \) and end loading in the current container. If \({U}_{a}={U}_{i}\), the whole loading process is terminated. If \({U}_{a}\ne {U}_{i}\), open the next container to continue loading.

Fig. 9
figure 9

Cargo j placed at the spatial corner \({S}_{5}\) in the Z-axis direction

In summary, the flowchart of the SCF_HA is shown in Fig. 10.

Fig. 10
figure 10

Flowchart of SCF_HA

Container type selection algorithm

Through summarizing and analyzing the research on the container type selection algorithm in “Solving methods”, we find that some scholars optimize the container types before loading cargoes. However, as the cargo loading is completed, the container type selection algorithms they proposed cannot dynamically adjust the container type based on the loading results, leading to a lack of timely optimization for container types. Meanwhile, in Stage 1, the SCF_HA primarily focuses on placing the cargoes into the container, without exploring and optimizing the combination of different types of containers.

Therefore, we propose a container type selection algorithm (CTSA) to optimize container types. Importantly, this algorithm can dynamically adjust and optimize the container types based on the feedback of the results after loading the cargoes, overcoming the weaknesses of the previous methods. Within this algorithm, based on the feedback from the solutions V generated in Stage 1, it is determined whether need to adjust the container types that already have been loaded. If no adjustment is required, the algorithm directly proceeds to Stage 3, which uses the IGA to optimize solutions V. If adjustments and optimizations are needed, our proposed CTSA is used to trial repair the container types and decide whether to replace the type of containers with the worst loading rate. The specific algorithm flowchart is shown in Fig. 11, and the detailed algorithm steps are as follows, where Step 1 to Step 6 denote the loading of cargoes in Stage 1.

Fig. 11
figure 11

Flowchart of CTSA

  • Step 1 Enter the information of the cargo. Based on the cargo information, construct the homogeneous blocks, and estimate the number of containers (\({B}_{N}\)). Initialize sets \({U}_{n}\), \(P\),and \({U}_{a}\), and assign the value of \({U}_{i}\) to \({U}_{d}\).

  • Step 2 Generate the container type sequence for loading cargo. In this paper, the container sequence is generated in two ways. The first way is alternately generated according to the volume of the descending sequence of the container space. In the second way, the container sequence is randomly generated to improve the diversity of solutions and avoid falling into local optimal solutions.

  • Step 3 Load the cargo according to the sequence of cargoes and the type of container. Sequentially iterate over the cargoes in set \({U}_{d}\) and determine whether cargo \(i\) satisfies the constraints in \(b\). If satisfied, search for remaining space in the container. If not, add it to the set that cannot load, update the set \({U}_{n}={U}_{n}+\left\{i\right\}\), and start loading the next cargo \(i=i+1\).

  • Step 4 Search for available space. If \(P=\varnothing \) or \({U}_{d}=\varnothing \cap {U}_{n}\ne \varnothing \), proceed to Step 5. If \(P\ne \varnothing \) and \({U}_{d}\ne \varnothing \), proceed to Step 6 to search for \(P\).

  • Step 5 Open the next container for loading according to the generated container type sequence in Step 2, initialize \({U}_{d}\) assign the value of \({U}_{d}={U}_{n}\), and proceed to Step 3.

  • Step 6 Calculate the fitness values of various spatial corners by the SCF_HA, and choose \({S}_{{\text{best}}}\) to load the cargo. The current cargo \(i\) is traversed sequentially through the spatial corners \({S}_{i}\) of the remaining placeable space in \(P\), and calculate the fitness value of \({S}_{i}\). Select the spatial corner with the highest fitness as the \({S}_{best}\) and load the cargo. Update the sets \({U}_{a}={U}_{a}+\left\{i\right\}\), \({U}_{d}={U}_{d}-\left\{i\right\}\), and \(i=\left\{i\right\}+1\).

  • Step 7 Determine whether there is currently unloaded cargo. If the set \({U}_{n}=\varnothing \) or \({U}_{a}={U}_{i}\), it means that all the cargoes have been loaded into the container and output the solutions \(V\); otherwise, proceed to Step 3 to continue loading.

  • Step 8 Extract the loading results of containers in solutions \(V\) or \({V}^{{\prime}{\prime}}\) as the optimal loading scheme \(I\), and initialize \(M=0\).

  • Step 9 Try to repair the container types with a low-loading-rate. Destroy the \({I}_{l}\), and its loaded cargoes are added to \({U}_{d}\) for reloading. Meanwhile, the type sequence of the containers is generated in the second way in Step 2.

  • Step 10 Reload the cargo. Reload the cargoes in \({U}_{d}\) and calculate the final loading scheme \({I}_{t}\).

  • Step 11 Determine the quality of the repair container. If \({I}_{t}\ge {I}_{l}\), choose the loading scheme \({I}_{t}\) of Step 10; otherwise, select the loading scheme \({I}_{l}\) of Step 9. Finally, update the total loading scheme \(I\)=\({I}_{{\text{best}}}\cup {\text{max}}\left\{{I}_{t},{I}_{l}\right\}\).

  • Step 12 Determine the container type with the worst loading rate. Determine whether the container used in \({I}_{{\text{worst}}}\) is of a large type, if so, proceed to Step 13; otherwise, proceed to Step 14.

  • Step 13 Change the container type. Change the current container size to a smaller container and reload the cargoes into the container. If all cargoes are loaded into the new type of container, it means that the container type has been successfully repaired and output \({I}_{{\text{new}}}\). If there are still unloaded cargoes, it means that the container type cannot be changed, and the output result is still \({I}_{{\text{worst}}}\). Finally, update the total loading scheme \(I\)=\(\left\{I-{I}_{{\text{worst}}}\right\}\cup {\text{max}}\left\{{I}_{{\text{worst}}},{I}_{{\text{new}}}\right\}\) and proceed to Step 14.

  • Step 14 Output the solutions \({V}{\prime}\) and determine whether \(M\) is equal to 1. If \(M=1\), directly output the final solutions \({V}_{{\text{best}}}\), otherwise enter Stage 3.

The pseudocode of the SCF_HA and the CTSA are summarized as Algorithms 1 and 2.

Algorithm 1
figure a

SCF_HA (Stage 1)

Algorithm 2
figure b

CTSA (Stage 2)

Improved genetic algorithm

Based on the literature review on solving methods in “Solving methods”, the design of algorithm for improving the solutions quality mainly consists of some intelligent algorithms. Among them, some scholars have used genetic algorithms to achieve optimization of the solutions [3, 51]. However, for the 3D-MBSBPP studied in this paper, the existing genetic algorithm (GA) is unable to effectively improve the quality of solutions. This is primarily due to the following two reasons: firstly, this paper incorporates minimizing the container usage cost as one of the constructed objective functions, which leads to the need to optimize container types during the evolutionary process to improve the solution quality. However, the existing GA primarily focuses on optimizing cargo placement state (cargo loading sequence and cargo placement orientation) and lacks the capability to optimize container types. This limitation renders the existing GA ineffective in optimizing solutions generated during the first two stages of this paper. Secondly, the three-dimensional bin packing problem itself is an NP-Hard problem with high complexity and it also involves optimizing container types. All these factors not only exponentially increase the difficulty of problem-solving but also expand the search space for solutions, ultimately causing the existing GA to be prone to premature convergence during the iteration process, thereby impacting the algorithm’s local search capability.

Therefore, to overcome the weaknesses of the existing GA and enhance its performance, this paper proposes an improved genetic algorithm (IGA). Specifically, we use a three-stage natural number coding to express the state of various types of cargoes placed in different types of containers, facilitating the algorithm to optimize both cargo loading and container types. Meanwhile, this paper designs the corresponding selection and crossover operators by combining the three-stage coding approach and proposes a new dynamic mutation operator to achieve dynamic mutation operation for different types of coding layers, enhancing the diversity of solutions. Besides, the tabu operator is added to the IGA to enhance the local search capability of the algorithm. Finally, the iteration is completed when the algorithm reaches the maximum number of iterations or the optimal solution unchanged for \(N\) successive generations, achieving the optimization of the solutions generated in the first two stages. The specific description of the proposed IGA is as follows.

Setting of chromosome coding method

In this paper, we use the three-stage natural number coding to express the state of various types of cargoes placed in different types of containers. The corresponding encoded string is represented as:

$$\begin{aligned} & \Big( S_{1} ,S_{2} , \ldots ,S_{{N_{c} }} ,S_{{N_{c} + 1}} ,S_{{N_{c} + 2}} , \ldots ,\\ & \qquad S_{{N_{c} + N}} ,S_{{N_{c} + N + 1}} ,S_{{N_{c} + N + 2}} , \ldots ,S_{{N_{c} + 2N}} \Big),\end{aligned} $$

where \({S}_{1}\sim {S}_{{N}_{c}}\) represents the serial number of the container, and the serial number of container of the same type remains consistent; \({S}_{{N}_{c}+1}\sim {S}_{{N}_{c}+N}\) represents the placement orientation of the corresponding number of cargoes in the container, and ranges from 1 to 6; and \({S}_{{N}_{c}+N+1}\sim {S}_{{N}_{c}+2N}\) represents the sequence in which the cargoes are loaded into the container.

Fitness function

Based on the space utilization rate and container usage cost, we establish the fitness function, and add the load balance constraint as a penalty function to limit the generation of infeasible schemes. The fitness function of the specific calculation formula is shown in Eqs. 2425 (including \({\omega }_{1}, {\omega }_{2}, {\omega }_{3}, {\omega }_{4}\) on behalf of the weight coefficient):

$$\begin{aligned} F & = \omega_{1} \times \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\frac{{\sum\nolimits_{i = 1}^{n} {v_{i} \alpha_{i}^{kj} } }}{{V_{kj} }}} } + \omega_{2} \times \sum\limits_{k = 1}^{c} {\sum\limits_{j = 1}^{m} {\frac{{\sum\nolimits_{i = 1}^{n} {g_{i} \alpha_{i}^{kj} } }}{{G_{kj} }}} } \\ & \quad + \omega_{3} \times \left( {\frac{1}{{P_{c} }}} \right) + \omega_{4} \times \frac{{\sum\nolimits_{u = 1}^{r} {S_{u} } }}{{N_{s} }},\end{aligned} $$
(24)

where \({P}_{c}\) represents:

$$ P_{c} = \frac{{\left( {\sum\nolimits_{k = 1}^{c} {C_{k} \times N_{k} } } \right) \times \frac{1}{{\sum\nolimits_{k = 1}^{c} {N_{k} } }} - \min \left( {C_{1} ,C_{2} ,C_{3} , \ldots ,C_{c} } \right)}}{{\max \left( {C_{1} ,C_{2} ,C_{3} , \ldots ,C_{c} } \right) - \min \left( {C_{1} ,C_{2} ,C_{3} , \ldots ,C_{c} } \right)}}. $$
(25)

Population initialization

To ensure efficient algorithm iteration and promote population diversity, the first 60% of the population is generated following specified rules, while the remaining 40% of the population is randomly generated. The specific operation for population initialization is shown in Fig. 12.

Fig. 12
figure 12

The specific population initialization operation

Selection, crossover, and mutation operators

The selection operator mainly adopts the tournament selection strategy. At the same time, to avoid the destruction of excellent solutions in the iterative process, the elite individual retention strategy is added to the algorithm. Crossover operator is primarily generated using partial crossover mapping.

In this paper, based on the type of coding layer, a dynamic mutation operator is proposed. When selecting the sequential coding layer mutation, the operator mainly randomly selects one of the following three strategies: the two-point crossover strategy, the gene exchange strategy between two points, and the multi-point rearrangement strategy. When selecting the integer coding layer, random number mutation is used, that is, \(m\) positions are randomly selected in the interval \(\left[1,n\right]\) for mutation, and \(m\) random numbers are generated according to Eq. 26. Finally, the generated random number is corrected based on the range of genes in the coding layer, to generate new genes.

$$ D_{{{\text{new}}}} = D + \left( {D_{\max } - D_{\min } } \right) \times \xi \times r, $$
(26)

where \({D}_{{\text{new}}}\) represents the newly generated gene, \(D\) represents the original gene, \({D}_{{\text{max}}}\) and \({D}_{{\text{min}}}\) respectively the upper and lower bounds of gene D, \(\xi \) represents the generation of random numbers from the interval \(\left[-\mathrm{1,1}\right]\), and \(r\) represents the step size of the change, with the value being in \(\left[\mathrm{0,1}\right]\).

Tabu operator

To enhance the local search capability of the genetic algorithm, the tabu operator is integrated. The solution at the end of the genetic algorithm iteration is used as the initial solution of tabu search for local search. The main steps are as follows.

  • Step 1 Input the neighborhood solutions to be searched;

  • Step 2 Select the neighborhood structure and set the search step size based on the input neighborhood solution;

  • Step 3 Search the neighborhood of the current solution based on the determined neighborhood structure and step size;

  • Step 4 Select candidate solutions from the new neighborhood solutions;

  • Step 5 Determine whether the candidate solution is consistent with the solution in the tabu list to avoid repeated searches for neighborhood solutions;

  • Step 6 When the optimal solution has not changed for N consecutive generations or the maximum number of iterations has been reached, it terminates and outputs the results.

In summary, the specific steps of IGA are as follows.

  • Step 1 Input the loading solutions V or \({V}{\prime}\), the parameters of the algorithm, and M;

  • Step 2 Determine the initial population pop;

  • Step 3 Selection, crossover, and mutation operations. The population is updated based on the selection, crossover, and mutation operators designed in this paper. Calculate the fitness values of the new population.

  • Step 4 Record the best individual fitness value sofarbest in each generation and the best fitness value gbest in the whole iteration process.

  • Step 5 Determine whether the termination condition of IGA is reached. If this is achieved, output the solutions and proceed to Step 6. If the termination condition of the iteration is not met, return to Step 3 and continue the iteration.

  • Step 6 Perform a tabu search. The input solutions are searched in the neighborhood and new neighborhood solutions are generated. Calculate the fitness value of the new neighborhood solutions.

  • Step 7 Select the candidate solutions. The new neighborhood solutions are sorted in descending sequence based on their fitness values, and the top 50% are selected as candidate solutions.

  • Step 8 Judge the tabu attribute of the candidate solutions. Check whether the candidate solutions appear in the tabu table, use the optimal solution sofarbest corresponding to the non-tabu object as the current solution, and replace the first object which is the first to enter the tabu table.

  • Step 9 Update sofarbest and gbest. Determine whether the termination condition has been reached at this time. If not, go back to Step 6. If so, proceed to Step 10.

  • Step 10 Output the solutions \({V}^{{\prime}{\prime}}\), M, and determine if further adjustment and optimization of the container type are needed. If needed then backtrack to Stage 2. If not needed, directly output the solutions \({V}^{{\prime}{\prime}}\) as the final solutions \({V}_{best}\).

The pseudocode of the specific procedure of the IGA is summarized as Algorithm 3.

Algorithm 3
figure c

IGA (Stage 3)

Computational experiments

This section conducts experimental analysis on the SCF_DFA proposed in this paper. We conduct a performance comparison of SCF_DFA with five state-of-the-art algorithms in “Comparison with state-of-the-art algorithms” and apply the SCF_DFA to solve the real-world instances for the 3D-MBSBPP in “3D-MBSBPP experimental analysis”. To further evaluate and analyze the performance of our proposed algorithm, the ablation experiments are conducted in “Ablation experimental analysis”. The experiments are carried out in the MATLAB R2022a environment and the algorithm parameters are set as follows: population size pop \(=\) 70, crossover probability pc \(=\) 0.8, mutation probability pm \(=\) 0.1, neighborhood search number carnum \(=\) 50, tabunum = 25, maximum iteration number gengerationmax \(=\) 500, maximum running time timelimit \(=\) 600 s.

Comparison with state-of-the-art algorithms

To demonstrate the performance of the SCF_DFA, the standard instances proposed by Bischoff and Ratcliff are selected to verify the algorithm. The instances can be obtained from the OR-Library database. This dataset consists of 7 files (thpack1 to thpack7), and each file contains 100 sets of instances. The container is an international standard 20-foot container (with dimensions of 587 × 233 × 220 cm). In these seven files, the number of different types of cargo gradually increases and the heterogeneity enhanced. Specifically, the number of different cargo types in the files is 3, 5, 8, 10, 12, 15, and 20, with each instance containing more than 100 pieces of cargo. We apply our proposed methods to solve these instances, conducting 10 random runs for each instance and calculating the average values. Besides, to validate the performance of the algorithm proposed in this paper, we compare the SCF_DFA with the following state-of-the-art algorithms published in literature:

  • GRASP: a greedy randomized adaptive search procedure approach proposed by Martínez et al. [9] (2015).

  • PRTS: a progressively-refined tree search approach proposed by Wang et al. [24] (2019).

  • TSTDE: a differential evolution algorithm combined with the ternary search tree model proposed by Huang et al. [22] (2022).

  • MDCLP: Filella et al. [1] (2022) proposed two evaluation criteria to optimize the solutions: MDCLP-B and MDCLP-S.

  • IABC: Bayraktar et al. [25] (2021) proposed three improved artificial bee colony algorithms to optimize the solutions.

The performance comparison of SCF_DFA with other algorithms are shown in Table 3. For files thpack1 through thpack3, the PRTS approach by Wang et al. [24] yields superior results. The main reason is that these files contain fewer types and a smaller quantity of cargoes, and the container can generate a tidier residual space, which facilitates the PRTS approach to solve the cargo placement. As the instances scale increase, the SCF_DFA proposed in this paper begins to demonstrate superiority. For example, in the files of thpack4, thpack5, and thpack7, the SCF_DFA obtains optimal results. Especially for thpack4, the SCF_DFA enhances container space utilization rate to 88.08%, which is 2.82% improvement over other methods. On the other hand, as the heterogeneity gradually increases, it may lead to irregularities in the residual space, thus affecting the algorithm's search for the optimal placement positions for cargo. However, as indicated in Table 3, except for our proposed algorithm and the IABC algorithm, the performance of remaining algorithms decreases with the rising cargo heterogeneity. In conclusion, it is evident from the last row of Table 3 that the SCF_DFA achieves a container's average space utilization rate of 87.39%, which surpasses that of other state-of-the-art methods and demonstrates the superiority of the proposed SCF_DFA.

Table 3 Comparison of proposed SCF_DFA with state-of-the-art algorithms

Table 4 shows the details of the results obtained by the SCF_DFA. Among them, the column labeled “Average” denotes the average value of the container space utilization rate obtained from all the instances in each file, and the column labeled “Std” denotes the standard deviation of the container space utilization rate in the file. From Table 4, it is evident that the space utilization rates of the containers fall within the range of 78–92%, with the majority clustered around 88%. Besides, the standard deviation of each instance exhibits relatively low fluctuation, indicating that the container loading results are stable and demonstrating the effectiveness of the SCF_DFA proposed in this paper.

Table 4 Experimental results of SCF_DFA

Through further analysis of the above experimental results, there are two main reasons for the superiority of the proposed SCF_DFA, as follows. Firstly, as the central component of the SCF_HA, the assessment operators are designed to minimize gaps between cargoes and improve cargo load balance. Based on these objectives, they analyze and evaluate all placeable spatial corner. This enhances the exploration capability of the algorithm for identifying the optimal placement and makes the cargoes better utilize the remaining space within the container when they are loaded. Secondly, the proposed algorithm in the previous stages can obtain higher-quality initial solutions, enhancing the efficiency of the search when optimizing solutions quality in the improved methods stage. We also make some improvements to the genetic algorithm, such as adding the dynamic mutation operator and the tabu operator, which enhances the performance of the genetic algorithm. Therefore, the SCF_DFA proposed in this paper shows significant advantage in solving the single-container type loading.

3D-MBSBPP experimental analysis

From “Comparison with state-of-the-art algorithms”, the SCF_DFA demonstrates superiority in solving the single-container type loading. When solving the 3D-MBSBPP, it needs to add the container type selection algorithm on the basis of solving the single-container type loading, realizing the corresponding adjustment and optimization of the container type. Since there is no standard instance for 3D-MBSBPP, we use the real-life instances mentioned in Han [56] for experimental analysis. The container information is shown in Table 5 and the cargo information is shown in Table 6. Among them, when a 40-foot container is fully loaded with cargo, the maximum lateral offset of the combined center of gravity is 350 mm, the maximum longitudinal offset is 100 mm and the maximum vertical offset is 100 mm. When a 20-foot container is fully loaded, the maximum lateral offset of the combined center of gravity is 350 mm, the maximum longitudinal offset is 150 mm, and the maximum vertical offset is 150 mm.

Table 5 Information of containers
Table 6 Information of cargoes to be loaded

The container type selection algorithm constructed by Han is consistent with the most widely used container type selection algorithms that we mentioned in “Solving methods”. To verify the superiority of the algorithm proposed in this paper, the container type selection algorithm constructed by Han is used as a baseline method to compare with the SCF_DFA. The algorithms are randomly run 10 times and the comparison of average performance is shown in Table 7.

Table 7 Average performance comparison of SCF_DFA with baseline method

In Table 7, the row labeled “Average space utilization rate” denotes the average container space utilization rate over 10 experiments. The row labeled “Container load balance index” denotes the standard deviation of all container loading results in each experiment, which represents the balance of the container loading results. From the average performance comparison in Table 7, under the same usage cost of containers, the SCF_DFA can improve the average space utilization rate by 1.48%. More importantly, the container load balance index of proposed SCF_DFA is 0.2115 lower than that of baseline method, demonstrating that the obtained container loading results are more balanced. It ensures equal stress inside the container and improves the safety of cargo transportation. In conclusion, these aspects collectively demonstrate the superiority of the proposed SCF_DFA in solving the 3D-MBSBPP.

To further demonstrate the performance of the SCF_DFA, the results of the fifth experiment are selected for the specific analysis. The specific results of the fifth experiment are shown in Table 8. The specific loading results are visualized in Fig. 13.

Table 8 Results of SCF_DFA in the fifth experiment
Fig. 13
figure 13

Loading diagram of each container

For the cost of using containers, if all 510 pieces of cargo are loaded, a total of three containers are needed when only 40-foot container is used, and the total cost is $ 2550. When only 20-foot containers are used, a total of five are needed, and the total cost is $ 2000. From Table 8, the results obtained through the application of our proposed algorithm indicate the need for a total of four containers: one 40-foot container and three 20-foot containers. The total cost amounts to $ 2050, demonstrating the cost-effectiveness of our algorithm in selecting container types. Also, from Table 8, it can be seen that the volume utilization rate of each container holds steady at more than 81%. The 179 pieces of cargo in the upper layer are all in a state of load balance and the actual center of gravity of each container falls within the safe deviation range.

For the 3D-MBSBPP, uneven container loading may occur. From the container load balance index in Table 7, it can be seen that the average container load balance index obtained from 10 experiments is 0.0253, indicating that the container loading results are stable. Especially from the specific space utilization rate of each container in Table 8, the SCF_DFA proposed in this paper can improve the balance of container loading. As a comparison, the container load balance index obtained from the baseline method is 0.2368, which is 0.2115 higher than the results in this paper, indicating that the container loading results obtained from the baseline method are more fluctuated. Therefore, the SCF_DFA proposed in this paper can effectively balance the loading of each container and ensure equal stress inside the container.

Through the analysis of the above experimental results, it is evident that the SCF_DFA proposed in this paper performs well in solving the 3D-MBSBPP due to the following two main reasons: firstly, the CTSA proposed in this paper can dynamically adjust and optimize the container types according to the feedback of the loading results, improving the flexibility of the algorithm. Especially during the trial repair phase of the CTSA, some containers with low-loading-rate will be replaced with new types and the cargoes in them will be reloaded. This makes the space utilization rate of each container more average and improves the balance of container loading. In contrast, the selection of the container type by the baseline method has been determined before the cargo is loaded, it may lead to irrationality in the set container type. For example, using a small type container is fully capable of carrying the remaining cargo, but a large type container is set up for loading, thus decreasing the performance of the method. Secondly, the objective function of the 3D-MBSBPP constructed in this paper is based on the container space utilization rate, the usage cost, and the cargo load balance. During the evolution process of the IGA, its fitness function also searches for the optimal solution based on these objectives. Therefore, the solutions obtained demonstrate superior performance across multiple dimensions.

Ablation experimental analysis

To further evaluate and prove the effectiveness of the SCF_DFA proposed in this paper, we conduct ablation experiments using instances from the 3D-MBSBPP in “3D-MBSBPP experimental analysis”. As depicted in Table 9, we compare the SCF_DFA with its constituent components, mainly the SCF_HA, the combination of SCF_HA with IGA, and the combination of SCF_HA with CTSA. The column labeled “Methods” denotes the comparative methods in the ablation experiments (w/o denotes that the SCF_DFA is without this component). We run each method 10 times randomly and calculate the average of the results from these 10 runs, as shown in the second column to the last column of the table.

Table 9 Comparison of proposed SCF_DFA without the components

The experimental results in Table 9 clearly demonstrate the impact of various components in the proposed algorithm on container space utilization rate and usage cost. Specifically, when only the SCF_HA is employed, it is evident from the first row of Table 9 that the results are the worst. The primary reason is that this method is primarily designed to optimize the placement of cargoes without considering the selection of container types. When the CTSA proposed in this paper is integrated into the SCF_HA, the second row shows a reduction of $ 1650 in container usage costs. Also, with optimization of container types, the container space utilization rate is improved by 18.64%. This indicates that the CTSA proposed in this paper can effectively improve the container space utilization rate and reduce usage costs. When the IGA is integrated into the SCF_HA, the third row shows an improvement of 11.13% in container space utilization rate and a reduction of $ 800 in usage costs, demonstrating that the proposed IGA effectively improves the quality of solutions generated in the first stage. However, the lack of optimization specifically for container types has caused the improvement in container space utilization rate and usage costs is not desirable. Finally, when the CTSA and the IGA are integrated into the SCF_HA, the results of the final row show a 29.38% improvement in container space utilization rate, and the usage costs is reduced by $ 2100, demonstrating the effectiveness of the SCF_DFA proposed in this paper. Importantly, it is also evident that all three components play crucial roles in improving the quality of solutions.

Conclusion and future works

The main purposes of this study are to solve the difficulties existing in the current three-dimensional bin packing problem and improve the methods involved, thereby enhancing the efficiency and cost-effectiveness of cargo loading processes. Through an analysis and review of previous research on the 3D-MBSBPP, it is found that there are still difficulties and challenges in two specific aspects: the construction of multiple objective functions and the design of the algorithms. Therefore, we innovatively construct a multiple objective mixed integer programming mathematical model aiming at maximizing container space utilization rate and cargo load balance while minimizing container usage costs. Secondly, we introduce an innovative dynamic feedback algorithm based on spatial corner fitness (SCF_DFA) to solve the 3D-MBSBPP. This algorithm improves the previous algorithm in terms of the rationality of the cargo placement position, the search of the remaining space, and the dynamic adjustment of the container type, assisting the company in improving container space utilization rate and reducing usage cost.

Specifically, during the construction methods stage, we propose a heuristic algorithm based on spatial corner fitness (SCF_HA) to load the cargoes. Its purposes are to select the optimal positions to place the cargo and to reduce the generation of gaps in the remaining space. Subsequently, after loading the container, based on the feedback from the loading results, we use the container type selection algorithm (CTSA) proposed in this paper to adjust and optimize the container types dynamically. This stage aims to reduce usage costs and improve container space utilization rate. Finally, during the improvement methods stage, we apply an improved genetic algorithm (IGA) to improve the quality of solutions generated in the first two stages. Comparative experiments with other state-of-the-art algorithms reveal that the SCF_DFA proposed in this paper can improve the space utilization rate by 1.79%, demonstrating its superiority and effectiveness. On this basis, the SCF_DFA is apply to solve the real-life instances of 3D-MBSBPP, and the final results show that the average space utilization rate of the containers remains at 85.38%, which is improved by 1.48% compare with the baseline method. The SCF_DFA can also improve the balance of container loading and ensure equal stress inside the container. Thus, it indicates that the SCF_DFA we proposed exhibits a certain superiority in solving the 3D-MBSBPP. Besides, to further evaluate and prove the effectiveness of the respective components of the algorithm, ablation experiments are conducted. The results show that each component in the algorithm plays a crucial role in improving the quality of solutions.

In future, we will conduct further research on 3D-MBSBPP based on the study in this paper, mainly including the following aspects: (i) Incorporating more practical constraints. For example, we will incorporate cargo fragility and extrusion constraints into the mathematical model. This aims to provide a more realistic simulation of the loading process in real-life scenarios. (ii) Exploring the identification of similar cargoes. We will try to use the clustering algorithm to identify and combine similar types of cargoes. (iii) Improving the algorithms proposed in this paper. In the construction methods stage, we will add more assessment operators for the spatial corner. In the container type selection algorithm, we will incorporate some perturbation solutions to better optimize the container types.