# An Enhanced Particle Swarm Optimization (PSO) Algorithm Employing Quasi-Random Numbers
## 2 Materials and Methods  
Particle Swarm Optimization  
There are countless examples of swarms in the real world, ranging from flocking birds to hunting wolves. When searching for nourishment, the individuals of these swarms, called particles to understand PSO, begin random exploration and then start gravitating towards the findings of other swarm individuals. While following signs of nourishment and searching randomly in space, these particles move towards their objective through knowledge of their discoveries and discoveries of the swarm. Similarly, in the PSO algorithm, proposed decision variable sets gravitate towards the optimal findings of each other, themselves, and the whole swarm together to achieve the globally optimal set of decision variables, yielding the optimal function value. The sets of decision variables are called position vectors. They are updated by vectors called velocity vectors (based on the physics principle that change in position is proportional to the velocity), by randomness, and by attraction towards their personal best sets of decision variables and the unanimous global best set of decision variables found by the whole swarm. The global optimum of the function is achieved through gradual movement towards optimal findings of the swarm. The following are the steps of the PSO algorithm. * Initialize Parameters:
* Define the population size (number of particles), \(Np\); Define the number of decision variables (dimension), \(D\);
* Define the maximum number of iterations, \(T\);
* Define the inertia weight, \(\omega\);
* Define acceleration constants: cognitive and social, \(c_{1},c_{2}\);
* Initialize the position and velocity of each particle randomly within the search space. The initially proposed set of solutions is grouped together to form the population matrix, which is written as follows:  
\[ \begin{bmatrix}x_{0}^{00}&\cdots&x_{0}^{0(D-1)}\\ \vdots&\ddots&\vdots\\ x_{0}^{(Np-1)0}&\cdots&x_{0}^{(Np-1)(D-1)}\end{bmatrix} \]  
Each row in this matrix represents a potential decision variable vector intended to optimize the objective function. Each element in a row is the position with respect to a particular dimension of the particle that corresponds with that row. The subscript for each element is 0, as these values are the initial values in the matrix (0 th iteration). The velocity matrix can be represented as follows:  
\[ \begin{bmatrix}v_{0}^{00}&\cdots&v_{0}^{0(D-1)}\\ \vdots&\ddots&\vdots\\ v_{0}^{(Np-1)0}&\cdots&v_{0}^{(Np-1)(D-1)}\end{bmatrix} \]  
This represents the velocity of each particle in all the dimensions. The velocity matrix changes the position matrix, and that is inspired by the physics concept that displacement is proportional to velocity. The superscript \(j\) is the index of the dimension. * Set the best-known position for each particle n, \(P_{n}^{ij}\) to its initial position. \[P^{j}=x^{0j}\]
* Evaluate Fitness: Evaluate the fitness (objective function value) for each particle based on its current position. * Update the personal best position for each particle \(G_{n}^{j}\) if its current fitness is better than its previous best fitness. * Update Global Best:
* Determine the particle with the best fitness among all particles in the swarm, \(P_{n}^{*}\). * Update the global best position with the particle's position with the best fitness, \(G_{n}^{*}\). * Update Velocities and Positions: For each particle, update its velocity and position based on the following formulae. The velocity of each particle at iteration \(n\) is updated according to the equation given below. \[ \begin{split} v_{n+1}^{ij}=\omega\times v_{n}^{ij}+c_{1}\times r _{1}\times\left(P_{n}^{j}-X_{n}^{ij}\right)+\\ c_{2}\times r_{2}\times\left(G_{n}{}^{j}-X_{n}^{ij}\right)\end{split}  \tag{1}\]  
where \(r_{1}\) and \(r_{2}\) are random numbers. So, we have two random numbers per variable.