Evolutionary Algorithm (EA)
This page describes how the evolutionary algorithm (EA) of EvoAl represents candidates. The configuration of the algorithm, its operators, selections, and replacements are described in the section “Evolutionary Algorithm” of the Optimisation Language.
Mapping domain data to the EA
The genotype of the evolutionary-algorithm configuration maps the search variables to the
EA. A genotype consists of chromosomes; every search variable belongs to exactly one
chromosome, and a chromosome holds the genes of its variables:
classDiagram
class Genotype ["genotype"]
class Chromosome ["chromosome"]
class BitChromosome ["bit-chromosome"]
class GrayChromosome ["gray-chromosome"]
class DoubleChromosome ["double-chromosome"]
class IntegerChromosome ["integer-chromosome"]
class ModelChromosome ["model-chromosome"]
Genotype *-- "1..*" Chromosome : chromosomes
Chromosome : +data[] features
Chromosome : +recombination[] recombination
Chromosome : +mutation[] mutation
BitChromosome --|> Chromosome
BitChromosome : +int precision
GrayChromosome --|> Chromosome
GrayChromosome : +int precision
DoubleChromosome --|> Chromosome
IntegerChromosome --|> Chromosome
ModelChromosome --|> Chromosome
The genotype is required, and every chromosome lists its operators. Every search variable
that is not boolean needs a lower and an upper bound; in a model, every int and real attribute
needs both boundaries.
double-chromosome
A gene is the real value of one variable. Real-valued operators such as sbx-crossover,
blx-alpha-crossover, or gaussian-mutation apply to it.
integer-chromosome
A gene is the integer value of one variable. creep-mutation and random-reset-mutation
apply to it.
bit-chromosome
Maps boolean, integer-, and real-valued variables to bits: one bit per boolean and precision
bits (default 16) per integer or real variable, in standard binary code. A real value is
represented in fixed-point precision within its bounds, since the IEEE-754 representation is
not useful for this purpose. bit-flip-mutation applies to it.
gray-chromosome
Like bit-chromosome, but integer and real variables are encoded in
Gray code: neighbouring values differ in one bit,
which changes how mutations move through the search space.
model-chromosome
Holds structured search data (data 'policy' of instance policy in the DDL): one gene is the
whole model of one variable, a tree of objects whose classes come from DL types or from an Ecore
metamodel (see Structured Data). The
initial models come from 'random-population' with a tree method (see
Optimisers). Two kinds of
operators change the models:
- The value mutations change the attribute values of the objects:
random-reset-mutation(boolean, int, real and enum attributes),gaussian-mutationandpolynomial-mutation(real attributes of at least cardinal scale),creep-mutation(int and enum attributes of at least ordinal scale) andbit-flip-mutation(boolean attributes). An attribute without@Scaleis nominal. The default'gene-probability'1 / n counts the attribute values a mutation applies to. - The structural operators change the trees. A node is chosen uniformly or, with
'internal-node-probability'p, an inner node with probability p and a leaf with 1 - p (Koza’s 90/10 rule; Koza 1992, ISBN 0-262-11170-5):
| Operator | Change |
|---|---|
subtree-crossover |
the two children exchange a subtree of every model; each subtree fits the place of the other (strongly typed genetic programming, Montana 1995, https://doi.org/10.1162/evco.1995.3.2.199), the roots are not exchanged |
subtree-mutation { method := ...; } |
a node, the root included, is replaced by a new random tree of its type, built with method |
array-size-mutation { method := ...; } |
an array of every model gets one element more or less within its element counts; method builds new objects |
array-reorder-mutation |
two elements of an array of every model are exchanged |
The structural mutations change every model once and have no 'gene-probability'. The
operators keep no size or depth limit: the candidate checks 'maximum-size' and
'maximum-depth' test the new candidates and can repair them (see
Candidate Checks).
'model-chromosome' {
features := [data 'policy'];
recombination := [ 'subtree-crossover' { probability := 0.8; 'internal-node-probability' := 0.9; } ];
mutation := [
'subtree-mutation' { probability := 0.3; method := grow { 'maximum-depth' := 5; 'maximum-size' := 30; }; },
'random-reset-mutation' { probability := 0.5; }
];
}
Genetic Programming is a model search space whose models are expressions.
Operators of a chromosome
Every chromosome lists its recombination and mutation operators; an empty list means that
the chromosome is not recombined or not mutated. An operator that does not apply to the
representation of its chromosome is rejected. The algorithm has no operators of its own, and
there are no default operators.
The examples ea-basic (one double chromosome) and ea-mixed-genotype (Gray and integer chromosomes) show both ways; genetic-programming uses a model chromosome.