Page 23 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 23

1. Artificial Intelligence                                        11

              The above operation defined as the simulation for rotating the roulette
           wheel and selecting the sector is repeated ‘L’ times for selecting ‘L’ values
           for the next generation. Note that the number corresponding to the big sector
           is having more chance for selection.
              The process of generating new set  of numbers  (ie) next generation
           population from existing set of numbers (ie) current generation population is
           repeated for many iteration.
              The Best value is chosen from the last generation corresponding to the
           maximum fitness value.

           2.2      Example


           Let us consider the optimization problem for maximizing the function f(x) =
           x+10*sin (5*x) +7*cos (4*x) +sin(x) ,subject to the constraint x varies from
           0 to 9.
              The numbers between 0 and 9 with the resolution of 0.001 are treated as
           the chromosomes used in the Genetic Algorithm. (ie) Float chromosomes are
           used in this  example. Population size of 10 chromosomes is  survived in
           every generation. Arithmetic cross over  is used as the genetic operator.
           Mutation operation is not used in this example Roulette Wheel selection is
           made at every generation. Algorithm flow is terminated after attaining the
           maximum number of iterations. In  this example Maximum  number of
           iterations used is 100.
              The Best solution for the above problem is obtained in the thirteenth
           generation using Genetic algorithm as 4.165 and the corresponding
           fitness function f(x) is computed as  8.443. Note that Genetic algorithm
           ends  up  with  local  maxima  as  shown  in  the  figure  1-5.  This  is  the
           drawback of the Genetic Algorithm. When you run the algorithm again, it
           may end up with Global maxima. The chromosomes generated randomly
           during the first generation affects the best solution obtained using genetic
           algorithm.
              Best chromosome at every  generation is collected. Best among  the
           collection is treated as  the  final  Best solution  which maximizes the
           function f(x).

           2.2.1     M-program for genetic algorithm

           The  Matlab  program  for  obtaining  the  best  solution  for  maximizing  the
           function  f(x)  =  x+10*sin  (5*x)  +7*cos  (4*x)  +sin(x)  using  Genetic
           Algorithm is given below.
   18   19   20   21   22   23   24   25   26   27   28