## 3 Hybrid EDA Solution for the GC-CRSN Problem
### Iterative Greedy Scheme for Constraint Satisfaction and Relay Assignment (IGS-CSRA)  
In this section, we present an iterative greedy scheme for constraint satisfaction and relay (IGS-CSRA). The IGS-CSRA scheme will be executed on each EDA individual in the population. IGS-CSRA illustrates the relay assignment for the EDA individual indexed by j - \(P^{j}=\left(p_{1}^{j},p_{2}^{j},\cdots,p_{L+K}^{j}\right)\). We denote by \(\widetilde{p}_{i}=p_{i}^{j},i=1,\cdots,L\), the \(i\)th relay's power level of the \(j\)th individual in the population. The proposed algorithm has two stages. In the first stage, based on the channel conditions, relays are assigned to the secondary users without satisfying the interference constraint. In the second stage, the algorithm performs final assignment under the constraint that interference to the primary users is satisfied. For developing this greedy algorithm, we can view the product of the channel from the \(i\)th relay to the \(k\)th secondary user and the channel from the source to the \(i\)th relay as profit taken from investing one unit of transmission power to relay \(i\). We also view the channel from the \(i\)th relay to its primary users as loss. In particular, our algorithm views max\((|g_{i,1}|^{2},|g_{i,2}|^{2},\cdots,|g_{i,M}|^{2})\) as loss incurred from investing unit transmission power to relay \(i\). Stage 1: In this stage, the algorithm assigns each relay to the secondary user that gives the maximum profit to loss ratio. The profit is secondary users channel gain--_i.e._, \(|h_{s,i}||h_{i,k}|\)--and loss is the maximum channel gain from the secondary user to the primary users--_i.e._, max\((|g_{i,1}|^{2},|g_{i,2}|^{2},\cdots,|g_{i,M}|^{2})\). Mathematically, for each relay \(i\), the algorithm temporarily assigns a secondary user:  
\[S\left(i\right)=\underset{k\in\{1,2,\cdots,K\}}{\text{arg max}}\frac{|h_{s,i}||h_{ i,k}|}{\text{max}\left(|g_{i,1}|^{2},|g_{i,2}|^{2},\cdots,|g_{i,M}|^{2}\right)}\]  
where \(S\) is an \(L\)-dimensional vector that stores this assignment. At the end of Stage 1, relays are assigned to the secondary users with the power \(\widetilde{p}_{i},i=1,\cdots,L\). Note that the relays' power levels randomly generated by the EDA algorithm can violate the constraint of limited interference to the primary users. In the next stage, the algorithm refines the relay assignment done in Stage 1 and adjusts the power level of each relay, so that interference to the primary users is satisfied. Stage 2: At the start of the second stage, the algorithm starts adjusting the relays' power levels if there is a violation of the primary users' interference constraint. First, the algorithm examines for each relay \(i\) whether its transmission power would still violate any interference constraint, even if all other relays' power level were set to zero. If \(\widetilde{p}_{i}\) violates any of the interference constraint, \(I^{max}_{m,k}\), even under the assumption that other relays' transmission power levels are all set to 0, then the algorithm first makes the following adjustment:  
\[\widetilde{p}_{i}=\text{min}\left(\widetilde{p}_{i},\frac{I^{max}_{1,k}}{|g_{i,1}|^{2}},\frac{I^{max}_{2,k}}{|g_{i,2}|^{2}},\cdots,\frac{I^{max}_{M,k}}{|g_{ i,M}|^{2}}\right),\forall(i,k)\]  
With this power adjustment, each user individually guarantees constraint satisfaction of the primary users' interference constraint. After the power adjustment, the algorithm iterates over the secondary users and completes the assignment of relays. At the \(k\)th iteration, the algorithm determines the set of relays, \(\Psi_{k}\), that are assigned to the \(k\)th secondary user in Stage 1. Then, the algorithm checks whether the relays in the set \(\Psi_{k}\) satisfy the interference constraint at all the primary users. If the relays in the set, \(\Psi_{k}\), violate the interference constraint at any primary user; then the algorithm iteratively removes the relay from the set, \(\Psi_{k}\), that causes maximum interference to the primary users.