Provide A Method Based on Genetic Algorithm to Optimize the Fuzzy Logic Controller for the Inverted Pendulum

One of the classic systems in dynamics and control is the inverted pendulum, which is known as one of the topics in control engineering due to its properties such as nonlinearity and inherent instability. Diﬀerent approaches are available to facilitate and automate the design of fuzzy control rules and their associated membership functions. Recently, diﬀerent approaches have been developed to ﬁnd the optimal fuzzy rule base system using genetic algorithm. The purpose of the proposed method is to set fuzzy rules and their membership function and the length of the learning process based on the use of a genetic algorithm. The results of the proposed method show that applying the integration of a genetic algorithm along with Mamdani fuzzy system can provide a suitable fuzzy controller to solve the problem of inverse pendulum control. The proposed method shows higher equilibrium speed and equilibrium quality compared to static fuzzy controllers without optimization. Using a fuzzy system in a dynamic inverted pendulum environment has better results compared to deﬁnite systems, and in addition, the optimization of the control parameters increases the quality of this model even beyond the simple case. base system using a genetic algorithm. A genetic algorithm is a powerful tool that facilitates the automated design of fuzzy control rules and membership

knowledge base. The purpose of the proposed method is to set fuzzy rules and their membership function and the length of the learning process based on the application of a genetic algorithm. Fuzzy control rules dependent on interactive learning are not enough just to design a fuzzy logic controller, as it makes it difficult to produce an optimal fuzzy logic controller. On the other hand, the type of membership functions and the scope of the fuzzy control rule are also a key factor in designing a fuzzy logic controller. Replacing human operators in some control tasks is one of the important goals of using fuzzy logic controllers [3]. One of the classic systems in dynamics and control is inverted pendulum, which is known as one of the topics in control engineering due to its properties such as nonlinearity and inherent instability [3]. Recent research has provided soft computational methods for inverse pendulum controller using adaptive fuzzy neural inference system [4]. The process of the proposed method takes place in four stages. Design planning is the first step in the proposed method. Identifies variables (inputs, states, outputs). The input and output worlds or the distance that divides each variable into a number of fuzzy regions is assigned and assigns a language tag to each region. The initial evaluation is the second step of the proposed method. Candidate solutions take place in the primary population. Randomly, the specified domain is encoded by a range of variables and chromosomes into a set of fuzzy rule parameter matrices and a language tag for each region of the fuzzy controller. Evaluation is the third step of the proposed method. Each potential solution (chromosome decoding) is evaluated and a degree of compatibility is determined according to the problem-solving function. Individuals are arranged according to the fit values. Examines the final criterion. If confirmed, it stops and returns the best chromosome (set of fuzzy rules) otherwise it goes to the next step. Reconstruction is the fourth step of the proposed method. The operator applies the crossover and mutation to all chromosomes to produce a new chromosome, in addition to the new generation and goes to the third stage. In this research, a new design method based on a genetic algorithm is proposed to design an optimal fuzzy controller to control the real-time of the inverted pendulum system for stability. The objectives of this study include designing an optimal fuzzy controller to control the real-time of the inverted pendulum system, using a genetic algorithm to optimize the fuzzy controller for the inverted pendulum, and setting comprehensible and reliable fuzzy rules. The rest of the paper is organized as follows: In the second section, the previous work on inverse pendulum control based on different methods such as methods based on genetic algorithm and methods based on fuzzy logic is examined. In the third section, the proposed method of this paper is described. In the fourth section, the results of the simulation of the proposed method are compared with other common algorithms and methods in this field. Finally, the conclusions of this research and suggestions for future research are presented in the fifth section.

Related works
In [2] the proposed controller combines two fuzzy control approaches for omnidirectional inverted pendulum (ODIP) system control with disturbances and uncertainties and Takagi-Sugeno fuzzy model is adopted for fuzzy modeling. In [1], a fuzzy cognitive map based PD controller structure is introduced and used for the stabilization of an inverted pendulum system which is a nonlinear, unstable, and under-actuated system. The proposed controller has two inputs which are the error and the change of error. In [5], the problem of controlling the inverted pendulum has been investigated in detail. A different application that resembles inverted pendulum system has been studied. It considers the model, state space form representation with ricotta equation for optimal control applied to the nonlinear system with state and output variables. Later, to control the system several control system techniques has been applied in the literature survey. The challenging part is the fuzzy based method, to control position and for stabilization of the inverted pendulum with the application of appropriate rules of the overshoot and settling time is obtained within the desired value. The fuzzy based LQR is designed for a nonlinear system using MATLAB/SIMULINK. In [6], in order to reduce the difficulty in the selection of the quantization factor and the proportion factor in the general fuzzy controller, a controller with the novel algorithm based on the Logistic chaotic variable is proposed. In [7], presents the design and the Real-Time implementation of self-balancing TwoWheeled Inverted Pendulum (TWIP) using state-feedback controller and a conventional fuzzy logic controller (CFLC) on Real-Time. The state-feedback controller consists of two parts PD controller and PI controller. The state-feedback controller was designed first for the nonlinear model then it was updated for the Real-Time implementation. In fuzzy logic, different optimization algorithms are used to find the optimal input setting for a reverse pendulum: In [8], an adaptive fuzzy controller is proposed to solve the trajectory tracking problem of the inverted pendulum on a cart system. The designed algorithm is featured by not using any knowledge of the dynamic model and incorporating a full-state feedback. The stability of the closed-loop system is proven via the Lyapunov theory, and boundedness of the solutions is guaranteed. The proposed controller is heuristically tuned and its performance is tested via simulation and real-time experimentation. For this reason, a tuning method is investigated via evolutionary algorithms: particle swarm optimization, firefly algorithm and differential evolution in order to optimize the performance and verify which technique produces better results. In [9], a vertically moving base inverted pendulum control analysis has been done using Matlab/Simulink Toolbox. Because the vertically moving base inverted pendulum system is nonlinear and highly unstable, a feedback control system is used to make the system controlled and stable. A nonlinear autoregressive moving average L2 controller which is a family of Neural Network controller is used with Resilient backpropagation and Levenberg Marquardt backpropagation Training Algorithm to improve the stability of the pendulum. Genetic algorithm has been used as a popular optimization algorithm in various models to find the optimal input setting for a reverse pendulum that requires proper input: In [10], inverted pendulum performance optimization has been performed through neural network and multiple genetic algorithms. Compared to the trial and error method, this method is significantly faster. In [11], a new genetic algorithm stabilizer has been introduced to stabilize inverted pendulum oscillation. In this study, the cost function with the genetic algorithm quickly becomes the best possible answer, and this algorithm can quickly search for optimal control parameters. Lack of design of controller parameters for this system using real-time modified exploratory methods and comparison of their efficiency with each other is the disadvantage of this algorithm. In [12], PID controller parameters are set using a genetic algorithm-based optimization. This is the fastest method among the three controllers for inverted pendulum stabilization. In [13], the PID controller is set to inverted pendulum using the genetic algorithm. By setting up a genetic algorithm, accurate knowledge of the system is not required, and the setting time is reduced by adjusting the genetic algorithm. In [14], the fuzzy logic controller provides a double inverted pendulum system. The genetic algorithm uses the simple coding method and propagation mechanism to express the complex phenomenon, thus solving the complex problem. In [4], considered proportional-integral optimized with genetic algorithm (GA-PID) controller on inverted pendulum for the control of the angle position. In [15], in order to simultaneously stabilize the both degrees of freedom, a robust sliding mode controller is designed for this under-actuated system. Finally, the control law is improved with aid of a novel adaptive approach based on an approximating function found via a multiple-crossover genetic algorithm so that the system always will be optimally robust against time-varying parametric uncertainties. In [16], the article proposed an innovative GA-FOPIDC to monitor the outcomes of an inverted pendulum in the stable range. To validate its upgraded exhibition, it has been implemented and tried to monitor the performance of an inverted pendulum in the steady state range. This paper implements a fuzzy logic controller for reverse pendulum and its parameters are optimized by genetic evolutionary algorithm.

Proposed Method
The inverse pendulum system is a high-speed system with a large number of variables, nonlinear, and absolute instability. It is commonly used as conventional test equipment to validate control theory. In recent years, many researchers have used intelligent control algorithms to do a lot of work-related to maintaining stability and achieving short response times. The inverse pendulum system is often used as an unstable nonlinear system due to its structural simplicity as a criterion for validating the performance and effectiveness of new control methods. Inverse pendulum control is balancing the pendulum in the vertical axis position. This is a very common nonlinear control problem, and many methods have been proposed to solve it. For example, model-based control, fuzzy control, neural network control, genetic algorithms, and so on. However, it is difficult for the controller to fully establish a pendulum system in short response time; In the proposed method, a fuzzy data-driven model is used to control the stabilization.

Generalities of the proposed method
In this section, the steps of the proposed method to present a method based on a genetic algorithm for optimizing the fuzzy logic controller for inverse pendulum are described. Sampling design technology includes software utilization, hardware development, and design and implementation algorithms that provide a way to help rapid development. The inverse pendulum is a nonlinear and unstable system for testing new control methods. The main weakness of fuzzy control is the lack of design methods. Besides, there are no rules for selecting membership functions and their definitions. When designing a fuzzy controller, however, you should rely on your own experience; however, in the design problem, especially in selecting the overlap of membership functions and determining the output and input scale factors, evolutionary optimization methods such as genetic algorithm can be relied on. The process of the proposed method is done in four steps. The first step is design planning. The second stage is the initial evaluation. The third step is evaluation. The fourth step is to rebuild. In the proposed method, the structure of the genetic algorithm is created from an iterative procedure with four main steps.
A) The principle of population element coding.
This step connects each point of the state space to data. Two types of coding can be distinguished; binary coding and real coding. B) Production of a fixed-sized initial population called the first generation.
The selection of the initial population is very important because it can be more or less convergent to the global optimal. C) Define an evaluation function (fitness) that provides the conditions for evaluating a solution and comparing it with other solutions. A good fitness function must take into account several criteria, such as satisfying the limitations of the problem, which provide a method based on the genetic algorithm for optimizing the fuzzy logic controller for the inverse pendulum. D) Generate new solutions using genetic operators.
These operators allow population diversity to be provided over generations and state-space to be fully explored.

Inverted pendulum system in the proposed method
The inverted pendulum system is shown in Fig. 1, which consists of a straight line rail, a cart, a pendulum, and an actuator unit. This cart can move freely to the left or right. The pendulum is centered on the upper surface of the cart and can rotate around an axis at a vertical level similar to a rail. Assuming that there is no friction in the system, the dynamic equation of the inverse pendulum system can be expressed as Eq. (1), and Eq. (2).
In Eq. (1), and Eq. (2), the parameters m c and m p are cart mass and pendulum mass per unit [kg], respectively, and g = 9.8m/s 2 is the gravitational acceleration. The l p parameter is the length from the center of the pendulum to the axis in units [m] and is equal to the length of the pendulum. The variable F means the driving force per unit [N] that is applied horizontally in the cart. The variables θ, ω, and α are the pendulum angle from the upward position, its angular velocity, its angular acceleration respectively, and the direction of the clock hands is positive. The variables x, v, and a indicate the position of the cart from the rail origin, its velocity, its acceleration, and its direct positive direction.The variables θ, ω, x, and v are the four state variables to describe the dynamic system. Fig. 1: The inverse pendulum system in the proposed method

Steps of the proposed method
Genetic algorithm is a nature-inspired search algorithm that uses a fundamental concept of the most appropriate survival that is encountered in species selection mechanisms. In a genetic algorithm, search variables are encoded in bits called chromosomes. They are dealing with a community of chromosomes, each representing a possible solution to a given problem. A chromosome has a fit value that indicates how well a solution looks as it exists. In control programs, this chromosome shows the adjustable parameters of the controller, and the amount of fitness is a quantitative measure of the controller's performance. Overall, the number of bits used for binary coding, crossover, and mutation is predetermined. Genetic research is driven by reproduction, mutation, and crossover. Each of these phases comes with a set of specific numerical parameters that determine that phase.

First step: design planning
The first step is design planning. Identifies variables (inputs, states, outputs). The input and output world, or the distance that divides each variable into several fuzzy regions, is assigned a language tag for each region. Fuzzy control is a method that uses expert knowledge in designing a controller. Past research on the global approximation theory has shown that any nonlinear function on a compact set can be an approximated by a fuzzy system with arbitrary accuracy. There is considerable research work on adaptive fuzzy control of nonlinear systems. The fuzzy logic system consists of four parts: fuzzy maker, knowledge base, inference engine, and non-fuzzy maker. Scale factors operate between the normalized space and the real space of a controlled process. The goal of the adjustment strategy, on the one hand, is to keep the pendulum stem at the top and, on the other hand, to bring the base mass to a specific reference position. Design planning for designing a fuzzy controller is always done in four steps, which are discussed below. From a practical point of view, real-time control requires to simplify the experimental model, and human intervention is always necessary for this type of control.
In general, a controller is based on the experience of the human operator for the intended practical purpose. Fuzzy controllers use exploratory information to develop design methods to control nonlinear dynamic systems. This approach eliminates the need for comprehensive knowledge and mathematical modeling of the system. The fuzzy control system is shown in Fig. 2 . Fuzzy outputs must be converted to fixed outputs, which is non-fuzzy. The purpose of fuzzy control is usually to replace the human operator with a fuzzy rule-based system. When the pendulum moves in one direction, the control algorithm tries to direct it at the right speed and direction. In this case, the input algorithm takes the pendulum angle and the position of the wheel measured by the encoders, then tells the wheel how to move and how fast. This study presents the development stages of a fuzzy controller for an inverted pendulum by developing a twoinput, single-output of Mamdani system. Expert knowledge is developed as a set of if / then rules. Also, the choice of membership functions and the fuzzy control rules database affect system performance. The number of fuzzy control rules decreases significantly with the combination of related variables.

A-Selection of inputs and outputs
As can be seen in Fig. 1, many many measurable variables are involved in maintaining the balance of the inverted pendulum system. To simplify the optimization process, it is necessary to select three variables for fuzzy by reducing the dimensions of the problem. An input is the angular value of the deviation of the pendulum stem from the vertical axis (which is called θ) and the rate of increase of this angle (angular velocity) which is equal to the derivative of the angle and is called dθ is considered as the second input. During this article, these two variables are also referred to as error and error derivative. The output variable is the force required to move the pendulum cart (base mass) as shown by F.

B-Definition of membership functions
All fuzzy subsets need to be fully defined; That is, their membership functions should be identified. Intuition and experience play an important role in this process. Some principles are derived from experience or experimentations, including: • Select triangular or trapezoidal functions • Overlapping space of close subsets • Maximum membership rate In the proposed method, for all input variables, five fuzzy subsets are considered. The membership functions have a triangular and symmetrical shape, which is by Figs. 3 and 4. The stage of determining the set of rules is related to the development of the base of controlling rules. This step requires expert knowledge. The strategy adopted is as follows: For example, whenever the angle and angle velocity increase (both θ is . . . ), ie the pendulum deviates to the right and the deflection velocity increases, the force F is applied forward to bring the base mass to the right, and inertia causes the pendulum to swing back and the angle θ to zero again. So the positive of θ and its derivative requires a largely positive force. The opposite is also true. If the pendulum moves to the left and its speed is high, we must immediately apply a large force to the left so that the inertia causes the pendulum to return to its place; Therefore, if θ is negative and its derivative is also negative, largely negative force is applied to the base mass. If we consider this base of rules as a matrix, the other values are defined as parallel diameters of sub-diameters and are symmetric.

D-Choosing a non-fuzzy method
In choosing a non-fuzzy method, the inference mechanism, ie determining the values of analogical factors, must be done. The fuzzy reasoning operation uses the maxmin Mamdani synthesis method, and the output of the non-fuzzy operation uses the conventional gravity method. The fuzzy rule is determined by human experience and can be modified according to experience. In general, the selection of scale factors as well as the degree of overlap of membership functions is done by grouping, which is a very large and time-consuming task. In the proposed method, a desirable method is proposed to find the appropriate values for different scale functions as well as to determine the degree of overlap based on the genetic algorithm.

Second step: Initial valuation
The second stage is the initial evaluation. Candidate solutions are created in the primary population. Randomly, the domain defined by the range of variables and chromosomes is encoded into a set of fuzzy rule parameter matrices and language tags for each fuzzy controller region. The first and most important step is to encode the problem into the appropriate genetic algorithm chromosomes and then build the population. The parameters to be optimized are coded binary with a limited length. Character strings representing these parameters are linked together to form a chromosome. Each population chromosome can be a possible solution to this problem. The number of assignment communities is N. The value of N will directly affect the usefulness of the genetic algorithm. If the population is too small, the search effect of the genetic algorithm will be bad. Conversely, if it involves a large number of people in the community, the computational work will increase, and the search time will be longer.

Third step: evaluation of the solution
The third step is evaluation. Each potential solution (chromosome decoding) is evaluated and a compatibility value is determined according to the problem-solving performance. Arranges people according to fitness values. It examines the final criterion. If approved, it stops and returns the best chromosome (membership functions and fuzzy rules), and otherwise, it goes to the next step. The selection of the initial population of individuals strongly affects the speed of the algorithm Too small a population is likely to be trapped in local minorities. Too large a population would be useless; because the convergence time will be too much. Population size should be chosen in such a way that a good compromise can be reached between the calculation time and the quality of the result. Some works recommend 20 to 100 chromosomes per population. The higher the number of chromosomes, the better the chance of achieving the desired results. However, because the execution time must be considered, nearly 100 chromosomes can be used in each generation. The fitness function used to evaluate individuals of each generation is equal to the sum of the square errors corresponding to Equation (3) [17].
To evaluate the quality of each person, it is necessary to build a goal function that can be applied to each person following the person's fit. In the inverse pendulum control period to hold the pendulum vertically, the objective function confirms the function model J, if the value of J is very small, then J will be selected as Equation (4).
In using the genetic algorithm to optimize the parameters, the work of the algorithm is performed only by the fitness value (the fitness function value for a particular chromosome) and does not require detailed information of the optimized object. The individual fitness function is calculated as Equation (5).
When the character index J tends to a smaller value, the fitness function F (x) tends to a larger region.

Fourth step: Reconstruction to produce chromosome and new generation
The fourth step is reconstruction. The operator applies the crossover and mutation to all chromosomes to produce a new chromosome as well as a new generation and goes to the third stage. In this study, a new design method based on the genetic algorithm is proposed to design an optimal fuzzy controller to control the real-time inverse pendulum system for stability. The purpose of the proposed architecture is to be able to set intelligible and reliable fuzzy rules and their optimal membership functions using the genetic algorithm. New solutions are generated using genetic operators. These operators allow population diversity to be provided over generations and state-space to be fully explored. The genetic operators used in the proposed method are as follows.

A-Selection operator in the proposed method
It allows statistically identifying the best people in a population and eliminating bad people. There are several methods to choose from, one of which is the roulette wheel mechanism that will be used in the proposed method. The genetic algorithm toolbox in MATLAB software provides three methods of selection, namely tournament selection, roulette wheel selection, and normal geometric selection; In the proposed method, the selection of the roulette wheel will be used. The goal of the selection is to find the perfect person from the current population and give them the opportunity to become parents to raise a generation. The selection standard is the value of the individual's fitness range. The fitness ratio is now a very basic and common method for selection in the genetic algorithm. Assuming the population size is n, the individual fitness value is fi, then the probability of choosing i is psi, which is in the Equation (6). During the selection operation, the fitness value ratio is confirmed.
B-Crossover operator in the proposed method The crossover operator involves the exchange of genetic material between chromosomes (parent) to create new chromosomes (offspring). Various forms of this operator have been developed. The simplest forms are the single point crossover and the two-point crossover. This operator selects two parents, selects a random position in the genetic coding, and directs the genetic information to the right of this point, thus creating two new children. In this section, the single point crossover method is used. The choice of single point crossover is usually random, then two people exchange their parts between one point and leave the other part in the original order. Thus, they produce a new person. Accordingly, the new generation will have good characters from their parent generation and have a good fitness in the environment. The probability of combination is usually 0.6 ∼ 1.0 [3].

C-Mutation operator in the proposed method
Mutation is a process by which the genetic algorithm's chance of reaching the desired point is amplified by changing the value of a randomly selected bit. The mutation process is simply selecting a small number of members of the population according to the probability of mutation and switching from zero to one or vice versa at a random mutation site selected in the selected string. As shown in Fig. 6.

Fig. 6: Mutation operator
In the proposed method, the mutation process is based on the specified probability of changing the bit value on the binary series cluster. The necessity of mutation is due to interference in the period of chromosome proliferation and then the production of a new person with a new character. It is also precisely because the individual mutation causes a rise through the partial optimization solution. Using the point mutation location method, the probability of mutation is 0.001 ∼ 0.01. After passing through the search circle, the community continuously performs the operations of mating, combination, and mutation until the end of the conditions that is, reaching the maximum generation or achieving the stability of evolution [3].

D-Elite operator in the proposed method
With the creation of a new population, there is a very high probability that the best chromosomes will be destroyed after mating and mutations. To prevent this, one of the methods of elite can be used, which includes copying one or more better chromosomes in the current generation. The rest of the population can then be generated according to the usual reproduction algorithm.

E-Stop condition
The stop condition plays an important role in judging the quality of individuals. The purpose of this guarantee is to optimize the final solution by genetic algorithm. The stop criterion consists of two components: • Stop after a fixed number of predetermined generations • Stoping when population evolution stops and cannot evolve further. In this study, instead of considering the best chromosome fitness values, the maximum generation index is used to end the program; Because the goal is to control the execution time; Therefore, the maximum number of generations is considered. In this section, the details of the proposed method are discussed. In the fourth section, the proposed method is implemented and results are compared with previous researches.

Experimental setup and simulation output
In this section, the simulation results for the problem are examined. The method of setting the parameters, causes, and results extracted from each method are examined step by step. Then, the final comparison between the previous methods and the simulation results of this research is performed and reviewed. The simulations were performed in MATLAB environment.

System used
In this research, the hardware equipment in Table 2 used for implementation.

Investigation of optimization stage and parameters of genetic algorithm
The first step is to study the optimization based on a genetic algorithm. Based on the proposed method, optimization is performed according to Table. 3. Based on the parameters in Table 3, the optimization output is shown in Figs. (7) to (10). The output of Fig. 7indicates that the optimization has been completed in iteration 16 and convergence has taken place. However, the final output is considered up to 20 iterations, which are called confidence iterations, and in the main system, it is not necessary for the iterations to be up to this value. Because the variance changes from the 16 th iteration to the lowest. In addition, the minimum and average response rates do not move towards improvement. As a result, considering the elite system for the optimization method, it can be stated that the method has reached the optimal response in the 16 th iteration.

Comparing the system with and without genetic optimization
The final comparison of the system is done by considering the optimization phase and not using genetic optimization. In the first comparison step, the optimization effect on the proposed fuzzy control system is shown in Fig. 10. According to Fig. 10, the proposed method has significant changes in fuzzy membership functions and thus in the output generation. For example, a special case is considered, where the value of e is equal to 0.5, the value of de is equal to -0.5, in the initial state of the fuzzy controller, the corresponding value of u is equal to 0.2 ( Fig. 10-a).If angel input (e) and derivate error (de) have the lowest value, the best result will be obtained, which is shown in blue. If angel input (e) and derivate error (de) have the highest value, the least result will be obtained, which is shown in yellow. The rest of the colors indicate that the area is continuous. The use of Gaussian functions in fuzzy membership functions But in the optimized state, this value is 0.01 ( Fig. 10-b). If the surface drawn in space is seen in these two cases, the changes are noticeable. If angel input (e) and derivate error (de) have the lowest value, the best result will be obtained, which is shown in blue. If angel input (e) and derivate error (de) have the highest value, the least result will be obtained, which is shown in yellow. The rest of the colors indicate that the area is continuous. The use of Gaussian functions in fuzzy membership functions makes the region more continuous.

Diagram of fuzzy membership functions after optimization with genetic algorithm
As shown in Fig. 11, after optimization by the genetic algorithm, the symmetric state of the fuzzy membership functions changes. Also, by comparing the Fig. 11-a, and Fig. 11-b, it can be seen that the fuzzy triangular functions are considered to be the same for both angular input (error) and angular velocity (derivation error) before optimization Fig. 11-c. It is completely different and the range of the membership function Z (zero) has increased in the second input.

Review and compare other parameters
Another comparison parameter is the angle change. To compare these two parameters, the fuzzy system before and after optimization has been used, which is shown in Fig. 12. At Fig. 12-a and Fig.  12-b the . . .
The last suggested output is location changes for time, as shown in Fig. 13. Comparing these two Figures, in the time axis, it can be seen that the proposed method achieves equilibrium faster than the simple fuzzy method and a more balanced system is observed in Fig. 12, and Fig. 13. There is no negative distance in Fig. 13-b and what is shown in this diagram is the positive and negative rate of the distance relative to the base value (desired).
According to Fig. 14 which comparatively shows the equilibrium of the proposed method and method [18], the proposed method compared to the method [18] also shows a more balanced system that two factors related to the different inference system and more precise optimization of the proposed method can be the causes of this problem. The proposed algorithm has four setting values that can be chosen, previous studies have used only one setting, which can be determined as the optimization target caused by the rigid approach model [19][20] [21].   developed to find an optimized fuzzy rule base system using genetic algorithms. A genetic algorithm is a powerful tool that facilitates the automated design of fuzzy control rules and membership knowledge base. The purpose of the proposed method of this research was to regulate fuzzy rules and their membership function and the length of the learning process based on the use of genetic algorithms. The results of the proposed method showed that applying the integration of a genetic algorithm along with Mamdani fuzzy system can provide a suitable fuzzy controller to solve the problem of inverse pendulum control. The proposed method showed higher equilibrium speed and quality compared to a static fuzzy controller without optimization. Also, the proposed method showed better results compared to other similar methods that used only one of the two modules used. The main point is that the results showed that using a fuzzy system in a dynamic inverted pendulum environment has better results compared to definite systems. Besides, optimizing the quality control parameters of this model raises it even higher than the simple model. The only problem is that the iterative optimization (a) Achieve robustness using a simple fuzzy controller (b) Achieve strength by using a fuzzy controller with a genetic optimizer Fig. 12: Inverted pendulum angle changes process is time-consuming, in which case the proposed method does not have much overhead, and considering the quality of the output, this computational cost will be negligible. It should be noted that future work in this area can be done using combined optimization methods in parallel to reduce optimization time.
(a) Achieve robustness using a simple fuzzy controller (b) Achieve strength by using a fuzzy controller with a genetic optimizer Funding This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors. Compliance with ethical standards Conflict of interest The authors declare that there is no conflict of interest regarding the publication of this paper. Ethical approval This article does not contain any studies with human participants or animals performed by any of the authors. Informed consent Informed consent was obtained from all the individual participants included in the study.