## 4 Joint Optimization of Altitude and Energy Beamforming for Multiple EHDs
### Efficient Near-Optimal Altitude and Energy Beamforming Design with Low Complexity
Next, in determining the optimal altitude, we adopt the GS line search method within \(\Big{[}\min\,\bigl{(}h_{\text{Prop},u_{\min,1}}^{\star},h_{\text{Prop},u_{ \min,2}}^{\star}\bigr{)},\max\bigl{(}h_{\text{Prop},u_{\min,1}}^{\star},h_{ \text{Prop},u_{\min,2}}^{\star}\bigr{)}\Big{]}\), rather than the exhaustive 1D line search method, in order to reduce the computational complexity. Similarly to the procedures for Algorithm 3 and Section 4.1, we determine the optimal altitude \(h_{\text{Prop}}^{\star}\) by solvingthe dual problem \(\mathbf{D}.\mathbf{P}_{2}^{\mathbf{X}}\). The detailed procedure for the proposed method to determine near-optimal altitude \(h_{\text{Prop}}^{\star}\) and energy beamforming \(\mathbf{X}_{\text{Prop}}^{\star}\) is described in Algorithm 4. ```
1:Input: Parameters of the channel statistics \((a_{1},b_{1},a_{2},b_{2},a_{3},c_{3})\), the minimum and maximum altitude of \(H_{\text{min}}\) and \(H_{\text{max}}\), the error tolerance \(e_{\text{GS}}\), \(\delta=\frac{(\sqrt{5}-1)}{2}\), the sum power constraint \(P\), all EHDs' horizontal distance, LoS component, and energy requirements, i.e., \(\big{[}r_{u},\mathbf{a}_{u},Q_{u}^{\text{Req}}\big{]}_{u=1}^{U}\)
2:for\(u=1:U\)do
3: Obtain \(h_{\text{Prop},u}^{\star}\) from the Algorithm 2
4: Compute \(\mathbf{X}_{u}^{\star}=P\mathbf{\tilde{a}}_{u}\mathbf{\tilde{a}}_{u}^{H}\) from (46)
5: Compute \(t_{\star,u}^{\text{max}}=\max\Big{(}\tau_{1}^{\star,u}(h_{\text{Prop},u^{ \star}}^{\star},\mathbf{X}_{u}^{\star}),...,\tau_{U}^{\star,u}(h_{\text{Prop},u^{ \star}}^{\star},\mathbf{X}_{u}^{\star})\Big{)}\) from (48)
6:endfor
7: Obtain: \(u_{\text{min},1}=\arg\min\limits_{u\in U}\,t_{\star,\mu}^{\text{max}}\) and then \(u_{\text{min},2}=\arg\min\limits_{u\in U\setminus u_{\text{min}}}\,t_{\star,u}^ {\text{max}}\), respectively
8:Set: \(h_{a}=\min\big{(}h_{\text{Prop},u_{\text{min},1}}^{\star},h_{\text{Prop},u_{ \text{min},2}}^{\star}\big{)}\) and \(h_{b}=\max\big{(}h_{\text{Prop},u_{\text{min},1}}^{\star},h_{\text{Prop},u_{ \text{min},2}}^{\star}\big{)}\), \(h_{s,a}=h_{a}+(1-\delta)(h_{b}-h_{a})\) and \(h_{s,b}=h_{b}-(1-\delta)(h_{b}-h_{a})\), \(Iter=1\)
9:Obtain: \(t_{s,a}=t^{\star}(h_{s,a})\) and \(t_{s,b}=t^{\star}(h_{s,b})\), respectively, from (42), by solving the dual problem \(\mathbf{D}.\mathbf{P}_{2}^{\mathbf{X}}\) with \([\mathbf{G}_{u}(h_{s,a})]_{u=1}^{U}\) and \([\mathbf{G}_{u}(h_{s,b})]_{u=1}^{U}\), respectively
10:while\(|h_{b}-h_{a}|<e_{\text{GS}}\)do
11:if\(t_{s,a}<t_{s,b}\), then
12:\(h_{b}\gets h_{s,b},\quad h_{s,b}\gets h_{s,a},\quad\text{and}\quad g _{s,b}\gets g_{s,a}\)
13:\(h_{s,a}\gets h_{a}+(1-\delta)(h_{b}-h_{a})\)
14:\(t_{s,a}\gets t^{\star}(h_{s,a})\) from (42) by solving the \(\mathbf{D}.\mathbf{P}_{2}^{\mathbf{X}}\) with \([\mathbf{G}_{u}(h_{s,a})]_{u=1}^{U}\)
15:else
16:\(h_{a}\gets h_{s,a},\quad h_{s,a}\gets h_{s,b},\quad\text{and}\quad g _{s,a}\gets g_{s,b}\)
17:\(h_{s,a}\gets h_{b}-(1-\delta)(h_{b}-h_{a})\)
18:\(t_{s,b}\gets t^{\star}(h_{s,b})\) from (42) by solving the \(\mathbf{D}.\mathbf{P}_{2}^{\mathbf{X}}\) with \([\mathbf{G}_{u}(h_{s,b})]_{u=1}^{U}\)
19:endif
20:\(Iter\gets Iter+1\)
21:endwhile
22:Total number of iterations:\(Iter_{tot}\gets Iter\)
23:Obtain \(h_{\text{Prop}}^{\star}=(h_{a}+h_{b})/2\)
24:Obtain \(\mathbf{X}_{\text{Prop}}^{\star}\) and \(t_{\text{Prop}}^{\star}\) by solving the primal problem \(\mathbf{P}_{2}^{\mathbf{X}}\) with \([\mathbf{G}_{u}(h_{\text{Prop}}^{\star})]_{u=1}^{U}\)
25:Output: The proposed near-optimal altitude \(h_{\text{Prop}}^{\star}\) and energy beamforming \(\mathbf{X}_{\text{Prop}}^{\star}\)
```  
**Algorithm 4** Proposed method to obtain a near-optimal solution for the problem \(\mathbf{P}_{2}\)