# Solving the Container Relocation Problem by Using a Metaheuristic Genetic Algorithm
## 5 Results and Discussion  
The experiment was run on a 64-bit Windows 10 operating system with an Intel(r) Core(tm) i5-8265U CPU 1.60 GHz processor and 8 GB of RAM. The method described above was implemented in Java using the integrated development environment (IDE) NetBeans 11.3. Additionally, the Java Genetic Algorithm and Programming (JGAP) library [45] was used to implement the genetic algorithm in this programming procedure. The method was tested with different parameter values within the genetic algorithm to find the best possible setup of the genetic algorithm to obtain the highest quality solutions in the shortest possible time. The best possible setting of the genetic algorithm had the following parameter values: the number of generations was 300, the size of the population of each generation was 100, the mutation probability was 0.05, and elitism (the best possible solution from the previous generation is automatically included in the next generation) was set, and the percentage of chromosomes from the previous generation that is included in the next generation was 0.5. The small number of chromosomes in each population (100) allows very fast execution of the genetic algorithm. However, to obtain high quality solutions (chromosomes), the number of generations must be increased, as well as the percentage of the crossover probability which, in addition to mutation, allows a diverse searching of solution space for CRP. Half of the chromosomes (solutions) of the previous generation are included in the process of the next generation of genetic algorithm, so such selection ensures that quality solutions are included in the search process along with the newly randomly generated solutions of the next generation. All parameters of genetic algorithm and their values are given in Table 1.  
Figure 11: The mutation process example. The method was tested on a test set of restricted CRPs described in [24]. As mentioned before, this test set consists of a large set of CRPs considering different bay sizes. All CRPs in this test set contain the maximum possible number of containers (maximum occupancy) within the bay considering the bay size of a given CRP. The maximum occupancy makes it difficult to solve the problem given the large number of blocking containers, so this test set is the most relevant test set for evaluating models that solve the CRP. The total number of containers stacked in the bay is obtained from the expression in [24]:  
\[\text{N}=\text{W}\times\text{H}-(\text{H}-1) \tag{2}\]  
where N is the total number of containers stacked within a bay, W is the total number of stacks (columns) in a bay, and H is the total number of tiers in a bay. The maximum occupancy is obtained by subtracting the (H \(-\) 1) from W \(\times\) H. The value (H \(-\) 1) is the largest number of relocations to retrieve one container if a stack is full (contains H containers) and the container, that needs to be retrieved, is blocked by (H \(-\) 1) containers within that stack, i.e., it is positioned at the bottom of the stack. In this way, there is always a sufficient number of free container positions (slots) to which blocking containers can be relocated. The experiment was performed for the following bay sizes: 3 \(\times\) 7-6 \(\times\) 7, 3 \(\times\) 6-6 \(\times\) 6, 3 \(\times\) 5-6 \(\times\) 5, 3 \(\times\) 4-6 \(\times\) 4, 3 \(\times\) 3-6 \(\times\) 3. The test set in [24] consists of 40 different problem instances for each bay size. The maximum tested bay size (6 \(\times\) 7) corresponds to the specifications of the latest technological RTG cranes in regard to the actual sizes of bays. Therefore, the tiers' parameter assumes a value from 3 to 6 while the stacks' parameter assumes a value from 3 to 7. The results obtained with the proposed method were compared with the other best models applied to this test set. In Table 2, the results obtained by the proposed method are compared with those obtained by the other authors who achieved the most significant results with this test set.