## 3 Proposed Optimal Strategy
### KE Optimization Method
#### 3.2.3 PSO Algorithm  
In this work, the PSO is applied to find the global solution to the KE optimization problem in Equations (22)-(25). Each feasible solution of the problem is termed a particle, which is assigned a random velocity and flow through the problem space. The \(i\)th particle of the swarm in the \(d\)-dimensional search space can be represented by its position \(x_{i}\) and velocity \(v_{i}\). Each particle keeps track of its previous best position (_pbest_) and the best performing particle of the swarm is termed the global best (_gbest_). According to the particle's previous best experience and the best experience among the particles in its neighborhood, the speed and direction of the particle velocity are updated [30; 31]. Mathematically, this algorithm is formulated as follows:  
\[v_{id}^{t+1}=wv_{id}^{t}+c_{1}r_{1}(\textit{pbest}_{id}^{t}-x_{id}^{t})+c_{2} r_{2}(\textit{gbest}_{id}^{t}-x_{id}^{t}) \tag{26}\]  
\[x_{id}^{t+1}=x_{id}^{t}+v_{id}^{t+1},\;i=\;1,2,...,n \tag{27}\]  
The variable \(\textit{pbest}_{id}^{t}\) represents the personal best position attained by the \(d\)-dimensional quantity of the individual \"\(i\)\" from among its \"\(t\)\" times of occurrence, and \(\textit{pbest}_{id}^{t}\) denotes the \(d\)-dimensional quantity of the best position attained globally by the swarm. New position and velocity vectors are determined for each particle by combining its previous velocity with \(\textit{pbest}_{id}^{t}\) and \(\textit{gbest}_{id}^{t}\)(Equations (26) and (27)). The initialization process for the velocities and positions of the particles is conducted by using vectors of random numbers. Here, each wind turbine is considered to be a particle while the whole complex of wind turbines is modeling the swarm. In other words, the deloaded power outputs of wind turbines are regulated as the particles of a swarm to achieve different possible answers for the problem. It means that the number of wind turbines is equal to the number of particles of the swarm.  
Inertial weight \(w\) is the modulus that controls the impact of previous velocity on the current one, thus practically, an appropriate selection of the inertial weight is requested to optimize for diverse wind speeds and distribute across all operating areas of the wind farm. The inertia weight may be increased if the objective values of particles close to accordance or tend to local optimal. Conversely,the inertia weight could be decreased. In this work, the inertial weight calculation according to number of iterations can be written as  
\[w(t)=w_{\max}-\frac{w_{\max}-w_{\min}}{t_{\max}}\times t \tag{28}\]  
Moreover, in order to permit the algorithm to avoid falling into local minima and search in the whole optimization space, and improve the algorithm accuracy and convergence speed, the acceleration coefficients in the searching process are controlled as follows:  
\[c_{1}=c_{1,\max}-\frac{c_{1,\max}-c_{1,\min}}{t_{\max}}\times t \tag{29}\]  
\[c_{2}=c_{2,\min}-\frac{c_{2,\max}+c_{2,\min}}{t_{\max}}\times t \tag{30}\]  
During the updating, the particle position \(x_{i}\) and velocity \(v_{i}\) are limited in the available range. When the maximum number of iterations or the performance index is reached, the output _gbest_ is the global optimal solution.