# NC-OFDM Satellite Communication Based on Compressed Spectrum Sensing
## 4 Subcarrier Power Allocation Algorithm
### Hybrid Genetic Particle Swarm Optimization Algorithm for Power Distribution  
Power allocation can be solved by using an optimization algorithm, and the design of the algorithm is the key to the overall performance of cognitive users. At present, optimiza  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Subcarrier Number** & **SNR (dB)** & **Subcarrier Number** & **SNR (dB)** \\ \hline
8 & 12 & 67 & 7 \\ \hline
9–19 & 13 & 78–79 & 7 \\ \hline
20 & 13 & 80–90 & 10 \\ \hline
21 & 12 & 91–95 & 7 \\ \hline
22 & 11 & 107 & 7 \\ \hline
37 & 9 & 108 & 8 \\ \hline
38 & 8 & 109 & 9 \\ \hline
44–46 & 7 & 110–119 & 10 \\ \hline
47–49 & 9 & 120–121 & 9 \\ \hline \hline \end{tabular}
\end{table}
Table 3: SNR of data subcarriers.  
tion algorithms are widely studied, including Genetic Algorithms (GA), PSOs, simulated annealing algorithms, tabu search algorithms, differential evolutionary algorithms, etc., among which GAs and PSOs are the two most widely used algorithms. GAs are a kind of random optimization search method based on the evolutionary rules of the biological world. They can use the search information of multiple search points at the same time. They has the characteristics of parallel operation and are suitable for large-scale complex optimization problems. The factor that has an impact on fitness is the subcarrier power. Therefore, the subcarrier power sequence is adopted as the chromosome in a GA. When the fitness function meets the output requirements, the algorithm outputs the sub-optimization results through initialization, coding, selection, crossover, compilation, and other basic operations.  
The idea of the GA comes from natural selection theory, and it has certain advantages for obtaining the optimal solution by searching for the most eligible individuals in the global space based on the rules of survival of the fittest. From the perspective of evolutionary iterations, the PSO algorithm makes use of the information interaction and individual memory within the population to speed up the search. In this paper, combined with the advantages of the two algorithms, a hybrid genetic particle swarm optimization algorithm is proposed. The evolutionary idea of the PSO algorithm is integrated into the updated GA, and the algorithm optimization is achieved by using the competition between the two algorithms.  
The flow and update process of the HGAPSO algorithm are shown in Figures 4 and 5, respectively.  
Figure 4: The flow of the HGAPSO.  
The specific optimization steps of HGAPSO are shown in Algorithm 1.  
```
1: Set particle update speed, population size, number of particles, weight factor \(c_{1}\), weight factor \(c_{2}\), coding method, crossover probability, mutation probability;
2: Generate a population randomly, initialize particle position, particle speed, and calculate its fitness;
3: In the population, find the global best and the best individual and calculate the corresponding best fitness value; randomly divide the population into two categories, defined as \(\mathbf{A}^{(i)}\) and \(\mathbf{B}^{(i)}\);
4: For each group, it is divided into two groups according to the degree of fitness, one of which has a fitness greater than two. Among them, form a new population using GA for crossover and mutation operations; \(\mathbf{A}_{2}^{(i)}\) and \(\mathbf{B}_{2}^{(i)}\) form another population, using PSO algorithm to update particle speed and position;
5: Form a new population after completing the update together, and recalculate the fitness value;
6: Judge whether the optimal population meets the requirements or not, then return to step 4, and output the result if it is satisfied.
```  
**Algorithm 1** HGAPSO.