3.2.2. Particle Swarm Optimization (PSO) Algorithm

The PSO algorithm is a stochastic technique based on the behavior of bee swarms [42]. This algorithm exhibits great effectiveness in multidimensional optimization problems. This methodology is based on the survival of some living beings (specifically the bees). As well as the genetic algorithm, PSO is initialized with a random initial population. However, in this case, each possible solution, known as a particle, has also been assigned a random velocity [42]. Each particle updates and stores the best position found so far (pbest) and also stores and updates the best position of the rest of the swarm (gbest). To represent the velocity update, the algorithm uses Equation (4), where *vi* is the velocity vector, *xi* is the position vector, α is the weight of the particle that controls the recognition of the place, *c*<sup>1</sup> and *c*<sup>2</sup> are the acceleration constants of the particles (usually take a value of 2 by default), and *rand* is a random number between 0 and 1.

$$w\_{i}(t+1) = a\upsilon\_{i} + c\_{1} \cdot rand \cdot (pbest(t) - x\_{i}(t)) + c\_{2} \cdot rand \cdot (gbest(t) - x\_{i}(t)) \tag{4}$$

Once the parameters that conform the algorithm are obtained, the swarm is generated by means of the following steps:

