# Towards a Digital Twin for Open-Frame Underwater Vehicles Using Evolutionary Algorithms
## 4 BlueROV2 Case
### Genetic Algorithm  
In this subsection, we provide a detailed description of the GA employed for optimizing parameter values in our study. In our specific case, a genetic algorithm from  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameters** & **Value** & **Units** \\ \hline \(m\) & 13.17 & kg \\ \hline \(B\) & 132.537 & N \\ \hline \(\mathcal{CG}\)\(\left(x_{g},\ y_{g},\ z_{g}\right)\) & \((0.0,0.0,0.0)\) & m \\ \hline \(\mathcal{  
the Python DEAP library (version 1.4.1) [47] was selected to optimize the values of the hydrodynamic model. The optimization process, represented in Figure 5, began with the initialization of a population of candidate solutions. Each individual in the population represented a candidate solution composed of a set of dynamic parameters (e.g., added mass, damping coefficients, and inertia), and the algorithm evolved the population over several generations to maximize a fitness function based on the similarity between the simulated and real trajectories. Each DOF was optimized individually, and the selected parameters for the optimization were different for each type of movement. For the linear movements, only three parameters were selected: the added mass, the linear damping, and the quadratic damping coefficients. For the rotational movements, the inertia was also included as a parameter, as its accuracy may not be good enough for the final modeling. Table 3 summarizes the parameters that were selected for each type of movement. The range for each parameter was carefully chosen from the initial values listed in Table 2, with some reasonable margin up and down, so the algorithm could find the optimal  
Figure 5: Block diagram illustrates the flow of the proposed genetic algorithm. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{2}{c}{**Type of Movement**} & \multirow{2}{*}{**Inertia**} & \multicolumn{2}{c}{**Added Mass**} & \multicolumn{2}{c}{**Linear Damping**} & \multicolumn{1}{c}{**Quadratic Damping**} \\ \hline \multirow{4}{*}{Linear Movements} & Surge & - & \(X_{\text{ii}}\) & \(X_{\text{u}}\) & \(X_{\text{u}|\text{u}|}\) \\ \cline{2-6}  & Sway & - & \(Y_{\text{i}}\) & \(Y_{\text{v}}\) & \(Y_{\text{v}|\text{v}|}\) \\ \cline{2-6}  & Heave & - & \(Z_{\text{w}}\) & \(Z_{\text{w}}\) & \(Z_{\text{w}|\text{w}|}\) \\ \hline \multirow{4}{*}{Rotational Movements} & Roll & \(I_{\text{xx}}\) & \(K_{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{ \text{\text{\text{\text{\text{\text{\text{\text{\text{    \text{ \text{  \texttext{   }}}}}}}}}}}}}}}} \) & \(K_{P}\) & \(K_{\text{\text{\text{\text  
parameters without using very broad limits. This was made with two ideas in mind: the first one was reducing the optimization time, as it is related to the search space size; and the second one was to avoid configurations that could produce similar numerical results on the simulation but were unreal, like positive damping coefficients. The main idea was to optimize the parameters, adjusting them, without losing all the original information from the real tests. Initialization  
The first generation was partially initialized using specific parameter values obtained from experimental data. The rest of the individuals were randomly initialized within defined parameter ranges. Evaluation  
After initialization, each individual (candidate solution) was evaluated using a custom fitness function, which calculated the sum of absolute differences between the simulated and real data across multiple tests and degrees of freedom (DOFs). Selection  
The selection process determined which solutions will proceed to the next generation based on their fitness values. In our study, we employed tournament selection to choose parents for the next generation. This strategy involved randomly selecting a subset of solutions (tournament size = 5) from the population, and the one with the highest fitness was chosen. This method helped maintain diversity while applying selection pressure.