## 5 Optimization Model and U-Net  
In the second phase, the prediction model of the precise radiation patterns (full vehicle model) is integrated in a Bayesian optimization (BO) model [14]. With it, we can use a less precise antenna model in CST (faster simulation), and with a convolutional neural network, the radiation patterns can be predicted, bringing them closer to more accurate models' results (longer simulation).  
The criterion chosen to define the best antenna placement is given by the maximization of the difference between the average realized gain, \(\widetilde{RG}_{i}\), and the average axial ratio, \(\widetilde{AR}_{i}\)  
Figure 8: Metrics: mean absolute error of the U-Net model vs. steps  
Figure 7: Case study. (**a**) Original RG of \(P6\) point. (**b**) Predicted RG of \(P6\) point.  
below the elevation angle \(\theta\leq\theta^{max}\) in the position \(i\), for all azimuth angles predicted by neural network and calculated by Equation (2):  
\[\begin{split}&\min-F(RG,\mathcal{A}R)=RG_{\rho_{n}}-k_{1}\mathcal{A}R _{\rho_{n}}\\ &\text{s.t}\\ &\left\{\begin{array}{l}BW^{min}\leq BW_{51\rho_{n}}\leq BW^{ max},\\ S11_{\rho_{n}}\leq S11_{max},\\ n=1,\ldots,N;\ \theta=1^{\circ},\ldots,\theta^{max};\ \phi=1^{\circ},\ldots,360^{ \circ}.\end{array}\right.\end{split} \tag{2}\]  
where:  
\(R\bar{G}_{\rho_{n}}\) is the realized average gain in position \(\rho_{n}\);  
\(\mathcal{A}R_{\rho_{n}}\) is the average axial ratio in position \(\rho_{n}\);  
\(BW_{511_{\rho_{n}}}\) is the bandwidth in position \(\rho_{n}\);  
\(S11_{\rho_{n}}\) is the return loss in position \(\rho_{n}\);  
\(k_{1}\) is a constant to normalize the objective function.  
The antenna placement problem was solved using BO packages [15; 16]. BO builds a probability model of an unknown objective function that would take a long time to evaluate at each point. Thus, through a Gaussian process (GP), a surrogate model with a normal distribution of \(i\) samples (with mean and variance defined) is constructed as a probability representation of the objective function [17].  
PG is a way to infer a function from samples of its inputs and outputs, also providing a distribution over the outputs. Therefore, when you guess the output of the function at some given point, the GP also tells us the probability of finding it within given ranges [18].  
The search for new points of evaluation in the real objective function will be given by an acquisition (or selection) function. This function represents the trade-off between exploring new areas, through the variance of the surrogate function, and taking advantage of known regions, through the mean. Maximizing this function is cheaper from a computational point of view and its maximum point determines the next point (\(n+1\)) to be sampled.  
Algorithm 1 shows how Bayesian optimization evaluates the objective function in an initial space and allocates the remainder of a budget of \(N\) function evaluations [17].  
```
-Place a GP prior function on \(F^{\prime}(\rho)\), by default \(\mu(\rho)=0\) (deterministic) -Observe \(F\) at \(n\) position operating on the current prior distribution. while\(n\leq N\)do -Update the posterior probability distribution on \(F\) using all available data. -Let \(\rho_{n}\) be a maximizer of the acquisition function over \(\rho\), where the acquisition function is computed using the current posterior distribution. \(>\)Get the radiation pattern (realized gain and axial ratio) from the simplified model and send it to U-Net. \(>\)U-Net: Predict the precises values of radiation pattern (realized gain and axial ratio) and send it back to BO. -Observe \(F(\rho_{n})\). -Update the Gaussian Process prior distribution with the new data to produce a posterior (which will become the prior in the next step). -Increment \(n\). endwhile return Solution: Return either the point evaluated with the best \(F(\rho_{n})\), or the point with the largest posterior mean.
```  
**Algorithm 1** Basic Bayesian optimization pseudo-code.