## 4 Discussion and Results  
To improve the performance of the array synthesis approach, multiple optimization runs utilizing genetic algorithm strategies were implemented. These runs facilitate the search for the optimal solution across the entire configuration space. In this case, the optimal solution is defined by a set of N = 18 phase shifts, each assigned to an individual cell element, in order to generate the desired radiation pattern. Based on the results obtained, the MATLAB code calculates the correct values required for each metasurface cell, as shown in Figure 1a, ensuring accurate implementation in a full-wave simulation. To evaluate the effectiveness of the proposed design approach, we analyzed the performance of the GA-optimized configuration. Figure 3a shows the 2D far-field plot of the normalized directivity on the H-plane of the antenna, comparing the results obtained through the approach based on the simple circular array synthesis (blue line) [26] with the enhanced approach based on the Genetic Algorithm optimization. The main lobe directions are set at 30\({}^{\circ}\), 45\({}^{\circ}\), and 60\({}^{\circ}\), with nulls imposed at corresponding angles to avoid high-side lobes. The corresponding values of the maximum main lobe and null positions for each  
Figure 2: Flowchart of the GA optimization for metasurface design. configuration are presented in Table 1, further validating the effectiveness of the proposed optimization method across various configurations. Additionally, to assess the feasibility of adopting the proposed GA algorithm for dynamically adjusting the behavior of the HMS. The GA was chosen for its flexibility and adaptability in handling the specific constraints of our metasurface design. The optimization process is applied to a structure that has already been initialized with a synthesis performed using the circular array model. This initial step significantly reduces the computational complexity, allowing the algorithm to focus on fine-tuning the structure for the desired radiation properties. This result highlights the potential for real-time adaptation, although future improvements could focus on reducing this computation time to enhance the system's dynamic responsiveness in practical applications. The computational time is a significant improvement compared to traditional gradient-based methods [22], which often require multiple iterations over complex cost functions, leading to longer runtimes. However, real-time applications demand further reduction in computational complexity. Future optimizations could explore parallelization techniques or hybrid algorithms to enhance performance while maintaining accuracy. We finally compare the semi-analytically derived results with a full-wave EM simulation tool. Hereinafter, without losing generality, the case of a coating metasurface \begin{table}
\begin{tabular}{c c c} \hline \hline
**Max Main Lobe** & **First Null** & **Second Null** \\ \hline \multirow{3}{*}{30\({}^{\circ}\)} & 0\({}^{\circ}\) & 60\({}^{\circ}\) \\  & 5\({}^{\circ}\) & 55\({}^{\circ}\) \\  & 10\({}^{\circ}\) & 50\({}^{\circ}\) \\ \hline \multirow{3}{*}{45\({}^{\circ}\)} & 15\({}^{\circ}\) & 65\({}^{\circ}\) \\  & 20\({}^{\circ}\) & 60\({}^{\circ}\) \\  & 20\({}^{\circ}\) & 75\({}^{\circ}\) \\ \hline \multirow{3}{*}{60\({}^{\circ}\)} & 30\({}^{\circ}\) & 90\({}^{\circ}\) \\  & 35\({}^{\circ}\) & 80\({}^{\circ}\) \\ \cline{1-1}  & 40\({}^{\circ}\) & 85\({}^{\circ}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Corresponding values of the maximum main lobe and null positions for each configuration of Figure 2(a). Figure 3: **(a)** Normalized far-field directivity results of the HMS pattern by circular array synthesis code (green line) for main lobe at 45\({}^{\circ}\) and nulls at 20\({}^{\circ}\) and 60\({}^{\circ}\), and GA code (other lines), evaluated at 0\({}^{\circ}\) of elevation angle. **(b)** Comparison between CST electromagnetic simulation and MATLAB estimation illustrating the results for multiple main lobe directions and null directions.