Modified differential evolution method for parametric synthesis of fuzzy control system

. A modification for differential evolution method is developed to solve the problem of synthesizing a fuzzy system with optimal parameters. This modification allows you to handle both integer and continuous variables, making it possible to solve any mixed integer-continuous problems, including parametric synthesis of fuzzy control system, as it contains both types of parameters. The main idea of the modification is to change the procedure for generating the initial population, as well as the introduction of additional restrictions that ensure the correct operation of the fuzzy system. The key idea of the modification is to change the procedure for the formation of the initial population, as well as the introduction of additional restrictions that ensure the correct operation of the fuzzy system. The problem of optimizing the parameters of a fuzzy system was formalized: a fuzzy system is represented by a vector of parameters characterizing it, and a control quality criterion is considered as an object function. To illustrate the operation of the algorithm, a fuzzy system was compiled that allows solving the problem of optimal speed performance. Keywords: fuzzy logic


Introduction
To control linear and nonlinear objects, methods for the synthesis of fuzzy controllers have been developed and widely used. Fuzzy controllers are developed using the methods of fuzzy sets and fuzzy logic.
Fuzzy logic allows you to formalize the knowledge of specialists and experts in solving control problems. Usually, to compile a table of fuzzy rules, knowledge of experts in the field of the problem being solved is required. However, there is often no possibility of inviting a specialist to solve the problem; furthermore, compiling fuzzy sets can also become a laborious task that requires appropriate qualifications. In this regard, the development and application of an algorithm for optimizing the parameters of a fuzzy system using metaheuristic methods is relevant.
The fuzzy logic method consists of five stages: 1) fuzzification of input and output data; 2) construction of fuzzy sets; 3) drawing up a table of fuzzy rules; 4) aggregation; 5) defuzzification.
Existing approaches allow you to solve specific control tasks with fuzzy controller or metaheuristic methods [1,2,3], or to optimize particular parts of the fuzzy system [4,5,6]. In this paper, we propose a general algorithm to solve any control task using an optimized fuzzy system.

Fuzzy System Model with Parameters Optimized Using Metaheuristic Methods
For optimization method appliance, it's necessary to simplify a fuzzy system model. A fuzzy system can be represented as a diagram containing the main modules with parameters characterizing the fuzzy system.
Object model  Thus, a fuzzy system can be represented by four main modules. Module 1: fuzzification converts the input data into fuzzy one. When fuzzifying input variables and output variable , each of them is associated with a linguistic variable and that takes linguistic values from sets and respectively. Each linguistic value , of variables and is associated with a triangular membership function.
In this way, the first module contains integer parameters that characterize the number of linguistic values of the corresponding linguistic variables, , as well as real parameters the coordinates of the vertices and points underlying the triangular membership functions for each input and output variable, , or . Module 2 contains linguistic inference rules [7]. The rules are given in the form: . Then the parameters characterizing the fuzzy system by the second modulus will be the numbersinteger values characterizing the values of .
Module 3 allows you to find the result of fuzzy inference with aggregation. It can be found in two ways: by processing the totality of all inferred fuzzy sets and by processing the generalized inferred fuzzy set [8]. A serial number is assigned to each method. Then the parameter characterizing the fuzzy system by the third module will be an integer parameter the number of the selected method. Module 4: defuzzification converts the result of fuzzy inference into a numeric value. Defuzzification methods correspond to the aggregation method used in module 3. If the first aggregation method has been chosen, the following methods can be applied: centroid and weighted average method. If the second aggregation method was chosen, the following methods are applied: max-membership principle, mean max membership method and centroid of area method [8]. As in module 3, a serial number is assigned to each method. Thus, the parameter characterizing the fuzzy system by the fourth module will be an integer parameterthe number of the selected method.

The fuzzy system parameters optimization problem formalization
So, a fuzzy system can be characterized by an extended block column vector of parameters: . Suppose mathematical model of the control object is known: , Where given continuous functions, ℝ ℝ , Tgiven end time. Then it's possible to calculate the corresponding to an initial state value of a functional on a separate trajectory in form: , Where , are given continuous functions. Due to the undefined given initial states, we define the quality criterion of system control: Where is set measure. Suppose that the set of initial states is an n-dimensional parallelepiped, i.e., . Then it can be divided into elementary n-dimensional parallelepipeds with sides , . Consider the set of central points of each elementary n-dimensional parallelepiped, where is the number of elementary parallelepipeds, is the number of elementary segments for each variable. Taking into account the accepted assumptions, the values of functionals (3) and (4) can be calculated approximately: Where are weight coefficients.

Differential evolution method modification for parametric synthesis of fuzzy control system
At the moment, most of the existing metaheuristic algorithms are aimed at solving problems in which the variables of the objective function are assumed to be continuous. However, in practice it is very common to encounter problems in which some or all of the variables have integer values. Most often, practical problems fall into the category of mixed integercontinuous problems [9,10,11].
The problem of optimizing the parameters of a fuzzy system also falls into this category. The column vector of fuzzy system parameters contains both continuous parameters ( ) and integer parameters ( ). Consider a modification of the differential evolution method that allows solving a mixed integer-continuous problem of optimizing the parameters of a fuzzy system.
In the problem of optimizing the parameters of a fuzzy system, we consider the functional as an objective function. As parameters to be optimized, consider the parameters of the first two modules, i.e., parameters . The main idea of the modification is to change the procedure for generating the initial population, as well as the introduction of additional restrictions that ensure the correct operation of the fuzzy system.
Consider the set of feasible solutions, given by constraints, for the problem of optimizing the parameters of a fuzzy system. For the mathematical model of the control object (1), we obtain the following restrictions : , ; , , Where are the fuzzy system input variables, is the output variable, are the lower bounds, and are the upper bounds. Taking into account the restrictions (7) imposed on the variables of the control object model, we obtain restrictions for the vector : 1. For continuous parameters : The main feature of the differential evolution method is the use of the linear operator "differentiation" [1,2,3]. Since the dimension of the vector , specifically the number of parameters and the size of the rule table , depends on the values of integer parameters , it is impossible to change them during the operation of the differential evolution method. To avoid changing them, they should be "frozen", i.e. they should be subject to strict restrictions: (12) For better results it is necessary to consider various options for the values for each parameter and all possible combinations of them. Also, depending on the specifics of a particular control problem, additional restrictions may be imposed on some parameters, such as the symmetry of triangular membership functions with respect to zero, the symmetry of the rule table, etc.
Moving on to the global minimum search strategy implemented in a modification of the differential evolution method. In further presentation, for simplicity, we denote the vector as . , is the number of coordinates for each individual [12,13,14]. In the modification of the differential evolution method for optimizing the parameters of a fuzzy system, the initial population is formed as follows: (13) Where is the uniform distribution operator. Thus, for integer individuals, one is added to the value of the upper bound. This is necessary so that the boundary values of the coordinates are also taken into account during the truncation operation. Next comes the cyclic process of replacing the current population with a new one.
The process of forming a new population for the proposed modified method of differential evolution differs only in checking the boundaries for the vector obtained as a result of the mutation.
If the th continuous coordinate (in our case, one of the values ), of the generated vector has gone beyond the set of feasible solutions , then it is replaced by a random variable generated using a uniform distribution, taking into account (8), (9), (10). For integer coordinates, a check is necessary: if the th integer coordinate in the generated vector has taken a continuous value, it is truncated using the operation . If the th truncated integer coordinate (in our case, one of the values ), of the generated vector , i.e. it went beyond the set of feasible solutions, then it is replaced by a new generated random variable . To form a new population, the values of the objective function for the target vector and the sample vector are compared. The value of the objective function is calculated using a fuzzy system with the parameters of the considered vector. If the value is less for the sample vector, then it replaces the target vector in the population, otherwise the target vector remains.

Algorithm of the problem of optimizing a fuzzy system parameters solution
The proposed algorithm consists only of 3 main steps: 1. Set the structure of the optimized fuzzy system in accordance with the diagram ( fig.  1).
2. Apply the modified method of differential evolution to minimize the functional with respect to the parameters of the fuzzy system. When calculating the values of the functional for the sample vector and the target vector: 2.1. For each elementary n-dimensional parallelepiped, calculate the criterion for the trajectory launched from its center. The trajectories are found by modeling the fuzzy system obtained as a result of applying the differential evolution method with the parameters of the sample vector and the target vector.
2.2. Calculate the value of the functional for the values of obtained in step 2.1 using formula (5) or (6).
3. Get the optimal vector .

Application on optimal speed problem
Consider the application of the algorithm to solve the problem of optimal speed. Problem statement. Find the optimal control in terms of speed, the trajectory corresponding to it and the time spent on the transition from the initial state to the origin of coordinates for the control object model described by the system of differential equations: , where The problem can be formulated in the form of a functional minimization problem [15]: , Where the end time of the control process is not given and is to be determined. It is required to find the optimal control , the corresponding trajectory and time .
This problem can be solved using the maximum principle. As a result, we obtain the equation of the phase trajectories of the system: .

From
we obtain two possible families of parabolas ( fig. 2). Along the trajectories passing through the origin, the movement occurs on the last interval of sign constancy. These trajectories form a switching line. The resulting phase portrait is shown in fig. 3.  Now we solve the problem by the method of fuzzy logic. For a fuzzy system, we obtain the optimal parameters using the modified differential evolution method.
Consider a parallelepiped as a set of initial states . Split it into elementary parallelepipeds with sides , . We get the set of central points of each elementary parallelepiped, where . Thus, formula (5) will take the form: , Where is found as a result of modeling a fuzzy system with parameters . Constrains (7) will take the form: Before applying the algorithm, let's analyze the problem. From , we can make assumptions about the structure of the desired fuzzy system: membership functions must be symmetrical with respect to zero; since takes the values either 1 or -1. The membership function, which has a vertex , allows to determine whether the switching line has been reached. Also, based on the phase portrait, one can make an assumption about the structure of the table of fuzzy system rules. The table of rules must be in the form of a square matrix (i.e. ) whose elements are symmetrical with respect to the secondary diagonal. The secondary diagonal is the intersection line of fuzzy areas corresponding to the switching line; therefore, the elements of the secondary diagonal must be equal to 2.
When solving the problem, in order to save resources, a solution strategy was chosen in which several tests are carried out for the number of individuals in the population and the maximum number of populations . Then the best one is selected from the obtained results.

Results
After a series of tests carried out using the software implementation of the algorithm, the assumptions made during the preliminary analysis of the problem were confirmed. Without additional restrictions that ensure the symmetry of the membership functions about zero, as well as without restrictions that provide the intended form of the table of rules, the results obtained were unsatisfactory.
The trajectory corresponding to the optimal control found using a fuzzy system is shown in Fig.5. Optimal time .

Discussion and Conclusions
The paper proposes an algorithm for finding optimal parameters for a fuzzy system using the differential evolution method with a modification that allows solving mixed integercontinuous problems. A set of programs in the Python language has been compiled, which allows optimizing the functioning of a fuzzy system and guaranteeing a good quality solution in an acceptable time. The simpful library was used to implement the operation of the fuzzy system.
Based on the results of solving the speed problem, the following conclusions were made: when solving practical problems, for the correct operation of the algorithm, it is necessary to carry out a preliminary analysis of the problem; as a result of the algorithm, a fuzzy system was obtained that is able to approximate the solution of the speed problem with sufficient accuracy. The trajectories obtained as a result of modeling have sufficient smoothness.