# A Relay Optimization Method for NOMA-Based Power Line Communication Systems
## 3 Optimization Process and Performance Analysis
### Uplink from Relay Node to Other Users
\[x_{i},y_{i}\in Selectable\ Users,\forall i \tag{27}\]  
where \(x_{i},y_{i}\) is the position of the \(i\)-th relay. Considering the above conditions, the optimization problem can be formalized as follows:  
\[subject\ to\left\{ \begin{aligned} & B_{d}\text{log}_{2}\Bigg{(}1+\frac{P_{S} \left|h_{S_{j}}^{(i)}\right|^{2}}{N_{1}}\Bigg{)}\geq C_{min}\\ & B_{u}\text{log}_{2}\Bigg{(}1+\frac{P_{r}\left|h_{r}^{(i)}\right| ^{2}}{N_{2}}\Bigg{)}\geq C_{min}\\ & P_{S}\geq 0\\ & P_{r}\geq 0\\ & BER\leq BER_{max}\\ & R_{i}\geq R_{min},\forall i\\ & x_{i},y_{i}\in Selectable\ Users,\forall i\\ \end{aligned} \right. \tag{28}\]  
After optimization, we obtain the relay positions that complete communication with minimal total power. Optimization Approach:  
This paper proposes a heuristic optimization algorithm combined with deep learning, aiming to solve the optimization problem. This hybrid approach uses deep learning models to predict Channel State Information (CSI) and heuristic algorithms for power optimization and relay selection. The specific process is as follows:  
1. Data Collection and Preprocessing: Collect data related to CSI, noise power, user positions, and other relevant factors from historical communication data. Normalize the data for training deep learning models. Input: Historical communication data, including user positions, historical CSI, and noise power. Process: Load historical data. Select relevant features (user positions, historical CSI, noise power). Normalize the data. The normalization of CSI is given by:  
\[\text{CSI}_{\text{scaled}}=\frac{\text{CSI}-\text{min}(\text{CSI})}{\text{max }(\text{CSI})-\text{min}(\text{CSI})} \tag{29}\]  
Output: Normalized features for model training. 2. Deep Learning Model Training: Design and create an LSTM deep learning model suitable for time series prediction. Train the model using historical data to predict future CSI. Input: Normalized features and corresponding targets (future CSI values). Process: Define the LSTM model structure. Compile the model using an appropriate loss function and optimizer. Train the model using training data. Output: Trained LSTM model. The LSTM model was trained on a dataset generated through extensive simulations of the power line communication environment. The dataset consists of 2000 training samples and 500 test samples, each representing a unique communication scenario with varying channel conditions, noise levels, and user positions. The dataset was designed to capture a wide range of CSI variations, including different levels of multipath fading, background noise, and impulsive noise. The diversity of the dataset ensures that the LSTM model can generalize well to unseen data, making its predictions more reliable in real-world scenarios. To further enhance the representativeness of the dataset, we incorporated log-normal fading channels and background noise models, which are typical in power line communication systems. The dataset was generated by simulating the communication environment over a range of distances (from 1 to 5 units) and frequencies (from 3 MHz to 30 MHz), ensuring that the model is exposed to a variety of channel conditions. This comprehensive dataset allows the LSTM model to learn the temporal dependencies and nonlinear dynamics of the channel, leading to more accurate CSI predictions. 3. Initial Power Allocation: Use the trained model to predict future CSI. Perform initial power allocation based on the predicted CSI to ensure that the initial allocation meets basic communication requirements. Input: Trained LSTM model and new data for prediction. Process: Use the trained model to predict future CSI. Initialize signal source power (\(p_{s}\)) and user power (\(p_{i}\)) with random values. Expressed as:  
\[\text{LSTM(CSI}_{\text{scaled}})\rightarrow\text{CSI}_{\text{scaled}} \tag{30}\]  
The denormalized prediction results can be expressed as:  
\[\widehat{\text{CSI}}=\widehat{\text{CSI}}_{\text{scaled}}\times(\text{max}( \text{CSI})-\text{min}(\text{CSI}))+\text{min}(\text{CSI}) \tag{31}\]  
4.