## 3 Optimization Algorithms
### The PSO algorithm  
This algorithm was one of the solutions that was used for resolving a huge mathematical optimization problem. It is classified as an evolutionary metaheuristic that belongs to the larger class of evolutionary algorithms. It was exposed by [PERSON] (electrical engineer) and [PERSON] (sociopsychologist) in 1995 [39]. It was originally inspired by the social behavior of animals evolving in swarms, such as schools of fish and flight groups of birds. We can see highly complex movement dynamics in these organisms, despite the fact that each individual has minimal intelligence and only local knowledge of his place in the swarm. [40]. Therefore, local information and the memory of each individual are used to decide their displacement. Simple rules, such as \"stay close to another candidate\", \"go in the same direction, \"or\" to go at the same speed, \"are sufficient to maintain the cohesion of the swarm and allow the implementation of complex adaptative collective behaviors [26]. The particle swarm is a population of simple agents called particles. Each particle is considered as a solution to the problem, where it has a position and a speed. In addition, each particle has a memory allowing it to remember its best performance and the best performance achieved by \"neighboring\" particles (informants). In addition, each particle has a group of informants, historically called its neighborhood [41; 42]. A swarm of particles, which are potential solutions to the optimization problem, will look for the global optimum with their movements. The following three components that influence the movement of a particle are:  
1. An inertia component: the particle tends to follow its current direction of movement;
2. A cognitive component: the particle tends to move towards the best site through which it has already passed;
3. A social component: particle tends to rely on the congeners' experience and, thus, to go to the best site already reached by its neighbors. The strategy for moving a particle is shown in Figure 5, where the three previous trends are illustrated. Figure 4: Block diagram of a PV system using an intelligent MPPT algorithm. In an \(N\)-dimensional search space, particle \(i\) of the swarm is modeled by its position vector \(\overrightarrow{x}_{i}=(x_{i1},x_{i2},\ldots,x_{iN})\) and by its speed vector \(\overrightarrow{v}_{i}=(v_{i1},v_{i2},\ldots,v_{iN})\). The value of the objective function determines the quality of its position at this point. The particle keeps in memory the best position through which it has ever passed, which we denote by \(\overrightarrow{P}_{best\_i}(p_{best\_i1},p_{best\_2},\ldots,p_{best\_iN})\). The best position reached by the particles of the swarm is denoted by \(\overrightarrow{G}_{best}=(g_{best\_1},g_{best\_2},\ldots,g_{best\_N})\). At the start of the algorithm, the swarm particles are randomly initialized in the search space of the problem. Then, at each iteration, each particle moves, linearly combining the three components mentioned above. Indeed, at iteration \(t+1\), the speed vector and the position vector are calculated from Equations (9) and (10), respectively, as follows:  
\[v_{i,j}^{t+1}=\omega v_{i,j}^{t}+c_{1}r_{1,t}^{t}\big{[}p_{best\_i,j}^{t}-x_{i,j}^{t}\big{]}+c_{2}r_{2,i}^{t}\big{[}g_{best\_i}^{t}-x_{i,j}^{t}\big{]} \tag{9}\]  
\[x_{i,j}^{t+1}=x_{i,j}^{t}+v_{i,j}^{t+1}\quad j\in\{1,2\ldots,N\} \tag{10}\]  
where \(\omega\) is a constant, called the coefficient of inertia; c1 and c2 are two constants, called acceleration coefficients; r1 and r2 are two random numbers drawn uniformly in the interval [0 1], at each iteration \(t\) and for each dimension \(j\). The three components mentioned above (i.e., inertia, cognitive and social) are represented in Equation (9) by the following terms:  
\(\omega v_{i,j}^{t}\) corresponds to the inertia component of the displacement, where the parameter \(\omega\) controls the influence of the direction of displacement on the future movement.