# 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 initial random grey wolf population, represented by \(N\) agents' positions in the \(q\)-dimensional search space, is generated. The iteration index is initialized to \(k=0\) and the maximum number of iterations is set to \(k_{\max}\). Step 2. The performance of each member of the population of agents is evaluated by simulations and/or experiments conducted on the fuzzy control system. The evaluation leads to the objective function value by mapping the GWO onto the optimization problems using  
\[\mathbf{X}_{i}(k)=\rho,\ i=1...N. \tag{27}\]  
Step 3. The first three best solutions obtained so far, i.e., \(\mathbf{X}^{\alpha}(k)\), \(\mathbf{X}^{\beta}(k)\), and \(\mathbf{X}^{\delta}(k)\), are identified using Equation (19). Step 4. The search coefficients are calculated using Equations (21) and (22). Step 5. The agents are moved to their new positions by computing \(\mathbf{X}_{i}(k+1)\) in terms of Equations (24), (25), and (26). Step 6. The updated vector solution \(\mathbf{X}_{i}(k+1)\in D_{\rho}\) is validated by checking the steady-state condition for the fuzzy control system with the T-S PI-FC parameter vector \(\rho=\mathbf{X}_{i}(k+1)\), so far [7]  
\[|y(t_{df})-r(t_{df})|\leq\varepsilon_{y}|r(t_{df})-r(0)|, \tag{28}\]  
where \(t_{df}\) is the final time moment. Theoretically \(t_{df}\rightarrow\infty\) as pointed out in Equation (13), but \(t_{df}\) takes practically a finite value in order to capture the transients in the fuzzy control system responses. The stability analysis of the fuzzy control system can be also employed with this regard. Step 7. The iteration index \(k\) is incremented and the algorithm continues with step 2 until \(k_{\max}\) is reached. Step 8. The algorithm is stopped and the final solution obtained so far is actually the solution to the optimization problems defined in Equation (13):  
\[\rho^{*}=\arg\min_{i=1...N}\!\!\int_{\alpha_{j}}(\mathbf{X}_{i}(k_{\max})). \tag{29}\]  
The substitution of \(d_{l}^{if}(k)\) taken from Equation (23) in Equation (24) leads to  
\[x^{lf}(k+1)=x^{lf}(k)-a_{l}^{f}(k)|c_{l}^{f}(k)x^{lf}(k)-x_{i}^{f}(k)|,\ f=1...q,\ i=1...N,\ l\in\{\alpha,\beta,\delta\}. \tag{30}\]  
The computation of the arithmetic mean in Equation (30) for \(l\in\{\alpha,\beta,\delta\}\) and then the application of Equation (25) at the iterations \(k+1\) and \(k\) are organized as the following state-space equation:\[x_{i}^{f}(k+1)=x_{i}^{f}(k)-[a_{\alpha}^{f}(k)|c_{\alpha}^{f}(k)x^{ \alpha f}(k)-x_{i}^{f}(k)]+a_{\beta}^{f}(k)|c_{\beta}^{f}(k)x^{\beta f}(k)-x_{i}^ {f}(k)| \tag{31}\] \[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}\]0  
which indicates a nonlinear dynamic system. Such expressions are used in [43; 44; 45] for other metaheuristics as well (PSO and GSA) and are then associated with stability analyses. However, the nonlinearity in Equation (31) makes the GWO analysis more difficult in comparison with [43; 44; 45]. Equation (31) is then expressed in the equivalent form  
\[ \begin{array}{ll}x_{i}^{f}(k+1)-x_{i}^{f}(k)=&-[a_{\alpha}^{f}(k)|c_{\alpha }^{f}(k)x^{\alpha f}(k)-x_{i}^{f}(k)]+a_{\beta}^{f}(k)|c_{\beta}^{f}(k)x^{ \beta f}(k)-x_{i}^{f}(k)|\\ &+a_{\delta}^{f}(k)|c_{\delta}^{f}(k)x^{\delta f}(k)-x_{i}^{f}(k)| |/3,\ f=1...q,\ i=1...N,\end{array}