## 3 Optimization Methods
### Interpolation  
The GA was used to find the radiation pattern at a given point in the streets. Evidently, it is not possible to calculate the radiation pattern for every position in the streets; thus, a methodology was required to determine the radiation pattern for positions on which the GA had not been trained.  
The approach used in this work consisted of training the GA on a rectangular grid, with constant values for \(dx\) and \(dy\), the separation between points in the grid, and then, interpolating unknown positions from the ones on which the GA had been trained; see Figure 2.  
In Figure 2, the red circles are the positions at which the GA was trained, which were separated from each other at \(dx\) and \(dy\), respectively. To get the radiation pattern for a position \((\hat{x},\hat{y})\), on which the GA had not been trained, an interpolation process was used. The radiation pattern for the new position \((\hat{x},\hat{y})\), was based on the values of four positions, as can be seen in Figure 3.  
Figure 3 is a zoomed-in version of Figure 2, where the car represents the new position \((\hat{x},\hat{y})\), and the four red points are the positions used for the interpolation. As can be seen from Figure 3, the four points are at positions \((x_{1},y_{1})\), \((x_{1},y_{2})\), \((x_{2},y_{1})\), and \((x_{2},y_{2})\). Point \((x_{1},y_{1})\) is denoted by \(p_{1}\), \((x_{1},y_{2})\) by \(p_{2}\), \((x_{2},y_{1})\) by \(p_{3}\), and \((x_{2},y_{2})\) by \(p_{4}\). Since these four points were trained with the GA, each of the four points had pairs of values \(\{(A_{j}^{i},\phi_{j}^{i})\}_{j\in\{1,2,\ldots\}}\), where \(i\) denotes the point, thus \(i\in\{1,2,3,4\}\), and \(k\) is the number of antenna in the antenna array.  
Figure 3: Points used for the interpolation procedure.  
Figure 2: Training and interpolating the genetic algorithm (GA).  
Since the value for the antenna only depends on the values of the amplitude and phase, the antenna of each point can be represented via the following notation:  
\[p_{j}^{i}=A_{j}^{i}e^{\hat{p}_{j}^{i}}. \tag{11}\]  
With the previous notation, the value of the new position, \(\hat{p}\), can be written as a linear combination of the values of \(p^{i}\). Thus, the values for \(\hat{p}\) results in:  
\[\hat{p}_{j}=\sum_{i=1}^{4}w_{i}p_{j}^{i}. \tag{12}\]  
The values for \(w_{i}\) should depend on how close the antenna is to the new position. The closer the antenna, the larger the value for \(w_{i}\) is. In order to achieve this relationship, the following expressions are employed:  
\[w_{i}^{x}=1-\frac{|x(p_{i})-\hat{x}|}{x_{1}-x_{0}}, \tag{13}\]  
\[w_{i}^{y}=1-\frac{|y(p_{i})-\hat{y}|}{y_{1}-y_{0}}, \tag{14}\]  
where \(x(p_{i})\) and \(y(p_{i})\) are the \(x\) and \(y\) positions for the point \(p_{i}\), respectively. With this expression, the weights are inversely proportional to the distance between the antenna and the new position. The previous weights are used to calculate \(w_{i}\) as \(w_{i}=w_{i}^{x}w_{i}^{y}\). Namely, Equation (11) must be written as:  
\[\hat{p}_{j}=\sum_{i=1}^{4}w_{i}^{x}w_{i}^{y}p_{j}^{i}, \tag{15}\]  
and as mentioned, \(p_{i}^{j}\) is given in Equation (10), \(w_{i}^{x}\) is given in Equation (12), and \(w_{i}^{y}\) is given in Equation (13). A final consideration is that maintaining the same total power for the antenna array regardless of the position was desired because the output power of the antenna should be constant. To this end, the value obtained in Expression (14) must be normalized by a constant total power \(P\) that is used for every other position. Thus, the final values for the amplitudes denoted \(\hat{p}_{j}\) are given by:  
\[\hat{p}_{j}=\hat{p}_{j}\frac{P^{2}}{\sum_{i=1}^{k}|\hat{p}_{i}|^{2}}, \tag{16}\]  
which ensures that the total power for the antenna array is \(P\) regardless of the position.