# Acceleration of Particle Swarm Optimization with AVX Instructions
## 2 Particle Swarm Optimization  
The algorithm utilizes a swarm theory inspired by observing animals and their social behavior (e.g., herds, fish schools, and bird flocks). The algorithm has a population of entities called particles serving as candidate solutions. Those particles are randomly initialized in the search space of the problem.  
Every particle starts with a random velocity vector that defines its movement. The particle adjusts this velocity vector with regard to its own experience and the best solution (position of a best-performing particle) in the current swarm. This way, the particle explores the search space, and the whole swarm should converge to the optimum solution.  
The problem's solution space is a \(J\) dimensional area with a population of \(I\) particles. Each particle \(i\) has a position \(X_{i}=x_{i1},x_{i2},\ldots,x_{ij}\) and a velocity vector \(V_{i}=v_{i1},v_{i2},\ldots,v_{ij}\). The particle updates the position during each iteration and moves towards a personal best-known position \(L_{i}=l_{1i},l_{i2},\ldots,l_{ij}\). The second attractor is the best position known so far \(G_{best}=g_{1},g_{2},\ldots,g_{j}\). The velocity update is then a combination of the previous velocity and the aforementioned attractors:  
\[v_{ij}(t+1)=w*v_{ij}(t)+c_{1}r_{1}(t)[l_{ij}(t)-x_{ij}(t)]+c_{2}r_{2}(t)[g_{j}( t)-x_{ij}(t)], \tag{1}\]  
where \(v_{ij}(t)\) is the velocity of particle \(i\) in dimension \(j\) at time \(t\). The inertial weight \(w\) influences the velocity from the previous iteration to control the exploration and exploitation of search space. Small \(w\) urges the particle to exploit the area in its near position, and a high value prevents getting stuck in local minima [15].  
Values \(r_{1}\) and \(r_{2}\) are independent random numbers (having uniform distribution from 0 to 1). \(c_{1}\) and \(c_{2}\) constants control the acceleration to attractors. \(c_{1}\) influences the cognitive part of the particle (moving towards the historically best position), representing primitive thinking. The constant \(c_{2}\) takes part in social behavior and represents the cooperation among particles.  
Various recommendations of \(c_{1}\) and \(c_{2}\) values exist. Some publications rely on using complementary values less than or equal to 1 [4; 16]. [PERSON] and others [15; 17] confirmed that having high inertial weight in compare to \(c_{1}\) and \(c_{2}\) (see Equation (2)) leads particles to divergent or cyclic trajectories:\[w>\frac{1}{2}(c_{1}+c_{2})-1. \tag{2}\]  
Similar results were found by other researchers in [18].  
The updated position of the particle is then computed simply as:  
\[X_{i}(t+1)=X_{i}(t)+V_{i}(t+1), \tag{3}\]  
where \(X_{i}(t)\) is the actual position of particle in search space and \(V_{i}(t+1)\) is the new velocity vector.  
The basic PSO terminate safer reaching a specific number of iterations when the value of \(G_{best}\) reaches a designated goal. One iteration (or generation) means the updating of particle position, evaluation of the fitness function, and updating of internal attractors (local \(l_{ij}\) and global \(G_{best}\) best) in the whole swarm. Table 1 summarizes PSO control parameters. The choice of values is similar to that of Engelbrecht [15; 19; 20].