Pr Jan R Schnittger
249 Promenade des Anglais - 06200 Nice France
Phone 04.93.21.65.59,04.93.59.08.00, Fax : 04.93.71.03.91
Internet E-mail address : email@example.com
A Genetic Algorithm in Adaptive Controls.
A genetic algorithm,a neural network, may model either
an existing plant process or a virtual one with more desirable
Such a model may be part of an adaptive control or it could
detect process failures. In other cases it could replace the ac-
tions of a skilled operator. In every case the algorithm is sub-
ject to an input u(t) and its output ym(t) is compared to the out-
put y(t) of the actual (or virtual) system ,that is given the same
u(t). The difference (y - ym )2 is minimized over the whole input
sequence (Least Squares)
(1).Consider a first order nonlinear system described by a difference
equation and design a model that identifies the process.
(2).The second case is a second order well damped linear system
subject to an input u(t) equal to either sin( a*p*t ) or cos(a*p*t).
The output of the plant y(t) is obtained using the inverse Laplace
transform and the model is then made to simulate the plant output
The Gene Hunter genetic algorithm  is a program available to
use with Microsoft Excel in order to optimize a "Fitness Function".
The actual model is a first order nonlinear difference equation with
a few sinus and cosinus terms for which the coefficients are deter-
mined in both cases (1) and (2) by the least squares principle.
A First Order Model
A very primitive Fourier series has proved to be of inte-
rest. The input to the Model and the Plant is u(k). Obviously
the past value u(k-1) is also available.
The Model is a polynom x[(u(k)] + x[u(k-1)] and the coef-
ficients of the "Fourier" series are the means to adjust the
model to simulate the plant
We shall use the following model:
x(k) = a+b*cos[p *u(k)/2] + c*cos[ p*u(k)/4 ] + d*sin[ p*u(k)/2]
x(k-1) = a + f*cos[ p*u(k-1)/2] + g*cos[ p*u(k-1)/4] + h*sin[ p*u(k-1)/2 ]
There is a very practical reason for using only fractions of the input
u(k) in the model. The plant input is limited to be
sin(0.5*pi*t) < u(t) < sin(1*pi*t)
This implies that more terms with 2*u(k), 3*u(k), etc correspond to
higher harmonics not existing in the input to the system. They would
not be very helpful in the simulation of the plant.
Model =ym =[x(k) + x(k-1) ] # Plant[ y(k)] (2)
The genetic algorithm compares a time sequence of the y(k) values
to the model ym .The minimum value of the Sum[y(k) -ym(k)]2
is obtained by running across the time values and adjusting the coef-
i continously for each cycle, until the minimum is reached
The Diagram I is a schematic view of the modelling process.
By arranging the u(k), y(k)m ,y(k) and the difference [y(k)-ym(k)]2 in
parallel columns in an Excel program it is possible to survey the mini-
mizing process through a "Fitness" function that shows the instaneous
value of least squares value 
It is seen that the Model by using u(k),u(k-1)
both increases the
versatilty for adjustment to the Plant output and the possible anti-
cipation of the input (actual inputs tend to vary more or less gradually)
A First Order Nonlinear System.
The nonlinear plant is described by:
Y(k+1) = 0.8*y(k) + f[u(k)] (3)
The function f[u(k)] = (u-0.8)*u*(u+0.5) is unknown but it is
assumed that f may be modelled by a neural network 
We shall use the given model (1),(2).
It is desired that the plant (3) be operated with a suitable model
Further it is indicated that the function u is limitated to
The model should follow the equation (3) as closely as possible.
If this could be realized the problem is already solved, although
one may continue to actually display the development of (3).
Using 40 steps within the given u-interval one obtains a very
good solution (actually better than shown in ),see Diagram II.
Modelling a Second Order Linear System.
The Laplace transform (i.e. the presentation in the frequency
domain) of the Plant is taken to be:
G(s) = (2s+1)/(s² +3s+2) = -1/(s+1) +3/(s+2) (4)
It may be assumed that real u(k) inputs is similar to sinus and cosinus
functions,such that those would also demonstrate the typical
behavior of a real system.
In the case of u(k) being a step function with 1/s in the frequency
domain the time domain behavior of the G(s) for such an input
could be obtained by Partial Fraction method. The result in the
frequency domain is:
0.5/s +1/(s+1) -1.5/(s+2)
and in the time domain:
0.5+ exp[-t] -1.5exp[-2t]
However when u(k) is a trigonometric function this method is
no longer possible. Instead one could use the inverse Laplace
transform : t
y(t) = £-1 [F1 (s)*F2 (s)] = / f1 ( t )* f2 (t- t ) dt
F1 (s) is the frequency domain representation of
u(k) = sin (a t) resp. cos(a t). Hence F1(s) will be
a / (s² + a² ) or s / (s² + a² )
It follows directly from the G(s) = -1/(s+1) +3/(s+2)
that f1(t-t)= - exp[-(t-t)] + 3exp[-2(t-t)]
For the details see Appendix I.
Testing the Model for the Second Order Linear System
The model has nine coefficients that are controlled by
the genetic algorithm. Evidently by using also u(k-2)
u(k-3) etc one would further increase the adaptability.
The training of the ym(k) was done in four steps, each
including u(k) equal to sin(0.5*pi*),sin(pi*t),cos(0.5pi*t)
and cos(pi*t) respectively. It was found that the model
approached closely the plant output,Diagram III and IV
This is a primary condition,particularly when the model
is trained and tested for the same input u((k) sequence.
However it is desirable that the model could simulate
a sinus or a cosinus function at different frequencies
and without previous knowledge of which function
Therefore the model was finally trained on all four u(k) inputs
i.e. both sinus and cosinus functions in one and the same sequence.
Next the model was tested for sin(0.75*pi*t and cos(0.75*pi*t) ,
at a frequency in between those used for the training.
The sin(0.75*pi*t),Diagram V, had a least square (for n=20 values)
of L=0.07995. Therefore the standard deviation is
s = [ L/(n-1)]1/2 = [0.077995/19]1/2 =0.06487
For the cos(0.75*pi*t) L=0.16284 and s= 0.09261,DiagramVI
It is found from the diagrams that the agreement of the model out-
put to the plant is better for the sinus function than the cosinus.
Thus the Model may be viewed as a first attempt to simulate the
response of the second order system. There are several options to
improve the model; increasing the number of time steps, including
a u(k-2) input and adding more terms in the polynom (and hence
increased adaptability). This could possibly enlarge the frequency
spectrum of the input u(k).
A genetic algorithm has produced a model expressed as a polynom
in trigonometric functions, with coefficients that mimize the error
over several input functions u(k).
A definite advantage when compared to other approaches is that there
is no dependance on the algorithm for future applications. The poly-
nom may be numerized in calculating programs, microelectronics etc.
1. Ward Systems Group: Gene Hunter 
2. Lin,C.T. &Lee,C.S.G.: Neural Fuzzy Systems,p.455,Ex.16.2
3. Schaum's Outline Series:Feedback & Control Systems,p78.