\section{GA based filter selection}\label{genetic} \vspace{1ex}%\noindent
To  test  the use of GAs for filter selection, we take in this
work a special case of the system (\ref{x})-(\ref{u}) known as
trackers and designed to regulate the tracking error $e(t_i)$ to
zero, with the following notations where ``p'' stands for
``plant'' and ``r'' for ``reference signal'':
\begin{equation}
  \begin{array}{l}
     x=
     \left[\begin{array}{c}
             x_{\mathrm{p}}\\
             x_{\mathrm{r}}\\
           \end{array}\right]\in \Rset^2, \quad
     \Phi_{\theta}=\Phi_0=
           \left[\begin{array}{cc}
             \Phi_{\mathrm{p}}&0\\
             0&\Phi_{\mathrm{r}}\\
           \end{array}\right] \\ \\
         \Psi_{\theta}=\Psi_0=
           \left[\begin{array}{c}
             \Psi_{\mathrm{p}}\\
             0\\
           \end{array}\right], \quad
     Q_{\theta}=
           \left[\begin{array}{cc}
             Q_{\mathrm{p}}&0\\
             0&Q_{\mathrm{r}}\\
           \end{array}\right] \\ \\
         H_{\theta}=H_0=
           \left[\begin{array}{cc}
             H_{\mathrm{p}}&0\\
             0&C_{\mathrm{r}}\\
           \end{array}\right],\quad
     R_{\theta}=
           \left[\begin{array}{cc}
             R_{\mathrm{p}}&0\\
             0&R_{\mathrm{r}}\\
           \end{array}\right]\\ \\
     e(t_i)=C_{\mathrm{p}} x_{\mathrm{p}}(t_i)-C_{\mathrm{r}} x_{\mathrm{r}}(t_i)      \\ \\
     u(t_i)=-G_{\mathrm{p}} \hat x_{0\mathrm{p}}(t^{+}_{i})-G_{\mathrm{r}} \hat x_{0\mathrm{r}}(t^{+}_{i})
  \end{array} \nonumber
\end{equation}

For  simulation,  the tracker described in
\cite{maybeck:1982} has been chosen where
\[
\begin{array}{llll}
\Phi_{\mathrm{p}}=0.82,&\Phi_{\mathrm{r}}=0.61,&\Psi_{\mathrm{p}}=0.18,&C_{\mathrm{p}}=1\\[1ex]
C_{\mathrm{r}}=1,&G_{\mathrm{p}}=0.36,& G_{\mathrm{r}}=-0.19&
\end{array}
\]
For  the Kalman filter design, we have
\begin{eqnarray*}
&H_{\mathrm{p}}=1,\quad Q_{\mathrm{p}}=0.084\sigma^{2}_{\mathrm{p}},\quad Q_{\mathrm{r}}=0.63\sigma_{\mathrm{r}}^{2} \\
&\sigma^2_{\mathrm{p}}=var,\quad \sigma_{\mathrm{r}}^2= var,\quad R_{\mathrm{p}}= var,\quad R_{\mathrm{r}}= var
\end{eqnarray*}
where ``var'' stands  for the variable quantities. In this example
the design parameter $\hat K = [\hat K_{\mathrm{p}} \bigm| \hat
K_{\mathrm{r}}]^T$ is a pair of real numbers each belongs to $(0;
1)$.

The  basic element  processed  by a GA is the string (chromosome)
formed by concatenating a substring (gene) each of which is a
binary code of  a parameter of search space
\cite{kristinsson:1992}. Thus each string represents a
possible solution to the problem. The GA works with a set of
strings, called the population. This population then evolves from
generation to generation through the application of genetic
operators. A GA in its simplest form uses three operators:
Selection, Crossover and Mutation.

We investigate  the following possibilities to construct
the genetic operators:\\[-1ex]

\emph{ENCODING}

{1.} A chromosome  is a binary code of the fractional part of
$\hat K$ . For example, $1011$ represents
    $\hat K = 1 \cdot 2^{-1}+0 \cdot 2^{-2}+1 \cdot 2^{-3}+1 \cdot 2^{-4}= 0.6875$.

{2.} A chromosome is a binary code. The range $(0; 1)$ is divided
by $2^l-1$ intervals where $l$ is the chromosome length. Each
interval has a number represented by binary code. The parameter is
the middle point of the interval representing the chromosome.

{3.} A chromosome is a Gray code. The range $(0; 1)$ is divided by
$2^l-1$ intervals, where $l$ is the chromosome length. Each
interval has a number represented by Gray code. The parameter is
the middle point of the interval representing the chromosome.\\[-1ex]

\emph{FITNESS FUNCTION}

The method used in (\ref{d}) is sometimes called ``polar
correlator'' method. We extend the use of it to include the
fitness function $F(k)$ construction as follows:

{1.} $\forall k=1,2,\dots, K; \, j=1,2,\dots, p$ \; compute
\[ \ \delta_{j}^{k}=\left|  0.5- \frac{n_{j}^{k}}{M}\right| \]

{2.} $\forall k=1,2,\dots, K$ \,  compute
\[ \delta_{k}= \sum_{j=1}^{p}\delta_{j}^{k} \]

{3.} Find \[\Delta = \max_{k}\delta_{k}\]

{4.} $\forall k=1,2,\dots, K$ \, obtain
\[ F(k)=\left[ -\delta_{k} + \Delta + 0.1  \right]\times 10\]


The  $F(k)$  is assigned to each individual  $k$  in the
population where high values mean good fit. The  assignment
is made at the end of a sample with number $l=1,2,\dots, L$,
each sample of size $M$. \\[-1ex]

\emph{ SELECTION}

There are a number of ways to do selection.

{1.}  \textsl{Roulette wheel}. Each  individual is  represented by
a space that proportionally corresponds to its fitness. By
repeatedly spinning the roulette wheel, individuals are chosen
using ``stochastic sampling with replacement'' to fill the
intermediate population.

{2.} \textsl{Remainder} \textsl{stochastic} \textsl{sampling}.
For each string $k$ where $F(k)/\bar{F}$ is greater than $1.0$
($\bar{F}$ is the average fitness), the integer portion of this
number indicates how many copies of that string are directly
placed in the intermediate population. All strings (including
those with $F(k)/\bar{F}$ less than 1.0) then place additional
copies in the intermediate population with a probability
corresponding to the fractional portion of $F(k)/\bar{F}$. For
example, a string with $F(k)/\bar{F}= 1.36$ places one copy in the
intermediate population, and then receives a $0.36$ chance of
placing the second copy. A string with $F(k)/\bar{F}= 0.54$ has a
$0.54$ chance of placing one string in the
intermediate population.\\[-1ex]

\emph{ELITISM}

Elite factor is a number of chromosomes passing from current
population into future population without any operations
%(selection-crossover-mutation)
as being the best ones.\\[-1ex]

\emph{CROSSOVER}

The  main operator to work on the parents is crossover, which is
applied with a certain probability, called crossover rate $p_c$
(in our case $p_c=1$).\\[-1ex]

{1.} \textsl{Single-point crossover}. The  crossover takes two
individuals from intermediate population, and cuts their
chromosome strings at some randomly chosen position, to produce
two ``head'' segments, and two ``tail'' segments. The tail
segments are then swapped over to produce two new full length
chromosomes:
$$
\left\{
    \begin{array}{c}
      000\vdots 0000\\
      111\vdots 1111
    \end{array}
  \times\Rightarrow
    \begin{array}{c}
      0001111\\ \\
      1110000
    \end{array}
\right.
$$

{2.} \textsl{Two-point crossover}.  This operator uses  two
randomly chosen crossover points. Strings exchange the segment
that falls between these two points:
$$
\left\{
    \begin{array}{c}
      00\vdots 000\vdots 00\\
      11\vdots 111\vdots 11
    \end{array}
  \times\Rightarrow
    \begin{array}{c}
      0011100\\ \\
      1100011
    \end{array}
\right.
$$

{3.} \textsl{Uniform crossover}. Each  gene in the offspring is
created by copying the corresponding gene from one or the other
parent, chosen according to a randomly generated crossover mask.
Where there is a 1 in the crossover mask, the gene is copied from
the first parent, and where there is a 0 in the mask, the gene is
copied from the second parent. A new crossover mask is randomly
generated for each pair of parents.
$$
 \begin{array}{lc}
 \mbox{mask}&1001011\\
 \mbox{parent 1}&0000000\\
 &\downarrow \ \ \ \downarrow \ \ \downarrow\downarrow\\
 \mbox{offspring}&0110100\\
 &\ \uparrow\uparrow\ \uparrow\ \ \ \\\
 \mbox{parent 2}&1111111
 \end{array}
$$\\[-1ex]

\emph{MUTATION}

Mutation is applied to  each child individually after crossover.
It randomly alters each gene with a small probability (typically
0.001). Following example shows the third gene of the chromosome
being mutated.
$$
    \begin{array}{c}
      00\vdots 0\vdots 00\\
      \end{array}
  \Rightarrow
    \begin{array}{c}
      00\vdots 1\vdots 00\\
    \end{array}
$$
%************************************************************
