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

5 Overview of GEA Toolbox Structure

The GEATbx is build around a layer model. Figure 5-1 gives a first overview of the layers used for the GEATbx.

Fig. 5-1: Layer model of the GEATbx

Central point is the Main function (geamain2). This function is called from the user interface (Demo functions, for instance, demofun1, demogeatbx). The Toolbox functions define default parameters for a number of different evolutionary algorithms. The Main function calls all necessary evolutionary operators. The call of evolutionary operators is done by a high-level layer calling the low-level layer. The Main function also calls the objective function. Additionally, the Main function performs nearly all the data management and result collection.

Figure 5-2 shows the full structure of the GEATbx using the names of the corresponding m-functions. Even in this detailed view the layer model is visible. Center of the toolbox is the Main function geamain2. The Main function is called by the Demo functions. The Demo functions get parameter sets of predefined algorithms via the Toolbox functions (tbx3*, tbx3real, tbx3bin, tbx3es1). The Main function calls the high-level operators (selection, recombin, mutate). The high-level operators call the low-level operators (selsus, recdis, mutreal). This layer model not only provides a good overview of the structure of the GEATbx. It makes the extension of the toolbox by new operators or special functions straightforward.

In this structure there are two main points of user input; the objective function and the demo function.. On the one hand the user must provide an objective function implementing its problem to solve. This task is described in Chapter 3. On the other hand the user must define the evolutionary algorithm to employ and define none, some or many of the provided options of the GEATbx. This can done in one central place. All the provided examples of the GEATbx are called demo functions and can be used as a starting point.

5.1 Naming Convention

Throughout the GEATbx the functions are named according to the following conventions.

Tab. 5-1: Naming convention of the GEATbx

 Präfix group of functions or operators demo high-level demo functions (set of options for a special problem, often used as demonstration) tbx3 high-level toolbox algorithms (define a special evolutionary algorithm of the toolbox) init initialization functions sel low-level selection operators rec low-level recombination operators mut low-level mutation operators reins low-level reinsertion operators obj mobj sim objective functions (implement a special problem) multi-objective functions simulation function (called by corresponding objective function) plot application specific plot functions

5.2 Calling Tree

Fig. 5-2: Calling tree of the Genetic and Evolutionary Algorithm Toolbox (GEATbx)

5.3 Demo / Startup function

At the beginning there is a high-level function for defining some parameters and the application specific details. These functions are called demo function (demo*.m).

• demofun1 (demo solving objfun1, employs an EA for real valued parameters),
• demofun2 (demo solving objfun2, employs an EA with ES as mutation operator),
• demogeatbx (simple menu driven demo to more than 15 objective functions and 3 different EA).

Inside a demo function all parameters of the EA and the optimization process can be defined. Every aspect of the behavior of the GEATbx can be controlled from the outside via parameters set in the demo functions. Thus, all things necessary to define a large optimization or to define special demonstrations are provided by the demo functions. This is the ideal point to define tailored parameter sets for public demonstrations, demos during lectures or to present special aspects of a large system.

5.4 Toolbox functions (Predefined algorithms)

The GEATbx contains a number of predefined EA. They are not more than a set of parameter options defined in a Toolbox function (tbx3*.m). The whole process of option setting, the meaning of the options and more is described in the document Parameter options of the GEATbx.

Examples of toolbox functions:

• tbx3real / tbx3int / tbx3bin (parameter for real / integer / binary valued variables),
• tbx3es1 (implements an evolution strategy),
• tbx3comp (switches migration and competition on),
• tbx3perm (implements a simple permutation / ordering EA),
• tbx3sga (implements the Simple Genetic Algorithm SGA),
• tbx3output (combines a number of options relevant for textual and graphical output).

By using one of these functions the respective options are set at ones. This makes reading the demo functions easier. And the options set defined in the toolbox functions can be reused by other optimizations. Further parameters can be set in the demo functions, even the ones provided by the toolbox function overwritten. All options not defined are set automatically inside the main function geamain2 by calling geaoptset, checking the validity of the options at the same time.

5.5 Evolutionary Algorithm - Main function

The demo functions call the working horse of the GEATbx:

Here all the administrative work is done: resolve parameter values, initialize the population, run the evolutionary algorithm including call of the objective function, and display and saving the results.

5.5.1 Initialization

The initialization is done by:

• initpop (high-level initialization function, initializes a whole population, includes user provided individuals, employs randomization of provided individuals and handles other aspects of initialization/inoculation),

which calls the representation specific low-level initialization functions:

• initrp (initializes a population using real values),
• initip (initializes a population using integer values),
• initbp (initializes a population using binary values).

An application specific initialization function (for instance initdopi) may also be employed. However, the already created/initialized individuals can be directly input to the main function (4th input parameter) via the demo function. The high-level initialization function initpop handles all aspects of population size, additional randomization or inclusion of randomly generated individuals.

5.5.2 Generational loop of the EA

As soon as the population of individuals is initialized and evaluated, the evolutionary algorithm starts. For as many generations as necessary/defined, new populations are produced and evaluated. All functions of the evolutionary algorithm are called via high-level functions, thus supporting the multi-population (distributed) concept.

Inside the high-level functions the appropriate functions are called.

5.5.3 Fitness assignment by ranking

For fitness assignment by ranking the toolbox provides one function, no low-level functions are used:

• ranking (linear and non-linear ranking; single- and multi-objective ranking).

Low-level functions are only used for multi-objective ranking, especially GOAL attainment and sharing:

• rankgoal (perform goal preference calculation between multiple objective values),
• rankplt (RANK two multi objective values Partially Less Than),
• rankshare (SHARing between individuals).

5.5.4 Selection

For selection a high-level function is provided:

By parameter low-level selection functions can be chosen, which will be called for the subpopulations inside the high-level function:

5.5.5 Recombination/Crossover

For recombination/crossover a high-level function is provided:

• recombin (high-level recombination/crossover function)

By parameter low-level recombination/crossover functions can be chosen which will be called for the subpopulations inside the high-level function. The term recombination is now used for all recombination functions (other publications use the term crossover to refer to recombination of binary valued variables).

Recombination for all parameter optimizations:

Recombination for real valued parameter optimizations:

Recombination for binary valued parameter optimizations (all implemented in recmp, they are special cases of discrete recombination):

• recsp (single point crossover),
• recdp (double point crossover),
• recsh (shuffle point crossover),
• recsprs (single point crossover with reduced surrogate),
• recdprs (double point crossover with reduced surrogate),
• recshrs (shuffle point crossover with reduced surrogate).

Currently, for integer valued parameter optimizations recdis must be used.

Recombination for permutation/ordering/combinatorial optimizations:

• recgp (generalized position crossover/recombination),
• recpm (partial matching crossover/recombination).

5.5.6 Mutation

For mutation a high-level function is provided:

• mutate (high-level mutation function)

Depending on the variable representation one of the low-level mutation functions will be called for every subpopulation:

Real values:

• mutreal (mutation operator for real values)

Integer values:

• mutint (mutation operator for integer values)

Binary values:

• mutbin (mutation operator for binary values)

For real valued representation a number of additional mutation functions are provided. These functions use the mutation operators of evolution strategies. Thus, an adaptation of strategy parameters takes place.

Evolution strategy mutation operators:

• mutes1 (adaptation of mutation step sizes),
• mutes2 (adaptation of mutation step sizes and another set of strategy parameters).

Mutation for permutation/ordering/combinatorial optimizations (all implemented in mutcomb):

5.5.7 Evaluation

The toolbox provides many examples for objective functions. These functions are called "obj*.m". All functions use the same calling syntax.

Standard evolutionary algorithm test functions with a free definable dimension using the real valued representation are provided in:

Binary valued representation is used in:

Dynamic optimization is implemented in:

Standard optimization test functions with 2 independent variables (dimension = 2) are provided in:

A number of multi-objective functions are also provided:

A rudimentary interface to the tsp-lib is also provided (not fully implemented, take it as a starting point and send me your extended implementation):

• objtsplib (interface to the tsp-lib, see subdirectory objfun/tsp).

See M-functions - Index (part of online documentation) for all functions or Examples of objective functions (part of online documentation) for a mathematical description.

It is possible to pass any number of additional parameters to the objective function, as long as the respective objective function can handle them. These parameters can be defined or loaded in the demo function and send as 5th parameter (and more) to geamain2. All these parameters are directly passed to the objective functions. This can be used to optimize a special aspect of the objective function or to define one or multiple parameter sets inside the objective function.

Instead of writing an objective function file and passing the name of the function, the objective function can be passed directly in a string to the main function as well. However, it is recommended to use one of the provided objective functions as a template and pass over only the file name.

5.5.8 Reinsertion

For reinsertion the toolbox provides a high-level function:

• reins (reinsertion of offspring into population).

Depending on the used population model (global/regional or local), a corresponding low-level reinsertion function is called from inside the high-level reinsertion function.

Low-level reinsertion functions:

• reinsreg (global/regional reinsertion of offspring into population),
• reinsloc (local reinsertion of offspring into population).

5.5.9 Migration

For migration the toolbox provides 1 function, no low-level functions are used:

• migrate (migration of individuals between subpopulations).

5.5.10 Competition

For competition between subpopulations the toolbox provides 1 function, no low-level functions are used:

• compete (competition between subpopulations).

5.5.11 Visualization

The visualization of the results is implemented on 3 different levels:

• tabular output of results of evolutionary algorithm (geaoptprint - pretty printed output of the options; gearunstatus - pretty printed output of the results of one generation),
• graphical output of results of evolutionary algorithm (resplot),
• problem specific output (specific m-file, for instance plotdopi for objdopi).

5.6 Utility functions

Throughout the toolbox low-level utility functions are used. They are useful for everyday work as well:

• compdiv (compute diverse things),
• comploc (compute stuff for the local model),
• compplot (compute stuff for plotting and visualization),
• chkbound (check boundaries and reset variables outside the boundaries),
• savebindata (save matlab variables using a provided name into one mat file),
• plotstd (set standard options for a new figure, used in all plot functions)
• expandm (expand a matrix),
• prprintf (pretty printed output),
• deblankall (deblank both sides of a string),
• findfiles (find files inside multiple directory and file search masks including wildcard),
• menutext (same as menu, but without graphical stuff, thus, can be compiled).

For the handling of the options structure a few special functions are provided:

• geaoptset (set a GEAOpt option),
• geaoptsave (save a GEAOpt structure into a m-file or a text file),
• geaoptload (load GEA Options from a text file into a GEAOpt structure).

 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.