# Resource Allocation for Relay-Based OFDMA Power Line Communication System
## 3 The Optimal Resource Allocation Strategy for a PLC System
### The Subcarrier Allocation Strategy
\right\} \tag{25}\]  
according to the assumption, there are two situations, i.e., \(v_{1}>v^{\prime}_{1},\ v_{2}<v^{\prime}_{2}\) and \(v_{1}<v^{\prime}_{1},\ v_{2}>v^{\prime}_{2}\), without loss of generality, we only consider the situation \(v_{1}>v^{\prime}_{1},\ v_{2}<v^{\prime}_{2}\). Calculate \(x_{n}\) by (24), if the value is negative, let \(x_{n}=0\), that is  
\[x_{n}(v_{1},v_{2})=0,\ \ n\in\overline{\mathcal{N}}_{1},\ \ \ \ \ \text{and}\ \ \ \ \ x_{n}(v^{\prime}_{1},v^{\prime}_{2})=0,\ \ n\in\overline{\mathcal{N}}_{2}. \tag{26}\]  
and \(\mathcal{C}_{2}\subseteq\overline{\mathcal{N}}_{1},\ \mathcal{C}_{1}\subseteq \overline{\mathcal{N}}_{2}\), which leads to  
\[x_{n}(v_{1},v_{2})=0,\ \ n\in\mathcal{C}_{2},\ \ \ \ \ \ \text{and}\ \ \ \ \ \ x_{n}(v^{\prime}_{1},v^{\prime}_{2})=0,\ \ n\in\mathcal{C}_{1}.\]  
Then, from \(\sum_{n\in\mathcal{N}_{1}}x_{n}(v_{1},v_{2})=\sum_{n\in\mathcal{N}_{2}}x_{n}( v^{\prime}_{1},v^{\prime}_{2})=P_{S}\), we can derive that  
\[P_{S}=\sum_{n\in\mathcal{N}_{1}}x_{n}(v_{1},v_{2})+\sum_{n\in\mathcal{C}_{2}}x _{n}(v_{1},v_{2})=\sum_{n\in\mathcal{N}_{2}}x_{n}(v^{\prime}_{1},v^{\prime}_{ 2})+\sum_{n\in\mathcal{C}_{1}}x_{n}(v^{\prime}_{1},v^{\prime}_{2}). \tag{27}\]  
According to the definition of set \(\mathcal{M}_{0}\), we can obtain  
\[P_{S}=\sum_{n\in\mathcal{M}_{0}}x_{n}(v_{1},v_{2})+\sum_{n\in\mathcal{M}_{0}}x _{n}(v^{\prime}_{1},v^{\prime}_{2}). \tag{28}\]  
Define two subcarrier sets \(\mathcal{D}_{1},\ \mathcal{D}_{2}\), which satisfy  
\[\left\{ \begin{array}{ll}x_{n}(v_{1},v_{2})\geq x_{n}(v^{\prime}_{1},v^{ \prime}_{2}),\ \ n\in\mathcal{D}_{1},\\ x_{n}(v_{1},v_{2})<x_{n}(v^{\prime}_{1},v^{\prime}_{2}),\ \ n\in\mathcal{D}_{2}. \end{array} \right\}, \tag{29}\]  
where \(\mathcal{D}_{1}\bigcup\mathcal{D}_{2}=\mathcal{M}_{0}\), combined with (24), we can derived that  
\[\eta_{n\in\mathcal{D}_{1}}>\eta_{n\in\mathcal{D}_{2}}. \tag{30}\]  
Additionally, from (27) we can obtain  
\[\sum_{n\in\mathcal{D}_{1}}\left(x_{n}(v_{1},v_{2})-x_{n}(v^{\prime}_{1},v^{ \prime}_{2})\right)=\sum_{n\in\mathcal{It can be seen that the above conclusion contradicts the previously held assumption. Therefore, there exists a unique solution for the optimization problem (24). Based on the above description, we can obtain the optimal power allocation scheme, however, the expression of the value \(L\), \(\
u_{1}\) and \(\
u_{2}\) are not available. The details about the calculation of the parameters are given in Algorithm 1. ```
1: Initialization: Let \(\
u_{1}\in[\
u_{1,\min},\
u_{1,\max}]\), \(\
u_{2}\in[\
u_{2,\min},\
u_{2,\max}]\), \(\
u_{1,\max}=\min G_{(i)}(P_{s})_{i\in\Omega_{n}}\), \(\
u_{2,\max}=\min G_{(i)}(0)_{i\in\Omega_{n}}\), \(\
u_{1,\min}=0\), \(\
u_{2,\min}=0\). 2: Let \(\
u_{1}=\frac{\
u_{1,\min}+\
u_{1,\max}}{2}\), \(\
u_{2}=\frac{\
u_{2,\min}+\
u_{2,\max}}{2}\), calculate \(x_{n}(\
u_{1},\
u_{2})\) by (24), and obtain the subcarrier set \(\mathcal{N}_{1}=\{n\in\Omega_{T}|x_{n}>0\}\). 3:while\(\frac{\left|\sum_{n\in\mathcal{N}_{1}}x_{n}(\
u_{1},\
u_{2})-P_{S}\right|}{P_{S}}>\epsilon\) or \(\frac{\left|\sum_{n\in\mathcal{N}_{1}}\theta_{n}x_{n}(\
u_{1},\
u_{2})-I_{ tot}\right|}{I_{tol}}>\epsilon\)do
4:while\(\left(\sum_{n\in\mathcal{N}_{1}}x_{n}(\
u_{1},\
u_{2})-P_{S}\right)\left( \sum_{n\in\mathcal{N}_{1}}\theta_{n}x_{n}(\
u_{1},\
u_{2})-I_{tol}\right)>0\)do
5: If \(\sum_{n\in\mathcal{N}_{1}}x_{n}(\
u_{1},\
u_{2})-P_{S}>0\), and \(\sum_{n\in\mathcal{N}_{1}}\theta_{n}x_{n}(\
u_{1},\
u_{2})-I_{tol}>0\), \(\
u_{1,\min}=\
u_{1}\), otherwise, \(\
u_{1,\max}=\
u_{1}\). 6: Let \(\
u_{1}=\frac{\
u_{1,\min}+\
u_{1,\max}}{2}\), calculate \(x_{n}\) by (24), and obtain the set \(\mathcal{N}_{1}\). 7:endwhile
8: If \(\sum_{n\in\mathcal{N}_{1}}x_{n}(\
u_{1},\
u_{2})>P_{S}\) and \(\sum_{n\in\mathcal{N}_{1}}\theta_{n}x_{n}(\
u_{1},\
u_{2})<I_{tol}\), \(\
u_{1,\min}=\
u_{1}\), \(\
u_{2,\max}=\
u_{2}\), otherwise, \(\
u_{1,\max}=\
u_{1}\), \(\
u_{2,\min}=\
u_{2}\).