# Optimal Power Allocation with Hybrid Relaying Based on the Channel Condition
## 3 Optimal Power Allocation Schemes for Hybrid Relay Networks
### AF and DF Relay Network  
In this subsection, we propose the optimal power allocation scheme for the three-hop AF and DF relay networks.  
The optimization problem to maximize the achievable rate under a sum relay power constraint can be written as  
\[\max_{P_{ad,1},P_{ad,2}}R_{ad}(P_{ad,1},P_{ad,2}),\ \ \ s.t.\ \ P_{ad,1}+P_{ad,2}=P. \tag{15}\]  
We define the ratio of \(P_{ad,1}\) to \(P\) as \(\alpha_{ad}\). By using \(\alpha_{ad}\), the optimization problem is rewritten as  
\[\max_{a_{ad}}\ \min\{\gamma_{ad,1}(\alpha_{ad}),\gamma_{ad,2}(\alpha_{ad})\},\ \ \ s.t.\ \ 0<\alpha_{ad}<1, \tag{16}\]  
where \(\gamma_{ad,1}(\alpha_{ad})\) and \(\gamma_{ad,2}(\alpha_{ad})\) are given, respectively, as  
\[\gamma_{ad,1}(\alpha_{ad})=\frac{P_{s}\alpha_{ad}P|h_{1}|^{2}|h_{2}|^{2}}{P_{ s}|h_{1}|^{2}+\alpha_{ad}P|h_{2}|^{2}+1}, \tag{17}\]  
\[\gamma_{ad,2}(\alpha_{ad})=-\alpha_{ad}P|h_{3}|^{2}+P|h_{3}|^{2}. \tag{18}\]As \(\alpha_{ad}\) increases, \(\gamma_{ad,1}(\alpha_{ad})\) increases and \(\gamma_{ad,2}(\alpha_{ad})\) decreases. Therefore, by solving the equation \(\gamma_{ad,1}(\alpha_{ad})=\gamma_{ad,2}(\alpha_{ad})\) and using the well-known quadratic formula, the optimal \(\alpha_{ad}\) is obtained as  
\[\alpha_{ad}=\frac{-b-\sqrt{b^{2}-4 ac}}{2a}, \tag{19}\]  
where \(a\), \(b\), and \(c\) are given, respectively, as  
\[\begin{split} a&=-P^{2}|h_{2}|^{2}|h_{3}|^{2},\\ b&=-P_{S}P|h_{1}|^{2}(|h_{2}|^{2}+|h_{3}|^{2})+P|h_{ 3}|^{2}(P|h_{2}|^{2}-1),\\ c&=P|h_{3}|^{2}(1+P_{s}|h_{1}|^{2}).\end{split} \tag{20}\]  
When the channel gains are the same, \(\alpha_{ad}\) in Equation (19) is represented as  
\[\alpha_{ad}=\frac{1}{2}+\frac{\sqrt{\lambda_{ad}^{2}+P^{2}|h_{ad}|^{4}+2P|h_{ ad}|^{2}}-\lambda_{ad}}{2P|h_{ad}|^{2}}, \tag{21}\]  
where \(|h_{ad}|^{2}=|h_{1}|^{2}=|h_{2}|^{2}=|h_{3}|^{2}\) and \(\lambda_{ad}\) is given by  
\[\lambda_{ad}=2P_{s}|h_{ad}|^{2}+1. \tag{22}\]  
From Equation (21), we know that \(\alpha_{ad}\) is greater than \(1/2\). In other words, we should allocate more power to the first relay than the second relay to maximize the achievable rate when the channel gains are the same. In addition, we know that \(\alpha_{ad}\) increases as \(P\) increases, as per Equation (21). Therefore, greater power should be allocated at the first AF relay, as \(P\) increases when the channel gains are the same.  
When \(|h_{ad}|^{2}=|h_{1}|^{2}=|h_{2}|^{2}=|h_{3}|^{2}\), the SNR for the AF-DF relay network in Equation (7) is rewritten as  
\[\gamma_{ad}=\min\left(\gamma_{ad,s2},\gamma_{ad,2d}\right), \tag{23}\]  
where \(\gamma_{ad,s2}\) and \(\gamma_{ad,2d}\) are given, respectively, as  
\[\gamma_{ad,s2}=\frac{P_{s}P_{ad,1}|h_{ad}|^{4}}{P_{s}|h_{ad}|^{2}+P_{ad,1}|h_{ ad}|^{2}+1}, \tag{24}\]  
\[\gamma_{ad,2d}=P_{ad,2}|h_{ad}|^{2}. \tag{25}\]  
Because \(\gamma_{ad,s2}\) has a similar form of the harmonic mean of \(P_{s}|h_{ad}|^{2}\) and \(P_{ad,1}|h_{ad}|^{2}\), the increment of \(\gamma_{ad,s2}\) is less than that of \(P_{ad,1}\) as \(P_{ad,1}\) increases. On the other hand, the increment of \(\gamma_{ad,2d}\) is equal to that of \(P_{ad,2}\) as \(P_{ad,2}\) increases. Therefore, the increment of \(\gamma_{ad,s2}\) is less than that of \(\gamma_{ad,2d}\) when the increments of \(P_{ad,1}\) and \(P_{ad,2}\) are the same. To maximize the minimum value between \(\gamma_{ad,s2}\) and \(\gamma_{ad,2d}\) in Equation (23), it is necessary to further increase \(\gamma_{ad,s2}\), which does not increase as much as \(\gamma_{ad,2d}\). In addition, to increase \(\gamma_{ad,s2}\) more than \(\gamma_{ad,2d}\), we should allocate more power at the first relay than at the second relay.