You are on page 1of 6

Genetic Algorithms for Optimum Designing of Fuzzy Controllers

I.Rojas, J.J.Merelo, H.Pomares, A.Prieto Departamento de Electrnica y Tecnologa de Computadores Universidad de Granada 18071-Granada. Spain E-mail: ignacio@casip.ugr.es

Abstract
This study investigates the use of Genetic Algorithms (GAs) to the design and implementation of Fuzzy Logic Controllers (FLC). Generally, the design of FLC involves determination of the structure of the rules, and membership function parameters. In this paper we presents a methodology for simultaneously design membership functions and rule sets for them. Most techniques treat these parts separately, which may result in a suboptimal solution, because the design parts are mutually dependent. We also proposed a new approach for optimum coding of fuzzy controllers via GAs. It is important to note that not only the number of parameters needed to optimize the system is considerably reduced compared with other approaches, but also that the performance of the hybrid system is improved.

1. Introduction
Fuzzy sets were introduced by Zadeh [ZAD65] as a means of representing and manipulating data that was not precise, but rather fuzzy. When the ideas of fuzzy logic are applied to control, it is generally called fuzzy control. Conventional controllers are derived from control theory techniques based on mathematical models of the open-loop process, called system, to be controlled. In a FLC, the dynamic behaviour of a fuzzy system is characterized by a set of linguistic description rules based on expert knowledge. The expert knowledge is usually of the form: IF (a set of conditions are satisfied, associated with fuzzy concepts or linguistic terms) THEN (a set of consequences can be inferred) In our terminology, a fuzzy control rule is a fuzzy conditional statement in which the antecedent is a condition in its application domain and the consequent is a control action for the system under control. Every intelligent technique has particular computational properties that make them suited for particular problems and not for others. For example, while Artificial Neural Networks are good at recognizing patterns and have the ability to learn, they are not good at explaining how they reach their decisions. Fuzzy logic systems, which can reason with imprecise information, are good at explaining their decisions but, in general, knowledge acquisition is difficult. Although fuzzy logic can encode expert knowledge directly using linguistic rules, it usually difficult to define and tune the membership functions and rules. These limitations have been a central driving force behind the creation of intelligent hybrid systems where two or more techniques are combined in a manner that overcomes the limitations of individual techniques. Since the tuning and learning of the parameters of a FLC can be analyzed as an optimization problem, Genetic Algorithms (GAs) offer a possibility to solve this problem [HOM95]. The analysis of the internal states in the design of the FLC (mainly the position of the membership

functions), with no restriction on the behaviour of the GA, shows [PAR94, SUR93] that for each input vector many rules are activated and the overlap is greater than two; besides, the position and domain of the membership functions do not usually match the characteristics of the problem being solved. When the overlap is too great, there are two important problems for the implementation and understanding of fuzzy systems:

The number of activated rules increases exponentially, which becomes important when a limitations such as hardware implementation of a FLC exist [ROJ95]. For example, if there are five input variables, each variable can take 7 different linguistic values; there are potentially 75 = 16807 possible input combinations and therefore potentially activated rules. However, with the constraint that each input can activate at most two different membership functions, each input vector will trigger at most 25 = 32 rules simultaneously. Fuzzy logic systems can explain their decisions, but if the overlap of the input membership functions is too great and the number of simultaneously active rules is very high, the system does not correspond to human expectation, because rules with different conclusions can be activated.

Thus in this paper we proposed a new approach to fuzzy controller designing and coding via genetic algorithms, with the constraint that the overlap of the membership functions are fixed to two.

2. Genetic Algorithms and Fuzzy Logic Controllers


Genetic algorithms are powerful optimization methods which can be used within control systems in conjunction with other techniques (e.g. PID, N, FLC, etc) [KAR91], either to find the best controller parameters or the best network topology. They are substantially "trial and error" methods based on the way biological evolution works. A drawback is that for each "generation" of the algorithm, several completely different solutions need to be verified and stored but just one will be the final one. The flow of GA can be simply explained as follows: [Step 1] [Step 2] [Step 3] [Step 4] A scheme for encoding solutions to a problem in the form of a chromosome (chromosomal representation). An initialization procedure for the population of chromosomes, using the initial chromosomal in Step 1 An evaluation function which indicates the fitness of each chromosome relative to the others in the current set of chromosomes (referred to as population). Select the proper chromosomes according to the fitness value to form a gene pool. There are three mayor operators(genetic operators) which are used to manipulate the genetic composition of the population: reproduction, crossover and mutation. Obtain a new population through the evolution process of crossover, and mutation between the genes of Step 4 Repeat Step 3 to Step 5 until some measure is satisfied (for example, in the fitness function or in the number of generation).

[Step 5] [Step 6]

It is also necessary a set of parameters that provide the initial settings for the algorithm: the size of the population and probabilities employed by the genetic operators.

2.1 Genetic Coding of a Fuzzy System


The coding of the optimization problem is of decisive importance for the success that can be achieved with genetic algorithms (GA). For this reason, a special coding was developed that appears to be especially suitable for the optimization or design of fuzzy systems.

In many applications, an additional problem comes from constraints that the sought solution must satisfy. Constraints cause most serious problems in traditional models where the search space is spanned by fixed representation (i.e binary), while the feasible space is only its portion. This may cause the search to drift into improper regions of the search space. There are number of approaches to deal with the problem:

The simplest is to throw away any infeasible offspring[DAV91], but this may quickly become ineffective if the constraints become more severe. The most often proposed solution was to modify the evaluation to penalize infeasible solutions [RIC89]. For example, using GA-FLC, [SUR93] modify the objective function (fitness) to reduce the maximum number of activated rules by defining an entropy function. modify the objective function (fitness) to reduce the maximum number of activated rules by defining an entropy function. Thus, this can often work nicely for so called weak constraints, that is constraints that do not necessarily invalidate solutions when violated, but generally proves disastrous for strong constraints, which are often present in function optimization. Another approach is to provide special repair algorithms that will move any inconsistent offspring into the feasible space. Again, this may prove too inefficient in highly constrained problems.

Many previous approaches to GA optimization of fuzzy sets followed the idea of implementing some of the constraints into the representation (for example, a symmetrical trapezoid can be represented by its centre, lower base and upper base, instead of the four corners). However, the remaining constraints would then be implemented as a penalty function [KOB92]. This has two problems: the search space remains unnecessarily large, and there is still a chance of generating infeasible solutions. We follow a different approach. We explicitly utilize all the constraints to reduce the search space. In our work the coding of the membership functions is done in such a way that the overlap is always two and thus the linguistic values have got a real meaning. The membership functions (MF) of the input signals are assumed to be triangular so that they can always be completely defined by three parameters. In our coding, only the central position is optimized. To rebuild the triangular function, the vertices of the neighbouring membership functions are used. Since the definition domain of the input variables is constant, membership functions defined outside that domain make no sense. The first and last linguistic values are defined in the limits for each input variable. Other advantages of this coding are: 1) The number of parameters needed to optimize the system is considerably reduced compared with other approaches (using triangular, trapezoidal or gaussian functions). For instance, for a system with two input variables and six linguistic values, the number of parameters to be optimized using trapezoidal functions is 2*6*4 = 48, while our approach needs only 4; thus, computation time is also reduced. Fig.1 shows that only the parameters C1 , C2 , C3 and C4 are necessary for determination of the membership functions in one variable. There is no need to define penalty functions in the fitness in order to reduce the number of activated rules.

2)

In our approach, an ordered operator acts such that the relative order of MFs in each variable is preserved, i.e., the centre of the linguistic value "Small" can take any value in the variable range but is always lower than the centre of the membership function "Big". It is important to note that the effectivity of the fuzzy models representing nonlinear input-output relationships depends on the fuzzy partition of the input-output spaces.

SIX MEMBERSHIP FUNCTIONS 1

POPULATION P ={A1 , ..., A M}

A1

Ai
Fuzzy System Description

AM

C 1 C 2 C 3 C 4 C 1 C 2 C 3 C4 R 1 R 2

R 36

C1

C3

C4

PARAMETERS

MFs for variable 1

MFs for variable 2

All possible rules

Figure 1: Membership function coding

Figure 2: Fuzzy System Representation

We have used real-encoded GA. For larger problems, the binary representation of FLC in GA becomes prohibitively long and search time increases as well. Moreover, GA do not perform very well in parameter fine tuning in the vicinity of an optimal solution. It has been shown [MIC92] that realencoded GAs converge faster, the results are more consistent, and higher precision can be achieved, especially on large problems. Using a population P of constant size M, the population is completely defined by its strings A, so P={A1, ... AM}. For the system of two input variables and six linguistic values, Fig.2 shows the fuzzy logic system string representation.

3. Analysis of a fuzzy system for the control of a liquid tank


The system studied in this paper is a real liquid-filled tank (Fig. 1). The aim is to control the height of the liquid. For this purpose, a pump is available to control the flow Qinput into the tank by means of a 0V-10V input level. To lower the level, since the pump cannot extract liquid, an electrovalve is installed, allowing a Qoutput flow from the tank. In every simulation the electrovalve is open, and so liquid is constantly leaving the tank. Providing the Qinput flow supplied by the pump is equal to or greater than Qoutput, the liquid can be maintained at the set point. In a liquidfilled tank, the relation between the height of the liquid and the input and output flows is not linear. An approximate mathematical model of the liquid-filled tank was obtained form various experimental measurements of the systems reactions to different Figure 3: Liquid-filled tank

impulses. In this model, the relation between the voltage at which the pump is operating and the level of the liquid (expressed as output voltage) may be described by Eq. 1. The following stage was the design of the fuzzy controller. Using the information provided by a previously-obtained classical PI controller, an initial set of rules and membership functions was determined. Given the feasibility of incorporating human knowledge and skills into the synthesis of the fuzzy controller, it was possible to optimize the system parameters. The input variables are, therefore, the error in the level of liquid and the time integral of this error.
G(s) Vout Vin 4.78 e
2s

1 1 320s 1 1.5s 1

(1)

To define the controller, a simple set of rules and membership functions was used. This consisted of seven membership functions for integral of error and seven for the error. Figure 4 shows the desired control surface and Fig.5 the evolution of the GA using four different codings for the fuzzy system (Table 1). Table 1 shows a comparison of the Mean Squared Error (MSE) and the number of parameters needed for different codings of the fuzzy system. It is important to note that the function fitness is defined as fitness = 1/MSE. The termination condition for the GA occurs when the maximum generation number is reached (1500 in our case). We must take into account, not only that the number of parameters needed to optimize the system is considerably reduced compared with other approaches, but also that the performance of the hybrid system is improved.
EVOLUTION OF FITNESS
OUTPUT SURFACE OF THE CONTROLLER

60

50

OUTPUT TO THE PUMP

0.8

40
0.6
FITNESS (1/MSE)

30

0.4

0.2

20

0 1 0.5 0 -0.5 -1 -1.5 ERROR 0 0.5 1

1.5

10

INTEGRAL OF THE ERROR

0 0

500 1000 NUMBER OF GENERATION

1500

Figure 4: Normalized output surface of the fuzzy controller

Figure 5: Evolution of GA for our approach (solid line), triangular, gaussian and trapezoidal withtout restriction (dashed, dotted and dashdot line respectively)

As indicated in Section 1, in order to understand the behaviour of the fuzzy controller obtained by genetic algorithm optimization, it is important to analyze not only the error of the system, but also the distribution of the membership functions. In fact, if the overlap and the number of simultaneously active rules are very high, the system is very difficult to understand. This occurs when using trapezoidal, triangular or gaussian membership functions without restriction, but not using triangular functions as here proposed.

Table 1: Comparison of different Genetic Codings of the membership functions in a Fuzzy System Membership function used for both input variables Triangular as here proposed Gaussian without restriction (w.r) Triangular (w.r) Trapezoidal (w.r) Mean Squared Error 0.019 0.103 0.081 0.066 Number of parameters of the fuzzy system (only for the membership functions) 10 28 42 56

4. References
[DAV91] [HOM95] L.Davis,"Handbook of Genetic Algorithms". Van Nostrand Reinhold, 1991. A.Homaifar, E.McCormick, "Simultaneous design of membership functions and rule sets for fuzzy controllers using genetic algorithms", IEEE Transactions on fuzzy systems,vol.3, no.2, May, 1995, pp.129-139. C.Karr, "Applying genetics to fuzzy logic", AI Expert 6, pp.26-33, 1991. K.Kibayashi, H.Ogata, T.Murai, "Method of Inducing Fuzzy Rules and Membership Functions", Proceeding of IFAC, 1992, pp.283-290. Z.Michalewicz, "Genetic Algorithms + Data Structures = Evolution Programs", Springer-Verlag, Berlin, 1992. D.Park, A.Kandel, G.Langholz "Genetic-Based new fuzzy reasoning models with application to fuzzy control", IEEE Trans. Sys. Man & Cyber., Vol.24,No.1, 3947,1994. J.T.Richardson, M.R. Palmer, G.Liepins, M.Hilliard, "Some Guidelines for Genetic Algorithms with Penalty Functions", In Proceedings of the Third International Conference on Genetic Algorithms, 1989. Rojas.I.; Pelayo,F.J.; Ortega,J.; Prieto,A.: "A compact VLSI approach for the implementation of fuzzy controllers", Proc. of 2nd Joint Conf. on Information Science, pp.72-75, Wrightsville Beach, Nort Carolina, Sept. 28 - Oct. 1, 1995. E.Sanchez, "Genetic algorithms, neural networks and fuzzy logic systems", 2nd International Conference on Fuzzy Logic & Neural Networks, Japan, 1992, pp.17-19. H.Surmann, A.Kanstein, K.Goser "Self-organizing and genetic algorithms for an automatic design of fuzzy control and decision systems", Proc. of EUFIT 93. L.A.Zadeh, " Fuzzy sets". Information and Control, vol.8, pp.338-353, 1965.

[KAR91] [KOB92]

[MIC92]

[PAR94]

[RIC89]

[ROJ95]

[SAN92]

[SUR93]

[ZAD65]

You might also like