GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions 

GEATbx: Tutorial 2 Quick Start

Previous PageTable Of ContentsIndexList Of FiguresNext Page

2 Quick Start

The Genetic and Evolutionary Algorithm Toolbox (GEATbx) is modularized. For all parameters default values depending on the size of the problem are defined.

A very simple objective function is x^2. This function is one of the example functions of the GEATbx and implemented in the m-file objfun1.

To minimize this function for x in [-5,5] for 2 dimensions the Matlab call will be:

The toolbox function tbxmpga implements the Multi Population Evolutionary Algorithm. The first parameter is the name of the objective function.

The second parameter contains the options vector of the GEATbx. Here, only the first option is used. The first option defines the output of results during the optimization. Setting it to 1 prints the results in tabular format in the command window after every generation (identical to Optimization Toolbox). All remaining options will be set internally to useful default values.

The third parameter defines the lower bound of the variable and parameter four the upper bound. After waiting a few seconds or minutes (depends on the used computer) the function returns the best found individual (the values of the variables). For the x^2 example, the optimum is 0 (zero) for all variables, thus very small values are returned:

A direct input of the function definition for this simple example is possible as well:

x includes the actual variable values. Take care of the multiple individuals used by the evolutionary algorithm - therefore x.^2 and not x^2!

The example can easily be expanded to higher dimensions. Let's minimize in 4 dimensions. By defining 4 lower and upper bounds, the dimension of the problem is defined.

An implementation of the x^2 objective function can be:

Using this function the minimization would be started with:

Until now only default parameters were used. However, using different parameter values the behavior of the evolutionary algorithm can be changed easily. The table of GEATbx Options gives an overview of the parameters and describes them in detail.

For changing the option values it is easier to define the options vector forehand and provide it as a parameter:

The maximal number of generations is set to 50 and the evolutionary algorithm runs with 2 subpopulations and 15 individuals each. The results are plotted in graphical form as well.

The function tbxmpga is nothing more than a function setting some of the options to special values, thus defining a special evolutionary algorithm. Other examples are tbxdbga and tbxdbin.

The shown examples will be sufficient for the first steps using the Genetic and Evolutionary Algorithm Toolbox. The next step will be to learn about writing an objective function, see Chapter 4, and how to handle the different representations of variables in the objective function and the evolutionary algorithm, see Chapter 3.

For a brief overview of the structure of the toolbox look at the calling tree, see Chapter 5 of the toolbox.

Previous PageTop Of PageTable Of ContentsIndexList Of FiguresNext Page

GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions 

This document is part of version 3.3 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.
© 1994-2000 Hartmut Pohlheim, All Rights Reserved, (support@geatbx.com).