# Optimization of the One-Size-Fits-All Layout Problem Based on Preparing Material for Steel Bridges
## 4 Hybrid Genetic Algorithm  
(1) Basic principles of the genetic whale algorithm  
The genetic whale algorithm proposed in this article combines the genetic algorithm with the whale optimization algorithm. Its fundamental principle is utilizing the genetic algorithm (GA) as the outer loop and integrating the whale optimization algorithm (WOA) into the GA. This design aims to make full use of the global search capability of the GA and the local search capability of the WOA to avoid falling into the local optimal solution during the search process. This enables the genetic whale algorithm to more effectively uncover the optimal solution on a global scale and to fully exploit the global search capabilities of the GA. During the entire algorithm operation, the GA not only dominates the outer loop but also incorporates the WOA, so the two work together to significantly improve the efficiency of the final solution. Therefore, the genetic whale algorithm is initiated from a randomly generated or a customized initial population. In each cycle, the individuals of the population are selected and crossed, the whale hunting process is then added, and finally, the mutation process is performed; the above is then repeated. A fixed number of iterations is used while monitoring the convergence of the objective function and the diversity of the population. The loop is terminated when any condition is met to obtain the optimal solution. The basic steps of the genetic whale algorithm are shown in Figure 7.  
(2) Initialize the population  
In this algorithm, the quality of the initial population directly affects its search performance. The initial population should have a certain diversity and should also meet the constraints of the problem. On the basis of conventional layout constraints, as shown in Figure 8, this study introduced \"stripe\" as a height-limiting factor, employing a random generation method. In the population initialization stage, the stripe height is randomly generated after the part sequence is randomly generated. The stripe height is determined using a random generation range based on the size of the parts and the width of the plate in the actual problem. The sequence of parts and the height of the stripe together form an individual. The number of stripes should be slightly larger to ensure that all parts can be arranged. As shown in Figure 8, the numerical values in the sequence of previously placed  
Figure 6: Stripe1 parts are filled. parts represent the part numbers. A positive value indicates that the part's rotation angle is 0\({}^{\circ}\), while a negative value indicates that the part's rotation angle is 90\({}^{\circ}\). The numerical values in the sequence of stripe heights represent the heights of each stripe. The initialized stripe height cannot be the final stripe height. Just as the parts are arranged in the sequence, the height of the stripe needs to be optimized through the crossover and mutation of the algorithm. (3) Fitness function calculation  
In the layout problem studied in this study, the fitness was the final utilization rate of the motherboard. The design of the fitness function is as follows:  
\[fitness=\frac{AreaSum}{W\times L} \tag{5}\]  
Here, \(AreaSum\) represents the sum of the areas of all discharged parts, \(W\) is the width of the motherboard, and \(L\) is the final length after all parts are arranged on the motherboard. The larger the \(fitness\), the higher the utilization rate and the better the layout effect. Since the width \(W\) of the motherboard is a fixed value, we can also regard \(L\) as the adaptation value. The smaller the \(L\), the higher the adaptation value. (4) Select operation  
This study used the roulette selection method to select individuals. In this process, the cumulative fitness value of all individuals is first calculated (the cumulative fitness value of the \(i\)th individual is \(F_{i}=\sum_{n=1}^{i}f_{i}\)), and then a random number \(rand\) is generated.