# A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- The modeling of an optimization problem for tuning an NFC, applied to a case study from the related literature, with dynamic-size solution vectors containing continuous and integer variables.
- The reformulation of the optimization problem as a bilevel optimization problem to be solved using metaheuristic algorithms, allowing for unbiased tuning of the NFC without fixing the size of weights or membership functions.
- The simulation of the case study, focusing on temperature control with the NFC as part of a biodiesel generation process, using the best setting found by the proposed method and comparing it with other approaches reported in the literature.

## 2. Neuro-Fuzzy Controller

## 3. Optimization

## 4. Bilevel Optimization for Tuning a NFC

#### 4.1. First Level

#### 4.2. Second Level

## 5. Experiments and Results

#### 5.1. Applying the Proposed Method in a Real-World Scenario

#### 5.2. Discussion

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Dempe, S.; Kue, F.M. Solving discrete linear bilevel optimization problems using the optimal value reformulation. J. Glob. Optim.
**2017**, 68, 255–277. [Google Scholar] [CrossRef] - Bard, J.F.; Falk, J.E. An explicit solution to the multi-level programming problem. Comput. Oper. Res.
**1982**, 9, 77–100. [Google Scholar] [CrossRef] - Poirion, P.L.; Toubaline, S.; D’Ambrosio, C.; Liberti, L. Algorithms and applications for a class of bilevel MILPs. Discret. Appl. Math.
**2020**, 272, 75–89. [Google Scholar] [CrossRef] - Cerulli, M.; D’Ambrosio, C.; Liberti, L. Flying Safely by Bilevel Programming. In Advances in Optimization and Decision Science for Society, Services and Enterprises: ODS, Genoa, Italy, 4–7 September 2019; Springer International Publishing: Cham, Switzerland, 2019; pp. 197–206. [Google Scholar] [CrossRef]
- Sinha, A.; Malo, P.; Xu, P.; Deb, K. A Bilevel Optimization Approach to Automated Parameter Tuning. In Proceedings of the 2014 Annual Conference on Genetic and Evolutionary Computation, New York, NY, USA, 18–20 October 2014; GECCO ′14. pp. 847–854. [Google Scholar] [CrossRef]
- Llorente-Vidrio, D.; Ballesteros, M.; Salgado, I.; Chairez, I. Deep Learning Adapted to Differential Neural Networks Used as Pattern Classification of Electrophysiological Signals. IEEE Trans. Pattern Anal. Mach. Intell.
**2022**, 44, 4807–4818. [Google Scholar] [CrossRef] [PubMed] - Llorente-Vidrio, D.; Pérez-San Lázaro, R.; Ballesteros, M.; Salgado, I.; Cruz-Ortiz, D.; Chairez, I. Event driven sliding mode control of a lower limb exoskeleton based on a continuous neural network electromyographic signal classifier. Mechatronics
**2020**, 72, 102451. [Google Scholar] [CrossRef] - Escobar-Jiménez, R.; Salvide-Hernández, F.; López-Muñoz, R.; Tolentino-Eslava, R.; Maya-Rodriguez, M.C. Monitoring and Prediction of Drinking Water Consumption. In Proceedings of the Telematics and Computing, Cancún, México, 7–11 November 2022; Mata-Rivera, M.F., Zagal-Flores, R., Barria-Huidobro, C., Eds.; Springer International Publishing: Cham, Switzerland, 2022; pp. 60–75. [Google Scholar]
- Pezeshki, Z.; Mazinani, S.M. Comparison of artificial neural networks, fuzzy logic and neuro fuzzy for predicting optimization of building thermal consumption: A survey. Artif. Intell. Rev.
**2019**, 52, 495–525. [Google Scholar] [CrossRef] - Pacco, H.C. Simulation of temperature control and irrigation time in the production of tulips using Fuzzy logic. Procedia Comput. Sci.
**2022**, 200, 1–12. [Google Scholar] [CrossRef] - Azad, A.S.; Rahaman, M.S.A.; Watada, J.; Vasant, P.; Vintaned, J.A.G. Optimization of the hydropower energy generation using Meta-Heuristic approaches: A review. Energy Rep.
**2020**, 6, 2230–2248. [Google Scholar] [CrossRef] - Han, H.; Liu, H.; Li, J.; Qiao, J. Cooperative fuzzy-neural control for wastewater treatment process. IEEE Trans. Ind. Inform.
**2020**, 17, 5971–5981. [Google Scholar] [CrossRef] - Maya-Rodriguez, M.C.; Carvajal-Mariscal, I.; López-Muñoz, R.; Lopez-Pacheco, M.A.; Tolentino-Eslava, R. Temperature Control of a Chemical Reactor Based on Neuro-Fuzzy Tuned with a Metaheuristic Technique to Improve Biodiesel Production. Energies
**2023**, 16, 6187. [Google Scholar] [CrossRef] - Stanescu, R.C.; Leahu, C.I.; Soica, A. Aspects Regarding the Modelling and Optimization of the Transesterification Process through Temperature Control of the Chemical Reactor. Energies
**2023**, 16, 2883. [Google Scholar] [CrossRef] - Atangana Njock, P.G.; Shen, S.L.; Zhou, A.; Modoni, G. Artificial neural network optimized by differential evolution for predicting diameters of jet grouted columns. J. Rock Mech. Geotech. Eng.
**2021**, 13, 1500–1512. [Google Scholar] [CrossRef] - Kabir Anaraki, A.; Ayati, M.; Kazemi, F. Magnetic resonance imaging-based brain tumor grades classification and grading via convolutional neural networks and genetic algorithms. Biocybern. Biomed. Eng.
**2019**, 39, 63–74. [Google Scholar] [CrossRef] - Lee, W.Y.; Park, S.M.; Sim, K.B. Optimal hyperparameter tuning of convolutional neural networks based on the parameter-setting-free harmony search algorithm. Optik
**2018**, 172, 359–367. [Google Scholar] [CrossRef] - Liu, J.; Wang, Y.; Huang, P.Q.; Jiang, S. Car: A cutting and repulsion-based evolutionary framework for mixed-integer programming problems. IEEE Trans. Cybern.
**2021**, 52, 13129–13141. [Google Scholar] [CrossRef] [PubMed] - Liu, J.; Wang, Y.; Xin, B.; Wang, L. A biobjective perspective for mixed-integer programming. IEEE Trans. Syst. Man Cybern. Syst.
**2021**, 52, 2374–2385. [Google Scholar] [CrossRef] - Molina Pérez, D.; Alfredo Portilla-Flores, E.; Mezura-Montes, E.; Vega-Alvarado, E. An improved estimation of distribution algorithm for solving constrained mixed-integer nonlinear programming problems. In Proceedings of the 2022 IEEE Congress on Evolutionary Computation (CEC), Padua, Italy, 18–23 July 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 1–8. [Google Scholar]
- Liu, Y.; Wang, H. Surrogate-assisted hybrid evolutionary algorithm with local estimation of distribution for expensive mixed-variable optimization problems. Appl. Soft Comput.
**2023**, 133, 109957. [Google Scholar] [CrossRef] - Tipsuwanporn, V.; Intajag, S.; Witheephanich, K.; Koetsam-ang, N.; Samiamag, S. Neuro-fuzzy controller design for industrial process controls. In Proceedings of the SICE 2004 Annual Conference, Sapporo, Japan, 4–6 August 2004; Volume 2, pp. 1656–1661. [Google Scholar]
- Ljung, L. System Identification Theory for User; Prentice-Hall: Englewood Cliffs, NJ, USA, 1987. [Google Scholar]
- Bortolet, P.; Palm, R. Identification, modeling and control by means of Takagi-Sugeno fuzzy systems. In Proceedings of the 6th International Fuzzy Systems Conference, Barcelona, Spain, 1–5 July 1997; Volume 1, pp. 515–520. [Google Scholar] [CrossRef]
- Huba, M.; Hypiusová, M.; Ťapák, P.; Vrancic, D. Active Disturbance Rejection Control for DC Motor Laboratory Plant Learning Object. Information
**2020**, 11, 151. [Google Scholar] [CrossRef] - Pelamatti, J.; Brevault, L.; Balesdent, M.; Talbi, E.G.; Guerin, Y. How to Deal with Mixed-Variable Optimization Problems: An Overview of Algorithms and Formulations. In Advances in Structural and Multidisciplinary Optimization; Schumacher, A., Vietor, T., Fiebig, S., Bletzinger, K.U., Maute, K., Eds.; Springer: Cham, Switzerland, 2018; pp. 64–82. [Google Scholar]
- Krink, T.; Filipic, B.; Fogel, G. Noisy optimization problems—A particular challenge for differential evolution? In Proceedings of the 2004 Congress on Evolutionary Computation (IEEE Cat. No.04TH8753), Portland, OR, USA, 19–23 June 2004; Volume 1, pp. 332–339. [Google Scholar] [CrossRef]
- Neri, F.; Tirronen, V. Recent advances in differential evolution: A survey and experimental analysis. Artif. Intell. Rev.
**2010**, 33, 61–106. [Google Scholar] [CrossRef] - Das, S.; Mullick, S.S.; Suganthan, P.N. Recent advances in differential evolution—An updated survey. Swarm Evol. Comput.
**2016**, 27, 1–30. [Google Scholar] [CrossRef] - Opara, K.R.; Arabas, J. Differential Evolution: A survey of theoretical analyses. Swarm Evol. Comput.
**2019**, 44, 546–558. [Google Scholar] [CrossRef] - Kleinert, T.; Labbé, M.; Ljubić, I.; Schmidt, M. A Survey on Mixed-Integer Programming Techniques in Bilevel Optimization. EURO J. Comput. Optim.
**2021**, 9, 100007. [Google Scholar] [CrossRef] - Potter, M.A.; De Jong, K.A. A cooperative coevolutionary approach to function optimization. In Proceedings of the International Conference on Parallel Problem Solving from Nature, Jerusalem, Israel, 9–14 October 1994; Springer: Berlin/Heidelberg, Germany, 1994; pp. 249–257. [Google Scholar]
- Shi, Y.j.; Teng, H.f.; Li, Z.q. Cooperative co-evolutionary differential evolution for function optimization. In Advances in Natural Computation: First International Conference, ICNC 2005, Changsha, China, August 27–29, 2005, Proceedings, Part II 1; Springer: Berlin/Heidelberg, Germany, 2005; pp. 1080–1088. [Google Scholar]
- Sayed, E.; Essam, D.; Sarker, R.; Elsayed, S. Decomposition-based evolutionary algorithm for large scale constrained problems. Inf. Sci.
**2015**, 316, 457–486. [Google Scholar] [CrossRef] - Noureddini, H.; Zhu, D. Differential Evolution: A Survey of the State-of-the-Art. J. Amer. Oil Chem. Soc.
**2002**, 104, 1457–1463. [Google Scholar] - Komers, K.; Skopal, F.; Stloukal, R.; Machek, J. Kinetics and mechanism of the KOH—Catalyzed methanolysis of rapeseed oil for biodiesel production. Eur. J. Lipid Sci. Technol.
**2011**, 15, 728–737. [Google Scholar] [CrossRef] - Storn, R.; Price, K. Differential Evolution—A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces. J. Glob. Optim.
**1997**, 11, 341–359. [Google Scholar] [CrossRef] - Das, S.; Suganthan, P.N. Differential Evolution: A Survey of the State-of-the-Art. IEEE Trans. Evol. Comput.
**2011**, 15, 4–31. [Google Scholar] [CrossRef] - Ali, M.; Törn, A. Population Set-Based Global Optimization Algorithms: Some Modifications and Numerical Studies. Comput. Oper. Res.
**2004**, 31, 1703–1725. [Google Scholar] [CrossRef] - Qin, A.K.; Huang, V.L.; Suganthan, P.N. Differential Evolution Algorithm with Strategy Adaptation for Global Numerical Optimization. IEEE Trans. Evol. Comput.
**2009**, 13, 398–417. [Google Scholar] [CrossRef]

**Figure 1.**Neuro-fuzzy model controller scheme [13].

**Figure 2.**Feedback implementation of the neuro-fuzzy controller [13].

**Figure 3.**Example with two dynamics of the reactor temperature using the same NFC architecture but with different values of $\overrightarrow{w}$.

**Figure 6.**Pilot plant scheme [14].

**Figure 9.**Dynamics of the reactor temperature with an initial condition of 20 °C using the NFC tuned by the bilevel optimization approach.

**Figure 10.**An example of the dynamics of a mathematical model of the reactor temperature with a really bad set of parameters for the NFC.

Parameter | Range |
---|---|

Parameter of the membership functions (${\varphi}_{j,k}$ and ${\sigma}_{j,k}$) | ${\varphi}_{j,k},{\sigma}_{j,k}$ $\in \left(\right)open="["\; close="]">-100,100$ |

Learning rate constants ${\eta}_{\varphi},{\eta}_{\sigma},{\eta}_{r}$ | ${\eta}_{\varphi},{\eta}_{\sigma},{\eta}_{r}$ $\in \left(\right)open="["\; close="]">0.0001,3$ |

Number of member functions m | $m\in \mathbb{Z}\cap \left(\right)open="["\; close="]">3,15$ |

Initial weights $\overrightarrow{w}$ referred to as ${r}_{j}$ | ${w}_{i}\in \left(\right)open="["\; close="]">0.0001,50$ |

Number of Membership | Noisy Optimization | |
---|---|---|

Run | Functions $\mathit{m}$ | Function Values |

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$ |

Average | $6.9$ | $5777.5$ |

Standard deviation | $2.9231$ | $220.5$ |

Run | Optimization Function Values |
---|---|

1 | $4824.6$ |

2 | $4949.8$ |

3 | $4785.3$ |

4 | $4918.3$ |

5 | $4877.5$ |

6 | $5081.2$ |

7 | $4804.4$ |

8 | $4878.1$ |

9 | $4799.0$ |

10 | $4961.8$ |

Average | $4888.0$ |

Standard deviation | $92.6$ |

**Table 4.**Objective function values using seven membership functions [13].

Run | Optimization Function Values |
---|---|

1 | $6762.7$ |

2 | $7218.1$ |

3 | $5888.4$ |

4 | $5956.0$ |

5 | $5641.9$ |

6 | $5768.8$ |

7 | $5959.0$ |

8 | $6007.2$ |

9 | $5979.6$ |

10 | $6039.6$ |

Average | $6122.1$ |

Standard deviation | $484.8$ |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

López-Muñoz, R.; Molina-Pérez, D.; Vega-Alvarado, E.; Duran-Medina, P.; Maya-Rodriguez, M.C.
A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller. *Appl. Sci.* **2024**, *14*, 5078.
https://doi.org/10.3390/app14125078

**AMA Style**

López-Muñoz R, Molina-Pérez D, Vega-Alvarado E, Duran-Medina P, Maya-Rodriguez MC.
A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller. *Applied Sciences*. 2024; 14(12):5078.
https://doi.org/10.3390/app14125078

**Chicago/Turabian Style**

López-Muñoz, Raúl, Daniel Molina-Pérez, Eduardo Vega-Alvarado, Pino Duran-Medina, and Mario C. Maya-Rodriguez.
2024. "A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller" *Applied Sciences* 14, no. 12: 5078.
https://doi.org/10.3390/app14125078