## 3 Models and Methods
### Particle Swarm Optimization
The hybrid model uses diversity and fast convergence to optimal solutions and reaches the best solution comparatively faster than other algorithms. Hybrid GA-PSO based algorithm consists of attributes of both GA and PSO. The flow of the GA-PSO algorithm is shown in Figure 1. The procedure starts by generating a random population and applying GA to the initial population. After the procedure reaches half of the number of iterations, the procedure stops and the generated solutions are passed to PSO where local and global variables are calculated and variables are updated accordingly. The procedure stops when the maximum number of iterations reaches. The initialization in the hybrid GA-PSO algorithm is set up by certain number of iterations. In the first iteration, the solution is started randomly. A series of new solutions are generated at the end of the first iteration. These solutions are used in a recursive way to form a series of new solutions. In a standard GA, the population is represented as a set of chromosomes. Each chromosome consists of genes. In GA, the evolution of chromosomes occurs via crossover and mutation operators and the selection of offspring for the next generations. Roulette wheel selection is used in the proposed algorithm. The selection procedure uses spinning a wheel based on the fitness value of each chromosome. For crossover clustered crossover operator is used. In this procedure breaking points in each chromosome are selected and new chromosomes are generated by mixing the selected points. For mutation operator swap mutation is used where a pair of genes is selected and genes at both points are swapped. The remaining iterations are performed with PSO taking the population generated with GA. The position and velocity of the particles in the previous iteration are used to create new particles. The position and velocity are changed on the basis of pbest and gbest parameters calculated at each iteration. These values change continuously with every iteration. In the first iteration, pbest is equal to solutions produced by GA. The gbest solution is the one with the lowest fitness value. In addition, a fitness-value based comparison is carried out between the previously created particles and newly created particles at each iteration. The pbest contains the particle having the best fitness value. At each iteration, the gbest stores the best particle among the entire generation by comparing the fitness value with the best value. This comparison at every step guarantees that all particles are marching towards the best solution to reach an optimal solution. Fitness is calculated in both cases with MAE. Algorithm 3 illustrates the implementation of the hybrid GA-PSO algorithm whereas Figure 2 shows the flow of the hybrid model in training the network. ```
Input :network weights Output:best solutions \(p_{c}\) crossover probability \(p_{m}\) mutation probability \(iter_{max}\) max number of iterations  initialize population p=\(E_{1},\ldots,E_{p_{0}}\), each entity is a d-dimension vector \(E_{i}=(e_{i1},\ldots,\ e_{id})\) \(iter\)=1 while\((iter\leq iter_{max}/2)\)do  calculate fitness with equation 4  best chromosome \(E_{best}\)= fittest chromosome selection (according to the fitness function)  crossover (according to crossover probability)  mutation (according to mutation probability)  select best chromosome (chromosome\({}_{i}\)) end  set particle p=(chromosome\({}_{i}\))  calculate fitness of \(p\) according to Eq. 4  calculate velocity of \(p\) according to Eq.5 \(gbest\)=global best position \(pbest\)=particles' best position whilenot reach iter\({}_{max}\)do  Initialize \(X_{ij}^{t}\) randomly  initialize velocity \(v\) randomly  evaluate \(p_{i}\)  update \(pbest\) and \(gbest\)  end while
```

**Algorithm 3**Hybrid GA-PSO algorithm

Figure 3 shows the predictive system of resources for the cloud [12]. The system consists of four modules, i.e., manager, preprocessor, trainer, and predictor. The Manager module is responsible for collecting the monitoring data regarding resources.