# An Adaptive Control Based on Improved Gray Wolf Algorithm for Mobile Robots
## 4 Design of the Adaptive Optimization Algorithm
In the process of online optimization, the new area that is updated with regard to every controller parameter \(K_{M}(k,u_{0})\) (\(M=1,2\)) is described through the following equation  
\[K_{A_{i}}(k,u_{0})=K_{i}(k,u_{0}-u_{1})+h_{k}o(k,u_{0})j(k,u_{0}) \tag{55}\]  
where \(K_{A_{i}}(k,u_{0})\) denotes the controller parameter of ith gray wolf, \(u_{1}\) denotes the search period, \(h_{k}\) indicates the number of repetitions of the fuzzy process for each parameter, \(o(k,u_{0})\) denotes the output of the fuzzy system, and \(j(k,u_{0})\) indicates the proportional function of the error. The fuzzy rule arranges the gray wolf individual into a new desired space to explore. Accordingly, the fuzzy system utilizes the integral of error \(\int\tau\|\ E_{i}(k,t)\ \|\), the paradigm \(\|\tau(t)\|\) is input, and the explore space \(o\) (\(k\), \(t\)) is output. Thus, for the input (\(x(k,t)\geq 0\)), set the linguistic values as (\(Z\), \(P\)), and for the output \(o(k,t)\), set (\(N\), \(Z\), \(P\)). The fuzzy rules are displayed in Table 1 and the Max-Min inference is according to Figure 5. The triangular-trapezoidal fuzzifier is used, the center of the region is the defuzzifier, and we define the output as follows  
Figure 4.0  
Next, the new search space is distributed to the remaining gray wolves as  
Figure 4.1 \begin{table}
\begin{tabular}{c c c} \hline \hline \(\|\tau(t)\|\) & \multicolumn{2}{c}{\(\|E_{i}(k,t)\|\)} \\ \cline{2-3}  & \(Z\) & \(P\) \\ \hline \(Z\) & \(Z\) & \(P\) \\ \(p\) & \(Z\) & \(N\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Fuzzy inference system (FIS) rule. Figure 5: (**a**) The membership function of integral error, where Emin is the minimum error (**b**) The membership function of applied torque, where Sat is the control saturation. where \(i=2,3,\ldots,N\). (4) Add inertia weight \(v\)  
In [13; 36], a novel inertia weight \(\omega\) is proposed, which plays a crucial role in the PSO as it reflects the capacity of particles to maintain their preceding time of motion. The inertia weight can improve the convergence and optimization of the PSO. Currently, the most widely used approach for dynamic inertia weights is the linear decreasing weight strategy [43]. The mathematical expression of this strategy is as follows  
\[\omega(t)=\omega_{max}-\frac{\omega_{max}-\omega_{min}}{T}\times t \tag{58}\]  
where \(\omega_{max}\) denotes the weight maximum and \(\omega_{min}\) denotes the weight minimum. Inspired by the above idea, let us add a dynamic inertia weight \(v\) to the GWO, where the value of \(v\) is larger when the number of iterations is relatively small, making it easier for the gray wolf to perform a global search. In the later stage of the algorithm search, the value of v decreases as the value of \(t\) increases, which is more conducive for a gray wolf in a local search. \[v(t)=v_{n}-\frac{v_{1}-v_{n}}{T}\times t \tag{59}\]  
where \(v_{1}\) represents the initial value of the inertia weight and \(v_{n}\) represents the final value of the inertia weight. The position update formula becomes  
\[X(t+1)=v(t)\times(X_{1}+X_{2}+X_{3}) \tag{60}\]  
B Algorithmic flow for improving the GWO  
The flowchart of the proposed improved GWO is shown in Figure 6. The algorithm will be used to optimize the variable parameters of the controller by the population of the gray wolves. Accordingly, the proposed improved GWO can be described as follows. (1) Initialization  
Assume that two populations of gray wolves (\(M=1\), \(2\)) are established and related with the controller parameters. The gray wolves in the populations are described as \(A_{1},A_{2},\cdots,A_{N}\), where \(N\) represents the total population within the gray wolves. To commence the training process, the controller parameters are initialized to zero, meaning that the gray wolf population begins from the origin. Then, set the population size \(N\), initial number of iterations \(t=1\), maximum number of iterations \(T\), and the initial convergence factor \(a_{0}\).