Evolutionary Tuning of Intelligent Fuzzy Control for Stabilization and Robustness in a Nonlinear Inverted Pendulum System
Abstract:
Nonlinear and inherently unstable systems continue to present significant difficulties for conventional control strategies, especially when actuator limitations and parameter uncertainty are involved. This work examines an intelligent control framework in which evolutionary optimization is combined with fuzzy logic control (FLC) to improve the stabilization and robustness of a nonlinear inverted pendulum system. A Mamdani-type fuzzy logic controller is employed to represent nonlinear feedback behavior without resorting to local linearization, while a genetic algorithm (GA) is used to tune the main scaling parameters through simulation-based optimization. The optimization procedure explicitly accounts for nonlinear system dynamics, actuator saturation, and failure-related performance penalties, allowing the evolutionary search to adjust the closed-loop response beyond heuristic parameter selection. Nonlinear time-domain simulations indicate that the optimized controller achieves faster convergence, reduced oscillatory motion, and more consistent performance than a manually tuned baseline controller. Further evaluations under different initial conditions and parameter variations demonstrate an enlarged region of attraction and stable behavior across a range of operating scenarios. These results suggest that evolutionary optimization can play an effective role in shaping fuzzy control structures for nonlinear systems by embedding robustness and performance objectives at the system level. The proposed approach offers a flexible and general framework for the intelligent stabilization of nonlinear and unstable dynamical systems and may be extended to other engineering applications characterized by strong nonlinearity and uncertainty.1. Introduction
The inverted pendulum on a cart is a widely used benchmark in control engineering because it is nonlinear, unstable in open loop, and highly sensitive to parameter changes and external disturbances [1]. Owing to these characteristics, it has been widely used to assess the performance and robustness of advanced control strategies. Conventional linear controllers typically rely on model linearization around the upright equilibrium point, which restricts their effectiveness under large disturbances, actuator constraints, or strongly nonlinear operating conditions. Early studies predominantly employed classical control schemes such as proportional-integral-derivative controllers [2]. While these methods are straightforward to implement, their performance is highly dependent on accurate system modeling and fixed gain tuning. As noted by Chen [3], such requirements significantly limit adaptability and robustness in the presence of uncertainties and unmodeled dynamics. To overcome these limitations, attention has increasingly shifted toward intelligent and adaptive control strategies, particularly fuzzy logic control (FLC).
FLC is a useful option for nonlinear systems because it does not need an exact mathematical model and can include human-like decision rules using linguistic terms [4]. However, the performance of an FLC is highly sensitive to the selection of its parameters, including scaling gains and membership function boundaries [5], [6]. As system complexity increases, manual tuning becomes impractical and often yields suboptimal performance. To address this challenge, evolutionary optimization techniques, most notably genetic algorithms (GAs), have been widely investigated for tuning fuzzy controllers [7]. GAs provide a global, derivative-free optimization framework inspired by natural selection, making them well suited for nonlinear, discontinuous, and simulation-based objective functions [8]. Alimoradpour et al. [9] demonstrated that GAs can systematically optimize Mamdani-type fuzzy controllers by tuning rule bases and membership functions, leading to significant improvements in inverted pendulum stabilization. Similarly, Aydın and Yakut [10] reported enhanced transient response and robustness in a rotary inverted pendulum system by applying GA optimization to fuzzy sliding mode control parameters.
In contrast, other studies have focused on adaptive fuzzy control without explicitly incorporating evolutionary optimization. Lakmesari et al. [11] proposed a robust adaptive controller combining fuzzy rules with gradient-based adaptation laws, while Li et al. [12] developed an adaptive fuzzy backstepping framework for nonlinear systems with unknown disturbances. Although effective, these approaches rely on local optimization mechanisms and may converge to suboptimal solutions when applied to highly nonlinear systems. More recently, alternative metaheuristic techniques have been explored. Abdul Razak et al. [13] employed Manta Ray Foraging Optimization to tune Type 2 fuzzy controllers, and Sanin-Villa et al. [14] compared several metaheuristic algorithms for inverted pendulum parameter estimation, reaffirming the competitiveness of GAs in nonlinear control applications.
Despite these improvements, many studies have only addressed parts of fuzzy controller tuning or have not provided a complete framework that includes nonlinear dynamics, actuator limits, and failure-aware performance goals. Motivated by this gap, the present study introduces a GA-optimized Mamdani-type fuzzy logic controller for a nonlinear inverted pendulum system. By integrating global evolutionary optimization with a structured fuzzy control architecture, the proposed approach aims to enhance stability, robustness, and tracking performance under nonlinear operating conditions and uncertainties.
2. Methodology
This study proposes an integrated framework for designing and optimizing a fuzzy logic controller for a nonlinear inverted pendulum on a cart using a GA, as shown in Figure 1. The overall methodology combines nonlinear system simulation, Mamdani-type fuzzy inference, and evolutionary optimization within a unified design loop.

The inverted pendulum dynamics are modeled in continuous time and numerically integrated using a fixed-step fourth-order Runge-Kutta method, ensuring accurate representation of nonlinear behavior and actuator saturation effects [15]. A baseline fuzzy controller is initially constructed using heuristic stabilizing rules based on pendulum angle and angular velocity. Subsequently, a GA is employed to optimize key scaling parameters of the fuzzy controller.
The optimization process relies on a simulation-based fitness function that accounts for transient tracking performance, control effort, and failure conditions. By embedding nonlinear plant dynamics, actuator constraints, and safety limits directly into the optimization loop, the proposed approach enables robust controller synthesis without relying on system linearization or gradient information. This makes the framework particularly suitable for unstable and highly nonlinear control problems.
The inverted pendulum system consists of a cart of mass (M) that moves horizontally and a rigid pendulum of mass (m) and length (l) in m pivoted on the cart, as shown in Figure 2. The state variables are the cart position (x) in m, cart velocity ($\dot{x}$) in m/s, pendulum angle (θ) in rad measured from the upright equilibrium, and angular velocity ($\dot{\theta}$) in rad/s. The control input is the horizontal force (F) in N applied to the cart.

The system dynamics are governed by coupled nonlinear differential equations derived using Newtonian mechanics. Due to the strong coupling between translational and rotational dynamics, small deviations in the pendulum angle can lead to rapid divergence, making the stabilization problem highly challenging and well suited for nonlinear and intelligent control approaches.
A Mamdani-type fuzzy logic controller is employed with two inputs and one output:
· Pendulum angle error: $e_\theta(t)=\theta_{ref}-\theta(t)$ (rad);
· Pendulum angular velocity error: $\dot{e} \theta(t)=-\dot{\theta}(t)$ (rad/s);
· Control output: cart force command F(t) (N).
The fuzzy controller operates on normalized input variables and produces a normalized control output, which is subsequently scaled to generate the physical control force. Each input and output variable is described by five triangular membership functions: Negative Big, Negative Small, Zero, Positive Small, and Positive Big. A total of 25 fuzzy rules is defined to capture stabilizing control behavior, forming a symmetric and intuitive rule base resembling a nonlinear proportional derivative control action.
The GA employed in this study follows a standard real GA configuration, incorporating tournament-based selection, elitism to preserve the best-performing individuals across generations, and real crossover and mutation operators. This conventional setup ensures reliable convergence while maintaining sufficient population diversity during the optimization of the fuzzy controller scaling gains.
Rather than directly optimizing all membership function parameters, the GA tunes three key scaling factors [16], [17]:
where, Ke scales the angle error input, Kd scales the angular velocity input, and Ku scales the fuzzy controller output to the physical force domain. This choice significantly reduces the search space while retaining strong influence over controller performance.
The GA minimizes a composite objective function defined as:
where, $w_\theta$, wx, and wu are weighting coefficients, t denotes time in seconds (s), and P is a large penalty applied if the pendulum angle exceeds a predefined safety threshold, indicating system failure. xref denotes the reference (desired) cart position. For example, xref = 0 represents the objective of keeping the cart at the origin while stabilizing the pendulum in the upright position. The integral time-weighted absolute error (ITAE) terms emphasize fast error elimination, while the control effort penalty discourages aggressive actuation.
3. Results
The proposed GA fuzzy control scheme was evaluated through nonlinear simulations with an initial pendulum angle of 8° and zero initial cart displacement. Actuator saturation was imposed at $\pm$15 N, and the simulation horizon was set to T = 8 s. The GA population size was 80 individuals with 60 generations. The plant parameters were set to M = 1.0 kg, m = 0.2 kg, and l = 0.3 m with viscous cart friction b = 0.1 N·s/m and gravity g = 9.81 m/s2, consistent with common inverted pendulum settings. The safety threshold θmax = 20° was used to define “failure” events (pendulum fall).
A manually selected baseline scaling set (Ke, Kd, Ku) = (8.0, 1.5, 12.0) was first tested to establish a reference performance. The GA then optimized the scaling vector subject to bounds Ke in [0.5, 40], Kd in [0.05, 8], and Ku in [$\text{1}$, $\text{30}$], which reflect physically plausible mappings between raw state errors and the normalized Fuzzy Inference System domain (and between normalized outputs and actuator force limits). The optimized gains (40, 0.566328, 23.3395) were obtained under the nonlinear simulation constraints using GA. Table 1 reports the baseline scaling gains and the GA-optimized gains. The results typically show that the GA increases Ke and Ku to strengthen corrective action for angle deviations, while selecting Kd to shape damping through angular rate feedback, yielding faster stabilization without persistent saturation.
Controller | Ke | Kd | Ku |
Baseline controller | 8 | 1.5 | 12 |
GA-optimized fuzzy logic controller | 40 | 0.566328 | 23.3395 |
Figure 3, Figure 4, and Figure 5 collectively illustrate the impact of GA-based tuning on the closed-loop behavior of the inverted pendulum system. The GA-optimized fuzzy controller rapidly attenuates the initial angular deviation and drives the pendulum toward the upright equilibrium with minimal residual error, whereas the baseline controller converges more slowly and exhibits a noticeable steady-state bias. This improvement in angular stabilization is accompanied by a substantial reduction in cart displacement, as the optimized controller prevents the unbounded drift observed under the baseline controller and maintains the cart motion within a limited range. In terms of actuation, the GA-optimized controller applies a more moderate and smoothly varying force after the transient phase, avoiding prolonged high control effort while respecting saturation constraints, in contrast to the baseline controller which relies on sustained force application to maintain stability.
Figure 3 illustrates the pendulum angle response. In the baseline case, stabilization is achieved but with slower decay and larger peak excursion. After GA tuning, the angle converges more rapidly toward the upright equilibrium and remains well within the safety bounds ±θmax (failure angle threshold), indicating an enlarged region of attraction for the tested initial condition and improved damping behavior. These trends are consistent with prior GA-tuned fuzzy control studies on inverted pendulum systems, where evolutionary scaling and Mamdani fuzzy logic tuning typically reduce overshoot and improve settling characteristics [18], [19].

This result illustrates the pendulum angle response for the baseline fuzzy controller and the GA-optimized fuzzy logic controller. While the baseline controller exhibits a slow convergence with a persistent steady-state offset of approximately several degrees, the GA-optimized fuzzy logic controller achieves significantly faster stabilization with negligible steady-state error and reduced oscillation amplitude, indicating improved damping and transient performance.
Figure 4 presents the cart position response. Because the FLC inputs are angle and angular velocity (rather than cart states), the position regulation is achieved indirectly through stabilizing motions that keep the pendulum upright. The GA-optimized controller reduces cart drift and oscillations by shaping the control effort term and by implicitly coordinating force actions through the nonlinear coupling between x and θ [18], [19].

The baseline controller results in a continuously increasing cart displacement, indicating poor regulation and drift, whereas the GA-optimized fuzzy logic controller significantly limits cart motion and maintains a bounded, smoother trajectory, reflecting improved coordination between pendulum stabilization and translational dynamics.
Figure 5 shows the applied force profile under saturation. The optimized controller tends to generate smoother force trajectories with reduced peak magnitudes (relative to a saturation-hitting baseline), reflecting the role of the effort penalty term and the GA’s ability to discover scaling gains that balance speed of stabilization with actuator feasibility [20], [21].

The GA-optimized controller produces a smoother force trajectory with lower sustained magnitude after the initial transient while remaining well within the saturation limits, whereas the baseline controller applies a higher and more persistent control effort, indicating less efficient use of actuation.
Table 2 summarizes the ITAE values for the pendulum angle and cart position, the peak absolute force, the peak absolute angle, and a failure flag for each controller. The GA-optimized controller consistently improves ITAE measures and reduces peak excursions, confirming that the evolutionary tuning successfully reshapes the closed-loop transient response under nonlinear dynamics and saturation [18].
Metric | Baseline Controller | GA-Optimized Fuzzy Logic Controller |
ITAEθ (rad·s) | 2.342 | 0.3387 |
ITAEx (m·s) | 385.4 | 45.38 |
Fmax (N) | 6 | 11.67 |
θmax (°) | 8 | 8 |
Failure | No | No |
To further evaluate the generalization and robustness of the proposed GA-optimized fuzzy logic controller, additional simulation studies were conducted under multiple initial conditions and parametric uncertainties. Robustness assessment is essential for nonlinear and unstable systems such as the inverted pendulum, where controller performance may degrade significantly outside nominal operating conditions. The controller was tested under a set of increasing initial pendulum angle deviations while maintaining zero initial cart displacement and velocity. Specifically, the initial angle was varied as follows:
This represents mild to severe perturbations from the upright equilibrium. For each scenario, the same GA-optimized fuzzy controller parameters were applied without retuning.
The simulation results indicate that the GA-optimized fuzzy controller successfully stabilizes the pendulum for all tested initial conditions, whereas the baseline fuzzy controller exhibits increased overshoot and longer settling times as the initial deviation grows. Importantly, no failure events were observed for the optimized controller within the tested range, demonstrating a wide region of attraction and improved nonlinear stability properties. In practical applications, physical parameters such as the cart mass, pendulum mass, and pendulum length are subject to modeling errors and variations. To assess robustness against such uncertainties, Monte Carlo simulations were performed in which key system parameters were independently perturbed within ±10% of their nominal values:
where, (M0, m0, l0) denotes the nominal model parameters used during the GA optimization.
For each randomized parameter set, the pendulum was initialized at θ(0) = 8°, and the closed-loop response was simulated over the full-time horizon. The GA-optimized fuzzy controller consistently maintained stability across all tested perturbations, with only moderate variations in settling time and control effort. In contrast, the baseline fuzzy controller showed noticeable performance degradation and occasional near-failure behavior under the same uncertainty levels. The robustness results demonstrate that the proposed GA-optimized fuzzy logic controller maintains stable and consistent performance across a wide range of operating conditions and modeling uncertainties. The evolutionary tuning process implicitly embeds robustness into the controller by optimizing performance over nonlinear simulations that include actuator saturation and failure penalties. As a result, the optimized fuzzy controller exhibits superior tolerance to initial condition variations and parameter mismatches compared with manually tuned fuzzy control designs.
Overall, these robustness evaluations indicate that the proposed GA-optimized fuzzy logic controller provides reliable stabilization and safe operation under realistic variations in initial conditions and system parameters, highlighting its suitability for practical deployment in nonlinear and uncertain control environments. These findings significantly strengthen the practical relevance of the proposed approach and support its applicability to real-world nonlinear control systems where exact model parameters and operating conditions cannot be guaranteed.
4. Discussion
The simulation results clearly demonstrate the advantages of GA-based tuning over manual selection of fuzzy controller parameters. The GA-optimized fuzzy logic controller achieves superior stability, faster convergence, and improved robustness compared with the baseline configuration, particularly under actuator saturation and failure constraints. A notable outcome is the substantial reduction in the ITAE of the pendulum angle, which directly reflects enhanced transient and steady-state performance. This observation is consistent with findings reported by Chen [3], who emphasized the ability of evolutionary optimization to overcome the limitations of fixed-gain and locally adaptive controllers. By globally exploring the scaling gain space, the GA avoids convergence to suboptimal solutions commonly associated with gradient-based methods.
In addition to improved pendulum stabilization, the GA-optimized controller exhibits reduced cart displacement, highlighting better coordination between stabilization and cart motion. Unlike approaches that focus solely on rule base or membership function optimization, the present results show that tuning scaling gains alone can yield substantial performance improvements when guided by an appropriately designed fitness function. Importantly, improved tracking performance is achieved without excessive control effort. The optimized controller respects actuator limits and produces smoother force profiles, which is advantageous for practical implementation where actuator wear and energy efficiency are critical concerns. Compared to adaptive or sliding mode fuzzy controllers reported in prior studies [11], [12], the proposed approach avoids aggressive or high-frequency control actions while maintaining robustness.
The inclusion of failure penalties further enhances safety by discouraging solutions that approach instability boundaries. This feature aligns with previous findings that GA-based tuning improves stability margins in inverted pendulum systems [10]. When compared with more recent bio-inspired optimization techniques [13], [14], the results reaffirm that classical GAs remain a competitive and reliable choice for nonlinear control applications. Overall, the proposed GA-optimized fuzzy logic controller provides a unified and effective framework that addresses nonlinear dynamics, actuator constraints, and safety considerations, outperforming manually tuned and locally adaptive fuzzy controllers.
5. Conclusion
This study presented a GA-optimized FLC strategy for stabilizing a nonlinear inverted pendulum on a cart. By integrating evolutionary optimization with a Mamdani-type Fuzzy Inference System, the proposed approach achieves faster stabilization, reduced overshoot, and lower control effort under nonlinear dynamics and actuator constraints. The results confirm the effectiveness of GAs for global tuning of fuzzy controller parameters. The proposed framework is general and can be extended to multi-input fuzzy controllers, alternative performance criteria, and a wide range of nonlinear mechatronic systems.
Conceptualization, M. M. and M. K.; methodology, M. M. and M. K.; software, M. M. and M. K.; validation, M. M. and M. K.; formal analysis, M. M. and M. K.; investigation, M. M. and M. K.; resources, M. M. and M. K.; writing—original draft preparation, M. M. and M. K.; writing—review and editing, M. M. and M. K.; visualization, M. M. and M. K.; supervision, M. M. and M. K. All authors have read and agreed to the published version of the manuscript.
The data used to support the research findings are available from the corresponding author upon request.
The authors acknowledge the Sakarya University of Applied Sciences (https://subu.edu.tr/) for the technical support provided to publish the present manuscript.
The authors declare no conflicts of interest.
