# Spectrum Decision-Making in Collaborative Cognitive Radio Networks
## 2 Materials and Methods
### Decision-Making Models
#### 2.3.2 Simple Additive Weighting (SAW)  
This algorithm develops a decision-making matrix comprised of criteria and alternatives. The spectral opportunity with the highest score is chosen, where \(r_{i,j}\) belongs to the matrix and the sum of weights is equal to (Equation (4)) [37; 38].  
\[u_{i}=\sum_{j=1}^{M}\omega_{i}r_{i,j}\ \ \forall i\in 1,\ldots,N \tag{4}\]  
For each intersection of the matrix, the algorithm assigns a weight (Equations (5) and (6)). This allows establishing a score for each assessed spectral opportunity and delivers the ranking of the alternatives. The spectral opportunity with the highest score is chosen. The coefficients of each of the equations are taken from [24]. Table 9 presents the description of each variable indicated in the equations.  
\[Score_{RT}=0.3985(AP)+0.3005(AAT)+0.0989(PSINR)+0.2021(ABW) \tag{5}\]  
\[Score_{BE}=0.2078(AP)+0.3989(AAT)+0.1020(PSINR)+0.2913(ABW) \tag{6}\]  
Algorithm 2 presents the programming structure for the SAW multi-criteria technique. The algorithm is divided into five blocks: two correspond to the input and output information, the third block corresponds to the SAW multi-criteria technique, the fourth block corresponds to the score, and the fifth block corresponds to the final ranking. The input block concatenates the information of the multi-criteria vectors (Table 9), which is taken by the SAW block to make the quotient between the average per row of the concatenated matrix and its maximum value. This information allows the scoring block to make the multiplication of the vector obtained with the coefficients of Equations (5) and (6). The ranking block takes the information and organizes the channels in a descending way where the channels with greater spectral opportunity are located in the first positions and those with less spectral opportunity are located in the last positions. Finally, the output block delivers a vector row of 500 columns with the descending position of the score of the channels. Figure 13 shows a flowchart of each of the blocks for a general description.  
Figure 13: Simple Additive Weighting (SAW) algorithm flowchart.  
```
1 Average = [AP; AAT; PSINR; ABW];
2 Ranking = W*Average;
3 [ -, Columns] = size(Ranking);
4 if Feedback == 0
5 %Vector Initial Ranking
6 ScoreF = sort( Ranking, 'descend' );
7 for i = 1 : Columns
8 [Position]=find(Ranking == ScoreF(i));
9 RankingF(1, i)= Position;
10 end
11 Feedback = 1;
12 elseif Feedback == 1
13 % Updated Ranking Vector
14 Ranking = 0.6*Ranking + 0.4*Ranking _Last;
15 ScoreF = sort(Ranking, 'descend') ;
16 for i = 1 : Columns
17 [Position] = find(Ranking == ScoreF(i));
18 [Position] = find(Ranking == ScoreF(i));
19 RankingF(1, i) = Position;
20 end
21 Ranking _Last = RankingF;
```  
**Algorithm 1**MATLAB implementation Feedback Fuzzy Analytical Hierarchical Process (FFAHP).  
```
1 Average = [AP; AAT; PSINR; ABW];
2 [Row, \(\sim\)] = size(Average);
3 for f = 1 : Row
4 X_m = max(Average(f, :));
5 r(f, :) = Average(f, :)./X_m;
6 end
7 Ranking = W*r;
8 [ \(\sim\), Columns] = size(Ranking);
9 ScoreF = sort(Ranking, 'descend') ;
10 for i = 1 : Columns
11 [Position] = find(Ranking == ScoreF(i));
12 RankingF(1, i) = Position;
13 end
```  
**Algorithm 2**MATLAB implementation Simple Additive Weighting (SAW).