## 3 Transmission Protocol Configuration and Resource Allocation Scheme
### Traffic Flow Resource Allocation Algorithm
#### 3.2.3 Resource Allocation Algorithm  
Through the determination of transmission protocol configuration \(\left(\alpha_{i}^{n,d},\alpha_{i}^{n,u},\alpha_{i}^{l}\right)\) and \(P_{0}^{l}\), the resource allocation problem of diversified traffic flow can be modeled as a network utility maximization problem, which can be further decomposed into a cell utility maximization problem handled by multiple base stations independently. The cell utility maximization problem corresponding to the base station can reduce its feasible solution through the KKT condition and traverse the possible solution to find the optimal solution.  
The steps of solving problem P2 are intuitively expressed in the form of Algorithm 1. Firstly, under the condition of given \(m\), the solution satisfies the necessary condition of lemma 2. Secondly, M is traversed to search for the optimal solution of problem P2.  
1. Initialization: business flow set \(\Gamma_{j,1}\), resource \(\Phi^{n,d}\), initial value \(U=0\) of objective function of problem P2;  
2. The traffic flows in \(\Gamma_{j,1}\) are divided into soft QoS traffic flow set \(\Gamma_{j,1}^{Q}\) and best effort traffic flow set \(\Gamma_{j,1}^{B}\), which are arranged in descending order of \(c_{j}^{n,d}\) respectively;  
3. for \(m=1\) to \(\left|\Gamma_{j,1}^{Q}\right|\) do  
4. Calculate the resource allocation result \(\alpha_{1}^{n,d}\) according to Equation (33)  
5. Substitute \(\alpha_{1}^{n,d}\) into the objective function in problem P2 and compute the objective function, \(U_{1}\)  
6. Calculate the resource allocation result \(\alpha_{2}^{n,d}\) according to Equation (35)  
7. Substitute \(\alpha_{2}^{n,d}\) into the objective function in problem P2 and compute the objective function, \(U_{2}\)  
8. if \(U_{1}>U\) and \(U_{1}>U_{2}\) then \(U=U_{1},\alpha^{n,d}=\alpha_{1}^{n,d}\);  
9. else if \(U_{2}>U\) and \(U_{2}>U_{1}\) then \(U=U_{2},\alpha^{n,d}=\alpha_{2}^{n,d}\);  
10. end if  
11. end for  
12. Returns the optimal solution \(\alpha^{n,d}\) and the objective function value U  
Through Algorithm 1, solution Algorithm 2 of problem P2 can be designed--the resource allocation algorithm based on utility maximization. The downlink and uplink traffic flow are divided by fixing a and b, and three subproblems with the same structure are constructed. After solving the optimal solution of the subproblem, the a and b are experienced to obtain the optimal solution of problem P1.  
```
1. Initialization: set \(\Gamma_{j}^{d}\), \(\Gamma_{j}^{u}\), initial value \(U=0\) of objective function of problem P1, resource \(\left(\Phi^{u,d},\Phi^{u,u},\Phi^{l}\right)\);
2. Sort the traffic flows in set \(\Gamma_{j}^{d}\) in descending order of \(c_{j}^{u,d}/c_{j}^{l,d}\);
3. Sort the traffic flows in set \(\Gamma_{j}^{u}\) in descending order of \(c_{j}^{u,u}/c_{j}^{l,u}\);
4. for \(b=1\) to \(\left|\Gamma_{j}^{d}\right|\) do
5. for \(a=1\) to \(\left|\Gamma_{j}^{u}\right|\) do
6. Update the business flow set \(\Gamma_{j,1}\), \(\Gamma_{j,2}\), \(\Gamma_{j,3}\), \(\Gamma_{j,4}\), and construct the corresponding three sub-problems;
7. Algorithm 1 is applied to solve subproblem 1, and the returned optimal solution \(\alpha^{u,d}\) and objective function value \(U_{1}\) are recorded;
8. Algorithm 1 is applied to solve subproblem 2, and the returned optimal solution \(\alpha^{u,u}\) and objective function value \(U_{2}\) are recorded;
9. Algorithm 1 is applied to solve subproblem 3, and the returned optimal solution \(\alpha^{l}=\left\{\alpha^{l,d},\alpha^{l,u}\right\}\) and objective function value \(U_{3}\) are recorded;
10. if \(U_{1}+U_{2}+U_{3}>U\) then \(U=U_{1}+U_{2}+U_{3}\);
11. According to the results of \(\alpha^{u,d}\), \(\alpha^{u,u}\) and \(\alpha^{l}=\left\{\alpha^{l,d},\alpha^{l,u}\right\}\); the solution \(\alpha_{j}\) of P1 is formed;
12. end if
13. end for
14. Returns the optimal solution \(\beta_{j}\) and the objective function value \(U\)
```  
**Algorithm 2** Utility of base station J based on resource allocation algorithm.