A Hybrid Greedy Algorithm and Simulated Annealing for Single Container Loading Problem: A Case Study

A single container loading problem is a problem to effectively load boxes in a threedimensional container. There are many researchers in this problem try to find the best solution to solve the problem with feasible computation time and to develop some models to solve real case problem. Heuristics are the most method used to solve this problem since the problem is an NPhard. In this paper, we introduce a hybrid greedy algorithm and simulate annealing algorithm to solve a real container loading problem in one flexible packaging company in Indonesia. Validation is used to show that the method can be applied practically. We use seven real cases to check the validity and performance of the model. The proposed method outperformed the solution developed by the company in all seven cases with feasible computational time.


Introduction
Container loading problems sometimes are called the packing problem, have been explored by many researchers since it plays important roles in logistics. There are some container loading problems have been explored to deal with problems in practice since there are many constraints should be considered such as constraint related with a container, item, cargo, positioning, and load (Bortfeldt and Wascher [1]). One type of container loading problem is a single container loading problem. The single container routing problem is a packing problem where a set of boxes are arranged to be put in a three-dimensional container with objectives to maximize space utilization. Araya and Riff [2] used beam search strategy to solve a single container outing problem and claimed their method outperform some preceding methods such as Zhu and Lim [3], Zhu et al. [4], Goncalves and Resende [5] and Fanslau and Bortfeldt [6].
There are some variations of a single container loading problem. Lim et al. [7] developed a heuristic model to solve a single container loading problem with axle weight constraints that are applied in the California Vehicle Code (CVC). Wang et al. [8] developed a single container loading problem by consideringing shipment priority that is common in a real situation. The research focus on a single container loading problem is not only about problem variations but also methods to solve the problem. some researchers try to find the best solution with Container loading problems are generally modeled as a mathematical program such as a mixed integer linear programming (MILP) formulation proposed by Chen et al. [9]. However, the MILP is efficient only for small problems. Huang et al. [10] proposed an effective heuristic method to solve 3D container loading problem for solving the formulation developed by Chen et al. [9]. There is feasible computation time. Huang and He [11] used a heuristic caving degree approach to solve a single container loading problem. Zhu and Lim [3] solved a single container loading problem by modifying a greedy algorithm. A heuristic method to solve a single container loading problem was developed by Araya and Riff [2] and they called the method as VCS. Most research used a heuristic approach to solve a single container loading problem and no one used a metaheuristic method. However, some metaheuristic methods are used to solve container loading problem such as Tabu Search (Liu et al. [122]). In this paper, we try to develop a hybrid heuristic and metaheuristic method to solve a single container loading problem and apply the method to one flexible packaging company in Indonesia. The hybrid method is applied to get efficient computation time and effective result. This paper is presented in four sections. The first section present background of the paper, the second section show model and solution development, section 3 shows the application of the solution to a real case on a company and the last section give the conclusion of this research.

Mathematical Model
Referring to Chen et al. [9] and Huang et al. [10] the model studied in this paper can be stated as follows: n : Total boxes to be loaded The Mixed Integer Linear Programming (MILP) from Huang et al. [9] is: The fitness function is minimizing container length to pack all the boxes.
In the first constraints, all boxes can't overlap.
In the third constraint, the length, wide and high of box i only parallel with one axis x, y, and z.

Greedy Algorithm
The model is an NP-hard model; therefore Greedy Algorithm and Simulated Annealing are used to solve the model. In the first step, we group pallets with the same size to set the height of stacks are not more than the height of a container. We use a greedy algorithm to solve the first step as follows: 1. Sort boxes from the largest size 2. Choose a box with the largest size, put it in the first level, and add one box with the same size and put it above the first box. 3. Check the total height, if the total height is less than the container height than choose one box with the same height and put it on the next level. 4. Continue step 3 until no boxes can be put above other boxes. 5. Find a new box with the largest size and continue with step 1. 6. Choose one box with the same size and less height and goes to step two. 7. Continue steps one to six until all boxes have been stacked.

Simulated Annealing
Simulated Annealing (SA) algorithm used in this problem is a simple SA algorithm as shown in Figure 1.

Encoding Method
Encoding method represents the solution to the problem. The solutions are coded into row strings where the first row represents the loading sequence into a container and the second row represents the position of the boxes and represented by a binary number. An example of the strings is shown in Figure  2. Figure 2 shows the first box loaded is box number 2, the second box is box 4 and so on. In the second row shows the rotation of the box where 1 represent the length of a box follows -axis and 1 if the length of the box follows -axis.

Fitness Function
A fitness function is a criterion that must be optimized. In this paper, we try to minimize the area of the unoccupied container. The fitness function is equal to the total wide of a container minus the total area of the boxes loaded in the container. There is a possibility that the solution is not feasible since the total width or the total length of loaded boxes are bigger than the container's width and length. When a feasible solution cannot be found then we set the fitness function as a big number.

Generation Mechanism of Neighbourhood Solution
Generation mechanism of neighbourhood solution is a mechanism to generate a new solution in each iteration. The generation mechanism in this paper is as follows: 1. Choose one position randomly and insert to any new position randomly 2. Check feasibility of the solution, when the solution is not feasible to change the position from 0 to 1 or from 1 to 0. 3. Try step 2 until a feasible solution is found. When a feasible solution still cannot be found, set fitness function with a big value.

Acceptance Criteria for the Neighbourhood Solution
The following criterion is used to evaluate whether a neighbourhood solution is accepted as a new solution or not.
∆= − * (22) where S is a new solution generated by neighborhood scheme and S is the old solution before neighborhood scheme is employed. When ∆ is negative then the new solution is better than the old one, but when ∆ is positive, there is a possibility for the new solution to be accepted with certain probability. The acceptance probability can be represented as Eq. 23.
where: = temperature at iteration-The next step is generating a random number where 0 < < 1. When is less than then a new solution is accepted, otherwise the new solution is rejected.

Temperature updating scheme
The temperature updating scheme used in this paper is the commonly geometric updating scheme as shown in Eq. 24.

Stopping Criteria
The simulated annealing algorithm is stopped when the temperature ( ) is less than a specific temperature defines in advanced.

Results and Discussions
The model is used to solve a problem at one flexible packaging company in Indonesia. There are seven cases are used to verify and validate the model. The simplest case is case 1 and the most complicated case is case 7, as shown in Table 1 and 2. Table 1 and are the result of the Greedy Algorithm. For example in Table 2 pallet number 28 is stacked above pallet number 27 and both pallets becomes one group pallet. Pallet number 15 cannot be stacked above pallet 14, since the total height is more than the container height. One pallet can be stacked with other pallet and become one group pallet if they have the same length and width.
The good solution of simulated annealing is determined by right parameters setting which is consist of initial temperature, stopping temperature, k, and the number of replication. The program is run under Macro software in OS Windows 8.1 64-bit with processor Intel(R)Core(TM) i5-4590 CPU @3.30GHz and RAM 4,00 GB. We use four parameters set as shown in Table 3. The result of the four parameters set is shown in Table 4.  Table 4 shows the best solution in case 1 to 6 for the four parameters set are the same and parameters set 4 giving the best solution for case 7. Running time for parameters set 1 and 3 significantly faster than parameters set 2 and 4. Parameters set 1 result in convergence solutions in 6 cases, parameters set 2 in 2 cases and parameters set 3 and 4 in 7 cases.
Therefore, we choose parameters set 3 since the parameters set is the best for running time and convergence. Even though the solution quality is less than solution quality or parameters set 4, the difference is not significant. The solution for seven cases for every temperature is shown in Figure 3.
We validate the model result with company's loading method and the unused area is shown in Table 5. Table 5 shows that our method has bigger unused area compare with the company's method for all cases. Since in average palette size is 1 m 2 , then we cannot add more pallet for cases 2, 3, 5, and 6. Using our method, we can add more pallet for cases 1, 4, and 7.

Conclusion
In this research, a hybrid greedy algorithm and a simulated annealing is developed to solve a single container loading problem in one company. Since some parameters are crucial to get efficient and effective solutions, we try four parameter sets and find the best parameters set. The method is validated using seven different cases form the company and the result is compared with the company's solution. The proposed methods outperform company's solution in seven cases with feasible computation time.
The paper can be extended by considering some real constraints that have not been considered in this paper. For example, some buyer asks the weight of the container should be not too much difference between the front, middle and back area.