# Pilot Sequence Allocation Schemes in Massive MIMO Systems Using Heuristic Approaches
## 4 Proposed Solutions
### Variable Neighbourhood Search  
Another technique we also used to make the PSO-SPV approach even more robust is the Variable Neighbourhood Search metaheuristic which is based on the systemic change of neighborhoods of each possible solution in an attempt to find better solutions near the PSO candidate solutions. VNS is applied to the PSO-SPV through an exchange of sequences allocated to user pairs on the same cell, i.e., users are randomly paired, and their pilot sequences are swapped whenever VNS is applied at each iteration of the PSO-SPV algorithm. Mathematically for each pair \(k^{\prime}\) e \(k^{\prime\prime}\) of users:  
\[\theta_{k^{\prime},\ell}=q^{\prime} \rightarrow \theta_{k^{\prime},\ell}=q^{\prime\prime}\] \[\theta_{k^{\prime\prime},\ell}=q^{\prime\prime} \rightarrow \theta_{k^{\prime\prime},\ell}=q^{\prime} \tag{23}\]  
where \(q^{\prime}\) and \(q^{\prime\prime}\) are the assigned pilot sequences. It is worth noting that when the number of the users is even, one of the users is left out of the VNS subroutine, and its pilot sequence remains unchanged. To avoid a large increase in complexity, this mechanism is not performed for all individuals of the PSO-SPV population. In fact, we define \(r_{\text{VNS}}\) as the probability of running VNS for each candidate solution in each one of the PSO-SPV iterations. The best balance between complexity and solution quality for the \(r_{\text{VNS}}\) parameter is discussed in the results section. Finally, the PSO-SPV and PSO-SPV-VNS algorithms are presented in the Algorithm 2. ```
input :Channel gain Hipermatrix--\(\mathbf{\beta}\)  Population Size--\(N\)  Max. Number of Iterations--\(I\) output :Pilot Sequence Allocation Hipermatrix \(\mathbf{\Theta}\)  Create \(N\) random candidate solutions \(\mathbf{x}_{1}[1],\ldots,\mathbf{x}_{N}[1]\) in the \(\mathbb{R}^{K\times L}\) space;  Apply SPV to each \(\mathbf{x}_{i}[1]\) generating the pilot sequence allocation array \(\theta_{i}[1]\);  Evaluate \(\mathcal{J}(\theta_{i}[1]),\ldots,\mathcal{J}(\theta_{N}[1])\) according to (13);  Start \(\mathbf{p}_{i}\) for each \(i=1,\ldots,N\) and \(\mathbf{p}_{g}=\underset{\mathbf{p}_{i}}{\arg\max}\ \mathcal{J}(\mathbf{p}_{i})\); for\(i=1\)until\(I\)do for\(j=1\)until\(N\)do  Update \(\mathbf{x}_{j}[i+1]\) using Equations (16), (19) and (22);  Apply SPV to each \(\mathbf{x}_{i}[t+1]\) generating the pilot sequence allocation array \(\theta_{i}[i+1]\); if\(rand()<r_{\text{VNS}}\)then  Randomly pair users and performe VNS through (23);  end if \(\mathcal{J}(\theta_{j}[i+1])>\mathcal{J}(\mathbf{p}_{j})\)then \(\mathbf{p}_{j}=\theta_{j}[i+1]\);  end if if \(\mathcal{J}(\theta_{j}[i+1])>\mathcal{J}(\mathbf{p}_{g})\)then \(\mathbf{p}_{g}=\theta_{j}[i+1]\);  end if  end if  end for
```  
**Algorithm 2**PSO-SPV-VNS  
``` input :Pilot Sequence Allocation Hipermatrix \(\mathbf{\Theta}\)  Create \(N\) random candidate solutions \(\mathbf{x}_{1}[1],\ldots,\mathbf{x}_{N}[1]\) in the \(\mathbb{R}^{K\times L}\) space;  Apply SPV to each \(\mathbf{x}_{i}[1]\) generating the pilot sequence allocation array \(\theta_{i}[1]\);  Evaluate \(\mathcal{J}(\theta_{i}[1]),\ldots,\mathcal{J}(\theta_{N}[1])\) according to (13);  Start \(\mathbf{p}_{i}\) for each \(i=1,\ldots,N\) and \(\mathbf{p}_{g}=\underset{\mathbf{p}_{i}}{\arg\

### Genetic Algorithm

GA is an evolutionary computation method created by [PERSON] [24], wherein the algorithm simulates the theory of evolution by [PERSON]. The process consists of taking a population of individuals which are composed of chromosomes and applying different genetic operations to the individuals chromosomes, combining them while aiming to improve some fitness function. At each iteration of the algorithm, called a generation, individuals pair up to create descendants creating a new generation. During this process, the chromosomes, which can represent a position in the problem domain, may suffer mutation, while the individuals derived from their parents are created from a crossover operation.