Optimal design of T–S fuzzy controller for a nonlinear system using a new adaptive particle swarm optimization algorithm

Designing an optimal Takagi–Sugeno (T–S) fuzzy system for real–world non–linear control problems is a challenging problem. Complex non–linear system produces large fuzzy rule–based and requires large amount of memory. To overcome these problems, this paper proposes a hybrid approach to generate the optimal T–S fuzzy system. First, the Fuzzy Clustering Method (FCM) is employed to partitioning the input space and extracting initial fuzzy rule–based. Moreover, a new Adaptive Particle Swarm Optimization (APSO) technique is suggested to determine the optimal number of clusters in FCM, which is the same as the number of fuzzy rules. Finally, Recursive Least Square (RLS) method based on the Mean Square Errors (MSE) criterion is used to regulate the coefficients of the consequent part of initial fuzzy rules. Some simulations are conducted on a Non–Linear Inverted Pendulum (NLIP) system to support the efficiency of the proposed approach in designing compact and accurate T–S fuzzy systems.


Introduction
Fuzzy logic systems are important tools for incorporating human expert knowledge in complement to mathematical knowledge. Based on this feature, utilization of fuzzy knowledge-based control to deal with non-linear systems whose dynamics are not explicitly understood and whose models cannot be simply established has been increased [1], [2]. Among various types of fuzzy systems, Takagi-Sugeno (T-S) fuzzy systems have recently gained much attention due to their special rule consequent structure and their success in a function approximation [3].
In T-S fuzzy systems the consequent part of fuzzy rules is a real-valued function of the input variables instead of a fuzzy set [4]. T-S fuzzy systems have some advantage in comparing to the other fuzzy system because of their modification. They can represent the complex plants stronger and also become appropriate for application in various kinds of learning algorithms. Generally, human knowledge can be classified into two groups [5]. The first, conscious knowledge which human experts are simply expressed their knowledge in the terms of fuzzy IF-THEN rules. In the other group, subconscious knowledge which the human experts cannot express its knowledge in the term of fuzzy IF-THEN rules. In this situation while the human experts are doing their works, they are viewed as black boxes and the inputs and the outputs data are measured and collected, i.e. input-output data pairs. T-S fuzzy modeling involves two stages: structure identification and parameter estimation [6]. There are two challenging problems in fuzzy structure identification: first, extracting significant input variables among all possible input-output pairs and the other, determining the number of required rules, i.e. finding how many rules are necessary and sufficient to achieve the given mapping, which is called partition validation or cluster validation. Those are usually determined by human experts in conventional fuzzy inference design with trial-and-error and based on their experience or some experiments. This study focuses on a data-driven approach since no expert is available to determine the optimal number of rules in the system.
With an increasing number of variables, the complexity of non-linear system, the number of rules is increasing exponentially, which makes more difficult for experts to define the rule set for good system performance, makes memory limitations, and will be a big obstacle to progress in the real application use of T-S fuzzy systems [6][7][8]. Therefore, an appropriate choice of the number of rules is important in designing the fuzzy systems, because too many rules result in a complex fuzzy system that may be unnecessary for the problem, whereas too few rules produce a less powerful fuzzy system that may be insufficient to achieve the objective. The optimal T-S fuzzy system uses one rule for one input-output pair, thus it is no longer a practical system if the number of input-output pairs is large. For these large problems, various clustering techniques, such as Chiu [9], Chung et al [10], an extension of Kohonen's selforganizing map [11], hierarchical clustering [12], can be used to cluster the input-output pairs so that a cluster can be represented by one rule. For this purpose, unsupervised fuzzy clustering in input space is used to determine the number of rules in the real control problems. Since Fuzzy C-means (FCM) is a fuzzy version of K-means algorithm, that is widely adopted in the literature, and significantly reduces the number of rules in the system modeling, it was used to identify the structure of FIS in this work. Two difficulties arise in the application of FCM; one is how to set the initial cluster center, and the other is the optimal number of clusters. For the former, we randomly select the data points and set them as initial centers. Various methods have been proposed to deal with determining the optimal number of clusters in FCM [13], [14]. One of the renowned approaches to determine the number of clusters properly is Particle Swarm Optimization (PSO); however, it has some problem. It convergence to local minima and also has some parameters which should be tuned for having a good search ability [15], [16]. In this study, an Adaptive Particle Swarm Optimization (APSO) is proposed to overcome those shortages. The APSO adjust its parameter adaptively by using the dynamic feedback from the success rate from the personal best updating of its particles. In this paper, an optimal stable T-S fuzzy system as a controller for a non-linear system is proposed. Adequate inputoutput data are obtained from the feedback linearization control. Then the initial fuzzy rule-based is derived by the FCM as a rule extraction method and in order for simplicity of fuzzy inference systems, the APSO is proposed to find the optimal number of rules in T-S fuzzy system. Finally, RLS technique based on MSE criterion is used to tune the coefficients of the consequent part of initial fuzzy rules. This paper is organized as follows. In section 2, APSO is introduced and it superior performance over standard PSO is proved. In section 3, the optimal procedure to design an optimal T-S is presented. In 4.1, The mathematical formulation of a non-linear pendulum (NLIP) as a classic example of non-linear systems is reviewed, 4.2 presents a nonlinear feedback linearization method to stabilize the NLIP, 4.3 presents some well-known error measurements criteria to validate the T-S fuzzy controller, and 4.4 shows the simulation results of applying the optimal T-S fuzzy controller on NLIP. Finally, conclusions are drawn in Section 5.

Adaptive particle swarm optimization
The Particle Swarm Optimization (PSO) which was first introduced by Kennedy and Eberhart, is one of the modern population-based optimization algorithms [17]. It uses swarm of particles to find a global optimum solution in the search space. Each particle represents a candidate solution to the cost function and it has its own position and velocity. Assume particle swarms are in D-dimensional search space. Let the ith particle in a D-dimensional space be represented as .The best previous position of the ith particle is recorded and represented as , which gives the best value in the cost function and also called pbest. General best position, gbest, denoted by is the best value of the Pbest among all the particles in the cost function. The velocity of the ith particle is represented as . In each of the iterations, the velocity and the position of each particle are updated according to Eq. (1) and Eq. (2), respectively.
(1) (2) Where is an inertia weight and it is typically selected in the interval [0, 1].
Is a cognition weight factor, is a social weight factor, and are generated randomly in the interval [0, 1]. In order to improve the performance of standard PSO the inertia, the cognition, and the social weight factors should be modified. The main idea for modifying the inertia weight is inspired from success rate of Schwefel [18], [19]. Here the concept of success rate is extended to while in each iteration the Pbest is achieved the better objective function value from its previous iteration. Thus, the success rate can be formulated in Eq. (3). Then simply the percentage of success rate is calculated by using Eq. (4).
(3) . In order to control the trade-off between exploitation and exploration property of the PSO algorithm the beginning of the optimization procedure, a large value for the cognitive weight and a small value for the social weight should be chosen. Hence, the exploration property of the PSO enhanced. By contrast, near the end stage of the PSO algorithm, a small cognitive weight and a large social weight should be selected for the convergence of the algorithm to the global optimum point [20]. Therefore, it is necessary to change the cognitive weight and social weight during the optimization process adaptively. The following formula for the APSO is proposed [20], [21]: If Where the superscripts "initial" and "final" indicate the initial and final values of the cognition weight and the social weight factor, respectively. In this section, the performance of APSO is compared with standard PSO. Finally, APSO is applied to a real world optimization problem to show its performance in engineering problem. The termination criterion of both PSO and APSO is determined by reaching a maximum iteration number. In this study, the maximum number of iterations and the number of particles are selected to be 50 and 20, respectively. In order to test and compare standard PSO and proposed APSO in this paper, three commonly used static benchmark functions are used. The test functions are used to investigate the convergence speed and solution quality of the PSO and APSO. Table 1 provides a detailed description of these problems. All the test functions are minimization problems. The first function (Rosenbrock) is unimodal function while the rest of the functions (Rastrigin and Ackly) are multimodal optimization problems. The dimension of the search space (D) is 30. For each test problem, is the best solution to the test problem and represents the best achievable fitness for that function. Fig. 1 shows the results based on the final accuracy and the convergence speed over 100 iterations. These results demonstrate that APSO has a considerable higher performance in unimodal and multimodal optimization problems.

Optimal design of T-S fuzzy system
T-S fuzzy systems are appropriate fuzzy rule-based systems for the approximation of many systems and function. In the T-S fuzzy systems, the consequents are taken to be either crisp numbers of linear functions of the inputs (8) Where is the input variable (antecedent) and is the output (consequent) of the i-Th rule . Is the number of the rules. Is the antecedent fuzzy set in the interval in the fuzzy antecedent in the T-S system is normally described by means of the product operator.
For the k-th input the total output of the system is defined by the sum of the independence rules contributions: Where is the normalized degree of realization of the antecedent clause of rule and is as follows: By using well-known off-line training algorithms, a T-S fuzzy system is obtained from the collected input-output data.
Due to the limited off-lines data at hand over a wide operating range of the plant, achieve a global T-S fuzzy system is not easy. While for successful control of non-linear a global T-S system is not essentially needed and a suitable control signal can be generated from the input-output data. In this study, FCM is used for extracting initial fuzzy rules. The number of rules is equal to the number of FCM clusters. Since choosing the optimal number of clusters in the FCM is yet rewarding problem an adaptive PSO, is employed to find the optimal number of clusters. After the maximum number of iterations is reached in APSO, global best particle represents an optimal solution which consists of the number of rules the T-S fuzzy controller. In the rule extraction approaches based on FCM, each cluster basically categorizes a region in the data space which contains a satisfactory mass of data to support the existence of a fuzzy input-output relationship. Because a rule is generated only where there is a cluster of data, the resulting rules are scattered in the input space rather than placed according to grid-like partitions in the input space. This fundamental property of clustering-based rule extraction approaches assists avoid combinatorial explosion of rules with increasing dimension of the input space, i.e. MISO and MIMO systems. The initial fuzzy model is not optimal because the antecedent part of the rules was achieved only based on partitioning the input-output space. Thus, the model is not able to portray the relation between input and output adequately. Several methods such as gradient descent and least mean squares by taking a measure of the output error have been used for adjusting the parameters of the fuzzy system [5]. In this study, the RLS method due to its higher speed and lower memory occupation compared to other optimizing TSK fuzzy systems is used. The summation of the number of rules (#Rules) and MSE is defined in equation (13) to use as the objective function for evaluating the performance index in the optimal designing of T-S fuzzy system. (12) Where the MSE formulates as follows:   (13) Where, is the output of T-S fuzzy system, is desired output, and is the number of points.

Simulation
Non-Linear Inverted Pendulum (NLIP) system is a classical problem in the field of nonlinear control theory which can be observed in the many real world control problems [22,23]. The NLIP system is an open-loop unstable system, that is, while the NLIP system simulated the pendulum drops down as fast as possible due to the gravity of the earth. Therefore, a problem encountered in designing T-S fuzzy is how to collect sufficient informative input-output data from the NLIP system. The output data from the unstable system does not show enough information or the dynamics of the system. A Feedback linearization control method is performed to stabilize the system before the rule extraction method can take place.

Mathematical formulation
The NLIP system consists of an inverted pole placing on a cart, which is moving in the horizontal direction, i.e. x. Fig.  2 shows the free body diagram of the NLIP system. The NLIP system has two degrees of freedom. They are horizontal displacement of the cart, i.e. x, and the angle between pendulum and its upright position, i.e. . The friction-free nonlinear dynamical equations of an inverted pendulum system are as follows: Where , are the masses of the cart and the pole, respectively, is the gravitational force, is half length of the pole, and is applied force signal (control signal). In addition, the states of NLIP system are assumed to be , , , for the state space representation. Fig. 3 shows the Simulink model of NLIP system. The open-loop of NLIP does not sufficiently generate informative input-output data for designing a T-S fuzzy controller, because the NLIP falls over quickly. Therefore, for gathering adequate input-output data the NLIP system must be stabilized.

Design of feedback control
Feedback linearization is a celebrated control design method for nonlinear systems which attracted lots of research in the last three decades [24], [25], [26]. A feedback linearization controller is designed to stabilize control Of the NLIP system. The main idea in feedback linearization approaches is to algebraically transform nonlinear systems dynamics into (fully or partially) linear ones. This aim is realized by eliminating the nonlinear part of the NLIP system. Hence, the closed loop system is more linear and the NLIP can be stable by positioning the closed loop poles in the stable region, i.e. in the open-left half-plane. The four equations (16)(17)(18)(19)(20) are entered into the main equation to prepare the adequate control law, certainty equivalence control law, for stabilizing the NLIP system.
where in Eq. 20, , , , The model of the certainty equivalence control law is presented in Fig. 4 and the Simulink model of the NLIP with its stable feedback linearization controller is shown in Fig 5. The inputs to this controller are the four-output states of the NLIP system. The accurate magnitude of control signal is derived from the control law to keep the pendulum stable. Fig. 6 shows the control signal derived by the feedback linearization controller. Now, by using the feedback controller, the input-output data will contain more information and they become proper for designing a T-S fuzzy controller based on input-output data.

Validation criteria
The efficiency of the fuzzy controller is evaluated by comparing the resultant control signal with output of non-linear feedback controller. Three error measurement indices, i.e. Sum of the Squared Errors (SSE), Mean Absolute Error (MAE), and MSE are used to verify the validation of the fuzzy controller. SSE is used to measure what the difference between each error and its group mean. (21) Where is the value of the i-th error and is the mean of all the errors. MAE is a quantity used to measure how close the output is to the actual output. MAE is formulated as follows: = (22) where the output of fuzzy controller is, is the output of non-linear feedback controller, and is the total number of data. In brief, these measurement criteria will verify an accuracy fuzzy controller, if the values of SSE, MAE, and MSE are close to zero. Table 2 presents the validation results.

The simulation results of optimal T-S fuzzy controller
In order to demonstrate the validity of the proposed method, the NLIP system is simulated . The NLIP parameters are  assigned the following values,  ,  , ,  ,  ,  ,  ,  ,  , , and The MATLAB software (R2008b) is employed in the simulation test. The T-S fuzzy controller is applied to the NLIP system. The results demonstrate that the proposed controller is stable and can properly control the NLIP system as well as the non-linear feedback linearization control method. The Simulink model of stable T-S fuzzy controller is drawn in Fig. 7. In the objective function is considered as output of T-S fuzzy controller with different numbers of rules and is the output of the non-linear feedback linearization. The convergence of the objective function versus the numbers of iterations during the procedure of APSO is shown in Fig. 8. The parameters of the APSO based on trial-and-error (the selected values are the best ones among several runs) is set as follows: , , , . The values of and are chosen to be 0.8 and 0.2 for this study. The obtained three optimal rules are as follow:  9 shows the position and position change of the cart and the angle and angle change of pendulum to its up straight. By doing so, the total number of rules in T-S fuzzy inference controller is dramatically reduced. Reduction in the number of rules has an acceptable error range. As a result of reduction in the number of rules, the memory requirement and model complexity are decreased. Fig. 10 represents the fuzzy membership function of the optimal T-S fuzzy controller. In Fig. 11, the input-output relations of T-S fuzzy controller are shown. (d) (e) (f) Fig. 11: The input-output relation in fuzzy T-S controller, a) first input and second input, b) first input and third input, c) first input and four input, d) second input and third input, e) second input and third input, and f) third input and fourth input

Conclusion
An optimal T-S fuzzy system for controlling a nonlinear inverted pendulum was proposed. Since complex non-linear systems generate large fuzzy rule based, the FCM is used for extracting an optimal and compact FIS. To achieve that aim, a new adaptive PSO was also presented to find the optimal number of rules. The simulation results demonstrate that the proposed method can provide optimal model structures for fuzzy systems and has low complexity while the error remain in an acceptable range.