# Dynamic Divide Grouping Non-Orthogonal Multiple Access in Terrestrial-Satellite Integrated Network
## 5 Joint Resource Allocation Optimization Scheme
### BS Channel Resource Allocation  
To maximize the capacity performance of BS users, by fixing the satellite parameters, we study the channel allocation scheme for the BS users. As stated before, the satellite will cause interference to all the BS users within its coverage. Thus, the optimization problem can be formulated as follows:\[\begin{array}{ll}\max\limits_{r,p}&\sum\limits_{j=1}^{N}\left(C_{B,i,j}^{(1)}+C_ {B,i,j}^{(2)}\right),\\ s.t&\text{C1}:\sum\limits_{j=1}^{N}r_{B,i,j}\leq r_{B,i,\max},\\ C2:r_{B,i,j},P_{B,i,j}>0,\\ C3:P_{B,i,j}\leq P_{\max}.\end{array} \tag{48}\]  
where \(r_{B,i,\max}\) is the total resource of BS, \(r_{B,i,j}\) represents the allocated resource for the BS subchannel \(j\) and \(P_{\max}\) represents the maximum power transmitted of group \(J\). Constraint C1 denotes the power constraint of the BS, Constraint C2 ensures the minimum resources of each group and Constraint C3 is the maximum transmit power of the group \(j\).  
```
1:Initialize:\(t=1,\theta_{S,J,J}^{(1)}=\theta_{S,J,J}^{(2)}=1,\beta_{S,J,J}^{(1)}=\beta_{S,J,J}^{ (2)}=0\); Initialize power \(P_{S,J,J}\)=0;
2:repeat
3: Initialize \(t_{\delta}=1,\lambda>0,\mu>0\)
4: Initialize \(I_{B}\)
5:repeat
6:for\(J=1\) to \(K_{i}/2\) do
7: Update \(P_{S,J,J}\) by using (44)
8: Update \(r_{S,J,J}\) by using (45)
9:endfor
10: Update \(\lambda,\mu\) by using (46) and (47)
11: Set \(t_{\delta}=t_{\delta}+1\)
12: Until \(\lambda,\mu\) converges
13: Set \(P_{S,J,J}[t]=P_{S,J,J}[t+1]\)
14: Update \(\theta_{S,J,J}^{(1)},\theta_{S,J,J}^{(2)},\beta_{S,J,J}^{(1)},\beta_{S,J,J}^{ (2)}\) by using (39) and (40)
15: Set \(t=t+1\)
16:Until \(P_{S,J,J},r_{S,J}\) converges
```  
**Algorithm 1** Satellite Beam Channel Resource Allocation.  
Similarly, according to successive approximation method [46], the objective function can be transformed as  
\[r_{B,i,j}\text{log}_{2}(1+\gamma_{B,i,j}^{(1)})\geq\frac{r_{B,i,j}}{In2}( \theta_{B,i,j}^{(1)}In\gamma_{B,i,j}^{(1)}+\beta_{B,i,j}^{(1)}), \tag{49}\]  
\[r_{B,i,j}\text{log}_{2}(1+\gamma_{B,i,j}^{(2)})\geq\frac{r_{B,i,j}}{In2}( \theta_{B,i,j}^{(2)}In\gamma_{B,i,j}^{(2)}+\beta_{B,j,j}^{(2)}), \tag{50}\]  
where approximation parameters are calculated as  
\[\theta_{B,i,j}^{(1)}=\frac{\overline{\gamma_{B,i,j}^{(1)}}}{1+\overline{ \gamma_{B,i,j}^{(1)}}},\beta_{B,i,j}^{(1)}=In\left(1+\overline{\gamma_{B,i,j}^ {(1)}}\right)-\frac{\overline{\gamma_{B,i,j}^{(1)}}}{1+\overline{\gamma_{B,i,j }^{(1)}}}In\overline{\gamma_{B,i,j}^{(1)}}, \tag{51}\]  
\[\theta_{B,i,j}^{(2)}=\frac{\overline{\gamma_{B,i,j}^{(2)}}}{1+\overline{ \gamma_{B,i,j}^{(2)}}},\beta_{B,i,j}^{(2)}=In\left(1+\overline{\gamma_{B,i,j }^{(2)}}\right)-\frac{\overline{\gamma_{B,i,j}^{(2)}}}{1+\overline{\gamma_{B, i,j}^{(2)}}}In\overline{\gamma_{B,i,j}^{(2)}}. \tag{52}\]  
Then, as \(\sum\limits_{j=1}^{N}\frac{r_{B,i,j}}{In2}[(\theta_{B,i,j}^{(1)}In\gamma_{B,i,j}^{(1)}+\beta_{B,i,j}^{(1)})+(\theta_{B,j,j}^{(2)}In\gamma_{B,i,j}^{(2)}+ \beta_{B,i,j}^{(2)})]\) is the lower bound of \(\sum\limits_{j=1}^{N}\left(C_{B,i,j}^{(1)}+C_{B,i,j}^{(2)}\right)\), changing the variable \(\overline{P_{B,i,j}^{-}}=InP_{B,i,j}\), the optimization problem in each iteration is transformed into  
solvable convex problem by logarithmic approximation. In the inner loop, we solve the transformed subproblem using the Lagrangian dual method. By updating the approximation parameters iteratively, we can finally obtain the optimal solution of original problem in (53).