# An Item Retrieval Algorithm in Flexible High-Density Puzzle Storage Systems
## 4 Analysis and Results  
### Simulation Results  
In this section, we investigate how the number of empty/white cells and the puzzle size affect the number of movements needed to retrieve black cells. We developed an object-oriented program to simulate more than 50,000 iterations using different puzzle configurations. As Figure 13 shows, we first generate a puzzle with a specific size and number of empty cells. Then, we randomly place the white cells, three black cells and a retrieval point into the puzzle. Finally, we take the average of the number of movements we need to retrieve each of the black cells. In each iteration, we randomly change the locations of the white and black cells. After 100 iterations, we find the average retrieval movement (ARM) for each one of our puzzle configurations. To illustrate the simulation process, consider a 6 \(\times\) 6 puzzle which includes 18 white cells. Figure 14 shows the average number of movements needed for each iteration. For instance, in iteration 34, we have the lowest number of movements needed because the white cells and black cells are randomly located close to each other. The ARM for this puzzle configuration (6 \(\times\) 6 with 18 white cells) is 10.4. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Path** & **(a)** & **(b)** & **(c)** & **(d)** & **(e)** \\ \hline Number of movements with & & & & & \\ white cell number 1 & 23 & 21 & 19 & 15 & 19 \\ Number of movements with & & & & & \\ white cell number 5 & 21 & 19 & 21 & 17 & 17 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The required number of movements based on selected empty cell and path in example 2. Figure 13: Steps of simulation. Then, we consider how changing the number of white cells affects the number of movements needed in the \(6\times 6\) puzzle with three black cells. In general, increasing the number of white cells in our puzzles has two opposite effects:  
1. Options Effect: increasing the number of white cells increases the options that the black cell has for seizing the nearest white cell;
2. Deadlock Effect: increasing the number of white cells increases the possibility of reaching a deadlock. According to Figure 15, as the number of white cells grows from one to three, the ARM slightly increases because the number of deadlock situations increases, and the Deadlock Effect outweighs the Options Effect. However, when the number of white cells grows further from 3 to 25, the Options Effect defeats the Deadlock Effect, and the ARM sharply decreases. However, by increasing the number of white cells above 25, the Options Effect becomes less influential, and the ARM reduces slightly. Next, consider a \(12\times 12\) puzzle. As Figure 16 shows, the effect of the number of white cells on the ARM is similar to Figure 15; first, a slight increase in the ARM is followed by a sharp decrease (from 3 white cells to 90 white cells), and after a specific point (90 white cells), increasing the number of white cells decreases the ARM slightly. Figure 14: Average number of movements needed to retrieve items in every iteration of a \(6\times 6\) puzzle with 18 white cells. Figure 15: The effect of the number of white cells on the ARM in a \(6\times 6\) puzzle. However, the effect of the number of white cells on the ARM for a 20 \(\times\) 20 puzzle is more interesting. According to Figure 17, as the number of white cells grows from 3 to 10, the Options Effect becomes more influential, and an initial increase in the ARM is followed by a sharp decrease. Then, the Options Effect loses its mastery, and the decreasing trend becomes slight (from 10 to 40 white cells). The trend thus far is what we observed in 6 \(\times\) 6 and 12 \(\times\) 12 puzzles. However, in a 20 \(\times\) 20 puzzle, if we increase the number of white cells above 40, again, a new sharp decrease in the ARM occurs, and this sharp decrease is again followed by another slight decrease from 200 white cells to 300 white cells.