# A Service-Constrained Positioning Strategy for an Autonomous Fleet of Airborne Base Stations
## 4 Positioning and Communication for a Fleet of UAVs
### Derivation of the UAV Trajectories
#### 4.2.2 Gradient of the Wireless Backhaul Constraint Functions
On the other hand, the second group of entries in \(\mathbf{v}\) corresponds only to the backhaul bandwidth of the UAV servicing the selected constraint (\(B_{i_{p}}^{BH}\)), which only affects \(R_{i_{p}}^{BH}\). As per the gradients of the positions, as it happened with the cost function, a closed form expression cannot be found; thus, a numerical estimation similar to the one formulated in Equation (28) has to be carried out, which is shown in Equation (32), where \(j\) is the index of entries corresponding to positions with a non-zero gradient:  
\[v_{j}[n+1]=v_{j}[n]+\mu\cdot\frac{\left(R_{i_{p}}^{BH}-\overline{R}\big{|}_{A_ {i_{p}}}\cdot N_{i_{p}}\right)\bigg{|}_{v_{j}[n]+\triangle}-\left.\left(R_{i_{ p}}^{BH}-\overline{R}\big{|}_{A_{i_{p}}}\cdot N_{i_{p}}\right)\right|_{v_{j}[n]}}{ \triangle}. \tag{32}\]  
Moreover, as it happened in Equation (28), the displacements have to be limited again according to the maximum feasible velocities. Regarding the case of the backhaul bandwidth, its corresponding gradient can be computed in closed form using the following expression (note that the expression of \(R_{i_{p}}^{BH}\) in Equation (29) does not include the region boundaries and \(\overline{R}\big{|}_{A_{i_{p}}}\) does not depend on \(B_{i_{p}}^{BH}\), thus its derivative is zero):  
\[\frac{\partial}{\partial\overline{BW}_{BH}\big{|}_{A_{i}}}\left(R_{BH}\big{|}_ {A_{i}}-\overline{R}\big{|}_{A_{i}}\cdot N_{i}\right)[n]=\left.\frac{\left(d_ {BHi}^{2}\cdot BW_{BH}\big{|}_{A_{i}}+k_{BH}\right)\cdot\ln(\frac{k_{BH}}{ \big{|}_{B_{BH}}^{BH}\big{|}_{A_{i}}}+1)-k_{BH}}{\ln(2)\cdot(d_{BHi}^{2}\cdot BW _{BH}\big{|}_{A_{i}}+k_{BH})}\right|_{n}. \tag{33}\]  
In reference to the last constraint in Equation (25), a limitation on the total shared backhaul bandwidth is imposed. When this constraint is not fulfilled and it is randomly selected, a small quantity \(\gamma\) is subtracted from each \(B_{i}^{BH}\), as the sum of all the variables \(B_{i}^{BH}\) has to be reduced. This reduction has to be small enough so that \(B_{i}^{BH}\) is not led to zero. Note that the reduction of \(B_{i}^{BH}\) may imply that some of the \(P\) constraints in Equation (24) become unfulfilled, which should be taken into account in the following iteration of the algorithm. Finally, to summarize this subsection, Algorithm 1 details the full algorithm with all its steps at each iteration. ```
1:Start iteration \([n]\)
2:for\(i=1:P\)do
3:if\(\overline{R}\big{|}_{R_{i}}\cdot N_{i}\geq R_{i}^{BH}\)then
4: Add index \(i\) to the unfulfilled constraints vector \(\mathbf{w}\)
5:endif
6:endfor
7:if\(\sum_{j=1}^{P}B_{j}^{BH}\geq B_{BH}^{total}\)then
8: Add the index \(P+1\) to \(\mathbf{w}\)
9:endif
10:if\(\mathbf{w}\) is empty then
11: go to 20
12:else
13: Randomly select one constraint of \(\mathbf{w}\)
14:endif
15:if selected \(i\leq P\)then
16: go to 24
17:else {the selected index is \(P+1\)}
18: go to 27
19:endif
20: Calculate \(\overline{R}\) for each region using Equation (22)
21: Identify the region \(i_{0}\) with the lowest \(\overline{R}\)
22: Find the UAVs to be moved
23: Update the positions of the selected UAVs using Equation (28) and taking into account the restrictions imposed by the maximum feasible velocities. Then, go to 29
24: Find the UAVs to be moved
25: Update the positions of the selected UAVs using Equation (32) and taking into account the restrictions imposed by the maximum feasible velocities
26: Update \(B_{i}^{BH}\) using Equation (33) and go to 28
27: Subtract a portion from all the bandwidths \(B_{i}^{BH}\)
28: Empty \(\mathbf{w}\)
29: End iteration \([n]\)
```  
**Algorithm 1** Positioning Strategy.