# Simulated Annealing for Resource Allocation in Downlink NOMA Systems in 5G Networks
## 3 Simulated Annealing Based Resource Allocation
### SA for Proportional Power Allocation \(\delta_{n}\)
Initialize temperature T = 100. 3. Set the maximum displacements \(\Delta\delta_{max}=1\). 4. Initialize the user pairing configuration. 5. Initialize random values for \(\delta_{n}\) as current Best Solution \(C_{B}\) for iteration \(j\). 6. Calculate the Throughput function of the Initial design \(f_{j}\) :
7. If \(j=3\). 8. Choose one random channel from 1 : \(N_{sc}\). 9. Change the corresponding \(\delta_{n}\) according to \(\delta_{n}=\delta_{n}+\rho\ \Delta\delta_{max}\), where \(\rho\in[-1,1]\). 10. Then denote the change in the new configuration \(C_{A}\) for iteration \(j+1\). 11. Calculate the Throughput function \(f_{j+1}\). 12. If \(f_{j+1}<f_{j}\), then accept the configuration. 13. Else \(f_{j+1}>f_{j}\). 14. Calculate: \(\Delta f=f_{j}-f_{j+1}\). 15. Generate the random number of \(\epsilon\in(0,1)\). 16. If \(\epsilon<\epsilon^{-\frac{\Delta f}{f}}\), then accept the new solution. 17. Reduce the temperature (\(T_{j}=T_{j-1}-\alpha\ T_{j-1}\)). 18. Accept the solution. 19. End the algorithm. ```  
**Algorithm 3**Proposed SA-based proportional Power Scheme. The proposed SA parameters are tuned to achieve the objective function's maximum and ensure the algorithm's convergence. The initial temperature is defined as \(T_{initial}=100\), which is the highest temperature for the optimization process. Furthermore, the temper \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Values** \\ \hline Bandwidth \(BW\) & 5 MHz \\ Subcarrier \(BW\) & 2 kHz \\ Cell Radius & 500 m \\ Min distance between \(UE\)-\(BS\) & 50 m \\ Min distance between \(UE\)-\(UE\) & 40 m \\ Number of Subchannels (\(N_{sc}\)) & 128 \\ Maximum Transmit Power (\(P_{Max}\)) & 12 Watt \\ Maximum multiplexed users on the same subchannel & 2 users \\ Total Number of users & 60 users \\ Noise Power Spectral Density (No) & \(-174\ dBm/Hz\) \\ User Minimum Data Rate & 500 b/s \\ Number of Transmit Antenna & 1 \\ Noise Figure & 9 dBm \\ Shadow Standard Deviation & 8 dB \\ Throughput calculation & Shannon’s capacity \\ \hline \hline \end{tabular}
\end{table} 
Table 2: System Design Parameters. ature is reduced slowly by \((\ T_{i}=T_{i-1}-\alpha\ T_{i-1})\) where \(\alpha=2/3\), which can guarantee a slow cooling schedule to obtain a global solution [22]. The SA algorithm achieves system performance with a minimum of 2000 iterations for the system that has many users. In Figure 3, the system throughput is evaluated for 10 users versus the maximum transmission power. The SA configurations are compared to NOMA-DC [10], the fractional transmission power allocation (FTPA) [4], and OFDMA. The SA-EQ cold configuration outperforms both scenarios of the hot configuration. The search in the cold configuration starts with users experiencing a good channel gain condition that is much better than the hot configuration search. In the cold configuration, the multiplexed users' channel condition is better than the hot configuration channel's condition. This channel gain difference induces a reasonable solution, which can give higher Throughput for the cold configuration. The user pairing in the cold configuration is performed based on the second user channel gain on the same subchannel is better than that of the second user channel gain in the hot configuration. The SA accepts good solutions directly, but the worst solutions are accepted with a probability that can check all feasible solutions. The difference between the neighbouring solutions will not be large enough to vary the optimal solution's probability. Both configurations show a slow increment when the power increases and reaches the maximum transmit power because of the system's power constraints. The SA performed a power allocation that performs as 7% better than NOMA-DC and 43% higher than the FTPA performance and OFDMA.