Ant Colony Optimization for Container Loading Problem

: Problem statement: The Container Loading Problem (CLP) considers packing a subset of given rectangular boxes into a rectangular container of fixed dimensions in the most optimum way. This was very important in the logistics industries and warehousing problems, since the cost can be reduced by increasing the space utilization ratio. Approach: This problem was solved in a two-phased Ant Colony Optimization (ACO) where a tower building approach was used as the inner heuristic. In the first phase, ACO with its probabilistic decision rule was used to construct a sequence of boxes. The boxes were then arranged into a container with the tower building heuristic in the second phase. The pheromone feedback of ACO using pheromone updating rule helped to improve the solutions. Results: Computational experiments were conducted on benchmark data set and the results obtained from the proposed algorithm are shown to be comparable with other methods from the literatures. Conclusion: ACO has the capability to solve the CLP.


INTRODUCTION
The Container Loading Problem (CLP) involves loading a subset of given three-dimensional rectangular boxes of different sizes into a three-dimensional rectangular container of fixed dimensions in such a way that optimum use is made of the available container space. This problem is NP-hard and belongs to the class of combinatorial optimization problems.
The CLP can be classified in several ways based on the classification by (Dyckhoff, 1990;Wascher et al., 2007). Firstly, the problem can be differentiated in which some of the boxes given are tolerable to be left behind and in another case, the boxes given have to be completely stowed. The problem of the first type is known as a three-dimensional knapsack problem while the problem of the second type is known as a threedimensional bin-packing problem. Another kind of differentiation is based on the number of different box types. These can be defined as the homogeneous problem with one type of box only, the weakly heterogeneous problem with relatively few box types but many boxes of each type and the strongly heterogeneous problem with many different types of boxes and few boxes of each type.
The problem considered in this study is the CLP of the knapsack type with a single container which is applied on the cases from the weakly to the strongly heterogeneous problems. The CLP can be defined as: "Given a set of n three-dimensional rectangular box types j∈ {1, 2,.., n}, each with given height h j , width w j , length l j and quantity m j and a three-dimensional rectangular container with height H, width W and length L. The objective is to pack a subset of the given boxes into the container in such a way that it is optimal in terms of the available container space and additional constraints must be met where necessary".
The main aim of the CLP is to find the best Space Utilization Ratio (SUR) as formulated as Eq. 1: Where: b = Quantity of packed box V a = Volume of the ath packed box C = Volume of the container Numerous requirements must be considered to ensure the feasibility of a stowed box, such as, a box must be positioned parallel to the side wall of the container, lies completely within the container and does not overlap with other boxes. Moreover, the following constraints must be met for each stowed box.
Orientation constraint: One or two dimension(s) of the box may not be oriented in a vertical way.

Stability constraint:
The stability is calculated by the ratio of the bottom area of the above box in contact with the boxes below. It demands that the stability of all boxes does not fall below a given percentage.
The CLP has already been solved by many scholars with different heuristic and metaheuristic approaches. Examples of the numerous heuristics that had been used to solve the CLP are wall-building and layering heuristic, stack building heuristic and cuboid arrangement heuristic. Wall-building and layering heuristic was first introduced by (George and Robinson, 1980) which is to fill the container with a number of layers of boxes and had been used by (Loh and Nee, 1992;. The stack building heuristic is proposed by (Gilmore and Gomory, 1965) which fills the container with the towers of boxes. However, the cuboid arrangement is to fill the container with cuboid arrangement of similar boxes. Ngoi et al. (1994) designed a spatial representation technique to solve the CLP.
In the recent years, metaheuristic incorporated with heuristic had been widely used to solve the CLP. (Gehring and Bortfeldt, 1997) proposed a hybrid Genetic Algorithm (GA) with a stack building heuristic. First, towers of boxes will be generated by a greedy algorithm. Then the towers are arranged into the container by a GA. (Bortfeldt and Gehring, 2001) and (Moura and Oliveira, 2005) implemented the wall building heuristic in the GA and GRASP respectively. A Tabu Search (TS) with cuboid arrangement heuristic had been used by (Bortfeldt and Gehring, 1998) to solve the CLP. (Zhuang et al., 2007) used an Ant Colony Optimization (ACO) to search the solution space in the CLP and Liang et al. (2007) solved the problem with a hybrid ACO with a GA and the stack building heuristic in a two-phased method. Towers of boxes are generated by the ACO in the first phase and to arrange the towers into the container is solved by the GA in the second phase.
Since there is less attention given on the ACO for the CLP, this study aims to propose a Hybrid ACO with tower building heuristic (HACO) to solve the problem.

MATERIALS AND METHODS
Tower building heuristic: The proposed tower building heuristic is inspired by the stack building heuristic proposed by (Gilmore and Gomory, 1965) and has been used by (Gehring and Bortfeldt, 1997) and Liang et al. (2007). In the stack building heuristic, after a box is placed on the base box, this next leads to three new tower spaces which are above, beside and in front of the placed box as illustrated in Fig. 1. However, in the proposed tower building heuristic, each layer of the boxes can only lead to no more than two spaces which are less complex.
The boxes are packed by stacking them one by one according to the sequence given until the container is full. There is always a base box for each tower and the base box is oriented in such a way that the least amount of space will be wasted. The box is placed with its bottom left back corner in the bottom left back corner of the empty space. While building a tower, the boxes above are not allowed to protrude over the base box and each layer can have no more than two boxes. Figure 2 explains the flow of the proposed tower building heuristic which is illustrated in Fig. 3-6. While loading the empty space in the container, the heuristic always chooses the innermost and leftmost available empty space as the next empty space.

Hybrid Ant Colony Optimization with tower building heuristic (HACO):
The ACO was first introduced by (Dorigo and Stutzle, 2004), which is a population-based metaheuristic for hard combinatorial optimization problems. It is inspired by the foraging behavior of real ants where most ants use the shortest route from the nest to the food source after a few transitory phases. This is due to an indirect form of communication among the "artificial ants" based on a chemical substance called pheromone. The ants select the best feasible arc according to a probabilistic rule which is based on the pheromone trail level τ ij and heuristic information η ij of each arc (i, j) at each step of constructing a solution.
The higher the pheromone trail and heuristic value of the arc, the higher the probability it will be selected. The heuristic value represents a priori information about the problem or run time information provided by a source different from the ants (Dorigo and Stutzle, 2004). The ants update the "artificial pheromone" trail and its amount is estimated to be proportional to the utility of the arc which is used to build the solution. The pheromone evaporation will help to avoid a rapid convergence to a sub-optimal solution and consequently to diversify the search space. Figure 7 shows the procedure of the proposed HACO for the CLP. The procedure begins with the initialization of the pheromone trails, τ 0 . The first ant in the M ants constructs the sequence of boxes starting with a random box. At each step of constructing the sequence of boxes, the ant applies the probability function Eq. 2: Where: τ ij = Pheromone trails η ij = The bottom area of box j D = Set of boxes that have yet to be chosen to choose a box j ∈ D as the next box when the current box is box i Equation 2 is adopted from the probability function used by (Alaya et al., 2004) in the multidimensional knapsack problem. However, (Liang et al., 2007) used a different probability function, P ij * as in Eq. 3 to construct the tower set, where, η ij is the contact area between box above and box below. In this study, however, we will use η ij as the bottom area of box j when we conduct the comparison experiments in the results section Eq. 3: After the ant has built a sequence of all the boxes, tower building heuristic is applied to pack the boxes into the container until it is full. The SUR is then evaluated based on the Eq. 1. After that, the pheromone trails between the box i and box j will be reduced through evaporation at a rate, ρ by Eq. 4: where: i ≠ j and ρ= (0, 1].
Finally, the pheromone trails of the boxes that have been packed in the container are updated by Eq. 5: Each ant represents a solution and the procedure is repeated by using the updated pheromone until the termination criterion is met. The termination criterion adopted in this study is when there is no improvement in the solution for the next 2000 ants.

RESULTS
The computational experiments are conducted on two benchmark data set from the literature. The first data set consists of 15 problem instances from LN named LN1 to LN15 proposed by (Loh and Nee, 1992), each with a different number of box type and container's dimensions. The second data set contains 15 problem sets from THPACK named THPACK1 to THPACK15, each with 100 problem instances proposed by  and (Davies and Bischoff, 1999). Each problem set in the second data set corresponded to a different number of box type which are ranging from 3-100 different box types. The characteristic of the problems change from weakly to strongly heterogeneous. The proposed HACO was coded in ANSI-C using Microsoft Visual C++ version 6 as the compiler and performed on a desktop computer running on Intel (R) Core2 Duo CPU 3.0GHz with 3.0GB of RAM.

DISCUSSION
In the proposed HACO algorithm, there are some parameters to be considered. These are: i) the number of ants, M, ii) the initial pheromone, τ 0 and iii) the pheromone evaporation rate, ρ. In this study, the M is always set to be 20000 for all experiments. A preliminary experiment is conducted on a range of benchmark problem instances as to find the appropriate values for τ 0 and ρ. The tested values are: τ 0 ∈{0.5, 1.0, 2.0} and ρ∈{0.1, 0.3, 0.5, 0.7, 0.9}. The experiment is tested on the first 10 problem instances from each THPACK1 to THPACK15 by using the combinations of the parameters and also different probability functions of Eq. 2-3. Each problem instance from the combination of the parameters is ran for 5 times to find the average. The computational results are listed in Table 1 where (a) represent Eq. 2 and (b) represent Eq. 3.
Each entry in column (a) and (b) is the average value of 750 runs (i.e., 150 problem instances × 5 runs). The execution time for each entry in column (a) and (b) are approximately 2.39,1.39s respectively. The differences in the execution time for both equations are insignificant. By comparing the results in column (a) and (b), the best result is found using the Eq. 2 with τ 0 = 2.0 and ρ = 0.1. Hence, we will set the τ 0 = 2.0, ρ = 0.1 and use the Eq. 2 for the remaining of the computational experiments.
In the second part of computational experiments, we assessed the performance of the Tower Building (TB) heuristic and the HACO compared to other approaches proposed in the literatures using the two benchmark data sets mentioned earlier. Note that for the TB heuristic, the sequence of boxes that need to be packed is following the sequences listed in the benchmark data set. Table 2 shows the THPACK test problems results compared to the other methods. Note that each entry in column 5 and 6 is the average value of 500 runs (i.e., 100 problem instances × 5 runs). The values in bold represent the best results for the benchmark data set. From the results showed, the HACO is always better than TB and has better results while compared to  and . While our results cannot be compared directly with (Liang et al., 2007) who only conducted the test problems from THPACK1 to THPACK7.     Bischoff and Liang et al. Set et al. (1995) Ratcliff (1995)    Ngoi Bischoff Bischoff Liang Prob and Nee et al. et al. and Ratcliff et al. no (1992) Table 3 shows the computational results of LN test problem instances. Each entry in column 7, 8 is the average value of 5 runs. The values in bold represent the best results for the data set. Note that the packing density cannot be compared directly with the SUR because these are calculated by the basis of the smallest rectangular enclosure of the loaded boxes instead of the actual container size which usually overstates the volume utilization achieved. From the results showed, the HACO is again always better than TB and has better results while compared to (Ngoi et al., 1994;. Furthermore, the results of HACO are quite comparable with (Liang et al., 2007). Figure 8 shows a loading layout from an output of THPACK2 for problem instance number 1 which is a 5 box type problem.

CONCLUSION
This study solved the CLP by applying ACO with its probabilistic rule and pheromone feedback to hybridize with the tower building heuristic. From the computational experiments, the proposed HACO generally yield comparable results. Therefore, the developed method has the capability to solve the CLP. Future work will focus on the exploration of the probability function which might further increase the space utilization ratio.