TUNING FUZZY SOFTWARE COMPONENTS WITH A DISTRIBUTED EVOLUTIONARY ENGINE Andrea Bottari, Gianni Degli Antoni and Andrea G. B. Tettamanzi Universita degli Studi di Milano, Polo Didattico e di Ricerca di Crema Via Bramante 65, 26013 Crema (CR), Italy E-mail:
[email protected], fgda,
[email protected]
Key words: evolutionary algorithms, fuzzy con- way of exploiting scattered and loosely interconnected computing resources. trol, distributed algorithms, software reuse.
ABSTRACT This paper presents a framework for the o-line tuning of fuzzy-logic based software components (FSCs) using a parallel evolutionary algorithms (EAs). The system was implemented on a high-speed network of workstations by means of a general-purpose task distribution tool. After the description of the framework's architecture, the tuning of FSCs is discussed as an alternative to maintenance, and some encouraging experimental results are described.
1
INTRODUCTION
This paper describes a distributed evolutionary engine providing an experimental setting for the tuning of fuzzy software components (FSCs). Our investigation addresses three main aspects, namely inexpensive, large scale synthesis and/or optimization of FSCs, reduction of software maintenance eorts and reusability, obtained through tuning rather than classical adaptation techniques. In order to deal with these problems by means of adaptation methods, an intensive use of computational resources is required. Concurrent computing on networks of heterogeneous machines has gained tremendous attention and popularity in recent years, after its feasibility and cost-eectiveness were proved [13]. Moreover, it is well known that EAs scale well and do not impose high demands on the communication network. For this reason, they provide an ideal
2
EVOLUTIONARY TUNING OF SOFTWARE COMPONENTS
Investigation on using EAs to tune software components, let alone FSCs, is relatively recent. The rst attempts aimed to the synthesis and optimization of FSCs were applied to control [6, 16, 8, 5, 15]. Another area in which research is active is data mining, where EAs are used to optimize database queries against completeness and relevance of the results they are able to retrieve [11]. A representative overview of current state of the art in the eld of evolutionary tuning of fuzzy systems is given in [3].
3
EVOLUTIONARY ANCE
MAINTEN-
Software component reuse is generally considered as an eective approach for decreasing the time and cost of application development [7]. However, the eort required by manual modi cation of components to adapt them to new applications is a major cause of failure for software reuse projects [1]. Hence, several methods have been proposed to modify components automatically instead of manually, possibly combined with fuzzy classi cation and retrieval techniques [2]. In the case of FSCs, a reduction of maintenance eorts can be achieved through evolutionary optimization of an existing FSC. FSC optimization, or tuning, requires fault scenarios to be available for evaluating FSC performance and an adaptation method to modify the FSC's behavior in order to improve its response to the environment, as represented by fault scenarios. Fault scenarios are sets of states, coded as vectors of environment and input values, that are used to uncover possible faulty operation of the FSCs under processing.
4
DISTRIBUTED EA'S
5
SYSTEM ARCHITECTURE
quential EA execution. The overall scheme of the distributed algorithm is the following (see also FigEAs have enjoyed an increasing popularity as ure 1): stochastic optimization methods in the last few years. The original formulation by Holland and others was 1. n blocks of mk +1 scenarios are generated, where sequential [4]. That made it easier to reason about k is the number of sequential evolutions between mathematical properties of EAs and was justi ed at two subsequent migrations, and each block is the time by the lack of adequate software and hardsent to a dierent workstation; ware. However, it is clear that EAs oer many natural opportunities for parallel or distributed imple- 2. an initial population of m individuals is genermentation [10]. ated or loaded from a le; Basically, there are two kinds of parallel EA models: the ne-grained or grid models [9], and the 3. the initial population of m individuals is broadcoarse-grained or island models. In the grid models, cast to all the n workstations in the network; large populations of individuals are imagined to be spatially distributed on a low-dimensional grid and 4. each workstation performs, independently of the individuals interact locally within a small neighborothers, k sequential evolutions as follows (see hood. Massively parallel SIMD machines are well also Figure 2): suited for the grid models. In the island models the individuals are divided (a) each workstation executes the sequential into smaller populations which evolve independently EA m times, with the same initial popuof one another and concurrently according to a standlation, using the kth set of m scenarios in ard sequential EA. Periodic migration of some selecits block; each execution produces a single ted individuals between islands injects new diversity individual; into converging populations. The island model is less demanding in terms of communication bandwidth, (b) the resulting m individuals are assembled which makes it better suited for a cluster implementto yield the initial population for the next ation. Distributed EAs of this kind have been prostep; posed for example in [14, 12]. Distributed computing resources have become workstation performs an additional sequenwidely available and extremely inexpensive. There- 5. each tial evolution, using the (mk + 1)th scenario in fore, designing EAs, which are notably computation its block and the result of Step 4 as the input intensive, so as to take advantage of such cheap repopulation, thus producing a single individual; sources, is not only worthwhile, but also compelling. In particular, our university can currently rely on > n, the best m of the resulting n individua high-speed ATM network of around 100 Pentium 6. ifalsmare assembled to yield the initial population and Pentium Pro workstations running the Microsoft for the next step, otherwise the needed numWindows NT operating system. An o-the-shelf disber of individuals is randomly extracted with retribution facility, namely ActiveTools' Clustor, has placement among the available ones; been adopted to implement DEE, the distributed evolutionary engine developed to exploit these networked machines for experiments in the evolutionary 7. if the termination condition is not met, go back to Step 3, otherwise the current population is tuning of FSCs. saved to a le. DEE comprises one master module, called Shuer, and any number of distributed slave modules. For the experiments in Section 6, each distributed slave module is a copy of the component adaptation part of the tuning environment of [1]. At each iteration of DEE's basic loop, the Shuer forms a new population by combining the populations returned by the slave nodes; once the new population is obtained, the Shuer sends it back to the slaves for the next iteration. Suppose that n workstations are in the network and that the population size is set to m for each se-
The scenarios used by the algorithm are randomly generated according to a given probability distribution, which should mirror the expected distribution of actual operating scenarios for the FSC in the real world. The termination condition can consist either in reaching a preset number of iterations or a desired quality level in the FSC performance or, nally, the improvement between two subsequent iterations falling below a given threshold. The above algorithm was easy to implement using Clustor, except for the looping part. Active Tools was kind enough to implement a new feature to this aim upon our request.
6 pop0
S1
S2
sequential evolutions
S3
sequential evolutions
sequential evolutions
EXPERIMENTS AND RESULTS
This section illustrates a sample application of DEE to a control problem. In order to make meaningful comparisons possible, we chose the same problem treated in [1]. We brie y summarize here both the problem and the FSC architecture used to solve it for sake of completeness, but we refer the interested reader to the cited article.
6.1 The Auto Cruise Control Problem
COMBINE
The auto cruise control problem consists in maintaining the speed of a vehicle as close as possible to a desired cruising speed yd , under changing road conditions (mainly slope and friction), by acting on its acceleration through the throttle and the brake. The road conditions (or environment) are speci ed by four variables: grade of slope ; Figure 1: An instance of the owchart of the al- desired cruising speed yd; gorithm's main loop with n = 3: Si is the block of road friction ; scenarios assigned to the ith workstation. vehicle mass m. The input to the controller consists in the speed error e = yd ? y (i.e. the dierence between the desired speed yd and the actual speed of the vehicle y) and its variation e. The output of the controller is the force, u, that has to be applied to the vehicle s1 s2 s3 s4 s5 s6 through appropriate actions on the throttle and the brake in order to correct its speed. The environment, de ned as above, is used in simulating the system operation in order to evaluate the controller performance. final pop
pop0
EA
EA
EA
EA
EA
EA
k times
s7
EA
s8
EA
s9
s10
EA
EA
s13
EA
s11
EA
s12
EA
6.2 The FSCs
The FSCs in our sample application are fuzzy rulebased controllers using two linguistic variables as inputs, namely speed error e and change of error e, and one output variable, the control u, proportional to acceleration. A fuzzy controller is made up of two blocks: the \IF-THEN" rules, of the form IF e is A AND e is B THEN u is C; where A, B and C are linguistic values, and membership functions de nitions for the linguistic values used in the rules.
6.3 Experimental setting
test runs were performed, with the settings Figure 2: An instance of the owchart of the al- Several in Table 1. gorithm's inner loop for each workstation, with k = 2 reported Fault scenarios were generated by perturbing a and m = 6. fault scenario that had previously been selected using
Population size Number of populations Number of sequential evolutions Number of scenarios
m 6 n 6 k 4 n(mk + 1) 150
Table 1: Settings used for the test runs. e n e
NE NE NE SN SP SP
NE SN ZE SP PO
NE SN ZE SP PO NE SN ZE SP PO NE SN ZE SP PO
Rules:
SN NE NE SN SP SP
Variable
= ?50 = ?25 =0 = 25 = 50
ZE SN SN ZE SP SP e:
SP SN SN SP PO PO
PO SN SN SP PO PO
= 25 = 25 = 25 = 25 = 25 Variable e: = ?500 = 250 = ?250 = 250 = 0 = 250 = 250 = 250 = 500 = 250 Variable u: = ?5000 = 2500 = ?2500 = 2500 = 0 = 2500 = 2500 = 2500 = 5000 = 2500
thing, evolution, whether natural or simulated, tends to take advantage of shortcuts, whenever they are available, even if this leads to less elegant solutions. In particular, evolution does not pay attention to the intended meaning of membership function labels: all that matters is in which rules membership functions are used. Therefore, reversals of their ordering are possible. Another interesting eect is that some linguistic values can be voided of their meaning (e.g. the associated membership function becomes 1 everywhere in the normal range of values or 0 everywhere except for a very small interval), thus leading to a sort of simpli cation of the rule base. For instance, Linguistic Value SP of Variable e in the controller of Figure 4 is practically 1 everywhere in the usual range of operation, causing all rules having the clause \e is SP" in the antecedent to drop that clause. On the other hand, the membership function of Value SN in the same variable has become a crisp value and therefore all rules having the clause \e is SN" in their antecedent could be eliminated from the rule base without signi cant change in the controller behavior. If needed, as a part of the maintenance process, one might restructure the rule base according to these considerations, thereby improving readability. In the above controller, for example, of the total 25 rules present in the reference controller, 17 would be eliminated and further 6 rules would be simpli ed. The optimized controller in Figure 4 also shows a remarkable improvement in performance with respect to the reference controller, reducing mean square error on the fault scenarios by a factor of 670.
Figure 3: The reference controller (mean square error: 204375.66). The names of the linguistic values have the following meaning: NE negative, SN small negative, ZE zero, SP small positive, PO positive. Membership functions are bell-shaped and they are de ned in terms of their mean, , and standard de7 viation . the method described in [1], i.e. such that it maximized the number of erroneous membership functions in a handcrafted controller used as reference. Perturbation was obtained by adding Gaussian noise to the selected fault scenario to obtain a wide range of \nearly critical" conditions. The initial population of controllers was generated in a similar way from the reference handcrafted controller shown in Figure 3.
6.4 Results
Figure 4 shows a sample fuzzy controller found by our algorithm. The rst thing that can be noticed is that such a controller is dramatically dierent from the reference. This is no wonder, since our controllers have a long evolutionary history and the evolutionary process works in a way that is fundamentally dierent from how a human expert would reason. For one
CONCLUSION
Our aim was to exploit the computational resources available in networks of workstations and evolutionary techniques to attain a greater generality and robustness of FSCs with respect to variations in operational environment, as well as a high degree of optimization. These results can be obtained at the expense of time required for the tuning process. However, on one side the speed-up ensured by increased parallelism can adequately compensate for the additional overhead. On the other hand, the cost of the computational resources involved is negligible in comparison with the cost of a human maintainer.
Acknowledgments This work was partially supported by M.U.R.S.T. 60% funds. The authors are indebted to David Rine and Junda Chen for their encouragement and suggestions. Rok Sosic and the whole development team at ActiveTools were of great help with Clustor.
e n e
NE SN ZE SP PO
Rules:
NE NE NE SN SP SP
SN NE NE SN SP SP
Variable
NE SN ZE SP PO
= ?10:670177 = ?35:564636 = 2:441505 = ?7:5 1015 = 58:822428
NE SN ZE SP PO
= ?1:1 1014 = ?22:823295 = 372:329898 = ?17:145093 = 1:4 109
NE SN ZE SP PO
ZE SN SN ZE SP SP e:
PO SN SN SP PO PO
= 18:811422 =0 = 0:000036 = 15 1015 = 0:000156
Variable
e
Variable
u
= ?4823:465750 = ?28664:973025 = ?2793:233960 = 23394:385044 = 5234:311239
SP SN SN SP PO PO
:
= 3 1014 =0 = 2:081205 = 1:017802 = 3 109
:
= 0:002467 = 1:341541 = 0:034434 = 47165:361741 = 0:001486
Figure 4: A sample fuzzy controller found by the algorithm: best individual after 24 iterations of the main loop (mean square error: 304.76).
REFERENCES [1] J. Chen and D. Rine. Testing trainable software components by combining genetic algorithms and backpropagation algorithms. In Proceedings of the IEEE Conference on Multivalued Logic Symposium, May 1997. [2] E. Damiani and M. G. Fugini. Fuzzy techniques for software reuse. In Proceedings of the ACM Symposium on Applied Computing (SAC '95), February 1995. [3] L. A. Zadeh E. Sanchez, T. Shibata. Genetic algorithms and fuzzy logic systems: Soft computing perspectives. World Scienti c, Singapore, 1996. [4] D. E. Goldberg. Genetic Algorithms in Search, Optimization & Machine Learning. AddisonWesley, Reading, MA, 1989. [5] C. Z. Janikow. A genetic algorithm for learning fuzzy controllers. In Proceedings of the ACM Symposium on Applied Computing, New York, 1994. ACM Press. [6] C. L. Karr. Design of an adaptive fuzzy logic controller using a genetic algorithm. In R. K. Belew and L. B. Booker, editors, Proceedings of the Fourth International Conference on Genetic Algorithms, San Mateo, CA, 1991. Morgan Kaufmann.
[7] C. W. Krueger. Software reuse. ACM Comp. Surveys, 24(2), June 1992. [8] M. Lee and H. Takagi. Embedding apriori knowledge into an integrated fuzzy system design method based on genetic algorithms. In Proceedings of the 5th IFSA World Congress (IFSA'93), pages Vol. II, 1293{1296, July 4{9 1993. [9] B. Manderick and P. Spiessens. Fine-grained parallel genetic algorithms. In J. D. Schaer, editor, Proceedings of the Third International Conference on Genetic Algorithms, San Mateo, CA, 1989. Morgan Kaufmann. [10] H. Muhlenbein. Parallel genetic algorithms, population genetics and combinatorial optimization. In J. D. Schaer, editor, Proceedings of the Third International Conference on Genetic Algorithms, pages 416{421, San Mateo, CA, 1989. Morgan Kaufmann. [11] E. Sanchez and P. Pierre. Fuzzy logic and genetic algorithms in information retrieval. In 3rd International Conference on Fuzzy Logic, Neural Networks and Soft Computing, 1994. [12] T. Starkweather, D. Whitley, and K. Mathias. Optimization using distributed genetic algorithms. In H.-P. Schwefel and R. Manner, editors, Parallel Problem Solving from Nature. 1st Workshop PPSN I, Berlin, 1991. SpringerVerlag. [13] V. S. Sunderam. Heterogeneous, networked based concurrent computing environments. Future Generation Computer Systems, 8(1{3), July 1992. [14] R. Tanese. Distributed genetic algorithms. In J. D. Schaer, editor, Proceedings of the Third International Conference on Genetic Algorithms, San Mateo, CA, 1989. Morgan Kaufmann. [15] A. Tettamanzi. An evolutionary algorithm for fuzzy controller synthesis and optimization. In Proceedings of the IEEE International Conference on Systems, Man and Cybernetics, volume 5/5, Vancouver, Canada, October 22{25 1995. IEEE Systems, Man and Cybernetics Society. [16] P. Thrift. Fuzzy logic synthesis with genetic algorithms. In R. K. Belew and L. B. Booker, editors, Proceedings of the Fourth International Conference on Genetic Algorithms, San Mateo, CA, 1991. Morgan Kaufmann.