Fast Non-dominated Sorting in Multi Objective Genetic Algorithm for Bin Packing Problem

The bin packing problem is a problem where goods with different volumes and dimensions are put into a container so that the volume of goods inserted is maximized. The problem of multi-objective bin packing is a problem that is more commonly found in everyday life, because what is considered in packing is usually not only volume. In this research, a multi-objective genetic algorithm is proposed to solve the multiobjective bin packing problem. The proposed genetic algorithm uses non-dominated sorting and crowding distance methods to get the best solution for each objective and to avoid bias. The algorithm is then tested with several test classes that represent different combinations of item and container sizes. From the results of the tests carried out, it was found that the proposed algorithm can find several solutions which are the best candidate solutions for each objective. Also found how the correlation of each objective in the population. Keywords—Genetic algorithm, bin packing problem, multi objective, multi solution, nondominated sorting ◼ ISSN (print): 1978-1520, ISSN (online): 2460-7258 IJCCS Vol. 16, No. 1, January 2022 : 55 – 66 56


INTRODUCTION
The bin packing problem is a problem where goods with different volumes and dimensions are provided, then these goods must be put into a number of containers (bins) so as to maximize the volume used [1] . There are many variations of the bin packing problem, for example 2D packing, linear packing, and 3D packing. This bin packing problem in computational complexity theory belongs to the NP-Hard problem and is difficult to solve [2] .
There are many approaches used by various researchers in solving the bin packing problem with a single objective. [3] solved the multiple bin packing problem with a single objective using the mixed genetic algorithm method with the heuristic packing method using the deepest bottom left first. [4] proposed an algorithm to solve the three-dimensional multiple bin packing problem. The proposed method is to use mixed integer programming and tabu search combined with sub-volume based heuristics.
There are research that uses evolutionary algorithm to solve the multi objective bin packing problem. The existence of this multi-objective problem is due to the fact that in everyday life, in arranging goods into containers, sometimes what is taken into account is not only the use of volume, it can also be taken into account the weight or value of the goods. In a study conducted by [5] , a multi-objective genetic algorithm was used to determine the solution for the arrangement of goods in containers. In the study by [5] , three objective functions were used, namely the number of goods, the weight of the goods, and the volume of goods. [6] solved multi objective bin packing problem using discrete particle swarm optimization method to find the order and rotation of packing goods, while binary space partitioning was used for container arrangement. [7] conducted a study to solve the single container loading problem with two objective functions, namely the value of goods and the use of space in the container. Here [7] using a multi-objective multipopulation genetic algorithm and supported by a fuzzy logic controller to optimize the genetic algorithm parameters used. [8] proposed a solution using particle swarm optimization. The objective that is trying to be solved is to minimize the use of containers, and optimize the center of gravity according to preferences. Some research did not use the evolutionary algorithm to solve multi objective bin packing problem instead using non heuristic approach. [9] carried out research using the greedy method, using a layer-based approach. The objective function that is taken into account is the number of bins used to minimize and balance the weight of each bin. [10] uses the greedy bottom left fill and bottom-up left-justified methods. The objective function that is calculated is the same as the research by [9] , namely the number of bins used and balancing the weight of each bin.
In [11] a genetic algorithm with non-dominated sorting method was found that can be used to obtain a set of solutions that are superior to other solutions of a multi-objective problem. This set of solutions is known as non-dominated solutions or Pareto optimal solutions. By using this non-dominated sorting method, there will be no bias in the selection process and the results of the genetic algorithm are in the form of a set of solutions (Pareto optimal solutions) not just one solution.
In this study, a genetic algorithm with a non-dominated sorting method was used which was adopted from the research of [12] which is the development of research by [11] . The method used is coupled with a strategy called crowding distance which makes the solutions on the Pareto front more evenly distributed. The objective function used in this research is to maximize the weight of the goods, maximize the use of space, and balance the weight of the bin.

METHODS
In this section, we will discuss how the proposed algorithm works. It will also explain how the algorithm can produce a solution for each objective.  Figure 1 above is a flow chart of the algorithm that will be used in this study. In this study, the input of the algorithm is a box list that is generated randomly, then the output of the algorithm is a set (pareto optimal solution) which contains the order of packing of the box list into a bin. The algorithm built in this study uses a genetic algorithm. The next section will explain in more detail step by step the algorithm that will be used.

1.1 Box list generation
The box list generation is divided into several classes , each of which has a different percentage of the number of small, medium, and large boxes described in Table 1.
,w ,h ,ψ denotes the length, width, height, and weight of the box. The box list will be generated randomly with the percentage rules for the number of types of box type in Table 2.

1.2 Chromosome coding
If is the number of boxes, then the solution is encoded with a representation in the form of a string s=s 1 ,s 2 ,...,s ,s n+1 ,s n+2 ,...,s 2 . Genes in the sequence 1 to contain number markers in the box, while the sequence states the order of packing into bins. While the genes in the sequence n+1 to 2 represent the rotation of the box in the same order. The rotation value is 1 if the box is rotated 90° with respect to the horizontal plane, and is 0 if no rotation is carried out. Table 3 is an example of chromosome coding.

1.3 Population Initialization
The initialization process is carried out by generating a solution with a random packing sequence and rotation.

1.4 S-DBLF Packing
Simple Deepest Bottom Left with Fill (S-DBLF) is a packing method that has been proposed by [13] . In the S-DBLF method, it tries to pack into the first available and valid place with the DBL sequence. Packing can be said to be valid if it meets the following conditions. a) Box does not exceed the size limit of the bin. b) Boxes do not intersect with other boxes. c) The box does not hang, meaning all the space under the box to be placed must be filled by another box. Figure 2 is the pseudocode of the S-DBLF packing method.

1.5 Objective Function and Fitness Evaluation
In this study, three objective functions and fitness function will be used. The following is an explanation of the three objective functions and the fitness function. Below is an explanation of the variables that will be used in the calculation of the objective function and the fitness function. The bin's center of gravity is on the x-axis. The bin's center of gravity is on the y-axis.

Volume utilization
The fitness function and the objective function for volume optimization aim to maximize the use of space so that there is less free space in the bin. Equation 1 is the fitness function for the volume utilization. While equation 2 is an objective function for the volume utilization.

Total box weight
The fitness function and objective function for the total weight of the box aims to maximize the weight of the items packed into the bin. In this fitness function, the total weight of all items that packed to the bin is calculated. Equation 3 is the fitness function for the total weight. While equation 4 is the objective function for the total weight.

Bin balance
The fitness function and objective function for bin balance aim to make the center of gravity of all items that packed to the bin as close as possible to the midpoint of the bin to the horizontal plane. To calculate the proximity, a calculation using the Euclidean distance from the center of gravity of all items combined with the midpoint of the bin is used. Equations 5, 6, 7, and 8 are the fitness functions for the bin balance. While equation 9 is the objective function for bin balance.

1.6 Fast Non-dominated Sort (FNDS)
The fast non-dominated sorting algorithm proposed by [12] , Figure 3 is the pseudocode of the fast non-dominated sorting algorithm.
procedure fast-non-dominated-sort(P): P = population ni = domination counter of solution i Fi = i-th front P-rank = pareto ranking begin for each p ∈ P do

1.7 Crowding Distance Calculation
The crowding distance calculation algorithm proposed by [12] . Figure 4 is the pseudocode of the crowding distance calculation. procedure crowding-distance-assignment(F): F = a pareto front begin l = |F| Figure 4 Crowding distance calculation pseudocode

1.8 Parent Selection (Tournament Selection)
The type of tournament selection that will be used is binary tournament selection, where two chromosomes will be selected at random and then compared which one is better. Two chromosomes compared to which one has the smaller pareto front. If they are the same, the one with the larger crowding distance will be chosen.

1.9 Crossover
The type of crossover used is the PMX crossover. The number of offspring resulting from this crossover process is . Each parent pair will produce one offspring, so the crossover process will be performed times.

1.10 Mutation
The mutation process is done by generating a random value between 0-1, and then. a) Swapping the packing order at random if random number less than 0.5. b) Reverse the rotation of a box randomly otherwise.

1.11 Generation Update
After the genetic process, 2 individuals will be obtained. Then best individuals will be selected in the order as in the parent selection process.

1.12 Stopping Criteria
The algorithm will be terminated when the specified maximum number of generations is reached.

1.13 Solution Selection
There are 4 solutions selected from the final population, namely the solution with the largest fitness volume, the solution with the largest weight fitness, the solution with the smallest box balance fitness, and the solution with the largest total fitness normalization. Equation 10 is the for calculating normalized fitness.

RESULTS AND DISCUSSION
In this section, we will discuss the tests that have been carried out on the classes that have been described previously. In this test, algorithm performance, algorithm parameters, and the correlation between objectives will be discussed. For each class will be tested against various pairs of parameters as well as the number of boxes and bin size large or small. The small bin size is the minimum size to place 50 boxes, while the large bin size is the minimum size to place 100 boxes. Each parameter pair will be tested 10 times then averaged.

Algorithm Performance
Based on the data in Table 4 the algorithm in this study runs best according to its fitness in class 1 which contains 100% small size boxes. While the worst performance of the algorithm occurs in class 3 which contains 100% of large boxes. Classes that have large box compositions all occupy the last few rankings. Class 7 is ranked 4th with a composition of 50% medium-sized boxes and 50% large-sized boxes. Then class 4 ranks 5th with a composition of 33% small boxes, 33% medium boxes, and 33% large boxes. Class 6 is ranked 6th with a composition of 50% big boxes and 50% small boxes. Then the other 2 classes that do not have a large box composition are ranked 2 and 3. At rank 3 there is class 5 with a composition of 50% small boxes and 50% medium boxes. Class 2 is ranked 2nd with a composition of 100% medium-sized boxes. Class ranking if it is not viewed from its fitness, but from each objective, the ranking obtained is also similar to a difference of 1-2 ranks compared to the ranking for its fitness. If the performance of the algorithm is viewed from the number of boxes and bin size pairs in Table 5 for fitness, volume, and density in the 50-small and 100-big pairs the results are not much different. The difference is in the center of mass, for the 100-big pair it is worse than the 50-small pair. As for the 100-small pair, it is better for all objectives, this shows that the algorithm has succeeded in selecting the box so that the objective value is better. As for the fitness in the 100-small pair, it tends to be smaller because the fitness divisor calculation on the weight objective is dynamic.

Genetic Algorithm Parameters
When viewed from the type of class in Table 6, for all classes, both mode and median, the best population size data is 100 individuals. For the number of generations in both the mode and median parameter data, the best is 500 generations with different classes being class 5 with 300 generations. Of the 7 classes, there are 6 classes that have a mode of the number of generations of 500 and also a median of 500 or 450 which indicates half or more of the data has a number of generations of 500 because the number of generations of 500 is the largest value of the 5 values of the number of generations tested. As for the mutation probability parameter, the best parameter for the majority of classes is 10%. Of the 7 classes, there are 5 classes with a mode of 10% and also a median of 10% which indicates half or more of the data has a mutation probability of 10%. Table 6 The best genetic algorithm parameters by class When viewed from the type of solution in Table 7, both the mode and the median have the same value. To get the type of solution with the best fitness, volume, and center of mass, genetic algorithm parameters are used for population size of 100, number of generations of 500, and mutation probability of 10%. To get the type of solution with the best weight, the parameters of the genetic genetic algorithm are population size 100, the number of generations is 500, and the mutation probability is 5%. For each type of solution, the number of generations parameter has a mode of 500 and a median of 500 which indicates half or more of the data has a number of generations of 500. Meanwhile, of the 4 types of solutions, there are 3 types of solutions that have a mutation probability mode of 10% and a median of 10% also which indicates half or more than the data has a mutation probability of 10%.  Table 8 shows the best genetic algorithm parameters when viewed based on pairs of box count and bin size. Almost all of the data obtained for the mode and median use population size parameters of 100, number of generations of 500 and mutation probability of 10%. The median value equal to the mode indicates that half or more of the data use the genetic algorithm's parameters. There is only one median difference in the 100-big pair with 400 generations.  Table 9 shows the correlation between the objective pairs by class. In class 4-7 the correlation for the volume-weight pair is close to 0 which indicates there is no correlation between the two objectives. Whereas in the objective pair of volume-center of mass and weight-center of mass there is a positive correlation which means that the greater the volume/weight value, the greater the center of mass value. This positive correlation means that if the volume/weight is getting bigger (improved) then the objective value of the center of mass is getting bigger which means it is getting worse because the objective of the center of mass is to minimize its value. When viewed in class 1-3 there is a positive correlation in the objective pair of volume-weight, whereas in the objective pair of volume-center of mass and weight-center of mass the same as in class 4-7 there is a positive correlation. It can also be noted that in class 1-3 the composition of the box consists of only one type of box, while in class 4-7 the composition is mixed. If the correlation between the objectives is seen from the data in Table 10 which shows the correlation between the objectives based on the type of solution, the correlation values generated for each pair of objectives tend not to differ much. For the three objective pairs there is a positive correlation, where the volume-weight pair has a correlation value that is not as large as the other pairs.  Table 11 shows the correlation between the objective pairs when viewed from the number of boxes and bin size pairs. For the volume-center-of-mass pairs for all pairs of box count and bin size there is a positive correlation, the objective pair of weight-center of mass also has positive correlation. Meanwhile, for the volume-weight objective pair, there is only a positive correlation in the 50-small and 100-big pairs, while in the 100-big pair the correlation value is close to zero. This might happen because the box selection has been optimized so that the volume and weight objectives are no longer correlated, and what remains is the box settings in the bin. From the research that has been done, several conclusions were obtained. The algorithm proposed in this study succeeded in finding several optimal solutions by considering three different objectives. The optimal solution for each objective is found and there is no bias towards a single objective in the final population. The algorithm works best on small box types and worst on large boxes for cube-shaped bins. The best genetic algorithm parameters in general to produce the most optimal solution are population size of 100, number of generations of 500, and mutation probability of 10%. There is a positive correlation in the objective pair of volume-center of mass and weight-center of mass. Meanwhile, the volume-weight pair is also positively correlated but its value tends to be closer to zero.

Correlation Between Objectives
In this research there is still much that can be done to improve it in the future. First, the algorithm can be tested on bins with shapes other than cubes. Then it can be tested for mutation probability above 10%. After that, the weight objective can be given a maximum value limit that can be entered into the bin so that when calculating fitness it can be divided by a non-dynamic divisor so that the test is more measurable.