Joint Gateway Selection and Resource Allocation for Cross-Tier Communication in Space-Air-Ground Integrated IoT Networks

Leveraging unmanned aerial vehicles (UAVs) as relays, the space-air-ground integrated Internet of Things (SAG-IoT) networks can provide wireless access services to the connected devices with high data rate, high flexibility, and wide coverage. However, besides bringing lots of benefits, the SAG-IoT systems also face many challenges due to the high mobility, unreliable satellite links, and limited resources. Especially, when multiple UAVs act relays for cross-tier communication to transfer the collected data from ground network tier to the satellite tier, how to select an appropriate number of UAVs as gateways to improve system spectral efficiency (SE) is an important issue. To the best of our knowledge, it is an entirely new problem since most existing works utilize all UAVs as relay nodes and neglect the spectrum allocation. Toward this end, we present this paper to discuss the joint optimization problem of gateway selection, bandwidth allocation, and UAV deployment with the objective of maximizing the system SE. A Dinkelbach method based iterative algorithm is proposed as our solution by alternately adopting simulated annealing and successively convex programming technologies. Experimental results show that our designed joint optimization schemes are able to significantly improve the system SE and can make optimal decisions of gateway selection, bandwidth allocation, as well as UAV deployment.

network tier to the satellite tier, to perform cross-tier data delivery in SAG-IoT [5], can not only reduce the terrestrial wireless interference on the direct ground-satellite links [6], but also improve the communication performance for the connected GIDs.
UAV-assisted relaying can provide effective wireless connection without infrastructure and promote the communication quality by enabling transmission between two nodes in the same or different networks [7]. Compared with ground communications, UAV-relaying systems are able to offer more scalable deployment, more elastic configuration, and wider coverage. The transmitters and receivers in the data delivery process are bridged by the UAVs' wireless links, thus the communication distance is extended [8]. Generally, according to the receiving terminals, UAV relaying networks can be broadly classified into the following categories: UAV-to-network [9], UAV-to-user, and UAV-to-UAV [10]. To ensure reliable UAV communication and achieve the best performance in relaying networks, several technical challenges must be well solved such as trajectory planning, interference suppression, and user association. In particular, due to their high mobility, the flying trajectory of UAVs must be designed carefully to avoid the collisions among them, so as to enhance the data transmission quality and effectively guarantee the real-time collection of IoT data [11].
Besides the problems mentioned above, using UAV as relay for the cross-tier communication in SAG-IoT also faces lots of other challenges. Firstly, UAVs in the air network should be deployed optimally in accordance with the distribution of GIDs to provide effectively and completely covering access services [12]. Secondly, in order to satisfy the quality of service (QoS) requirements of GIDs, it is necessary for SAG networks to serve IoT with high data rate, low latency, and strong robustness. Thus, given the limited bandwidth and transmit power, how to design efficient resource allocation schemes while comprehensively considering the diverse practical constraints from space, air, and ground networks is anther challenge. Thirdly and most essentially, due to the long propagation distance, the the communication link from UAV to satellite needs to be allocated much bandwidth for data delivery. Therefore, if every UAV acts as relay in the multi-UAV aided SAG-IoT systems, most spectrum resource must be occupied, which will inevitably decrease the system spectral efficiency (SE) [13], [14]. A feasible strategy is to select an appropriate number of UAVs as gateways to forward the traffic of GIDs to the satellites. How to explore adaptable gateway selection algorithms among multiple UAVs to improve system SE is an important issue.
Up to now, there have been lots of research works focusing on the UAV-involved relaying space-air-ground integrated networks (SAGINs), including both single UAV and multiple UAVs. For instance, by jointly optimizing the UAV's location and the blocklength allocation in the single UAV enabled ultra-reliable and low-latency communication (URLLC) relay systems, Pan et al. [15] devised an iterative method based on perturbation to minimize the decoding error probability (DCB) with the latency constraints. Similarly, Ren et al. in [16] studied the amplifier-and-forward mode in single UAV aided URLLC relay communication system while considering the channel models of both free-space and three-dimensional. The authors proposed two lowcomplexity iterative algorithms to minimize DCB by jointly optimizing the location and power of UAV. In the multi-UAV relaying SAGINs, Zhang et al. in [17] investigated the applications, scenarios, requirements, and challenges of the flying ad hoc networks (FANETs) based on UAVs and discussed UAV communications systems designed for air-toground, air-to-air, and air-to-satellite links as well as in-cabin communications.
Especially for the SAG-IoT networks, the authors in [18] presented a two-stage joint hovering altitude and power control scheme to address the resource allocation and crosstier interference problems in multi-UAV aided SAG threetier IoT networks. They designed low-complexity greedy search algorithm and used Lagrange dual decomposition and concave-convex procedure method to solve such problems. Dai et al. [19] considered a single UAV relaying SAG-IoT network to achieve the maximum rate of the ground vehicles. A successive convex approximation based algorithm was proposed by jointly optimizing the power allocation and UAV trajectory with the constraints of UAV's energy, transmission and mobility. Li et al. mainly studied the energy efficiency in the space-air-ground based Internet of remote things (IoRT) networks [20]. The authors utilized UAVs to relay the ground traffic to the satellites and presented an iterative method to jointly optimize the channel selection, transmission power allocation and UAV position deployment. Similarly, using drones as relays, Wang et al. in [21] proposed a SAG-IoRT framework and designed an iterative algorithm via the joint optimization of the devices access scheduling, power control, and UAV trajectory to maximize the system throughput. While in [22], the authors used UAV to collect data for IoRT sensors with the assistance of low earth orbit (LEO) satellite networks. They designed column generation based algorithms to minimize the total UAVs' trajectory and transmission energy cost with the guarantee of IoRT demands.
Meanwhile, the problem of gateway selection has been also well studied in plenty of literature. These available works put their interests into either terrestrial multi-hop wireless networks such as wireless mesh networks and vehicle ad hoc networks, or FANETs consisting of UAVs [23]. Notice that all the proposed methods in these works mainly took into account only ground network or the aerial one, and cannot be readily adopted in SAG-IoT. As for gateway selection in the space-air-ground networks, Wang et al. [24] conceived a distributed gateway selection algorithm based on dynamic partition adjustment to minimize the energy consumption of UAVs. They also presented an adaptive gateway selection algorithm to counteract the time-variant evolution of the UAV network topology. Our previous work [5] used expected transmission count as optimizing objective and proposed a greedy gateway selection algorithm to improve the link quality of the 4304 VOLUME 9, 2021 air network for cross-layer data delivery. Based on this, our another work [25] presented a simulated annealing algorithm to select optimal gateways so as to minimize the average link transmission energy. Nevertheless, these works considered the fixed number of gateway selection and did not account for the resource allocation and UAV deployment.
There is no doubt that the available works on UAV-assisted SAG-IoT have provided significant insights into the performance optimization of resource allocation and UAV deployment. However, these works mainly focused on the energy efficiency while few of them considered the bandwidth optimization. In addition, most existing works explored every UAV as relay to forward the data traffic, which will cause the lower system SE. In light of this, we present this paper to investigate the SE maximization of the UAV relaying cross-tier communication in SAG-IoT networks by integrally optimizing the gateway selection, bandwidth allocation, and UAV deployment. In particular, the main contributions of this paper can be summarized as follows.
• Given the space-air-ground integrated IoT network architecture, we mainly focus on the cross-tier data delivery process which uses UAV as relays to transfer the traffic originated from ground IoT devices to the satellites.
• We present a new joint optimization problem of gateway selection and resource allocation as well as UAV deployment for cross-tier communication, and formulate it as a constrained optimization problem to obtain the maximum system spectral efficiency.
• By jointly adopting Dinkelbach strategy, simulated annealing method, and successively convex programming technology, an iterative scheme is devised to solve the proposed NP-hard and non-convex problem while comprehensively taking into account the spectrum allocation among the ground-to-air, air-to-air, and airto-space communication links.
• Extensive simulations have been conducted to evaluate the obtained performance of our designed schemes. Numerical results validate that for different numbers of GIDs and UAVs, the proposed iterative method can not only give the best gateway selection decision, but also implement the optimal bandwidth allocation as well as the UAV position deployment, so as to achieve maximum system SE. The rest of this paper is organized as follows: In Section II, we first introduces the system model, then the problem of cross-tier gateway selection and resource allocation is formulated. Section III describes the detailed iterative algorithm for the problem. We present extensive numerical results in Section IV, and finally conclude the whole paper in Section V.

II. SYSTEM MODEL AND PROBLEM FORMULATION
In this paper, we consider a three-tier space-air-ground integrated IoT network as depicted in Figure 1.  area to conduct certain tasks, and each GID m has the minimum transmission rate requirement of r min m for data delivery. The examples of GIDs can be various types of devices used for monitoring, sensing, and video surveillance. By adopting decode-and-forward (DF) scheme [26] and full-duplex technology, N hovering UAVs N = {1, 2, . . . , N } with sufficiently large data buffers form an FANET in the air network tier. Each UAV can communicate with both satellite and GIDs as well as other UAVs. In space tier, one or more LEO satellites provide the full coverage to this area, and connect the remote control centre (RCC) through the satellite backbone network. Specially, we adopt a 3-D Cartesian coordinate system in which the positions of GID m ∈ M and UAV n ∈ N are denoted by d G m = (x G m , y G m ) and d A n = (x A n , y A n , h n ), respectively, and each UAV is hovering within a security height range of [H min , H max ]. We also assume that the positions of both GIDs and UAVs remain unchanged during the data transmission process. Consider that one UAV serves a group of GIDs while each GID can access only one UAV simultaneously, and that all of the M GIDs can be covered by the N UAVs.
Given the network architecture, we mainly investigate the data delivery process from the GIDs to the satellite. Note that there is no cellular coverage in the considered remote area, and the GIDs are assumed to have no capability of accessing satellite directly. It is to say, to transmit their data to the RCC, the GIDs must first transmit their data to the UAVs, and then leverage the air network as relay to communicate with satellites, thus the cross-tier communication is caused. Utilizing UAVs as relays can improve the quality of satellite links. However, if each UAV n ∈ N establishes a connection with the satellite, this will result in low SE and severe interference at the satellite. A practical solution is to select a subset G of N as gateways, so that the other UAVs can transfer the ground traffic to satellites via the gateways. Let the decision variable s n ∈ {0, 1} denote the gateway selection of UAV n, if UAV n is selected as a gateway, s n = 1, otherwise s n = 0. We aim at selecting an appropriate number of UAVs as gateways, G = {s n ·n|∀n ∈ N }, in the cross-tier communication process to maximize the system SE and optimize the bandwidth allocation for the integrated network.

A. CHANNEL MODEL
As shown in Figure 1, there are three types of channels in the system: 1) G2A channel (from GID to UAV), 2) A2A channel (from UAV to UAV), and 3) A2S channel (from UAV to satellite).
According to [27] and [28], the average path-loss of G2A channel between GID m and UAV n can be given as is the carrier frequency, v (m/s) is the velocity of light, η LOS and η NLOS (dB) are environment-dependent and denote the average additive losses caused by the free space path-loss for line of sight (LOS) and non-LOS (NLOS) links, is the distance between GID m and UAV n, P m,n LOS is the LOS probability of G2A link, which can be calculated as where φ and ϕ are constant values determined by environment, θ m,n is the elevation angle between GID m and UAV n, which can be expressed as As for the A2A channel between two UAVs m and n, it usually has better quality since it has higher probability to obtain LOS links, thus the average path-loss model between these two UAVs can be expressed as [29] L A2A m,n = 20 log where represents the distance between these two UAVs. In order to guarantee the communication security among N UAVs, we assume that d A2A m,n cannot be less than the minimum security distance d min .
Based on (1) and (4), the channel gains between a GID/UAV m and a UAV n are given as g m,n = 10 −L G2A m,n /10 , G2A link 10 −L A2A m,n /10 , A2A link (6) As discussed in [30], most characteristics in satellite-UAV propagation channel are similar to those in satellite-ground channel. Therefore, in this paper, the radio propagation loss of the A2S link caused by the free space loss (FSL) and antenna pattern are all taken into account, which can be expressed as where G tx and G rx are the antenna gains of the UAV and the satellite, respectively. Generally, we consider the antenna array element of UAV is omni-directional, thus G tx = 1 is satisfied [31]. H s represents the orbit height of the LEO satellite. The signal gain from UAV n to the satellite, g A2S n , can be formulated as (n ∈ N ) denote the bandwidth allocated to the G2A communication from GID m to UAV n, the A2A link from UAV m to n, and the A2S transmission from UAV n to the satellite, respectively, the bandwidth allocation matrix can be expressed as Let p G m represent the transmit power of GID m, the uplink data rate from GID m to UAV n can be given as where N A 0 is the noise power spectral density at the UAV receiver, g A2G m,n is the average channel gain between GID m and UAV n.
Similarly, let p A m and g A2A m,n separately denote the transmit power of UAV m and the average channel gain of the A2A wireless link, the achievable data rate from UAV m to UAV n is After being uploaded to UAV n, the data originated from GID m will be decoded at the corresponding UAV and then be forwarded to the gateways via the multi-hop A2A wireless links. It is assumed that a UAV can directly forward its data to at most one of other UAVs. Let P n,u = {q i |1 ≤ i ≤ |P n,u |} denote the ordered set of UAVs on the path from UAV n to the gateway u ∈ G, obviously, q 1 = n, q |P n,u | = u, where |P n,u | is the cardinality of set P n,u . According to the DF protocol, the transmission rate for forwarding the data of GID from UAV n to gateway u can be given as When arriving at gateway u, the data of GID m will be transmitted to the satellite through the A2S communication link. Let N S 0 denote the noise power spectral density at the satellite, the uplink data rate for the A2S communication from gateway u to the satellite can be given as Thus, the data delivery rate for GID m from ground tier to space tier, r m , and the overall system throughput, R tot , are respectively expressed as and The system SE refers to the total data rate that can be transmitted over the allocated bandwidth in the integrated IoT network, which can be calculated as

C. PROBLEM FORMULATION
Based on the network architecture, system models, and assumptions described above, the objective of this paper is to obtain the maximum SE of the system by jointly optimizing the spectrum allocation, gateway selection, and UAV position deployment, while satisfying the given total available bandwidth B, the required minimum transmission data of each GID, and the maximum LEO satellite capacity r S max . For notational convenience, we define S = {s n }, D = {d A n }, and X = {S, B, D}, the constrained SE maximization problem can be mathematically formulated as follows.
In problem P1, the constraint C1 guarantees that the achievable data transmission rate of each GID must meet its minimum rate requirement, C2 represents that the total data rate cannot exceed the maximum capacity of the LEO satellite. The constraint C3 ensures that the totally allocated bandwidth in the system must be less than or equal to the available spectrum. C5 and C6 introduce the so-called flow conservation constraint [32] in the multi-hop connections, which represent the sum of incoming data flows of each UAV should be larger than or at least equal to its total outgoing ones. While the constraint C7 declares that a UAV is selected as gateway or not. C8 and C9 state that the communication distance between two UAVs must be larger than the minimum security distance. Apparently, gateway selection is a typical facility location problem, which is NP-hard [33]. Therefore, problem P1 is NP-hard.
The objective function of problem P1 is multivariate with respect to variables S, B, and D. Constraints C5, C6, and C8 as well as the objective function are non-convex. In addition, P1 is also a mixed integer programming problem due to the existence of binary variable s n in constraint C7. Accordingly, problem P1 is a non-convex mixed integer programming optimal problem, which is challenging to be solved. VOLUME 9, 2021

III. PROPOSED SCHEME FOR JOINT GATEWAY SELECTION AND BANDWIDTH ALLOCATION
In this section, we propose an iterative scheme to maximize the system SE by jointly optimizing gateway selection, bandwidth allocation, and UAV deployment. We first use the Dinkelbach method to transform the objective function of P1 from the non-line fractional form to a tractable subtractive one. Then the transformed problem is decomposed into three sub-problems by alternately optimizing the gateway selection, bandwidth allocation, and UAV deployment. Finally, the optimal solution to P1 is obtained by iteratively solving these three sub-problems.

A. PROBLEM REFORMULATION
Without loss of generality, we define the maximum system SE as λ * , which can be expressed as where X * = {S * , B * , D * } are the optimal schemes of gateway selection, bandwidth allocation, and UAV position deployment. According to [34], it is easy to prove that the optimal solutions X * can be obtained if and only if max where λ is a non-negative variable. As discussed in [34], max{R tot − λB tot } is a strictly monotonic descent function with respect to λ. In order to solve problem P2 and obtain the maximum system SE, we propose a Dinkelbach based algorithm, in which a set of growing λ is iteratively created to make the value of f (λ) = max{R tot (X) − λB tot (X)} approximate to 0. In each iteration, a set feasible solutions of X in P2 is first obtained for the given λ. Then the value of λ can be subsequently updated according to the feasible X. Finally, the optimal λ * and X * can be derived when f (λ * ) = max{R tot (X * ) − λ * B tot (X * )} = 0 is satisfied after multiple iterations. The details of the proposed iterative SE maximization scheme based on the Dinkelbach method are described in Algorithm 1.

1) Gateway Selection Optimization:
It is easy to observe that the gateway selection in P2 is an integer programming problem for the given UAV deployment D and bandwidth allocation B, which can be formulated as Obviously, P2.1 can be solved by adopting the optimal enumeration method, which has the computational complexity of O(2 n ) and is inapplicable to large scale problems.
Simulated annealing (SA) is a probabilistic heuristic search technique based on the annealing process in metallurgy. Thanks to its fast convergence, less parameter, and simplicity, SA has been widely adapted for decision making and optimization in recent years [35]. In this paper, we propose an SA based gateway selection method, i.e., SAGA, to solve P2.1 and obtain the near optimal gateway selection decision, whose details are listed in Algorithm 2.
In Algorithm 2, an initial gateway selection scheme S 0 is randomly generated and the value of objective function in P2.1 can be computed as At each iteration in repeat-loop, we randomly select only one UAV and change its selection status from S t−1 to generate the new gateway selection combination S t , and calculate its corresponding f (S t ). The decision variation of the selected UAV n in the t th iteration is expressed as where S t−1 is the gateway selection scheme of (t − 1) th iteration. The new scheme will be accepted if it is better than the old one, i.e., f (S t ) ≥ f (S t−1 ). Otherwise, the acceptance of S t will be allowed with a probability ρ = e − δ T , where δ = f (S t ) − f (S t−1 ), and T is the current temperature.
As elaborated in Algorithm 2, SAGA regards the new decision of gateway selection as the currently optimal scheme when it has better value of f (S). What's more, if the current scheme gets worse, SAGA adopts an acceptance probability for this scheme so that it can escape from the local optimal problem. Therefore, Algorithm 2 can obtain a near optimal gateway selection decision for the problem P2.1.

Algorithm 2 A Simulated Annealing Based Gateway Selection Algorithm (SAGA)
Input: M, C max , λ k , the fixed bandwidth allocation B and UAV position deployment D. Output: S opt -an approximately optimal decision of gateway selection. 1: Initialize T = T 0 -the initial temperature, T final -the terminate temperature, α-the annealing coefficient, t = 0; 2: generate an initial gateway selection scheme S 0 , S opt = S 0 ; 3: compute f (S 0 ) using Eq. (22); 4: repeat 5: generate a new selection scheme S t using Eq. (23); 6: compute f (S t ) using Eq. (22); 7: generate a random number η ∈ (0, 1); 9: if δ ≥ 0 or e − δ T < η then 2) Bandwidth Allocation Optimization: For any given schemes of gateway selection S and UAV deployment D, problem P2 can be transformed as Due to the non-convexity of constraints C5 and C6, problem P2.2 is non-convex and cannot be solved by stand convex optimization schemes. Notice that for given S and D, r A2A n,l is concave concerning b A2A n,l , and r A2S u is concave with respect to b A2S u . It is known that any concave function is global upper-bounded by its first-order Taylor expansion at any point [36]. Accordingly, we can use the successively convex programming (SCP) [37] technique to tackle the non-convexity of problem P2.2. The right-hand-side terms of constraints C5 and C6 are substituted with their convex upper bounds at a given local point in each iteration. Let B i denote the obtained bandwidth allocation in the i th iteration, we have where By replacing r A2A n,l and r A2S u with their upper bounds (r A2A n,l ) i and (r A2S u ) i , respectively, the non-convex constraints C5 and C6 are separately approximated as the following convex constraints.
Thus, problem P2.2 can be approximated as follows.
Problem P2.3 is also non-convex due to the fact that constraints C8 is non-convex. Similar to P2.2, P2.3 can also be solved by adopting SCP method to relax this constraint. Especially, as for C8, we know that ||d A m − d A n || 2 is convex with regard to the positions of UAV. By applying the first-order Taylor expansion at any point (d A m ) i and (d A n ) i , the lower bounder of ||d A m − d A n || 2 can be expressed as . (31) Thus, constraint C7 can be approximated as (32) Problem P2.3 is transformed into the following form by substituting C8 for C8, and can be solved using YALMIP solver. C1, C2, C5, C6, C8 , C9. (33) VOLUME 9, 2021 4) Joint Optimization: Based on solving the problems P2.1, P2.2 , and P2.3 , a joint optimization algorithm is developed to obtain the optimal solutions in an alternate method given λ k of k-th iteration in Algorithm 1. At first, an initial scheme of UAV location deployment and bandwidth allocation is randomly generated. Then in the repeat loop, the optimal X k = {S k , B k , D k } is iteratively obtained by alternately solving the three sub-problems. This jointly alternating optimization scheme is summarized in Algorithm 3.

Algorithm 3 Joint Optimization of Gateway Selection, UAV Deployment, and Bandwidth Allocation
Input: M, B, λ k , K max2 -the maximum number of iterations, ζ -an infinitesimal positive number. Output: X k -the optimal solutions to P2 for given λ k .
1: Initialize j = 1, generate an initial scheme of UAV location deployment D 0 and bandwidth allocation B 0 ; 2: repeat 3: solve problem P2.1 to obtain gateway selection decision S j for given D j−1 and B j−1 ; 4: for fixed S j and D j−1 , solve problem P2.2 to obtain B j ; 5: for fixed S j and B j , solve problem P2.3 to obtain D j ; 6: 8: break; 9: end if 10: j = j + 1; 11: until j > K max2 12: X k = X j ; 13: return X k .

C. COMPUTATIONAL COMPLEXITY ANALYSIS
From above discussions, one can see that there exists a double-loop in the proposed jointly iterative optimization scheme. The outer while-loop in Algorithm 1 computes the system SE λ using the Dinkelbach technique, while the inner repeat-loop in Algorithm 3 produces an optimal solutions of X for given λ via an alternate method. As described in Algorithm 1, the variation of λ in the while-loop depends on the total system capacity and allocated bandwidth as shown in Eq. (19). The computational complexity of this algorithm is mainly determined by the resolution progress of problem P2. While the optimal solutions of P2 is obtained by solving three decomposed sub-problems through the repeat-loop in Algorithm 3.
To solve P2.1, step 7 in Algorithm 2, which is used to compute δ, has the most computational complexity of O(MN ) at each iteration of repeat-loop, M and N are separately the number of GIDs and UAVs. Thus, it will take t max MN times for Algorithm 2 to obtain the near-optimal gateway selection solution, where t max is the iteration number. Since P2.2 and P2.3 are solved by YALMIP toolbox, and it adopts a primal-dual interior point method with complexity O((MN ) 3 log(ε −1 )) [39], where ε is the accepted duality gap. Therefore, if the maximum iteration numbers of Algorithm 1 and Algorithm 3 are denoted by k max and j max , respectively, the total computation complexity for the proposed jointly iterative system SE maximizing scheme can be calculated as O(k max j max (t max MN + (MN ) 3 log(ε −1 ))).

A. PARAMETER SETTINGS
In our simulations, we consider a remote 3 km × 3 km square area in which 60 GIDs are randomly distributed with the minimum data rate requirements of 10 kbps ∼ 20 kbps. 10 UAVs are hovering at the height of 100 m ∼ 150 m above the considered area, the minimum distance between UAVs is set as 100 m. The transmit power of each GID and UAV are 0.1 W and 3 W, respectively. The LEO satellite's orbit height is set as 700 km and its maximum capacity is 200 Mbps. Both the G2A and A2A as well as the A2S channels are all operated at C-band of 5G Hz given the available bandwidth of 100 MHz. The noise power spectral density is -169 dBm/Hz, and the antenna gain of the satellite is set to be 45 dBi. The values of environment variables (φ, ϕ, η LOS , η NLOS ) are (4.88, 0.43, 0.1, 21) [40].

B. SIMULATION RESULTS
We first use Figure 3 to present the optimized result of UAV deployment and the gateway selection via the proposed scheme given 60 GIDs' distribution. From this figure, one can see that, 10 UAVs are all deployed to their most suitable positions according to the distribution of GIDs and the bandwidth allocation of A2G and A2A links. Three gateways are optimally selected from these UAVs in accordance with the locations of UAVs and the bandwidth allocated to the A2A links and the A2S links. This experimental result verifies that our proposed scheme can optimize both UAV deployment and gateway selection when the distribution of the GIDs is known. Next, we study the convergence of our proposed scheme, which is a joint optimization algorithm combining gateway selection, bandwidth allocation, and UAV position deployment. Notice that we are mainly interested in the iteration numbers of the Dinkelbach method, due to the fact that the spectral efficiency λ is updated only in each iteration of this algorithm. Figure 4 illustrates the convergence of the proposed algorithm with different numbers of GIDs and UAVs. From this figure, one can see that, given various networks settings, the system SE always reaches its maximum value after 12 iterations, which verifies that our proposed optimization scheme has a good convergence. In the following, we perform the joint optimization scheme by using the gateway selection methods of SAGA and optimal exhaustive algorithm (OEA), respectively, to check the effectiveness of our proposed SA based algorithm. The number of UAVs, N , varies from 5 to 12, and the that of GIDs, M , are set as 20 and 40. Figure 5 and Figure 6 demonstrate the performance of these two algorithms. Figure 5 depicts the comparison results of the obtained maximum system SE. As illustrated in this figure, for the given number of GIDs, the system SE increases following the number of UAVs due to that more UAVs can shorten the communication distances  of the G2A and A2A links and improve the channel gains, resulting in less bandwidth requirements. Figure 5 also shows that, SAGA can obtain a near optimal system SE compared to OEA. Figure 6 presents the running time comparison between SAGA and OEA. It is clearly that OEA has extremely longer running time than SAGA, especially when the number of UAVs becomes larger.
We deploy 10 UAVs in the network to evaluate the performance of our joint optimization scheme according to the calculated SE and system throughput with different numbers of GIDs. In these simulations, besides our solutions, two UAV relaying strategies are also adopted to provide better comparisons. One is selecting all UAVs as relays [20], the other is selecting only one UAV by enumeration method. Figure 7 and Figure 8 show the comparison results of the maximum SE and the total system throughput among the three methods, respectively. As depicted in these two figures, both the system SE and the throughput increase monotonically with the growing number of GIDs M due to that more GIDs will produce more data traffic and increase the system capacity, leading to more requirement of bandwidth. It can be also observed from these   figures that, the obtained SE and throughput results by the three schemes are very close when the number of GIDs is small. While with the GID number growing, the gap between the results of proposed scheme and that of the two others becomes larger. We can come to the conclusion from the comparisons that our proposed selection scheme has better performance than the relaying schemes of selecting all and selecting one.
To further evaluate the advantages of the joint optimization algorithm, we compare the performance of the system SE under different schemes, including scheme random bandwidth allocation and gateway selection without UAV position optimization, scheme only optimizing gateway selection, scheme with only UAV position optimization while randomly enumerating 1∼3 gateways, and our proposed scheme. What should be noticed is that, the schemes of both gateway selection and UAV position optimization are all based on bandwidth allocation optimization described in Section III-B-2. Moreover, in order to validate the performance of the joint optimization strategy, we replace our bandwidth allocation method with a modified algorithm based on [41] while remaining the optimization methods of gateway selection and UAV deployment. Figure 9 shows the comparison results with the number of GIDs varying from 20 to 100. From the comparison of above schemes, it can be seen that, given the same number of GIDs, scheme with only optimizing UAV deployment can slightly improve the system SE than the scheme of gateway selection optimization merely, and both the schemes have advantages on the SE increase over the scheme without optimization. In addition, given the same gateway selection and UAV deployment, our proposed bandwidth allocation strategy can obtain better results of SE than the modified algorithm based on [41]. Finally, our proposed scheme is much more preferred to the other four schemes as the number of GIDs becomes larger.
It is remarkable that in our proposed optimization scheme, there is no specified number of gateways in the simulated annealing based gateway selection algorithm. How many gateways are actually required is determined by the jointly   FIGURE 9. Comparison of the system SE by adopting different schemes, i.e., scheme with only UAV position optimization, scheme only optimizing gateway selection, scheme without optimization, scheme with bandwidth allocation based on [41], and our proposed scheme.
optimized results of the bandwidth allocation and the UAV deployment, as well as the maximum system SE. To validate the superiority of the SAGA method, we replace Algorithm 2 with the enumeration algorithm, to select 2∼4 gateways, respectively, and then execute the jointly optimizing scheme to maximize the system SE. Figure 10 elaborates the comparison results of the calculated SE among the different number of gateways. As can be seen from this figure, selecting more gateways does not always produce higher SE, especially when the number of GIDs is small. On the contrary, given the same traffic originated from GIDs, more gateways will lead to more bandwidth being allocated to the A2S links, and thus lessens the system SE. Figure 10 also confirms that our proposed scheme is able to get the optimal performance of system SE compared to the solutions with fixed number of gateways with the number of GIDs growing.

V. CONCLUSION
In this paper, we have studied the gateway selection and resource allocation for cross-tier data delivery in the UAV-aided SAG-IoT networks to maximize the system spectral efficiency. We defined this issue as a constrained optimization problem based on the system models. To efficiently solve this problem, we first decomposed it into three sub-problems and then used simulated annealing based method and YALMIP tool to solve them, respectively. Finally an iterative algorithm was proposed to alternately optimize gateway selection, bandwidth allocation, and UAV deployment. Different numbers of GIDs and various optimization schemes have been adopted in our performance evaluation. Simulation results verified that to the joint optimization problem, our proposed solution could select the optimal set of gateways and achieve maximum spectral efficiency for the cross-tier commination in SAG-IoT systems.