# A Bilevel Optimization Approach for Tuning a Neuro-Fuzzy Controller
## 1 Introduction  
Metaheuristics have gained popularity in various engineering fields due to the advantages these algorithms provide for addressing optimization problems when analytical or classical methods are not viable. This non-viability mainly occurs if the objective function to be optimized is not derivable or when there are insufficient computing resources to use analytical methods. However, solving real-world engineering problems that involve mixed variables (integer and continuous) is challenging, even for metaheuristic algorithms. This makes it necessary to modify the algorithms themselves or their application. In this type of problem, where integer and real variables coexist, highly complex search spaces are generated. Another limitation of metaheuristics is related to the operations performed on the candidate solutions to update them and eventually find a better solution, which implies that all solution vectors must have the same dimension. When the optimization problem involves candidate solutions with differing numbers of variables, metaheuristic algorithms are limited to exploring subsets of the search spaces at a time. In this work, the concept of bilevel optimization is employed to tackle this issue. It refers to a type of optimization in which one problem is embedded within another (the lower problem), such that the solution to this first problem sets a constraint for the upper problem [1]. According to [2], optimization cases that are both non-convex and non-differentiable are considered hard problems. An alternative for addressing them involves formulating these as bilevel optimization problems and solving them using metaheuristics. In [3], a bilevel mixed-integer linear problem was formulated to determine the optimal distribution of measurement devices across an electrical network. Another example was detailed in [4],where a bilevel problem was formulated to avoid air conflicts by establishing a distance threshold between planes, which implies an underlying problem for each pair of planes in a traffic control system. The authors in [5] proposed tuning the hyperparameters of a neural network by formulating a bilevel optimization problem, which was solved using the differential evolution algorithm (DE). Although the present work also focuses on parameter tuning, its nature and the bilevel problem formulated differ due to the use of solution vectors of different sizes, an aspect not contemplated in the aforementioned works. Nowadays, research efforts in automatic control theory are focused on developing more efficient modern controllers with strong mathematical properties. These controllers are designed to guarantee adequate solutions that meet the control objectives set by the user, even in the presence of disturbances and the inherent uncertainties of dynamical systems, particularly in real-world problems. This focus has led to collaboration across various areas to complement and enhance these solutions with controllers based on bio-inspired algorithms, such as neural networks, expert systems, fuzzy logic, and neuro-fuzzy systems, among others. The performance of this type of controller strongly depends on the initialization of the hyperparameters for their operation, which are typically selected randomly. Metaheuristics can help reduce this dependency and optimize controller performance by generating good setup parameters. Neuro-fuzzy controllers combine the learning plasticity of neural networks with the method of harnessing human knowledge through fuzzy logic. This type of controller is particularly attractive for solving real-world problems in the industrial sector, as it can adapt to changing environmental conditions over time while considering human operators who have worked for a long time with the process, accumulating vast experience. Various works have addressed the tuning of different controllers through experimentation, using random combinations [6; 7; 8]. Another example of a challenging optimization problem is the tuning of a neuro-fuzzy controller (NFC).