# Energy-Efficient Subcarrier Pairing and Power Allocation for DF Relay Networks with an Eavesdropper
## 3 Energy-Efficient Subcarrier Pairing and Power Allocation Algorithm  
The objective function in (33) is in a fractional form and the optimization problem is mixed-integer binary non-linear programming. In result, the problem becomes non-convex [18]. To make the problem tractable, an auxiliary variable \(\Omega_{i}\), \(i\in\{1,...,K\}\) is introduced and change of variables \(\hat{P}_{S,i}=\ln P_{S,i}\), \(\hat{P}_{R,j}=\ln P_{R,j}\), and \(\hat{\Omega}_{i}=\ln\Omega_{i}\) is applied to transform the problem as follows:  
\[ \begin{split}\text{(P.2)}\max_{\mathbf{P}_{S},\mathbf{P}_{R}, \boldsymbol{\rho},\boldsymbol{\Omega}}&\frac{\frac{ \frac{ 1}{2}\sum\limits_{i=1}^{K}\sum\limits_{j=1}^{K}\rho_{i,j}\log_{2}\left(1+e ^{\hat{\Omega}_{i}}\right)}-\sum\limits_{j=1}^{K}\log_{2}\left(1+\hat{\Gamma}_ {RE,j}\right)}{\sum_{i=1}^{K}\sum_{j=1}^{K}\rho_{i,j}\left(e^{\hat{P}_{S,i}}+e^ {\hat{P}_{R,j}}\right)+P_{\text{SC}}}\\ \text{s.t.}&\text{(C.1)}\quad\sum_{i=1}^{K}\sum_{j=1 }^{K}\rho_{i,j}\left(e^{\hat{P}_{S,i}}+e^{\hat{P}_{R,j}}\right)\leq P_{max}\,; \\ &\text{(C.2)}-\text{(C.4)}\,\,;\\ &\text{(C.5)}\,\,\,e^{\hat{\Omega}_{i}-\hat{P}_{S,i}}\frac{ \sigma_{R,i}^{2}}{\left|h_{SR,i}\right|^{2}}\leq 1,\;\;\;\forall i\,;\\ &\text{(C.6)}\,\,\,e^{\hat{\Omega}_{j}-\hat{P}_{R,j}}\frac{ \sigma_{D,j}^{2}}{\left|h_{RD,j}\right|^{2}}\leq 1,\;\;\forall j\,. \end{split}  \tag{11}\]  
where \(\boldsymbol{\Omega}=[\Omega_{1},\Omega_{2},\cdots,\Omega_{K}]\) and \(\hat{\Gamma}_{RE,j}\) can be given as  
\[\hat{\Gamma}_{RE,j}=\frac{e^{\hat{P}_{R,j}}\left|h_{RE,j}\right|^{2}}{\sigma_{ E,j}^{2}},\qquad\forall j \tag{12}\]  
To deal with the fractional objective function, we now transform the objective function in (11) into a subtractive form by using a successive convex approximation (SCA) method to impose two lower bounds as follows:\[\log_{2}\left(1+e^{\Omega_{i}}\right) \geq\frac{\alpha_{i}^{d}}{\ln 2}\hat{\Omega}_{i}+\beta_{i}^{d},\ \forall i \tag{13}\] \[\log_{2}\left(1+\hat{\Gamma}_{RE,i}\right) \geq\frac{\alpha_{j}^{e}}{\ln 2}\left(\hat{P}_{R,j}+\ln\left(\left|h_{RE,j} \right|^{2}\right)-\ln\left(\sigma_{E,j}^{2}\right)\right)+\beta_{j}^{e},\ \forall j \tag{14}\]  
where the coefficients in (13) are determined in the following manner [6]:  
\[\alpha_{i}^{d} =\frac{\xi_{i}}{1+\xi_{i}} \tag{15}\] \[\beta_{i}^{d} =\log_{2}\left(1+\xi_{i}\right)-\alpha_{i}^{d}\log_{2}\left(\xi_ {i}\right) \tag{16}\]  
for any \(\xi_{i}>0\). Note that the equality in (13) holds when \(a_{i}^{d}=\hat{\Omega}_{i}/1+\hat{\Omega}_{i}\) and \(\beta_{i}^{d}=\log_{2}\left(1+\hat{\Omega}_{i}\right)-\alpha_{i}^{d}\log_{2} \left(\hat{\Omega}_{i}\right)\), and the equality holds for \(\left(\alpha_{i}^{d},\beta_{i}^{d}\right)=\left(0,1\right)\) if \(\hat{\Omega}_{i}\rightarrow\infty\). Also, \(\alpha_{j}^{e}\) and \(\beta_{j}^{e}\) are defined similarly. After substituting (13) and (14) into (11) the objective function turns out to be concave-over-convex and thus we apply the well-known Dinkelbach method to transform it into a subtractive form [19]:  
\[\left(\text{P.3}\right)\max_{\mathbf{P}_{S},\mathbf{P}_{R}, \boldsymbol{\rho},\boldsymbol{\Omega}}\frac{1}{2}\sum_{i=1}^{K}\sum_{j=1}^{K} \rho_{i,j}\left(\frac{\alpha_{i}^{d}}{\ln 2}\hat{\Omega}_{i}+\beta_{i}^{d} \right)-\sum_{j=1}^{K}\frac{\alpha_{j}^{e}}{\ln 2}\left(\hat{P}_{R,j}+\ln \left(\left|h_{RE,j}\right|^{2}\right)-\ln\left(\sigma_{E,j}^{2}\right) \right)-\beta_{j}^{e}\] \[-\mathbf{\Psi}(t)\left(\sum_{i=1}^{K}\sum_{j=1}^{K}\rho_{i,j} \left(e^{\hat{P}_{S,j}}+e^{\hat{P}_{R,j}}\right)+P_{\text{SC}}\right)\] \[\text{s.t. }\quad\left(\text{C.1}\right)-\left(\text{C.6}\right) \tag{17}\]  
where \(\mathbf{\Psi}(t)\) is a positive parameter at iteration \(t\) and it is treated as a penalty factor for the power utilization. When the parameter approaches zero, it indicates that the penalty is zero for the power utilization, and the resource allocation problem converts into a problem of secure sum rate maximization in a relay network.