Optimization of Scaling Factors of Fuzzy Logic

0 downloads 0 Views 1MB Size Report
system may become unstable, oscillate or stable but ... A fuzzy logic control system enhances the ... techniques such as float or binary strings, roulette selection ...
Copyright 0 IFAC Artificial Intelligence in Real-Time Control, Kuala Lumpur, Malaysia, 1997

Optimization of Scaling Factors of Fuzzy Logic Controllers by Genetic Algorithms H. LI, P.T. Chan, A.B . Rad and YK. Wong The Hong Kong Polytechnic University Department of Electrical Engineering Hung Horn, Kowloon, Hong Kong [email protected], [email protected] based [1]. Compared with other classic and intelligent control methodologies, fuzzy control algorithms (a) do not require a detailed infonnation of the system, (b) implement the expert knowledge for a higher degree of autonomy, (c) realize robust nonlinear control, and (d) reduce the development and maintenance time. Thus fuzzy control has gained immense popularity in recent years(2, 3, 4). There is lack of systematic design methodologies for fuzzy controller design. Usually a trial-and-error methodology is used to design the rule sets, membership function and etc.. This is time consuming and the results are not optimal. Recently, neural network [6, 7], inductive reasoning (8), sliding mode[9] and Genetic Algorithms [10, 11, 12) are reported in literature to facilitate a more efficient approach to design of fuzzy controllers.

Abstract: It is known that besides the membership function and rule sets, scaling factors are also very important to be considered in designing a fuzzy logic controller. If they are not chosen properly, the system may become unstable, oscillate or stable but with a large overshoot and slow response time. However, finding the optimal scaling factors is not a trivial task for complex, partially unknown or nonlinear systems. Furthennore, the traditional trialand-error methods of finding a proper scaling factors is experience-based, time-consuming and do not always guarantee good response. In this paper, a Genetic Algorithm(GA)-based tuning and optimization method for scaling factors is proposed. In order to show the generality of this method, the proposed GA search for optimal scaling factors is tested on two different types of systems: a third order linear open-loop stable system and an open-loop unstable system (ball and beam system). Simulation results verify that the fuzzy logic controller whose scaling factors are optimized by GA achieve better performance. Copyright© 1998 IFAC Keywords: Fuzzy logic Algorithms, Scaling factors

controller,

Genetic Algorithms are powerful, global search techniques which emulate evolution theory and natural genetics. GAs provide a simpler, robust and effective way to design fuzzy controllers. The reader may refer to literature [10, 11 , 12] for how GAs are used to optimize either membership functions or rule sets or both of them simultaneously. In this paper, a GA-based scaling factors tuning method is presented. This is because besides membership functions and rule sets, scaling factors also play an important role in fuzzy control. Their improper choice may cause instability, oscillation problems and deteriorated damping effects. Hence, they are importance for control perfonnance and stability issues.

Genetic

1. Introduction A fuzzy logic control system enhances the perfonnance, reliability and robustness of control by incorporating human knowledge which cannot easily be incorporated in the mathematical model upon which conventional controller designs are generally

In addition, there are other benefits to tune scaling factors based on GA:

347

1.Calculations are very fast and can easily be realized in real- time.

(6) Print out best solution found

When GAs are applied to develop the optimal membership function or rules, they attempt like a kind of structure reconfiguration, and the composition of chromosome is relatively complex, so the GAs will take long time to find the final results. That's the reason why most research of GA-based fuzzy controller are limited to simulation studies on off-line optimization. While the scaling factors involve small parameters reconstruction, the calculation time is very short, and possible to be realized on-line.

-·--~!lIIII!l1

• ---

r rrrrr_n

2. It is a more general design method. GA-based membership function and rules design are more problem-related and only fit for one/some special kind of problems. For example, the membership functions should be limited so that the rules represented by chromosomes will not incre.'lse to a large number to cope with convergence. However, tuning scaling factors does not impose such conditions on the system. Generally GA-based methods can Ie.'ld to optimized scaling factors. Two different systems with GA-based scaling factors tuning are demonstrated in this paper.

FI,ure 1 A typical CA opera line cycle

This summarized the overall idea and steps needed to design a genetic algorithm. However, real implementations have to consider a number of techniques such as float or binary strings, roulette selection as well as the population size. crossover and mutation rates, convergence criteria etc.. GAs are very sensitive to these techniques.

The rest of the paper is organized as follows: a basic review of theory of GA is included in Section 2. Section 3 discusses how to implement GA to optimize scaling factors. The simulation results is included in Section 4. Finally, the paper is concluded in Section 5.

3. GA-based scaling factor tuning algorithm A typical structure of fuzzy controller can be divided into 5 parts, as shown in Figure 2:

2. Genetic Algorithm

er.. ,

eonlroJler IDpul

l

Genetic Algorithms was originally introduced by John Holland in 1962 (13) and further developed by Goldberg (14). A genetic algorithm maps a problem on a set of binary strings, where e.'lch string represents a potential solution. Then GA manipulates the most promising strings and search for improved solutions. It operates typic.'llly through a simple cycle of four stages as shown in Fig. I.

Part I

Normal'•• U•• P... t 2 'aaalneatioD

Part 3

Inl«eDce IDctneo Part. O~tus&lne.tloa

Part 0 Denonaalb:aU••

GA is implcmcnted according to the following procedure: (1) Generate an initial population (2) Evaluate the population (3) Apply genetic operators to produce the offspring (4) Select the best population for the ne:\1 generation (5) Repeat step 3 until tennination

~

Cri, C'OhtroU.r •• tJHIl

Figure 2: Fuzzy controller desi,n

Selection of scaling factors are perfonned in both part 1 and 5. Part 1 is input normalization which maps the physical values of the current process state

348

However, it is not convenient to use BR in this study since the scaling factors are floating numbers. Hence Floating Representation (FR) is used in this study for its natural and efficient representation with fast convergence. The floating number representation can be defined within the variables upper and lower bounds. An example is shown in Figure 5.

variables into a nonnalized domain. Output denonnalisation, part 5, maps the nonnalized value of the control output variables into their respective physical domains. The scaling factors which describe the input nonnalization and output denormalisation play a role similar to that of the gain coefficients in a conventional controller, i.e. the different choice of scaling factors directly effect the controller perfonnance and stability issues.

Figure 5 The floating number representation

Basically, there are two 1Th1jor approaches in determining the scaling factors, i.e. heuristic and analytic. These are however complex and may not be optimal. A generalized model is built in Figure 3:

for scaling factors

2. Selection function The selection of individuals to produce successive generations plays an important role in GA and there are several schemes for the selection process (15) : Roulette Wheel (R W) selection, Scaling techniques, Tournament, Elicit models, Ranking methods, etc. In this study, RW is used. The probability, Pj. for each individual is defined by:

P[lndividual i is chosen)

","PopSize L..Jj=1

L----fc:................... ~_J

F

(1)

J

where F.i equals the fitness of individual i.

Figure 3 A general fuzzy loCic controller tuned by CA

3. Genetic Operators Genetic Operators provide the basic search mechanism of the GA. There are two basic types of operators: crossover and mutation. For real-valued representations (the floating number encoding) there are unifonn mutation, non-unifonn mutlltion, multinon-unifonn mutation, boundary mutation, simple crossover, arithmetic crossover, and heuristic crossover. In this study, unifonn mutation and simple crossover are used.

For this model, the fuzzy controller has n inputs, m outputs, the related scaling factors kit. k i2, •• •, kin , kot. ko2 .... kom are to be adjusted by Genetic Algorithms. In section 2, six fundamental issues were stated to be required for GA to find the optilTh11 parameters. 1. Solution representation GA uses a sequence of genes to fonn a chromosome which describe each individual of the population. A gene could consist of binary digits (0 and 1), floating point numbers, integers, symbols, lTh'ltrices etc.. Usually the Binary Representation (BR) is accepted for its simplicity and originality [1). For example, a 3-bit BR encoding the scaling factors is shown in Figure 4.

x

and y be two m-dimensional row vectors Let denoting individuals from the population. Simple crossover generates a random number r from a unifonn distribution from 1 to m and cre.'ltes two as showing in Eq. (2). new individuals (X ' and

y">

, Xj

=

{Xi,i < r Yi ,olherw ise

, {Yj,i < r

I=:. I~:. I . . . I~~. I . . . I:;-. I~: I

Yi

Figure 4 3-bit representation for scaling factors

=

Xi ,olherwize

(2)

Unifonn mutation randomly selects one variable, j. and sets it equal to a unifonn random number V (aj.h i ):

349

(3)

4. Initialization The GA must be provided with an initial population. The most common method is to randomly generate solutions for the entire population. The Guassian Uniform Distribution is used to generate tbe random initial population is expressed in Eq. (4) as:

1

p(x) = ..J2iia e

Figurc 6 Fuzzy systcm of a third order system

Figure 6 shows a typical fuzzy control system for a third order plant. It uses the two linguistic variables: error (e), change in error ( e ) as the controller inputs and only onc output (u). There are two scaling factors connected with two inputs individually.

-(X-I'"

2a'

lower boundary < x < upper boundary

(4)

5. Termination The GA moves from generation to another via selecting and reproducing parents until a tennination criterion is met. The common tennin.1tion criterion is the maximum number of generations and population convergence criteria. In this study, we have combined both indices into onc:

if

..-, .......

max fit,. -max fit,._s < terminate criteria max_fit,.

---==..:...-::-----==......!:::;;:,.

,0

Figure 7 shows two response curves of system when Ute desired value is a unit step function . The solid line shows the response obtained using the proposed technique and the dotted line shows the result of tuning of scaling factor by lrial-and-error method. Compared with Ute dolled one, the solid one has faster response time and less overshoot.

6. Evaluation Function For GA-based control problems, evaluation function is the most important part of the genetic algorithm because it is the only element of these six issues which has the relationship with outside applications. In this study, we not only consider the rise-time, offsets but also the steady slale error. The fitness function is the popular Integral of Time Absolute Error (ITAE) Criterion:

=

Jtle~t

20

Figure 7.

then stop if n=30 then stop where n is the number of the generations.

f

11

r_.

02

....

I

0.11

(5)

0'.

4. Case studies

..

.n /

Two cases are considered to evaluate Ule proposed GA-bascd optimal scaling factors tuning algoriUlm.

0.01

0

-

'0

'5

20

Figure 8.

1. Third order system

Figure 8 demonstrate Ute evolution process of average fitness of population per generation. With

350

GA, individuals with high fitness will be remained to generate better solution while those with worse fitness will be discarded. This process will be repeated until finally a best solution is found. At first, the average fitness is not good, only 0.07, but it improves with generations. At last, it converged to 0.2 after 15th generations.

a : angle of the beam,

ci : angular velocity of the beam, u : the voltage of the D.C. motor. In order to control the ball on the desired position X, the conventional fuzzy algorithms is no longer

applicable. The controller inputs are three states of the system, i.e. error of X, X, a , (not error and change of error) and the output is voltage U. The three controller inputs' scaling factors should be optimized.

2. The Ball and Beam Balance system Figure 9 and 10 show the ball and beam balance system being controlled by a fuzzy controller.

\--

025

(r;e~e:::I)====:::::::,..,

x

Beam

D

02

o 1~ 01

Figure 11.

486 PC FiII ...._

figure 9 The b e am and ball setup

Ball

:I i

4.-----~--------~--------~--------~----____,

osition

05

Figure 10 Fuzzy control system for beam and ball balance

°0~--------~--------1~0--------~1~5--------~~--------~25 Gen. . tiCl'1

Figure 12. The ball and beam balance is an open-loop unstable system, its state-space equation is as follows! 16):

The response using GA tuning is shown as solid line in Fig. 11 . Although the dotted line has faster rising time but its overshoot is much higher. Both solid and dotted lines have almost the same settling time. Considering the general perfonnance, the solid one is better. Figure 12 shows that GA converges only af1er several generations.

o o

6.53

(6)

o o where

X

=[ x

x

5. Conclusion

a

~ : position of the ball,

Although scaling factors are important for system to achieve good perfonnance, it is difficult to find

x : velocity of the ball,

351

[4]

their optimal values using traditional optimal methods. This is because the fuzzy logic controllerbased system is nonlinear which make the optimal cost functions are nonJinear, complex, and even can not expressed mathematically which make the traditional optimization methods fail to solve them.

(5)

The traditional method of finding convenient scaling factors depends on the expert's experience and a large number of trials. However, this knowledge-based and time-consuming method do not guarantee a high quality of all the scaling factors. Genetic Algorithm provides a new direction to solve this problem. GA is especially useful for the function surface with complex, nonlinear, multi local optima where other traditional optimal methods fail. Besides, it does not require special knowledge about the operation scaling factors process, i.e., it is general and only depend on the index function selected. In this study, the object function considers both the dynamic and static performance, i.e., rising time, overshoot, steady state error and settling time are taken into account. When compared with trialand-error, GA generally offers a better performance index. Moreover, if one or more criteria are required to consider when searching for the optimal scaling factors, it can be achieved simply by choosing a different index function. Further, GA-based method is highly efficient search since it only costs several minutes while the trial-and-error generally takes much more time to complete.

[6]

(7)

[8]

[9]

[10]

[11]

Most papers in GA are based on simulation studies. This is due to nature of GA, which requires a model of the plant for facilitating application in real-time. However the convergence of this method is relatively fast and therefore suitable for real-time control.

[12]

(13]

6. Reference [1]

[2]

[3]

D. Driankov, H. Hellendoorn and M. Reinfrank , " An introduction to fuzzy control", Springer-Verlag Berlin Heidelberg 1993 Mamdani, E. M., "Application of fuzzy algorithms for control of simple dynamic plant," Proc. IEEE, 1974, 1585-1588. Tanscbeit R. and Sehar{ E.M., "Experiments with the use of a rule-based self-organizing controller for robotics applications," Fuzzy Sets and Systems, vol. 26, pp. 195-214,1988

[14]

[15]

(16]

352

Sugeno M. and Nishida M., "Fuzzy control of model car," Fuzzy Sets and Systems, vol. 16,pp.103-113,1985 Hwang W.R. and Thompson W.E., "An Improved Method For Designing Fuzzy Controller for Position Control Systems," Second IEEE International Conference on Fuzzy Systems, San Francisco, California, March 28-April1, 1993 Hwang W.R. and Thompson W.E., "Design of Intelligent Fuzzy Logic Controllers Using Genetic Algorithms", the 3rd IEEE International Conference on Fuzzy Systems, 1994 Hakagi, H., L Hayashi, "NN-driven fuzzy International Journal of reasoning. " Approximate Reasoning, 1991,5, 191-212. Kong S. G. and Kosko B. , "Adaptive Fuzzy Systems for backing up a Truck-and-Trailer", IEEE Transactions on neural networks, vol.3, No.2, March 1992 Hunt, K.J., "Classification by induction: application to modeling and control of nonlinear systems", Intelligent Systems Engineering, 1993,231-245. Karr, C.L., Gentry, E.J., "Fuzzy control of PH using genetic algorithms", IEEE Trans. Fuzzy Systems, 1993, 1( 1),46-53. Hwang W.R. and Thompson W.E., "Design of Intelligent Fuzzy Logic Controllers Using Genetic Algorithms", the 3rd IEEE International Conference on Fuzzy Systems, 1994 Homaifar A. and McCormick E., "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 J.H. Holland, "Adaptation in Natural and Artificial Systems",Ann Arbor, MI: Univ. Mich. Press, 1975. D.E. Goldberg, "Genetic Algorithms in Search, Optimization and Machine Learning", Reading, MA: AddisonWesleY,1989 Houck, c., Joines, J., and Kay, M., "A Genetic Algorithm for Function Optimization: A Matlab Implementation," NCSU-IE TR 95-09, 1995. [l6]Camo AS, The Balance Control Work Bench, larleveien 4, N-7012 Trondheim, Norway.