212 Genetic Algorithm Implementation Using Matlab
These data structures are discussed in the following subsections.
8.2.1 Chromosomes
The chromosomedata structure stores an entire populationin a single matrix of sizeNind
×
Lind, where Nind is the number of individuals in the population and Lindis the length of the genotypic representation of those individuals. Each row corre-sponds to an individual’s genotype, consisting of base-
n
, typically binary, values.Chrom
=
⎡⎢⎢⎢⎢⎣
g
1
,
1
g
1
,
2
g
1
,
3
···
g
1
,
Lind
g
2
,
1
g
2
,
2
g
2
,
3
···
g
2
,
Lind
g
3
,
1
g
3
,
2
g
3
,
3
···
g
3
,
Lind
· · · ··· ·
g
Nind
,
1
g
Nind
,
2
g
Nind
,
3
···
g
Nind
,
Lind
⎤⎥⎥⎥⎥⎦
individual 1individual 2individual 3
·
individual NindThis data representation does not force a structure on the chromosome structure,only requiring that all chromosomes are of equal length. Thus, structured popula-tions or populationswith varying genotypicbases may be used in the Genetic Algo-rithm Toolbox provided that a suitable decoding function, mapping chromosomesonto phenotypes, is employed.
8.2.2 Phenotypes
The decision variables, or phenotypes, in the genetic algorithm are obtained by ap-plying some mapping from the chromosome representation into the decision vari-able space. Here, each string contained in the chromosome structure decodes to arowvectoroforder
Nvar
,accordingtothenumberofdimensionsin thesearchspaceand corresponding to the decision variable vector value. The decision variables arestored in a numerical matrix of size
Nind
×
Nvar
. Again, each row corresponds toa particular individual’s phenotype. An example of the phenotype data structure isgivenbelow,where bin2realis used to representan arbitraryfunction,possiblyfromthe GA Toolbox, mapping the genotypes onto the phenotypes.
Phen = bin2real(Chrom) % map genotype to phenotype
=
⎡⎢⎢⎢⎢⎣
x
1
,
1
x
1
,
2
x
1
,
3
···
x
1
,
Nvar
x
2
,
1
x
2
,
2
x
2
,
3
···
x
2
,
Nvar
x
3
,
1
x
3
,
2
x
3
,
3
···
x
3
,
Nvar
· · · ··· ·
x
Nind
,
1
x
Nind
,
2
x
Nind
,
3
···
x
Nind
,
Nvar
⎤⎥⎥⎥⎥⎦
individual 1individual 2individual 3
·
individual NindThe actual mapping between the chromosome representation and their phenotypicvalues depends upon the bin2real function used. It is perfectly feasible using this
Add a Comment
deleted_fbuser_1314681558left a comment
deleted_fbuser_1320291129left a comment
nocturnokleft a comment