# A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller
## 5 Experiments and Results
This parameter selection meets the recommendations in [37] and the results documented in [38], indicating that the optimal search capacity and convergence speed are sensitive to the control parameter choice. In particular, for \(F=0.6\), it is suggested that a value of \(CR\) be in the range of \([0.3,0.9]\). \(CR=0.5\) has been used as a fixed value or as a starting point for diverse DE variants in [39, 40], respectively, producing good results. The stop criterion was the maximum number of evaluations of the objective function. For the lower problem, it was set at 500,000, while in the upper level, 50,000 evaluations were carried out. This is because, in the first level, 10 noise samples were considered in each evaluation to obtain the final value used for DE. The resulting number of membership functions and the optimization function value in the first level of the tuning process are shown in Table 2, also including their average and standard deviation. Five different values for the number of membership functions, \(m\), were obtained from the lower problem. The value with the best performance (and also the one that appeared most frequently), \(m=5\), was used in the second level to determine the best configuration for the NFC. The final results are shown in Table 3. The best result from the upper-level optimization was simulated for the tracking task of the controller. Additionally, the results obtained in [13, 14] were simulated, corresponding to an NFC controller with a different architecture than that obtained by the bilevel optimization approach in this work and to an analytically tuned PID controller, respectively (see Figure 7). In quantitative terms, to evaluate the performance of the controllers, Equation (23) was used, which is a function that penalizes the error in the monitoring task. So, the closer the value is to zero, the better the \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Range** \\ \hline Parameter of the membership & \(\phi_{j,k},\sigma_{j,k}\) \\ functions (\(\phi_{j,k}\) and \(\sigma_{j,k}\)) & \(\in[-100,100]\) \\ \hline Learning rate constants & \(\eta_{\phi},\eta_{\sigma},\eta_{r}\) \\ \(\eta_{\phi},\eta_{\sigma},\eta_{r}\) & \(\in[0.0001,3]\) \\ \hline Number of member functions \(m\) & \(m\in\mathbb{Z}\cap[3,15]\) \\ \hline Initial weights \(\widehat{w}\) referred to as \(r_{j}\) & \(w_{i}\in[0.0001,50]\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List and range of tuned parameters for the NFC. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Number of Membership** & **Noisy Optimization** \\
**Run** & **Functions**\(m\) & **Function Values** \\ \hline
1 & 8 & 5766.2 \\
2 & 7 & 5567.9 \\
3 & 5 & 5875.4 \\
4 & 5 & 5796.7 \\
5 & 13 & 5968.0 \\
6 & 11 & 5962.3 \\
7 & 5 & 5800.3 \\
8 & 5 & 6016.5 \\
9 & 5 & 5272.5 \\
10 & 5 & 5748.8 \\ \hline Average & 6.9 & 5777.5 \\ \hline Standard deviation & 2.9231 & 220.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Objective function values obtained in the first level of the tuning. controller is considered. The best performance was obtained by the NFC with the tuning in this work through the bilevel optimization approach with a value of \(f_{NFC5}(\vec{x})=4785.3\), followed by the NFC reported in [13] with a value of \(f_{NFC}(\vec{x})=5641.9\), and finally, the PID controller reported in [14] with a value of \(f_{PID}(\vec{k})=59,076.6\). The function \(f_{PID}(\vec{k})\) refers to Equation (23) in the sense that error metrics between the obtained signal and the desired value are used to evaluate the performance of the controllers, but in the case of the PID controller, these would be subject to the gains of the PID controller \(\vec{k}\) instead of the architecture and values of the NFC \(\vec{w}\). The simulation begins at 0 \({}^{\circ}\)C due to the characteristics of the transfer function with zero initial conditions. However, in the real world, it must start from the ambient temperature of the place where the process is located.