GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com

# 8 Data Structures of the GEATbx

Nearly all data structures of the GEATbx are mapped to 2-D matrizes.

The used data structures in the GEATbx:

• Chromosomes (genotype / individuals)
• Phenotype (decision variables / individuals)
• Objective function values (objective values)
• Fitness values

Remark:

Many problems don't need a mapping from the chromosome to phenotype structure. For instance, if the variables are real valued and the evolutionary algorithm works with this real valued variables, there is no mapping necessary. Similar for binary variables and an evolutionary algorithm that uses binary variables. Then, chromosomes and phenotypes are identical. Thus, throughout the whole documentation the term individual is used for both, chromosomes and phenotypes. Only if differentiation is necessary between both, the original terms will be used. Please read the section about Variable Representation, Chapter 4 for more information as well.

## 8.1 Chromosomes (genotype / individuals)

The chromosome data structure stores an entire population in a single matrix of size Nind x Lind, where Nind is the number of individuals in the population and Lind is the length of the genotypic representation of those individuals (for integer and real valued representation Lind is 1, that means, genotype and phenotype are identical). Each row corresponds to an individual's genotype, consisting of binary, integer or real values.

An example of the chromosome structure

```Chrom = g1,1     g1,2     g1,3    ...  g1,Lind        individual 1
g2,1     g2,2     g2,3    ...  g2,Lind        individual 2
g3,1     g3,2     g3,3    ...  g3,Lind        individual 3
.       .       .     ...   .
gNind,1   gNind,2   gNind,3   ...  gNind,Lind     individual Nind```

This data representation does not force a structure on the chromosome structure, only requiring that all chromosomes are of equal length. Thus, structured populations or populations with varying genotypic bases may be used in the GEATbx. However, a suitable decoding function, mapping chromosomes onto phenotypes, must be employed.

## 8.2 Phenotypes (decision variables / individuals)

The decision variables (phenotypes) in the evolutionary algorithm are obtained by applying some mapping from the chromosome representation into the decision variable space. Here, each string contained in the chromosome structure decodes to a row vector of order Nvar, according to the number of dimensions in the search space and corresponding to the decision variable vector value.

The decision variables are stored in a numerical matrix of size Nind x Nvar. Again, each row corresponds to a particular individual's phenotype. An example of the phenotype data structure is given below, where bin2real is used to represent a decoding function mapping the genotypes onto the phenotypes.

```Phen = bin2real(Chrom)    % map genotype to phenotype
Phen = x1,1     x1,2     x1,3    ...  x1,Nvar        individual 1
x2,1     x2,2     x2,3    ...  x2,Nvar        individual 2
x3,1     x3,2     x3,3    ...  x3,Nvar        individual 3
.       .       .     ...   .
xNind,1   xNind,2   xNind,3   ...  xNind,Nvar     individual Nind```

The actual mapping between the chromosome representation and their phenotypic values depends upon the decode function used. It is perfectly feasible using this representation to have vectors of decision variables of different types. For example, it is possible to mix integer, real-valued, and binary decision variables in the same Phen data structure.

## 8.3 Objective function values

An objective function is used to evaluate the performance of the phenotypes in the problem domain. Objective function values can be scalar or, in the case of multiobjective problems, vectors. Note that objective function values are not necessarily the same as fitness values.

Objective function values are stored in a numerical matrix of size Nind·Nobj, where Nobj is the number of objectives. Each row corresponds to a particular individual's objective vector. An example of the objective function values data structure is shown below, with mobjfonseca2 representing an example multiobjective function.

```ObjV = mobjfonseca2(Phen)     % objective function
ObjV = y1,1     y1,2     y1,3    ...  y1,Nobj        individual 1
y2,1     y2,2     y2,3    ...  y2,Nobj        individual 2
y3,1     y3,2     y3,3    ...  y3,Nobj        individual 3
.       .       .     ...   .
yNind,1   yNind,2   yNind,3   ...  yNind,Nobj     individual Nind```

## 8.4 Fitness values

Fitness values are derived from the objective function values through a scaling or ranking function. Fitness values are non-negative scalars and are stored in column vectors of length Nind, an example of which is shown below. ranking is a fitness function contained in the GEATbx.

```Fitn = ranking(ObjV)     % fitness function
Fitn = f1     individual 1
f2     individual 2
f3     individual 3
...
fNind   individual Nind```

Note that for multiobjective functions, the fitness of a particular individual is a function of a vector of objective function values. Multiobjective problems are characterized by having no single unique solution, but a family of equally fit solutions with different values of decision variables. Care should therefore be taken to adopt some mechanism to ensure that the population is able to evolve the set of Pareto optimal solutions.

## 8.5 Multiple subpopulations

The GEATbx supports the use of a single population divided into a number of subpopulations or demes by modifying the use of data structures so that subpopulations are stored in contiguous blocks within a single matrix. For example, the chromosome data structure, Chrom, composed of Subpop subpopulations, each of length N individuals Ind, is stored as:

```Chrom =     ...
Ind1 Subpop1
Ind2 Subpop1
...
IndN Subpop1
Ind1 Subpop2
Ind2 Subpop2
...
IndN Subpop2
...
Ind1 SubpopSubpop
Ind2 SubpopSubpop
...
IndN SubpopSubpop```

This is known as the regional model, also called migration or island model.

 GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com

This document is part of version 3.8 of the GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with Matlab - www.geatbx.com.
The Genetic and Evolutionary Algorithm Toolbox is not public domain.