Fuzzy Dynamic Adaptation of Gap Generation and Mutation in Genetic Optimization of Type 2 Fuzzy Controllers

We propose to use an approach based on fuzzy logic for the adaptation of gap generation and mutation probability in a genetic algorithm. The performance of this method is presented with the benchmark problem of flight control and results show how it can decrease the error during the flight of an airplane using fuzzy logic for some parameters of the genetic algorithm. In this case of study, we use fuzzy systems for adapting two parameters of the genetic algorithm to improve the design of a type 2 fuzzy controller and enhance its performance to achieve flight control. Finally, a statistical test is presented to prove the performance enhancement in the application using fuzzy adaptation in the genetic algorithm. It is important to mention that not only is this idea for control problems but also it can be used in pattern recognition and many different problems.


Introduction
At present time, people live in a society where technology is everywhere and changes every day to help the people in their daily activities.In particular, there are control systems that are used every day, for example, in the washing machine controlled by fuzzy systems that help with the washing time, cars with different types of intelligent controls helping to improve the driving, and water control systems for many different applications, for example, control of irrigation in plantations, etc.Some applications are more complex, for example, flight control in an airplane or a drone, which need more precision because they are used to transport people and medicines, to monitor people, and to locate cars, among other diverse activities.This is the reason why the control of each one of the systems needs to be as precise as possible, and in each example mentioned above the control is needed to help realize more efficiently each task.In any problem it is necessary to study further the control to improve the results of traditional methods such as PI, PD, or PID (Proportional, Integral, and Derivative), which are some types of the controllers used in applications, but in this case fuzzy systems are used to control the nonlinear plant [1][2][3][4].For the case of fuzzy systems they can be type 1 or type 2, the basic structure of type 1 is based on 3 components: (1) a "rule base" which include a selection of fuzzy rules, (2) "data base" where the membership functions are defined in the fuzzy rules, and (3) "reasoning mechanism" which improves the inference procedure upon the rules and given facts to derive a reasonable output.In the case of type 2 fuzzy sets, which have uncertainty in the membership functions, it is also possible to achieve a higher degree of approximation in modeling real world problems; type 2 fuzzy logic is a generalization of conventional type 1 fuzzy system, but the uncertainty in not only limited to the linguistic variables [5].Having decided on a specific control method, some problems need to achieve even better performance and optimization [6][7][8] which is needed to get better control in these applications.For this reason, the main motivation in this work is to improve an optimization method that can be applied in any area and can help achieve even better controllers but can also be for other applications, like in pattern recognition, statistics, etc.The optimization method that was improved in this work is the genetic algorithm.This metaheuristic has some 2

Aggregator Simulation Plant
Conventional Genetic Algorithm parameters, such as mutation percentage, gap generation, crossing, and selection, and each parameter has an internal behavior that contributes to the complete genetic algorithm to solve any solution [9][10][11].Actually some authors have previously used fuzzy adaptation of some parameters in many different algorithms.For example, in [12] the authors used Ant Colony Optimization (ACO) as an optimization method to solve benchmark problems, but they adapted parameters using fuzzy logic to control the diversity of the solutions; with this adaptation they controlled the exploration and the exploitation abilities of ACO, and in [13] a Fuzzy Bee Colony Optimization (FBCO) algorithm is proposed by the authors and the main objective in this work is to apply interval type 2 fuzzy logic to find the values of two parameters in the algorithm, the Alpha and Beta to obtain the stability of the trajectory of a mobile robot.In another work, a fuzzy crossover operator and selection probability in genetic algorithm (GA) is presented in [14] where authors used a conventional GA to test a data set, but in the algorithm they used fuzzy systems to adapt the crossover operator and selection probability, and they compared their results with some crossover operators commonly used and they presented good results and quality solutions with the fuzzy adaptation in crossover.In [15] also a genetic algorithm is presented, but in this application the authors used the mutation operator to be adapted with fuzzy systems and with this they try to offer suitable diversity levels to improve results by avoiding premature convergence.In [16] the authors present a genetic algorithm with adaptation in some parameters as selection, crossover, and mutation; these parameters helped to find a better solution and were tested in three different 5dimensional problems.In previous works fuzzy adaptation is presented and results show how the fuzzy parameter adaptation in the metaheuristic can help to improve results.
In this work we can use also the genetic algorithm to adapt 2 parameters: one is mutation and the other is gap generation.
In previous work the mutation has been used, but they use only the diversity as input in the fuzzy systems and in this case two inputs are considered (generation and diversity) and also we considered the gap generation to observe the behavior between these and mutation and to test using a control problem to prove that also gap generation is important to achieve the solution of the control problem of the case of study.The main contribution of this work is the adaptation of the mutation and gap generation parameters using fuzzy systems in genetic algorithms applied to the design of optimal to flight control.The paper is organized as follows: Section 2 explains the proposed method to understand better its application, in Section 3 the problem description and the control problem are explained and also results are presented in Section 4, Section 5 covers the statistical test to compare the results, and finally Section 6 presents the conclusions.

Proposed Method
In previous papers a proposed method for control was presented and tested with different benchmark control problems and in this paper the previous architecture is presented and then the new modification is illustrated to test the proposed method.The architecture used in the previous paper is illustrated in Figure 1.
Figure 1 is the representation of the first architecture used in some papers by the authors of this work also, where c 1 to c 3 represent the data inputs of each individual controller; u 1 to u 3 represent the outputs of each controller going to the aggregator to obtain new outputs (u 1 * to u 3 * ); then new data is obtained between the aggregators to give new information to the simulation plant and obtain results (y 1 to y 3 ) [14,17].A brief explanation of this architecture is that when a problem is very complex then the problem can be divided into subproblems (solved by simpler fuzzy systems) to study better each part of the problem and then all the outputs of the individual fuzzy systems (controllers) can go into an aggregation module that can appropriately join the outputs of all the individual fuzzy controller systems and

Aggregator Simulation Plant
Fuzzy Genetic Algorithm Generation Gap

Mutation
Fuzzy systems all the systems are optimized using a conventional genetic algorithm obtaining new and better values for controlling the plant, and one of the tests with this architecture is illustrated in [17].Fuzzy logic is a great tool to improve results in many different areas and can manage the uncertainty with more precision than other methods, and this is one of the reasons that the proposed method is presented.In addition, any metaheuristic algorithm has some parameters that affect the performance of the algorithm to obtain better results and fuzzy systems [18,19] can be a good alternative to perform parameter adaptation and in this way improve the results of the algorithm.In this paper, as previously mentioned, a new variant of a genetic algorithm was developed by dynamically adapting some of its parameters (mutation and gap generation).In some works, mentioned above, they used mutation, crossover, and selection, but the key issue is that gap generation can also improve results when working together with mutation, as we can verify with the simulation results presented in this work.
In this paper we describe in Section 5 the simulation results and the statistical test that will provide numerical evidence of the effectiveness of the proposed method.In this new architecture the fuzzy adaptation is incorporated into the genetic algorithm.In Figure 2 the new architecture is illustrated and fuzzy adaptation of the mutation and gap generation are presented to improve the genetic algorithm.

Problem Description
In this paper the main contribution is the fuzzy parameter adaptation in the genetic algorithm for optimizing fuzzy systems in the control area, but the general method can be applied in any area of application.The generation gap is the part of the population that is replaced in each cycle and the aim is to control this parameter in the best possible way during execution.For this case, a Mamdani fuzzy system was designed using one input and one output, 3 triangular membership functions are used in each variable, distance is the input variable, and percentage of gap generation is an output [20,21].Mutation is used to maintain the genetic diversity, and in this case two inputs are used the generation and the diversity to obtain the mutation as output.In Figures 3 and 4, the fuzzy systems of the parameters are presented [22,23].
In the first fuzzy system of Figure 3 the distance was calculated using the Euclidian distance by (1) [24] where A,  represent two columns of data to be compared where A is the base value and  is the result of the simulation,  represents the number of individuals in the generation, and  and  are the values of each iteration.
In the fuzzy system adaptation for the mutation, the generation is calculated by (2) where Generation is a percentage of the elapsing generations, current generation represents the number of elapsing generations, and Maximum number of generations is the total number of generations set for the optimization algorithm to find the best possible solution and diversity by (3) where  represents the number of individuals of one generation and  is the number of individuals of all generations and  is the total of generations.

𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 = 𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑀𝑎𝑥𝑖𝑚𝑢𝑚 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑔𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝑠
(2) The flow of a commonly genetic algorithm is illustrated in Figure 5.  Applying the fuzzy adaptation as we mentioned above the new structure of the genetic algorithm [25,26] is illustrated in Figure 6.
Comparing Figure 6 with Figure 5, it might seem that we made a very small change in the structure, but results in the paper will show the real behavior of these apparent small changes.
The problem considered in this work is the flight control of an airplane, because in some previous papers [2] some results were obtained and at the end of this paper the comparison is presented.The behavior of any airplane is explained in this section; any airplane can realize three types of movements: longitudinal control and lateral and directional control.First, to obtain the longitudinal control the elevators need to be controlled by the pedals of the airplane; then to obtain the lateral control this is obtained by controlling through the rudder using also the stick.In other words, when the elevator is pulled using the pedals pitch control towards the pilot, which is a movement of the aileron and elevator controls, control stick, or side stick controller (referred to as adding back pressure), the airplane's nose will rotate backwards relative to the pilot around the pitch (lateral) axis of the airplane [27][28][29].When pushing the pitch control elevator towards the instrument panel, which is the forward movement of the aileron and elevator controls, control stick, or side stick controller (referred to as increasing forward pressure), the airplane rotates the nose forward relative to the pilot around the pitch axis of the airplane.When right pressure is applied for the aileron control, which is a clockwise rotation of aileron and elevator controls or the right deflection of the control stick or side stick controller, the airplane's right wing banks (rolls) lower in relation to the pilot [30][31][32].When left pressure is applied to the aileron control, which is a counterclockwise rotation of aileron and elevator controls or the left deflection of the control stick or side stick controller, the airplane's left wing banks (rolls) lower in relation to the pilot [33][34][35].Think of this movement from the pilot's head to the pilot's left hip [36]; explaining some behavior of the flight the velocity (V) is defined by (4) as well as forces and moments () by ( 5) and ( 6) [37][38][39][40].
In any aircraft it is necessary to coordinate the body axes, stability axes, and the wind axes; the axis systems are defined by sin () fl    (8) where V T represents the total speed of the aircraft, ∝ represents the angle of attack, and  represents the sideslip angle; to define the rotation its mathematical representation is expressed by ( 10)-( 11); (10) represents the first rotation with the wind axes and (11) represents the rotation with the stability axes.
And finally a rotation matrix is represented by (12) and an aircraft model is illustrated in (13). ( +  −  −  cos () cos (B)) = The benchmark problem is to maintain the stability of the aircraft in flight using the proposed method to be tested.First the fuzzy systems were designed to control the flight control, 3 individual fuzzy controllers were proposed, and then a fuzzy aggregator was developed to obtain new values to achieve the control and a conventional genetic algorithm was used [7]; in relation to the mathematical model and the optimization it is important to mention that when the longitudinal, lateral, and directional control are modified by fuzzy systems its behavior is changing from the speed at which it moves as the forces and moments related to the airplane.For this reason each movement of the plane is very important; for example, moving the wheel or the pedals or any change applied in the fuzzy system can produce an important behavior of the airplane.In this case the optimization is focused on the entire system to stabilize the plane where all the fuzzy systems that are controlling are involved.In addition, one of the main objectives in this paper is to achieve even more the optimization by using fuzzy parameters: mutation and gap function.

Simulation Results
As mentioned in Section 3 previous results were obtained using a conventional genetic algorithm and a proposed method using the flight control as benchmark problem.It is important to mention that the aggregator of the proposed method is a type 2 fuzzy system that was optimized using a genetic algorithm and results in Table 1 illustrate the behavior.The conventional genetic algorithm was improved using the adaptation of two parameters as was mentioned in Section 2. Mutation and gap generation were adapted using fuzzy systems and the rules for each fuzzy system are presented in Boxes 1 and 2, respectively.Some rules as can be appreciated in Box 2 have the same antecedent and different consequent; this is because in some complex control problems also it implies an inherent fault tolerance; for example, consider that a rule has been erroneously implemented or that a hardware defect returns wrong results; the value of the output variable can be compensated by other rules defining this variable [41].All decisions are based on the testing of all of the rules in a FIS; it is important to mention that rules must be combined in some order to obtain a decision, but because of the internal process of the fuzzy systems as we mentioned before, if a rule does not work, it discards it and takes the one that works with the selected problem.In this case, several combinations were performed for this case of study.In Box 2 all the possible combinations of rules were used for the system to get the best ones; it is important to mention that the rules are not optimized except only the membership functions.But for future works the fuzzy rules can be optimizing to get the best for a specific case.Having the type 1 fuzzy system for the adaptation of parameters in the genetic algorithm, the modified genetic algorithm was tested using the type 1 fuzzy adaptation and tested with number of generations of 20, population size of 25, selection of roulette, and crossover of a single point.Finally, the best type 2 fuzzy aggregator using type 1 fuzzy adaptation in genetic algorithm is illustrated in Figures 7 to 12.
The convergence of the fuzzy genetic algorithm is illustrated if Figure 13  It is true that a type 2 fuzzy system adds complexity to the global system because of the cost in relation to time, but type 2 can model better the uncertainty in many control problems; in this case these systems are used and to design the controller a fuzzy genetic algorithm was proposed, because, for example, in [14] results can be appreciated and compared in relation to this improvement.In other works, different cases are considered with fuzzy logic and genetic algorithm, but in this case flight control was selected.
The results using the fuzzy genetic algorithm in the flight benchmark problem are presented in Table 2. Table 2 summarizes the errors for the three control processes.
The behavior of the airplane in flight is illustrated in Figure 14 where the yellow line is the reference and the purple line represents the behavior of the airplane, which are very close in the figure.In Tables 1 and 2 the behavior of the controllers is illustrated, for example, 0.045 in Table 2 and 0.254 in Table 1, which means that when the proposed method is used the error decreases; these errors represent the case when an airplane is flying with some height and wind, the angles of the elevators, rudder, and ailerons have to be at a certain number, for example, 2, and the error represents how close you get to that number.When an optimization method is used to design a control system, the main task for the optimization is to search for the best parameters to control the system.But we cannot say the optimization is complete and the result obtained is the best because even the optimization method can be improved in each step.For example, in this case of study a genetic algorithm was used with fuzzy system for the mutation and function gap parameters.The mutation percentage to make effective operation for a specific control case is not known exactly; it is therefore a fuzzy system which helps to find closer the percentage and to achieve even more optimization methods.Is the same situation in the gap function when a fuzzy system is used for the gap function it is possible to have higher search space for the solution in the replacement percentage.Fuzzy systems can model better the uncertainty in abrupt changes inside the control system.That is why good results are obtained with fuzzy parameters because they can obtain a better percentage for the mutation and gap function for this specific case of study and finally as a result obtain the good stability in flight control.
In Figure 14 the behavior of the system is illustrated as mentioned above and 2 lines are presented in that figure but it is almost impossible to appreciate both lines due to almost perfect behavior in control and errors are very few as seen in Table 2 in comparison to Table 1.It is a good figure to observe the better behavior in the control system.

Statistical Test
In this section a statistical Student t-test is presented where the results using the type 1 fuzzy adaptation in genetic algorithm to optimize the aggregator to achieve the flight control are compared with results with a type 2 fuzzy aggregator with   the conclusion will be that there is a statistically significant difference.
Figures 15-17 represent the individual values of the aileron, elevator, and rudder, respectively, when the type 2 aggregator is optimized to obtain the total control of the flight using a conventional genetic algorithm and when the GA is improved using a type 1 fuzzy adaptation in mutation probability and gap generation.
In Tables 3-5 a comparison is presented when a conventional genetic algorithm is used to optimize the type 2 fuzzy aggregator that is an important part of the architecture to help to control the flight of an airplane and these results show that there is a significant evidence of improvement when the genetic algorithm is improved using a type 1 fuzzy adaptation in the mutation and generation gap parameters.It is important to mention that Tables 3-5 are illustrating how the uncertainty of the stability in flight control is modeled better than using the conventional GA, as in all cases the mean and the standard deviation are below the    conventional algorithm.Also the precision in control is better as mentioned above and the T-value presents a significant difference in the data which show also T-values such as 9.65, 11.57, and 8.18 in the above T-test and this means an important difference.Also the P values in all cases present really low values, which means there is a very low probability of obtaining a result that is better with the original method (conventional genetic algorithm) than with the one obtained with the fuzzy parameters in the algorithm.

Conclusions
In this paper a type 1 fuzzy parameter adaptation in genetic algorithms was proposed to optimize the parameters of the membership functions for a type 2 fuzzy aggregation module that is used in the proposed architecture to achieve in this case the flight control.The main contribution was to modify part of the structure of the genetic algorithm to obtain a better GA and with this achieve better solutions of the control problem.
In this case we compared with previous works and we can conclude that by using type 1 fuzzy parameter adaptation to improve the genetic algorithm the solution to the problem of flight control was better than when the conventional genetic algorithm is used.To verify the results a statistical Student ttest was used and in all cases there is significant evidence of statistical difference (with more than 95 % confidence) that using fuzzy parameter adaptation improves the performance of the genetic algorithm to obtain a better type 2 controller.Future work will include considering other complex control problems, like in robot or drone control, to test the flexibility of the proposed approach for optimization.In addition, consider other types of applications, for example, in pattern recognition, identification, and time series prediction.

Figure 1 :
Figure 1: Proposed architecture in previous work.

Figure 2 :
Figure 2: Proposed architecture with a fuzzy genetic algorithm.

Figure 6 :
Figure 6: Flow of fuzzy adaptation in genetic algorithm.

Figure 12 :
Figure 12: Type 2 fuzzy aggregator with ailerons as new input.

Figure 13 :
Figure 13: Convergence of the fuzzy genetic algorithm.

Figure 14 :
Figure 14: Behavior of the airplane.

Figure 15 :Figure 16 :Figure 17 :
Figure 15: Box plot for individual values of aileron optimizing with a conventional GA and a type 1 fuzzy adaptation in GA.

Table 1 :
Results for type 2 fuzzy system using genetic conventional GA.
(1) if (Distance is Very near) then (gap is low)(2) if (Distance is Very near) then (gap is medium) (3) if (Distance is Very near) then (gap is high) (4) if (Distance is near) then (gap is low) (5) if (Distance is near) then (gap is medium) (6) if (Distance is near) then (gap is high) (7) if (Distance is far) then (gap is low) (8) if (Distance is far) then (gap is medium) (9) if (Distance is far) then (gap is high) (10) if (Distance is Very far) then (gap is high) Box 1: Rules for the fuzzy gap generation.
and the fitness function is presented in REF is the reference, Y FS is the output of the controller, n is the number of points used in the comparison, and N is the number of the controllers.The parameters used in the GA are as follows: generations = 20, individuals = 25, selection = roulette, discrete mutation, and crossover of a single point with fuzzy crossover rate and fuzzy mutation rate.

Table 2 :
Results for type 2 fuzzy system using genetic type 1 fuzzy adaptation in GA. of freedom, the t-value represents the size of the difference relative to the variation in your sample data, and T-value illustrates the calculated difference represented as standard error.If T-value is close to 0 this means there is not a significant difference.If P value is very low (<  level) then the null hypothesis is rejected and finally

Table 3 :
Results for the Student t-test with the aileron.

Table 4 :
Results for the Student t-test with the elevator.

Table 5 :
Results for the Student t-test with the rudder.