Optimisers
EvoAl supports different optimisers, which are described in this section. While the algorithms work differently, they have common aspects. The following describes these common aspects, while the optimiser-specific aspects are described in the corresponding sub-pages: the Evolutionary Algorithm (EA), Particle Swarm Optimisation (PSO) and Genetic Programming (GP). The configuration of all algorithms, including local search, random search and CMA-ES, is described in the section Algorithms of the Optimisation Language.
flowchart TD
initial[Initial Population Generation]
fitness[Fitness Evaluation]
stopping[\Check stopping criteria/]
selection[Offspring Selection]
alteration[Alteration Process]
result[\Resulting Individual\]
initial --> fitness
fitness --> stopping
stopping -->|false| selection
selection --> alteration
alteration --> fitness
stopping -->|true| result
The following definitions show the common aspects of all algorithms:
abstract type algorithm extends configuration {
'initialisation' : instance 'initial-population';
'optimisation-function' : instance 'fitness-function';
'comparator' : instance comparator;
'stopping-criteria' : array instance 'stopping-criterion';
'fitness-pipeline' : array instance 'fitness-step' := [];
'candidate-checks' : array instance 'candidate-check' := [];
'constraint-measure' : instance 'constraint-measure' := 'exact-measure' {};
'evaluation-strategy' : instance 'evaluation-strategy' := 'single-evaluation' {};
}
| Attribute | Meaning |
|---|---|
'initialisation' |
where the initial candidates come from (see below) |
'optimisation-function' |
the function that evaluates a candidate, e.g. the problem’s function or a surrogate |
'comparator' |
how two candidates are compared by their fitness |
'stopping-criteria' |
when the run stops: after the first iteration in which one of them is satisfied |
'fitness-pipeline' |
further steps that compute the fitness from the objectives, e.g. a weighted sum or a constraint penalty |
'candidate-checks' |
tests of candidates with a reaction to a failure |
'constraint-measure' |
how far a candidate violates the constraints of the DDL |
'evaluation-strategy' |
how often a candidate is evaluated, e.g. several times for a noisy function |
The section Configuring an Algorithm of the Optimisation Language describes them in detail.
Running a Search in Parallel
EvoAl evaluates the candidates of an iteration on several threads. The number of threads
is set with the environment variable EVOAL_THREADS of the start scripts or with the
command-line option -Bcore:evaluation-threads=<n>; the default is the number of
processors:
EVOAL_THREADS=4 $EVOAL_HOME/bin/evoal-search.sh . search.ol output
The result does not depend on the number of threads: with the same seed (EVOAL_SEED),
a search gives the same output with 1 or 64 threads. Random search, particle swarm
optimisation and CMA-ES evaluate in parallel; local search evaluates one neighbour after the other.
Optimisation functions that are not thread-safe are evaluated one after the other. A
surrogate is thread-safe if its prediction pipeline is: every model of EvoAl, the
preparation steps with fitted parameters and 'model-prediction' are thread-safe; a
surrogate whose predicting use case contains another step is evaluated one after the
other. Details are in the README of de.evoal.optimisation.api.
Initial Population Generation
All population-based optimisation algorithms require an initial population. The generation of this population depends on your use case, and different strategies can be followed. The most straightforward approach is to generate the individuals randomly.
Random Initial Population (de.evoal.optimisation.core)
The random initial population will generate random individuals within the bounds of the DDL. Constraints between dimensions are not respected by the generator; the algorithm handles them, e.g., with a 'constraint-check' (see the Optimisation Language). A numeric value is drawn uniformly within the boundaries of its data, within the range of its type if it has none; a boolean or an enum literal is drawn uniformly.
Structured data in the search space (data 'policy' of instance policy in the DDL) is a model: the population builds a random tree of instances of the DL type, its subtypes and the types of its attributes with the method. The concrete subtype of an attribute of an abstract type is drawn among the subtypes in the loaded DL modules that fit the limits, by the 'subtype-weights' of the method or uniformly without weights, the number of elements of an array within its @MinimumNumberOfElements and @MaximumNumberOfElements, a number within its @LowerBoundary and @UpperBoundary (see Annotations of model attributes). A model must not contain attributes of the types string, data, path, expression or literal, arrays without @MaximumNumberOfElements or multi-dimensional arrays; the run reports every such attribute before it starts. The methods are the initialisation methods of tree-based genetic programming (Koza 1992; Poli, Langdon and McPhee 2008, section 2.2): the root has depth 0, every contained instance one more than its container.
| Method | Trees |
|---|---|
grow { 'maximum-depth' := d; } |
every instance that fits the depth limit may be chosen, so branches may end early |
full { 'maximum-depth' := d; } |
as long as the depth limit can be reached, only instances that can reach it are chosen, optional attributes are set and arrays get at least one element |
'ramped-half-and-half' { 'minimum-depth' := a; 'maximum-depth' := b; } |
the depth limits from a to b in turn, each for one full and one grow tree |
All methods take 'maximum-size' (the largest number of instances of a model, no limit if not given) and 'optional-probability' (the probability that an optional attribute gets a value; required if the model has optional attributes). There are no default values; Koza used ramped half-and-half with the depths 2 to 6.
All methods also take 'subtype-weights': a class is drawn with a probability proportional to its weight. A 'subtype-weight' names a class or a supertype as the memory model writes it (the qualified DL name, <nsURI>#//<class> for a class of an .ecore file). The weight of a class is the one of the nearest named type among the class and its supertypes, 1 if none is named, and a class of weight 0 is never created. Every method states its own weights, e.g. the method of 'random-population' and the one of 'subtree-mutation'. The repairs of the candidate checks 'maximum-depth' and 'maximum-size' do not know the weights: they may insert an excluded class that ends a branch, and EvoAl warns about it when the configuration is loaded.
method := grow {
'maximum-depth' := 4;
'subtype-weights' := [
'subtype-weight' { subtype := "de.evoal.optimisation.gp.genetic-programming.protected-square-root"; weight := 0.0; },
'subtype-weight' { subtype := "de.evoal.optimisation.gp.genetic-programming.constant"; weight := 2.0; }
];
};
'initialisation' := 'random-population' {
method := 'ramped-half-and-half' { 'minimum-depth' := 5; 'maximum-depth' := 7; 'maximum-size' := 60; };
};
The classes of a model can also come from an Ecore metamodel (@EcoreType, see the Data Definition Language); the population then draws among the concrete subclasses of all its files, the multiplicities of the metamodel and the boundaries of the facets of its data types.
The memory model writes a model as a tree ({"type": …, "values": {…}}, the type of a metamodel class as <nsURI>#//<class>); model-xmi writes the models of a metamodel as XMI files; the CSV writers of the candidates reject a search space with structured data.
Training Population (de.evoal.surrogate.optimisation)
If you are working with a black box optimisation function you have trained, you can use the training data as individuals of the initial population. If your search space has many constraints, this might be a better starting point than random individuals. The candidates are drawn at random, with repetition, from the training data in 'training-file'. Without 'training-file', the population uses the training data of the run, given on the command line with -Bsurrogate:training-data-file=<file-name> (the fifth argument of evoal-search-with-surrogate.sh) and read once per run; this is the only place where a run setting instead of the configuration decides what runs. Without both, the configuration is rejected at start. It can also be the 'replacement-source' of a candidate check. The specification of the training data-based initial population generator is the following:
type 'training-population' extends 'initial-population' {
/**
* The file with the training data.
*/
'training-file' : optional string;
}