Page 351 - Applied Numerical Methods Using MATLAB
P. 351

340    OPTIMIZATION

            Np = 30; %population size
            Nb = [12 12]; %the numbers of bits for representing each variable
            Pc = 0.5; Pm = 0.01; %Probability of crossover/mutation
            eta = 1; kmax = 100; %learning rate and the maximum # of iterations
            [xo_gen,fo_gen] = genetic(f,x0,l,u,Np,Nb,Pc,Pm,eta,kmax)




             HYBRID GENETIC ALGORITHM
             Step 0. Pick the initial guess x 0 = [x 01 ...x 0N ](N: the dimension of the vari-
                  able), the lower bound l = [l 1 .. .l N ], the upper bound u = [u 1 ... u N ],
                  the population size N p , the vector N b = [N b1 ... N bN ] consisting of the
                  numbers of bits assigned for the representation of each variable x i ,the
                  probability of crossover P c , the probability of mutation P m , the learn-
                  ing rate η(0 <η ≤ 1, to be made small/large for slow/fast learning),
                  and the maximum number of iterations k max > 0. Note that the dimen-
                  sions of x 0 , u,and l are all the same as N, which is the dimension
                  of the variable x to be found and the population size N p can not be
                  greater than 2 N b  in order to avoid duplicated chromosomes and should
                  be an even integer for constituting the mating pool in the crossover
                  stage.
             Step 1. Random Generation of Initial Population
                                    o
                              o
                      o
                 Set x = x 0 , f = f(x ) and construct in a random way the initial pop-
                  ulation array X 1 that consists of N p states (in the admissible region
                  bounded by u and l) including the initial state x 0 , by setting
                   X 1 (1) = x 0 and X 1 (k) = l + rand. (u − l)  for k = 2: Np  (7.1.26)
                                                ∗
                 where rand is a random vector of the same dimension N as x 0 , u,
                  and l. Then, encode each number of this population array into a binary
                  string by

                                  m−1        m
                        P 1 (n, 1 +    N bi :    N bi )
                                   i=1        i=1
                             = binary representation of X 1 (n, m) with N bm bits
                                        X 1 (n, m) − l(m)
                             = (2 N bm  − 1)
                                         u(m) − l(m)
                                for n = 1: N p and m = 1: N            (7.1.27)

                 so that the whole population array becomes a pool array, each row of
                  which is a chromosome represented by a binary string of  
 N  N bi bits.
                                                                   i=1
   346   347   348   349   350   351   352   353   354   355   356