# An Easily Understandable Grey Wolf Optimizer and Its Application to Fuzzy Controller Tuning
## 3 Grey Wolf Optimizer, Analysis, and Optimal Tuning Approach
### Grey Wolf Optimizer and Analysis  
The operating mechanism of GWO according to its standard formulation given in [12] starts with the random initialization of the agents that comprise the wolf pack. A total number of \(N\) agents (i.e., grey wolves) is used, and each agent is assigned to a position vector \(\mathbf{X}_{i}(k)\)  
\[\mathbf{X}_{i}(k)=\left[ \begin{array}{cccccc}x_{i}^{1}(k)&...&x_{i}^{f}(k)&...&x_{i}^{q}&(k)\end{array} \right]^{T},\;i=1...N, \tag{17}\]  
where \(x_{i}^{f}(k)\) is the position of \(i\)th agent in the \(f\)th dimension, \(f=1...q\), \(k\) is the index of the current iteration, \(k=1...k_{\max}\), and \(k_{\max}\) is the maximum number of iterations. The search process specific to GWO continues with the exploration stage, which models the search for the prey. During this stage the positions of the top three agents, namely the alpha (\(\alpha\)), beta (\(\beta\)), and delta (\(\delta\)) agents, dictate the search pattern by diverging from other agents and converging to the prey, representing the optimal solution. The exploitation stage models the attack on the prey. The top three agents constrain the other agents (the omega (\(\omega\)) agents) to update their positions according to theirs. The following notations are used for the top three agent position vectors, i.e., the first three best solutions obtained at each iteration (or the alpha, beta, and delta solutions):  
\[\mathbf{X}^{l}(k)=[ \begin{array}{cccccc}x^{l1}(k)&...&x^{lf}(k)&...&x^{lq}(k )\end{array} ]^{T},l\in\{\alpha,\beta,\delta\}, \tag{18}\]  
the three vector solutions \(\mathbf{X}^{\alpha}(k),\mathbf{X}^{\beta}(k)\), and \(\mathbf{X}^{\delta}(k)\) are obtained by the following selection process:  
\[ \begin{array}{l}J_{\alpha_{j}}(\mathbf{X}^{\alpha}(k))=\min_{i=1...N}\{J_{ \alpha_{j}}(\mathbf{X}_{i}(k))|\;\mathbf{X}_{i}(k)\in D_{\rho}\},\\ J_{\alpha_{j}}(\mathbf{X}^{\beta}(k))=\min_{i=1...N}\{J_{\alpha_{j}}(\mathbf{ X}_{i}(k))|\;\mathbf{X}_{i}(k)\in D_{\rho}\backslash\{\mathbf{X}^{\alpha}(k)\}\},\\ J_{\alpha_{j}}(\mathbf{X}^{\delta}(k))=\min_{i=1...N}\{J_{\alpha_{j}}(\mathbf{ X}_{i}(k))|\;\mathbf{X}_{i}(k)\in D_{\rho}\backslash\{\mathbf{X}^{\alpha}(k), \mathbf{X}^{\beta}(k)\}\},\end{array}  \tag{19}\]  
and they fulfill the condition  
\[J_{\alpha_{j}}(\mathbf{X}^{\alpha}(k))<J_{\alpha_{j}}(\mathbf{X}^{\beta}(k))<J _{\alpha_{j}}(\mathbf{X}^{\delta}(k)). \tag{20}\]  
A set of search coefficients is then defined:  
\[ \begin{array}{l}a_{l}^{f}(k)=a^{f}(k)(2r_{1l}^{f}-1),\\ c_{l}^{f}(k)=2r_{2l}^{f},\;l\in\{\alpha,\beta,\delta\},\end{array}  \tag{21}\]  
where \(r_{1l}^{f}\) and \(r_{2l}^{f}\) are uniformly distributed random numbers within \(0\leq r_{1l}^{f}\leq 1\), \(0\leq r_{2l}^{f}\leq 1\), \(f=1...q\), and the coefficients \(a^{f}(k)\) are linearly decreased from 2 to 0 during the search process:  
\[a^{f}(k)=2[1-(k-1)/(k_{\max}-1)],\;f=1...q. \tag{22}\]  
The approximate distances between the current solution and the alpha, beta, and delta solutions, i.e., \(d_{\alpha}^{if}(k)\), \(d_{\beta}^{if}(k)\), and \(d_{\delta}^{if}(k)\), respectively, are  
\[d_{l}^{if}(k)=|c_{l}^{f}(k)x^{lf}(k)-x_{i}^{f}(k)|,\;i=1...N,\;l\in\{\alpha, \beta,\delta\}. \tag{23}\]The components (agents) of the updated alpha, beta, and delta solutions are computed as  
\[x^{lf}(k+1)=x^{lf}(k)-a_{l}^{f}(k)d_{l}^{if}(k),\ f=1...q,\ i=1...N,\ l\in\{ \alpha,\beta,\delta\}, \tag{24}\]  
and they lead to the updated expressions of the agents' positions obtained as the arithmetic mean of the updated alpha, beta, and delta agents:  
\[x_{i}^{f}(k+1)=\left[x^{\alpha f}(k+1)+x^{\beta f}(k+1)+x^{\delta f}(k+1) \right]/3,\ f=1...q,\ i=1...N. \tag{25}\]  
The vector counterpart of Equation (25) is the formula that gives the update vector solution \(\mathbf{X}_{i}(k+1)\):  
\[\mathbf{X}_{i}(k+1)=\left[\mathbf{X}^{\alpha}(k+1)+\mathbf{X}^{\beta}(k+1)+ \mathbf{X}^{\delta}(k+1)\right]/3,i=1...N. \tag{26}\]  
The GWO consists of the following steps that are formulated by the revision of the steps presented in [20; 21]:  
Step 1.