You are on page 1of 17

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO.

2, APRIL 2008

203

Real-Valued Compact Genetic Algorithms for Embedded Microcontroller Optimization


Ernesto Mininno, Francesco Cupertino, and David Naso
AbstractRecent research on compact genetic algorithms (cGAs) has proposed a number of evolutionary search methods with reduced memory requirements. In cGAs, the evolution of populations is emulated by processing a probability vector with specic update rules. This paper considers the implementation of cGAs in microcontroller-based control platforms. In particular, to overcome some problems related to the binary encoding schemes adopted in most cGAs, this paper also proposes a new variant based on a real-valued solution coding. The presented variant achieves nal solutions of the same quality as those found by binary cGAs, with a signicantly reduced computational cost. The potential of the proposed approach is assessed by means of an extensive comparative study, which includes numerical results on benchmark functions, simulated and experimental microcontroller design problems. Index TermsCompact genetic algorithms (cGAs), electric drives, embedded systems, online optimization.

I. INTRODUCTION

OMPACT genetic algorithms (cGAs) [10] are evolutionary algorithms that mimic the behavior of conventional GAs by evolving a probability vector (PV) that describes the hypothetic distribution of a population of solutions in the search space. A cGA iteratively processes the PV with updating mechanisms that mimic the typical selection and recombination operations performed in a standard GA (sGA) until a stopping criterion is met. Reference [10] showed that the cGA is almost equivalent to a sGA with binary tournament selection and uniform crossover on a number of test problems, and also suggested some mechanisms to alter the selection pressure in the cGA. The main strength of the cGA is the signicant reduction of memory requirements, as it needs to store only the PV instead of an entire population of solutions. This feature makes them particularly suitable for memory-constrained applications such as evolvable-hardware [26] or complex combinatorial problems [2]. Since the cGA mimics the order-one behavior of sGAs, it may be ineffective for optimization problems with higher order building blocks. Recent research has investigated a number of ways to address this fundamental issue. More specically, [2] applies the cGAs to the TSP problem, and proposes a variant that employs an efcient local search operator to enhance the speed of convergence and the quality of the solutions. Reference [1] discusses the analogies between cGAs and -ES,

Manuscript received May 16, 2006; revised October 10, 2006. The authors are with the Dipartimento di Elettrotecnica ed Elettronica, Politecnico di Bari, 200 70125 Bari, Italy (e-mail: mininno@deemail.poliba.it; cupertino@deemail.poliba.it; naso@poliba.it). Digital Object Identier 10.1109/TEVC.2007.896689

and extends a mathematical model of ES [14] to cGAs obtaining useful analytical performance gures. Moreover, [1] introduces the concept of elitism, and proposes two new variants, with strong and weak elitism respectively, that signicantly outper-ES. Reference [26] suggests various form both cGAs and cGAs combining elitism, mutation (exploration of the neighborhood of the current individual), and resampling (periodic reevaluation of the tness of the best known individual in case of noisy or time-varying tness). Reference [26] shows that some of the proposed variants are extremely effective for both static and dynamic optimization problems, and can be implemented in commonly available eld programmable gate array (FPGA) boards. This paper shares the same fundamental motivations as the work in [26]. In particular, extending our previous work on hardware-in-the-loop optimization [4], here we investigate the possibility of using a cGA as the main optimization engine for solving online closed-loop control design problems. The typical task of a GA in a control engineering application is to nd the best values for a predened set of free parameters dening either a process model or a control law. Updated surveys of this research area can be found in [4] and [27]. Both surveys outline that the number of hardware applications is extremely limited for various reasons. In such a context, the cGAs are particularly interesting not only for the mentioned reduction of memory (power and space [26]) requirements, but also because their general structure (the lack of a population, the absence of random selection and recombination) lends itself well to online implementations that overcome the typical problems related to the conventional population-after-population algorithmic scheme of sGA. In our application, the design problem can be viewed as the search for the optimal setting of a number of real-valued coefcients that specify the inputoutput difference equation of the controller. While in our previous research [4], the main search engine was a sGA executed on a host computer that continuously downloaded new controllers to the microprocessor running the feedback control law, here we focus on a family of cGAs suitable to be directly executed on the oating-point microcontroller without the need of a host computer. This potential of cGAs appears particularly promising because embedded microcontroller-based platforms are increasingly widespread in various control and automation research areas, as mechatronics, automotive, and rapid prototyping systems. Implementing an effective cGA for the considered purpose is not trivial, because most microcontroller platforms are programmable with object-oriented software based on oating-point real-valued variables, whereas to date most literature about cGAs (including all the references mentioned above) concentrates on binary-encoding schemes. In a microcontroller implementation, the need to continuously perform

1089-778X/$25.00 2007 IEEE

204

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 1. Normalization of two truncated Gaussian curves (with standard deviations  ; . with a nonzero support only in the normalized interval

[01 +1]

= 1 and  = 10, respectively) so as to obtain a probability density function

binary-to-oat coding and decoding operations may weaken, to a variable extent, the advantages related to reduced memory requirements offered by cGAs. To overcome this problem, this paper proposes a variant of a cGA that works directly with real-valued chromosomes. More specically, for an optimization problem with real-valued variables, the real-valued cGA 2 matrix describing the mean and the standard uses as PV a deviation of the distribution of each gene in the hypothetical population. New variants of the update rules are then introduced to evolve the PV in a way that mimics the binary-coded cGA, which in turn emulates the behavior of a sGA. The similarities between cGAs and evolutionary strategies (ES) have already been pointed out in recent literature [1]. The analogies become even more evident in our case, as the use of a probabilistic description of the population with real-valued mean and standard deviation immediately recalls -ES (e.g., [7] and [12]). the well-known scheme of the Furthermore, the real-valued cGA also has some important relationships with other recently proposed evolutionary algorithms that incorporate probabilistic tools, such as continuous population-based incremental learning (PBIL) [21], [22], [29], or univariate marginal distribution algorithms (UMDAs) [23], [25], [28]. The differences and analogies with respect to these algorithms will be discussed after the description of the real-valued cGA in Section II. The behavior of both binary and real-valued cGAs is assessed in three different ways. Section III considers a set of well-known benchmark functions and compares the two cGAs (with binary and real-valued coding schemes) with their standard population-based versions (i.e., binary and real-valued sGAs). Tests also include noise-corrupted tness measurements, to better emulate the typical conditions in which microcontroller optimization is performed. Section IV focuses on the feedback control of a simulated second order model of a DC motor drive. The aim of this case study is to provide an easily repeatable benchmark for comparative purposes. Section V describes the experimental application of the cGAs to design and optimize online the discrete anti-windup PI speed controller for a vector controlled in-

duction motor (IM) drive subject to a time-varying load using a torque-controlled brushless generator, mounted on the same shaft. Conclusive remarks are nally drawn in Section VI. II. COMPACT GAS WITH REAL-VALUED CODING The cGA proposed in this paper combines the nonpersistent elitist compact GA proposed in [1] with a real-valued chromosome representation. The real-valued coding has been widely used in evolutionary algorithms (including GAs [12]) to avoid the additional computational cost related to the binary-to-oat conversions. To use a real-valued coding in a cGA, a number of modications are necessary. For brevity, we will hereafter refer to the nonpersistent elitist binary-coded cGA as bcGA, and to the real-valued variant as rcGA. In order to avoid repetitive descriptions of known algorithms, we adopt here the same notation used in [1], and focus only on the rcGA. Let us consider a minimization problem in a -dimensional hyper-rectangle ( is the number of parameters). Without loss of generality, let us assume that parameters are normalized so that each search interval is . The estimate of the single (binary) gene distribution in a cGA can be specied with a scalar in [0,1] expressing the probability of nding a 0 or a 1 in the single gene. As the rcGA uses real-valued genes, the distribution of the single gene in the hypothetical population must be described by a probability density function (PDF) dened on the normalized interval . A variety of different PDFs could be used for this purpose. We assume that the distribution of the th gene can be described with a Gaussian PDF with mean and standard deviation . More precisely, since the Gaussian PDF is dened in , we adopt a Gaussian-shaped PDF dened on whose height is normalized so that its area is equal to one. Fig. 1 illustrates the effects of the normalization procedure on a Gaussian PDF with zero-mean and standard deviations equal to 1 and 10, respectively. The height normalization has a generally negligible computational cost, as it is obtained by means of a simple numerical procedure that is widely adopted in pseudorandom number generation, and more

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

205

Fig. 2. Real-valued variant of the nonpersistent elitist bcGA.

generally, in practical implementations of stochastic algorithms (see, e.g., [3] and [15, Appendix D2]). Therefore, the PV becomes in our case a 2 matrix specifying the two parameters of the PDF of each single gene. Thus, we dene (1) is the vector of the where mean values, is the vector of the standard deviations, and is the iteration index. Fig. 2 describes the rcGA with the typical pseudocode used in related literature. The main differences with the bcGA regard the generation of the initial population and the update rule. The initial population is generated by setting and , where is a large positive constant (e.g., , see also Fig. 1). In this way, after height normalization we obtain a PDF that approximates sufciently well the uniform distribution that is almost always used to generate initial individuals in realvalued GAs. The update rule is designed so as to replicate the typical operations of a bcGA. As in [10], the idea is to mimic a steady-state binary tournament selection. This operator simply replaces the looser with a copy of the winner, and consequently also alters the compact, probabilistic description of the population. In particular, while the mean is simply moved in the direction of the

winner with a step whose size depends on the population size , the standard deviation is subject to a less transparent effect, due to its quadratic structure. Fig. 2 reports the update rule for the standard deviation in a compact form, particularly convenient for algorithm implementation, which can be directly obtained with simple manipulations, as described in Appendix A. As mentioned, this rcGA shares a number of similarities with other types of evolutionary algorithms. All cGAs belong to a larger class of methods known as estimation of distribution algorithms (EDAs), which have been extensively analyzed in recent literature [18]. In particular, among the EDAs that model the hypothetical population with PDFs dened on continuous intervals, the algorithms known as continuous-PBIL ( ) ) share some common aspects and continuous-UMDA ( algorithms (see [20] and [21] and the with our rcGA. The included references) are extensions of a population-based algorithm originally devised for binary search spaces. One specic version of uses a set of Gaussian distributions to model the vector of problems variables [19]. During the iterations, this PBIL algorithm only changes the mean values, while the standard deviations are constant parameters that must be xed : 1) randomly a priori. At each iteration, the Gaussianextracts a population of solutions using the current distribution for each variable; 2) sorts the solutions according to their tness; and then 3) updates the means of the distributions with a simple

206

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

TABLE I SUMMARY OF CONFIGURATION PARAMETERS OF THE FOUR GAS

linear law (a combination of the best, the second best and the worst individual). The rcGA in Fig. 2 could be viewed as a parwith , improved by nonticular form of Gaussian persistent elitism, and an adaptation law for the standard deviations. It is also interesting to note that other recent research about conrms the advantages of standard deviextensions of ation adaptation ([22] obtains promising results with a mechanism similar to the well-known 1/5 success rule). Moreover, the literature also suggests some other interesting possibilities deserving further investigations (e.g., replacing Gaussian PDF with histograms, or adapting the coefcient of the update rule for the mean vector [21]), although the extension or adaptation of these ideas to our online microcontroller optimization problem is not immediate, especially considering the signicant limitations on the available computational time. Among the [23], [25] also many EDAs available in literature, the uses Gaussian PDFs as probabilistic models of population distribution. There are many variants of this algorithm. The proposed in [23] is among the most widely citd ones: it extracts couples of individuals using the current PDFs, performs tournaments, and uses the winners to estimate the parame, the general structure ters of the new PDFs. When setting of may look quite similar to the rcGA in Fig. 2, but it are should be noted that: 1) the PDF update laws of the quite different from those in Fig. 2 and 2) the update laws explicitly need a population size greater than one to work properly. The main strengths of UMDAs lie in their amenability to theoretical analyses, and in their capability to learn the interdependencies among the problem variables (by adopting more complex multivariate PDFs). On the other hand, it should be evident that implementing such a population-based in our real-time environment could be even more prohibitive than in the case of a sGA, due to the additional costs related to the more complex update laws for multivariate PDFs (see remarks in [24]). Finally, as already pointed out in [1], cGAs can -ES. Since ESs use be viewed as a particular type of Gaussian PDF to characterize the additive mutation, the simi-ES are even more larities between our rcGA and the apparent. The main difference between the two evolutionary algorithms can be seen in the meaning and actual use of parameters and . In -ES, the generic gene represents the value of the th element of the best solution known at the iteration , rather than the center of the probabilistic func-

tion modeling the distribution of the ctitious population. Since as affected by probabilistic uncertainty, ES do not consider using the same notation introduced in Fig. 2, the update law for in a -ES is (i.e., the algorithm simply replaces the gene of the parent with the one of the best-known solution). On the contrary, it is evident in Fig. 2 that the rcGA makes a much smoother move towards the winner, which also depends on the parameter . Similar analogies can be observed in the updates of the standard deviation . In ESs, the paindicates the standard deviation of the mutation, rameter to geni.e., the random additive perturbations applied to erate a new solution. In ESs, is usually updated either with heuristic rules that take into account the amount of successful perturbations obtained over a predened number of mutations (e.g., the 1/5 success rule [12]) or with self-adaptation (i.e., it becomes a further gene of the chromosome evolved by the ES). The novel update rule proposed in Fig. 2 may be properly placed in the rst class of methods, although it still appears signicantly different from the typical ES parameter update rules (to our best knowledge there has been no previous effort in developing a mutation update rule in ESs inspired to binary cGAs). III. NUMERICAL BENCHMARKS Tuning and validation of the proposed rcGA are based on a comparison with three other standard algorithms selected from literature. The set of reference standards includes the elitist bcGAs proposed in [1] and two population-based GAs. The following subsections illustrate the congurations of the reference algorithms, the suite of benchmark functions, and the summary of numerical results, respectively. A. Reference Algorithms for Comparison Obtaining a signicant comparison between GAs is always difcult, as the relative results are strongly inuenced by the nontrivial conguration of the single algorithms. For this reason, the set of reference algorithms includes two GA codes available in the Genetic Algorithm Direct Search Toolbox (Version 1.0.3) [17]. Essentially, the two standard algorithms differ for the encoding scheme and for the crossover operators. The congurations are summarized in Table I. One fundamental difference between the population-based and the compact GAs lies in the sizes of the actual or cti-

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

207

tious populations used by the four algorithms. For all the GAs, this parameter is chosen so as to make all the GAs approximately converge using the same number of tness calls (which is the stopping criterion for all our numerical and experimental investigations). We have performed a number of preliminary tests, obtaining results that agree with indications available in recent literature [1], [10]). In particular, the standard GAs require smaller population sizes than the cGAs (about 2 to 4 times in the case of nonpersistent elitist cGA, as also reported in [1]). Finally, the number of bits used for the parameter encoding in binary GAs was chosen so as to have a sufcient resolution to converge reasonably close to the known optima. Finally, the parameters dening the elitist mechanism in the two cGAs were chosen empirically. B. Benchmark Functions The comparison is based on ve well-known benchmark functions selected from GA literature for their different characteristics. For each function, we consider two cases: in the rst one, tness measurements are noise-free, while in the other one they are subject to additive Gaussian noise with zero-mean and (such a noise amplitude is chosen standard deviations to reproduce the typical uncertainty affecting control performance measures). The number of free parameters for each . The use of relatively small size problems is function is motivated by the interest in evaluating the performances of the algorithms in noisy search spaces having the same size of the control design problems tackled on the microcontroller board. The ve benchmark functions are dened as follows. 1) Rastrigins Function:

4) Michalewicz Function: (5) This is a multimodal test function ( local optima). The denes the steepness of the valleys or edges. parameter leads to more difcult search. The function values Larger for points in the space outside the narrow valleys give very little information on the location of the global optimum. In our , which places the global minimum in tests, we use [12]. 5) Rosenbrocks Function (Also Known as Dejongs Second Function): (6) This is a standard test function in optimization theory. Due to a long narrow valley present in this function, gradient-based techniques may require a large number of iterations before the global , is found. minimum C. Summary of Results: Quality of Final Solutions Each algorithm is run 1000 times to obtain average performances. The results are summarized in Figs. 37. The gures draw the histograms of the distribution of the best solutions found in each of the 1000 replications. In particular, to give an immediately interpretable index of performance, the distribution of nal solutions is viewed in terms of the normalized distance (with respect to the actual width of the search space) from the true optimum. The analysis of the single benchmarks highlights a number of interesting results. For the Rastragin function, all the algorithms are relatively unable to escape the local minima. Especially for the bGA and rcGA, the distribution of the nal solutions tends to become looser as the noise level is increased, but the overall performance of the four algorithms can be considered approximately equivalent. Local minima have a signicant inuence on the nal performance of the GAs also for the Schwefel benchmark. In this case, it is interesting to note that both cGAs outperform the population-based algorithms, being able to nd the true optimum in about 40%50% of the noise-free runs and about 20%30% in the noisy case, respectively. The Schwefel benchmark is particularly troublesome for the rGA, which only occasionally (or never in the case of high noise) converges to the true optimum. In contrast, the results of the rcGA are particularly interesting, as they also slightly outperform the bcGA in both noise-free and noisy cases. Similar results are obtained on the Circle function, for which the performance of the rcGA in the noise-free case is particularly remarkable. The cGAs exhibit a relatively better ability to overcome multimodality also in the Michalewicz benchmark, although this time the bcGA is largely the best performing algorithm, being able to hold a remarkable result (over 60% of runs ending in global optimum) also in the noisy case. Both bGA and rcGA are able to get closer to the optimum of the Rosenbrocks function within the allowed 1000 tness calls. The advantage of these algorithms becomes even more evident in the noisy case.

(2) This benchmark is highly multimodal due to the cosine modulation that produces regularly distributed local minima. The global [16]. optimum is the origin with 2) Circle Function:

(3) this is a multimodal function described in [13]. It has many local optima (minima) that are located on concentric circles near the global optimum (the origin). 3) Schwefels Function: (4) This is a deceptive function in which the global minimum is geometrically distant, over the parameter space, from the next best local minima. This may cause the search algorithm to move toward the wrong direction. The global minimum is located at , with .

208

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 3. Distribution of the nal best solution found by the four compared GAs in each run for the Rastragin function. The distance from optimum is normalized with respect to the width of the search interval. For all the algorithms, only few runs end sufciently close to the true optimum, independently from the presence of noise. On the other hand, bGA and rcGA seem to be slightly more sensitive to noise.

A joint analysis of the results on the ve benchmarks suggests that, in low-dimensional optimization benchmarks, the two cGAs exhibit, in general, very satisfactory results, sometimes even more accurate and less sensitive to noise than

those of the sGAs. On the other hand, it is also quite foreseeable that the relative performance of the algorithms observed in these low-dimensional cases may dramatically change for larger size problems involving higher order building blocks,

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

209

Fig. 4. Distribution of the nal best solution found by the four compared GAs in each run for the Schwefel function. The distance from optimum is normalized with respect to the width of the search interval. The cGAs are evidently more effective than their population-based correspondents.

as often remarked in technical literature on cGAs. However, the analysis of the performance of the rcGA on larger size optimization problems is not among the scopes of this manuscript.

IV. MICROCONTROLLER DESIGN ON A SIMULATED PLANT As previously mentioned, the cGAs have an algorithmic structure that lends itself readily to online applications in which

210

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 5. Distribution of the nal best solution found by the four compared GAs in each run for the Circle function. The distance from optimum is normalized with respect to the width of the search interval. The rcGA yields in this case the most remarkable performance, with over 400800 runs ending in the true optimum regardless of the amount of noise.

tness measures are performed uninterruptedly on a hardware process. Such a case is examined in the experimental investigations described in the remainder of this paper, which are all performed on a dSPACE 1104 microcontroller board based on a 250 MHz Motorola Power PC microprocessor. The board,

specically designed for measurement and control application, is equipped with several AD and DA converters, and is directly programmable in the Matlab/Simulink object-oriented language. The following subsections describe two different benchmarks for binary and real-valued cGAs.

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

211

Fig. 6. Distribution of the nal best solution found by the four compared GAs in each run for the Michalewicz function. The distance from optimum is normalized with respect to the width of the search interval. The bcGA is the best performing algorithm for this benchmark, in which both cGAs outperform their populationbased equivalents.

A. Measuring Actual Computational Costs Implementing a conventional population-based GA directly on a microcontroller is not simple, for various reasons. As men-

tioned, a sGA requires the memory necessary to store the current population and an additional memory to perform selection, crossover, and mutation operations (and binary to real coding/ decoding operations if present). Moreover, since the selection,

212

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 7. Distribution of the nal best solution found by the four compared GAs in each run for the Rosenbrocks function. The distance from optimum is normalized with respect to the width of the search interval. The bGA and rcGA are the best performing algorithm for this benchmark.

crossover and mutation operations are concentrated at the end of an iteration, the computational cost is evenly distributed over time. Such an algorithmic scheme causes peaks of computational requirements that may overload the microcontroller at every end of GA iteration. This, in turn, may generate con-

trol delays that are particularly undesirable in closed-loop feedback schemes. All the cGAs can be effectively used to overcome these limitations, and in particular, the rcGA proposed in this paper is even lighter in terms of actual computational requirements on a typical microcontroller. To assess the amount

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

213

Fig. 8. Block diagram of the controlled plant with the reference PI controller.

TABLE II EXECUTION TIME OF ONE ITERATION OF CGAS ON DS1104 BOARD

Fig. 9. Schema of the cGA-based optimization.

of benets offered by the rcGA in this respect, we implemented the bcGA and the rcGA on the microcontroller, and measured the average time needed by each algorithm to perform all the numerical operations in one single iteration (from step 2 to step 4 of the pseudocode in Fig. 2), except for the computation of the tness. For completeness, we mention that the tness function for this benchmark is the Michalewicz function described above (with a progressively increased number of parameters), but it should be clear that the considered hardware conguration makes the result independent of the particular objective function. Unless explicitly specied, all the conguration parameters of the cGAs are the same as those used in the previous tests and summarized in Table I. Moreover, in the bcGA, each real-valued variable is converted in a 16 bit binary-coded string. Table II summarizes the results of these tests, showing the ratio of the iteration execution times of rcGA and bcGA. As expected, the rcGA is about 3 to 5 times faster, depending on the number of parameters. The difference is particularly signicant in our control applications: the rcGA permits the use of shorter sampling times for the same parametrized law (or the implementation of more complex control laws at the same sampling time), or the use of less-performing microcontroller for the same embedded control application. B. Online Design of a PI Controller for a Simulated Plant To provide repeatable results on a case study commonly available in technical literature [6], [11], this section focuses on the online optimization of the proportional and integral gains for a discrete-time anti-windup PI controller applied to a nonlinear plant. As described in Fig. 8, the controlled plant is a linear second-order transfer function with an input saturation when . Fig. 8 also the control signal exceeds the range shows the reference PI controller which can be obtained using

the classical, model-based Symmetrical Optimum design approach [11]. The overall scheme of the cGA-based design is illustrated in Fig. 9. The differential equations describing the controlled nonlinear plant are discretized with Euler method and a sampling step equal to 3 ms, and the resulting difference equations, as well as the cGA and the PI controller, are run simultaneously by the microcontroller board, while an external PC is used for monitoring purposes. The speed reference is a square wave having amplitude equal to 0.5 p.u. and period equal to 0.6 s. The objective function (hereafter cost function) to be minimized by the cGAs is the integral of the absolute error (IAE) calculated comparing the simulated DC motor speed response with the output of the reference model (in Fig. 8) to the same reference input. The parameters optimized by the cGAs are the two Proportional and Integral controller gains. The search is bounded in [0 3.5] and [0 10] for proportional and integral gain, respectively. At each speed step, the current IAE value (that is, the cost function to be minimized) is passed to the cGA and the integrator is reset to zero. The cGA depicted in Fig. 9 is then executed every 0.3 s. The execution time of one full iteration (from step 2 to step 4 in Fig. 2 except for the cost function measurements) of the rcGAs for the bcGA. is 65 , while this time raises to 180 The main conguration parameters of the cGAs are selected according to preliminary tuning experiments. The population size is set equal to 200 for both algorithms. The stopping criterion is 5000 cost function evaluations for all the tests. Moreover, the maximum length of inheritance is set equal to 100. Under these general settings, we execute three tests with slightly differing congurations. The rst and simplest test (hereafter test a) considers a linear reference model (no actuator saturation) and a noise-free simulation. The second test (test b) is still performed with a linear reference model but the output of

214

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 10. Comparison of the simulated speed responses of the reference controller (model-based symmetrical optimum, continuous line) and the speed response of a PI controller obtained with the rcGA (dotted line) and with the bcGA (dashed line). The perfect overlap of the three responses is also emphasized on the right-hand side on an expanded view of the overshoot.

Fig. 11. Comparison of average bcGA and rcGA evolution, in test a (linear, noise free), b (linear, noisy), and c (nonlinear, noisy), respectively. To emphasize the differences in terms of computational costs, the horizontal axis reports the actual computation time used by each cGA.

the DC motor is articially corrupted at each sample time with of the rated a uniform random number ranging between motor speed. Moreover, the end of the evaluation of each individual (at every 0.3 s), a second uniform random number beof the measured value of the IAE is also added tween to the cost function, to further increase the amount of uncertainty on the simulated cost measurement. In particular, the two sources of noise simulate: 1) the inherently noisy measurement of the rotor speed due to transducer inaccuracy and interferences with other devices and 2) the imperfect repeatability of each experiment, which is a typical challenge of experimental hardware-in-the-loop optimization processes. Finally, in addition to the noise sources of the test b, the third test (test c) considers an range, and a PI actuator with saturation outside the regulator with an antiwindup algorithm. This last test better approximates the real-time experiment on an actual electric drive. Each test is repeated 100 times and the average results are summarized in Table III. Table III highlights two interesting results. It can be immediately noted that the rcGA outperforms the bcGA in terms of both average cost function values, and smallest standard deviations. Moreover, considering the nal values for controllers parameters, it can be also noted that the rcGA is able to converge to the gains of the reference controller also in the noise-corrupted and nonlinear cases. Fig. 10 compares the speed response of the reference control loop with the response of one PI obtained by

TABLE III AVERAGE RESULTS FOR SIMULATED PI DESIGN (NOTATION STD INDICATES STANDARD DEVIATION)

the rcGA. The differences between the two controllers are indistinguishable, even in the expanded view of transient responses [Fig. 10(b)]. The differences between the two cGAs in terms of speed of convergence and computational requirements are illustrated in Fig. 11. It can be noted that the rcGA obtains a signicantly lower average cost value in test a, while the average cost values for tests b and c are almost equivalent, although the rcGA is much faster in converging towards the reference values. Another important advantage of rcGA over bcGA is the execution speed. As evidenced by Fig. 11, both algorithms converge after about 2000 tness calls, but the rcGA needs about 36% of the computational requirement of a bcGA. Fig. 11 clearly highlights that the rcGA has a more turbulent explorative search due to the

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

215

Fig. 12. Induction motor drive block diagram.

combination of nonpersistent elitism with a real-valued approximation of the probabilistic gene distribution. V. EMBEDDED MICROCONTROLLER OPTIMIZATION This section extends the ideas and investigations illustrated in the previous sections to an experimental bench for the feedback control of a vector-controlled IM drive [4]. Fig. 12 illustrates the overall schema of the system [11]. The current controllers are not subject to optimization, and are the same for all the experiments. The plant is a IM loaded using a torque controlled brushless generator, mounted on the same shaft. The IM name, current plate parameters are as follows: voltage , power , speed , , inertia , pole pairs torque , and torque constant . In this case study, the microcontroller runs the cGAs, the control laws and a supervision algorithm that interrupts the experimentation of badly performing solutions. The various modules have different sampling times. In particular, controller and sampling time, while stability supervisor run with a 200 the cGAs have a 0.75 s sampling time. Each run is stopped after about 6 min of search, but both algorithms converge in nearly 3 min. According to preliminary investigations for algorithm conguration, in this case study we set the population , and the maximum length of inheritance size for both cGAs . We also remark that the execution time of a complete iteration of the vector control scheme (the four controllers in Fig. 12 and necessary coordinate transformations) is for about 100 , and one iteration of the cGA requires 65 for the bcGA. Since both cGAs the rcGA and about 180 are executed at every 3750 iterations of controller difference equation, the increase of computer cost due to the introduction of the optimization algorithms is negligible, as it amounts to of the cycle time for the rcGA and 0.048% for the bcGA. Performing experiments directly on hardware raises the fundamental issue of the risks related to unstable or badly performing individuals, generated due to the inherently random

exploration of the GAs, especially during the early iterations. Testing such controllers is not necessary and often dangerous, since it may cause hardware damage. The use of linear controllers, combined with the availability of an accurate linear model of the plant makes possible, at least in principle, the analysis of stability prior to the actual implementation of each solution. Obviously, due to the various unknown parameters and nonlinearities neglected in this process, the information on closed-loop poles does not yield a fully reliable prediction of each controllers stability. However, as foreseeable, controllers with unstable model-based closed-loop poles seldom provide acceptable performances on the real motor. This information can be protably used to dene appropriate bounds of the search space for the two gains, but the theoretical guarantees of closedloop stability on the actual hardware remain a matter of accuracy of the available model. In order to overcome the need of an accurate model, and simultaneously guarantee a sufcient level of safety during the genetic search, in this paper we have adopted an heuristic strategy that effectively overcomes the limitations of model-based analysis. Instead of computing the cost function at the end of each evaluation interval, as usually done in online tuning approaches, we compute each index contributing to the total cost function online, i.e., updating its value at each time sample of the experiment. The online value of each cost term is constantly monitored, and whenever it exceeds a predened threshold the current experiment is immediately stopped. This allows us to detect unstable (or highly unsatisfactory) solutions well before the involved signals reach potentially dangerous values. In case a monitored index exceeds the prescribed threshold, the value of the cost is multiplied by a penalty factor and assigned to the individual, and the algorithm proceeds with another experiment. In this way, the evolutionary search is never interrupted until the terminating condition occurs. On average, only 2%3% of the experiments are prematurely interrupted due to bad performance, and mostly in the rst iterations. The design of the experiment for cost measurement also plays a fundamental role in the success of the evolutionary design. In this section, the speed reference signal is a square wave having

216

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

Fig. 13. Evolution of cost function and proportional gain over time in a sample run: currently tested individual is in thin line, current elitist in thick line. (a) Cost function bcGA. (b) Cost function rcGA. (c) Proportional gain bcGA. (d) Proportional gain rcGA. (Figures about the evolution of the integral gain are very similar, and omitted for brevity.)

amplitude equal to 1 p.u. (between ) and period equal to 1.5 s. After 0.5 s from every change of the reference signal, a step change of load torque (from 0% to 70% of motor rated torque) is applied, in order to also evaluate the overall disturbance rejection. The proles of both motor speed and control action (the current isqref) are acquired during the experiment, and used to compute the cost function, which essentially takes into account three criteria, i.e., the tracking performance, the disturbance rejection, and the smoothness of the control action. In mathematical terms, the optimization problem is formulated as the minimization of a cost function obtained as the sum of two terms (7) where is the duration of the experiment for cost function measurement, and the two functions and are dened as if otherwise and (8)

TABLE IV AVERAGE RESULTS FOR EXPERIMENTAL PI DESIGN (NOTATION STD INDICATES STANDARD DEVIATION)

if otherwise

(9)
Fig. 14. Comparison of controllers obtained with rcGA (rst row of gures) and linear model-based design (second row). From left to right, the gure show the overall speed response on one cost function evaluation experiment (a) and (c), and the corresponding control action (b) and (d).

The function takes into account the tracking performance in the rst part of the experiment, and the disturbance rejection in the time interval in which the step load torque is applied. More specically, the tracking error is considered only in the time intervals in which the current feed is lower that a predened threshold (the tracking error due to controller saturation compares cannot be further reduced). The second function the control action ltered by a rst-order linear lter with time

constant (indicated in (9) as ), with the unitself. As smoother control actions ltered actual action give lower values of the integral of , this index is intended to

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

217

Fig. 15. (a) Comparison of controllers obtained with rcGA, (b) bcGA, and (c) linear model-based design: expanded view of the steady-state time interval of one cost function evaluation experiment when the load torque is applied. The expanded view of the symmetrical-optimum model-based design (c) also reports the closed-loop response obtained on the approximated model used for design purposes. It can be noted that in spite of model accuracy (the modeling error seems negligible prior to the application of the load), the nal result is clearly less effective than the PI obtained with cGAs.

penalize controllers with an excessively oscillatory control action, which may cause stresses for the IM producing vibrations, acoustic noise, and extra losses. At the end of the experiment , the measured cost is passed to the cGA, and a interval new experiment is started. The search interval is [0 1.5] for the proportional gain and [0 20] for the integral gain. The stopping criterion is the maximum number of cost function calls chosen equal to 500 (i.e., the whole experiment lasts 375 seconds, although all the algorithms converge in about half of this interval). The average results are summarized in Table IV. Also, in this case, the rcGA is able to obtain better PI controllers, in spite of the higher standard deviation of controller gain (noise, actuator saturation, and other nonlinearities in this case make the considered cost function less sensitive to small variations of the controller gains). Fig. 13 shows the evolution of the cost function and proportional gain in two typical runs of a bcGA and a rcGA. The effects of nonpersistent elitism are clearly visible in the evolution of both algorithms, which have a remarkably similar behavior. To provide a quantitative comparison with other available design strategies, Fig. 14 compares the result of a PI controller optimized by the rcGA with a PI designed with the IM model-based symmetrical-optimum approach. The design technique can be summarized as follows (further details can be found in [4] and [9]). The gains of the current controllers are selected so as to achieve a rst-order closed-loop response with time constant . In order to design the speed controller, the equal to plant is approximated with a rst-order system having time con, i.e., the sum of all the delays found in stant the speed control loop (current control , speed low-pass lter , and delays due to the digital implementation of the con). Once the rst-order model is dened, it can be trol scheme easily shown [9] that the open loop transfer function reduces to the following: (10) and is the complex Laplace transform variwhere able. Then, according to the design theory of the symmetrical optimum [9], the gains of the PI can be obtained with the following formula: (11)

The differences between the model-based PI and the cGA-based PI are illustrated in Figs. 14 and 15. In particular, Fig. 15(c) compares the closed-loop responses obtained using the same model-based controller in simulation and during one experiment on the actual hardware. The similarity between the two responses conrms that the mathematical model used for the symmetrical optimum design is fairly accurate. Nevertheless, the model based procedure obtains a less satisfactory result (larger overshoot, larger effects of the load torque). It has to be mentioned that it is a fairly common practice in all PID model-based design methods to perform a nal hand-tuning session directly on the controlled hardware and rene the performance of the closed-loop system. Thus, it is reasonable to believe that the symmetrical-optimum PI could be made more satisfactory with hand-tuning renements. On the other hand, this possibility does not make the result of the cGA less signicant, since the latter is obtained with a fully automated model-free procedure in less than 3 min. VI. CONCLUSION This paper proposed a variant of an effective elitist cGA working with a real-valued PV. In a wide set of simulated and experimental investigations, the variant exhibited satisfactory behavior, with reduced computational requirements and repeatable and generally accurate results, comparable to those of other state-of-art compact and population-based GAs. As in the case of population-based GAs, a real-coded implementation of a cGA is an interesting tradeoff between simplicity of the code, interpretability of the PVs and chromosomes, and accuracy of the nal solutions. The efcacy of the proposed algorithm is conrmed by a realworld application in the context of embedded microcontroller optimization. On the proposed platform, the effects of the actual and unknown high-order phenomena and nonlinearities are fully accounted in the cost measurement, and the nal controller is ready-for-use with known performance. The cGAs require a very low computational cost, and therefore can be directly implemented on the same processor running the control algorithm, overcoming the typical limitations related to the conventional population-after-population algorithmic scheme of sGA. The presented research leaves many directions open for further investigations. In principle, the cGAs seem suitable to also solve more challenging online tuning problems, e.g., optimizing

218

IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 12, NO. 2, APRIL 2008

(A3)

a nonlinear interpolator such as a neural network. However, further research is necessary to investigate the potential limitations related to the typical order-one behavior of cGAs in these larger size optimization problems. Another promising direction regards the simultaneous optimization of the four controllers operating in the IM. Also, such a simultaneous design problem is particularly challenging because of the unpredictable interactions between the various controllers. APPENDIX Derivation of the Update Rules: Let us consider a population of individuals and focus on one generic gene . Let us group the values of the gene in the population in the vector , where is a and the generic iteration index. Let us indicate with mean and standard deviations of . Let us assume that is subject to a binary tournament selection involving the generic individuals and , where index corresponds to the winner and to the looser. The vector of genes after the tournament becomes . The can be immediately computed as mean value of

REFERENCES
[1] C. W. Ahn and R. S. Ramakrishna, Elitism based compact genetic algorithms, IEEE Trans. Evol. Comput, vol. 7, no. 4, pp. 367385 , Aug. 2003. [2] R. Baraglia, J. I. Hidalgo, and R. Perego, A hybrid heuristic for the traveling salesman problem, IEEE Trans. Evol. Comput., vol. 5, no. 6, pp. 613622, Dec. 2001. [3] W. J. Cody, Rational Chebyshev approximations for the error function, Math. Comp., vol. 8, pp. 631638, 1969. [4] F. Cupertino, E. Mininno, D. Naso, B. Turchiano, and L. Salvatore, On-line genetic design of anti-windup unstructured controllers for electric drives with variable load, IEEE Trans. Evol. Comput., vol. 8, 4, pp. 347364, Aug. 2004. [5] F. Cupertino, G. L. Cascella, L. Salvatore, and N. Salvatore, A simple stator ux oriented induction motor control, EPE Journal, vol. 15, no. 3, 2005. [6] F. Cupertino, A. Lattanzi, and L. Salvatore, A new fuzzy logic-based controller design method for DC and AC impressed-voltage drives, IEEE Trans. Power Electron., vol. 15, no. 6, pp. 974982, Nov. 2000. [7] D. B. Fogel, Evolutionary Computation. Piscataway, NJ: IEEE Press, 1995. [8] D. E. Goldberg, Genetic Algorithms in Search, Optimization, and Machine Learning. Reading, MA: Addison-Wesley, 1989. [9] H. Grob, J. Hamann, and G. Wiegartner, Electrical Feed Drives in Automation. Alpharetta, GA: Siemens, 2001. [10] G. Harik, F. G. Lobo, and D. E. Goldberg, The compact genetic algorithm, IEEE Trans. Evol. Comput., vol. 3, pp. 287297, Nov. 1999. [11] W. Leonhard, Control of Electrical Drives. Berlin, Germany: Springer-Verlag, 1985. [12] Z. Michalewicz, Genetic Algorithms + Data Structures = Evolutionary Programs, 2nd ed. New York: Springer-Verlag, 1994. [13] S. D. Mller, J. Marchetto, S. Airaghi, and P. Koumoutsakos, Optimization based on bacterial chemotaxis, IEEE Trans. Evol. Comput., vol. 6, pp. 1629, Feb. 2002. [14] G. Rudolph, Self-adaptive mutations may lead to premature convergence, IEEE Trans. Evol. Comput., vol. 5, pp. 410414, Aug. 2001. [15] J. C. Spall, Introduction to Stochastic Search and Optimization: Estimation, Simulation, and Control. New York: Wiley, 2003. [16] A. Trn and A. Zilinskas, Global Optimization. Berlin, Germany: Springer-Verlag, 1989, vol. 350, Lecture Notes in Computer Science. [17] The Matlab Users Guide The MathWorks, Inc., Natich, MA, 2006. [Online]. Available: www.mathworks.com [18] P. Larraaga and J. A. Lozano, Eds., Estimation of Distribution Algorithms: A New Tool for Evolutionary Computation. Norwell, MA: Kluwer, 2001. [19] M. Sebag and A. Ducoulombier, Extending population-based incremental learning to continuous search spaces, in Parallel Problem Solving from Nature, PPSN, V. A. E. Eiben, Ed. et al. Amsterdam: Springer, 1998, pp. 418427. [20] M. Gallagher, An empirical investigation of the user-parameters and performance of continuous PBIL algorithms [population-based incremental learning], in Proc. IEEE Signal Process. Soc. Workshop on Neural Netw.Signal Processing X, Dec. 1113, 2000, vol. 2, pp. 702710. [21] B. Yuan and M. Gallagher, Playing in continuous spaces: Some analysis and extension of population-based incremental learning, in Proc. IEEE Congr. Evol. Comput., Dec. 2003, vol. 1, pp. 443450. [22] M. Schmidt, K. Kristensen, and T. Randers Jensen, Adding genetics to the standard PBIL algorithm, in Proc. IEEE Congr. Evol. Comput., Jul. 69, 1999, vol. 2. [23] C. Gonzailez, J. A. Lozano, and P. Larranaga, Mathematical modeling of UMDA algorithm with tournament selection: Behavior on linear and quadratic functions, Int. J. Approximate Reasoning, vol. 31, no. 3, pp. 313340, 2002. [24] D. Y. Cho and B. T. Zhang, Continuous estimation of distribution algorithms with probabilistic principal component analysis, in Proc. IEEE Congr. Evol. Comput., May 2730, 2001, vol. 1, pp. 521526.

(A1) obtaining the straightforward update rule for the mean introduced in Fig. 2. Analogously, the standard deviation after tournament is dened as

(A2)

Substituting (A1) in (A2), we obtain equation (A3) at the top of the page. Expanding the squared terms in brackets, and after some straightforward manipulation, the latter equation can be rewritten as

(A4) which is the update rule for the standard deviation used in the rcGA in Fig. 2. ACKNOWLEDGMENT The authors wish to thank the anonymous reviewers, the associate editor, and the editor-in chief for their valuable suggestions.

MININNO et al.: REAL-VALUED COMPACT GENETIC ALGORITHMS FOR EMBEDDED MICROCONTROLLER OPTIMIZATION

219

[25] C. Yunpeng, X. Sun, and P. Jia, Probabilistic modeling for continuous EDA with Boltzmann selection and Kullback-Leibeler divergence, in Proc. GECCO, 8th Annu. Conf. Genetic Evol. Comput., 2006, vol. 1, pp. 389396. [26] J. C. Gallagher, S. Vigraham, and G. Kramer, A family of compact genetic algorithms for intrinsic evolvable hardware, IEEE Trans. Evol. Comput., vol. 8, pp. 111126, Apr. 2004. [27] P. J. Fleming and R. C. Purshouse, Evolutionary algorithms in control system engineering: A survey, Control Eng. Practice, vol. 10, pp. 12231241, 2002. [28] Y. Hong, Q. Ren, and J. Zeng, Adaptive population size for univariate marginal distribution algorithm, in Proc. IEEE Congr. Evol. Comput., Sep. 25, 2005, vol. 2, pp. 13961402. [29] T. Goslin, N. Jin, and E. Tsang, Population based incremental learning with guided mutation versus genetic algorithms: Iterated prisoners dilemma, Proc. IEEE Congr. Evol. Comput., vol. 1, pp. 958965, Sep. 25, 2005.

Francesco Cupertino was born in Italy on December 1972. He received the Laurea degree and the Ph.D. degree in electrical engineering from the Technical University of Bari, Bari, Italy, in 1997 and 2001, respectively. From 1999 to 2000, he was with the PEMC Research Group, University of Nottingham, Nottingham, U.K. Since July 2002, he has been an Assistant Professor with the Electrical and Electronic Engineering Department, Technical University of Bari. He teaches several courses in electrical drives at the Technical University of Bari. His main research interests cover the intelligent motion control, design, and fault diagnosis of electrical machines. He is the author or coauthor of more than 50 scientic papers on these topics.

Ernesto Mininno was born in Bari, Italy, on December 1977. He received the M.Sc. and Ph.D. degrees in electrical engineering from the Politecnico di Bari, Bari, in 2002 and 2007, respectively. Since December 2003, he has been with the Italian National Research Council (CNR) and Sintesi-scpa, working in the eld of industrial automation. He is also currently working with the Converters, Electrical Machines, and Drives Research Team at the Polytechnic of Bari. His main research interests focus on intelligent control of electrical machines and real-time control systems for industrial robotics

David Naso received the Laurea degree (Hons.) in electronic engineering and the Ph.D. degree in electrical engineering from the Polytechnic of Bari, Bari, Italy, in 1994 and 1998, respectively. He was a Guest Researcher with the Operation Research Institute, Technical University of Aachen, Aachen, Germany, in 1997. Since 1999, he has been an Assistant Professor of Automatic Control and Technical Head of the Robotics Laboratory at the Department of Electric and Electronic Engineering, Polytechnic of Bari. His research interests include computational intelligence and its application to control, industrial automation and robotics, numerical and combinatorial optimization, and distributed control of manufacturing systems. He is author of 78 journal and conference papers on these topics.

You might also like