# Social-Aware-Based Resource Allocation for NOMA-Enhanced D2D Communications
## 3 Social-Aware-Based Resource Allocation
### Optimization Model
#### 3.2.2 Power Control
According to previous analysis, the data rate can be rewritten as  
\[\gamma_{\mathrm{m}}\geq\gamma_{m}^{th}\quad\forall m \tag{31}\]9  
\[\gamma_{d}^{k}\geq\gamma_{d}^{th}\quad k\in\{D\}\]0  
\[\gamma_{d}^{k}\geq\gamma_{d}^{th}\quad k\in\{D\}\]1  
In order to maximize the sum rate of all D2D content providers in D2D clusters, the optimization goal can be defined as  
\[\gamma_{d}^{k}\geq\gamma_{d}^{th}\quad k\in\{D\}\]2  
We can obtain the Hessian matrix by seeking the second partial derivative of Equations (47)-(49) as  
\[H_{1}=\left[ \begin{array}{ccc}0&0&0\\ 0&-\frac{\alpha_{1}}{\ln 2}\frac{\left(e^{P_{3}}h_{3}+P_{C}h_{C1}+\sigma^{2} \right)e^{P_{2}}g_{2}}{\left(e^{P_{2}}g_{2}+e^{P_{3}}h_{3}+P_{C}h_{C1}+\sigma^{ 2}\right)^{2}}&\frac{\alpha_{1}}{\ln 2}\frac{e^{P_{2}}g_{2}e^{P_{3}}h_{3}}{\left(e^{P_{2}}g_{2 }+e^{P_{3}}h_{3}+P_{C}h_{C1}+\sigma^{2}\right)^{2}}\\ 0&\frac{\alpha_{1}}{\ln 2}\frac{e^{P_{3}}h_{3}e^{2}g_{2}}{\left(e^{P_{2}}g_{2}+e^{P _{3}}h_{3}+P_{C}h_{C1}+\sigma^{2}\right)^{2}}&-\frac{\alpha_{1}}{\ln 2} \frac{\left(e^{P_{2}}g_{2}+P_{C}h_{C1}+\sigma^{2}\right)e^{P_{3}}h_{3}}{\left(e ^{P_{2}}g_{2}+e^{P_{3}}h_{3}+P_{C}h_{C1}+\sigma^{2}\right)^{2}}\end{array} \right] \tag{51}\]  
\[H_{2}=\left[ \begin{array}{ccc}0&0&0\\ 0&0&\frac{\alpha_{2}}{\ln 2}e^{P_{3}}h_{3}\\ 0&0&-\frac{\alpha_{2}}{\ln 2}\frac{\left(P_{C}h_{C1}+\sigma^{2}\right)e^{P_{3}}h_{3} }{\left(e^{P_{3}}h_{3}+P_{C}h_{C1}+\sigma^{2}\right)^{2}}\end{array} \right] \tag{52}\]  
\[H_{3}=\left[ \begin{array}{ccc}-\frac{\alpha_{3}}{\ln 2}\frac{\left(e^{P_{2}}h_{2 }+P_{C}h_{C3}+\sigma^{2}\right)e^{P_{1}}h_{1}}{\left(e^{P_{1}}h_{1}+e^{P_{2}}h _{2}+P_{C}h_{C3}+\sigma^{2}\right)^{2}}&\frac{\alpha_{3}}{\ln 2}\frac{e^{P_{1}}h_{1}e^{ P_{2}}h_{2}}{\left(e^{P_{1}}h_{1}+e^{P_{2}}h_{2}+P_{C}h_{C3}+\sigma^{2}\right)^{2}}&0\\ \frac{\alpha_{3}}{\ln 2}\frac{e^{P_{2}}h_{2}e^{P_{1}}h_{1}}{\left(e^{P_{1}}h_{1}+e^{P_{ 2}}h_{2}+P_{C}h_{C3}+\sigma^{2}\right)^{2}}&-\frac{\alpha_{3}}{\ln 2}\frac{\left(e^{P_{1}}h_{1}+P_{C}h_{C3}+\sigma^{2} \right)^{P_{2}}h_{2}}{\left(e^{P_{1}}h_{1}+e^{P_{2}}h_{2}+P_{C}h_{C3}+\sigma^{2 }\right)^{2}}&0\\ 0&0\end{array} \right] \tag{53}\]  
We can draw the conclusion that the optimization goal is concave because \(H_{1}\leq 0,H_{2}\leq 0,H_{3}\leq 0\). Moreover, Constraints (41) and (43) are linear function about \(e^{P_{d}^{k}}\). Constraint (42) has a similar structure to the optimization goal, and the convexity will not be proofed again. As a consequence, the optimization problem is convex. \(\Box\)  
Since the optimization problem has been transformed into a convex problem, we can solve it via GA. GA searches for the optimal solution by simulating the natural evolutionary process. It finds the solution with the highest fitness through encoding, selection, crossover, and mutation. Because of the convexity of the optimization problem, we can use GA to solve the power allocation problem so as to reduce the time complexity and quickly obtain the optimal solution. The proposed power allocation method based on SCA and GA is described in Algorithm 3. **Theorem 3**. : _The power allocation algorithm based on SCA and GA can converge to the optimal strategy._  
Proof. : Assume the optimal solution is \(P_{d}^{k}(t)\) after \(t\) iterations, then we can obtain the following inequality:  
\[\sum_{k\in\mathcal{D}}R_{d}^{k}(t)=f\Big{(}P_{d}^{k}(t)\Big{)}<f\Big{(}P_{d}^{k} (t+1)\Big{)}\leq\sum_{k\in\mathcal{D}}R_{d}^{k}(t+1) \tag{54}\]  
The first equality holds because \(\gamma_{d}^{k}(t)\) is derived from \(\alpha_{d}^{k}(t)\) and \(\beta_{d}^{k}(t)\). The second inequality holds because \(f\Big{(}P_{d}^{k}(t+1)\Big{)}\) is the optimal solution of the \(t+1\) iteration. The third inequality holds because of the lower bound theory in Equation (38). Since the sum rate of D2D users in the cell is limited, the power allocation algorithm will finally converge. The computational complexity of the power allocation algorithm consists of two parts. The complexity of SCA depends on the number of iterations when it converges.