## 3 Two-Stage Adaptive Relay Selection and Power Allocation Strategy  
In this section, a two-stage adaptive relay selection and power allocation strategy is proposed to maximize the achievable data rate of \(x_{2}\) at U\({}_{2}\) while guaranteeing the QoS of U\({}_{1}\). The selection criteria of the optimal relay change adaptively according to the signal sent by U\({}_{1}\) at the end of the first time slot (i.e., the decoding result of U\({}_{1}\)). After all relays receive the signal, the candidate sets will be determined, and the optimal relay will be selected from the candidate sets or U\({}_{1}\) to transmit the user's desired signal. There are two stages:  
* In the first stage, the relays are selected from the candidate sets to ensure that the achievable rate of the transmitted signal is not lower than the target data rate of U\({}_{1}\);
* In the second stage, a relay that maximizes the achievable rate of \(x_{2}\) at U\({}_{2}\) is selected from the relays determined in the first stage. Power allocation of the optimal relay is adaptive. That means the power allocation needs to ensure the QoS of U\({}_{1}\) first, then the remaining power is allocated to U\({}_{2}\). After sending the signaling, U\({}_{1}\) will adjust its decoding order in the second time slot according to decoding result. In particular, if U\({}_{1}\) fails to decode its own signal in the first time slot, it will be considered as a \"weak user\" in the second time slot. Therefore, according to the signaling sent by U\({}_{1}\), four relay selection criteria with power allocation are designed as follows. Case 1: U\({}_{1}\) successfully decodes \(x_{2}\) and \(x_{1}\) (\(\Theta\) = '11')  
In this case, U\({}_{1}\) successfully decodes \(x_{2}\) and \(x_{1}\) in the first time slot and does not need the assistance from relays in the second time slot. The optimal relay from \(S_{1}\) or U\({}_{1}\) is selected to transmit \(x_{2}\) to U\({}_{2}\). If \(R_{n}\), \(n\in S_{1}\) is selected, the power allocation coefficient will be set as \(\beta_{n2}^{11}=1\). It means that \(R_{n}\) will send \(x_{R_{n}}^{11}=x_{2}\) with full power to U\({}_{2}\). Based on Equation (5), the achievable rate of \(x_{2}\) at U\({}_{2}\) is given by  
\[R_{R_{n}U_{2}}^{x_{2},11}=\frac{1}{2}log_{2}\Big{(}1+\rho_{R}\big{|}h_{R_{n}U_ {2}}\big{|}^{2}\Big{)} \tag{10}\]  
If all the relays cannot meet the target data rate requirements of U\({}_{2}\), U\({}_{1}\) is used as the optimal relay. The criterion for determining the optimal relay \(R_{n^{*}}\) is given by  
\[n^{*}=\left\{ \begin{array}{ll}0,&\underset{n\in S_{1}}{max}\Big{\{}R_{R_{n} U_{2}}^{x_{2},11}\Big{\}}<R_{2},\\ \underset{n\in S_{1}}{argmax}\Big{\{}R_{R_{n}U_{2}}^{x_{2},11}\Big{\}},& \underset{n\in S_{1}}{otherwise}.\end{array} \right. \tag{11}\]  
where \(n^{*}=0\) suggests that U\({}_{1}\) is selected as the optimal relay. Different from the selection strategy in [29], relay participation is preferred in this paper. Case 2: U\({}_{1}\) successfully decodes \(x_{2}\) but fails to decode \(x_{1}\) (\(\Theta\) = '10')  
In this case, both U\({}_{1}\) and U\({}_{2}\) need the assistance from relays in the second time slot. The optimal relay is selected from \(S_{2}\). Assuming that \(R_{n}\), \(n\in S_{2}\) is selected, it will generate a new superimposed signal \(x_{R_{n}}^{10}=\sqrt{\beta_{n1}^{10}}x_{1}+\sqrt{\beta_{n2}^{10}}x_{2}\) based on SC to serve U\({}_{1}\) and U\({}_{2}\). Note that U\({}_{1}\) is considered as the weak user in the second slot because it fails to decode its own signal in the first slot. Based on SIC, \(x_{1}\) is decoded first after U\({}_{2}\) receives the superimposed signal.