GEATbx Tutorial 3.3c

GEATbx Tutorial 3.3c

-

English
47 Pages
Read
Download
Downloading requires you to have access to the YouScribe library
Learn all about the services we offer

Description












Tutorial
Genetic and Evolutionary Algorithm
Toolbox for use with Matlab





Hartmut Pohlheim








Documentation for:
Genetic and Evolutionary Algorithm Toolbox for use with Matlab
version: toolbox 3.3
documentation 3.3c (February 2003 - still in work)


WWW: http://www.geatbx.com/
Email: support@geatbx.com



Contents
1 Introduction ..................................................................................................... 1
2 Quick Start....................................................................................................... 3
2.1 First demonstration.. 3
2.2 Second demonstration .................................................................................................... 6
2.3 Your first objective function .......................................................................................... 7
2.4 Further Steps................................................................................................................... 9
3 Writing Objective Functions........................................................................ 11
3.1 Parametric optimization functions................................................................................ 11
3.2 Optimization of dynamic systems 13
3.3 Remark ......................................................................................................................... 15
4 Variable Representation......... ...

Subjects

Informations

Published by
Reads 143
Language English
Report a problem
Tutorial
Genetic and Evolutionary Algorithm Toolbox for use with Matlab
Hartmut Pohlheim
Documentation for: Genetic and Evolutionary Algorithm Toolbox for use with Matlab version:toolbox 3.3 documentation 3.3c (February 2003 - still in work) WWW: http://www.geatbx.com/ Email: support@geatbx.com
Contents
1 Introduction ..................................................................................................... 1
2QuickStart.......................................................................................................32.1 First demonstration ......................................................................................................... 3 2.2 Second demonstration .................................................................................................... 6 2.3 Your first objective function .......................................................................................... 7 2.4 Further Steps................................................................................................................... 9
3 Writing Objective Functions ........................................................................ 113.1 Parametric optimization functions................................................................................ 11 3.2 Optimization of dynamic systems ................................................................................ 13 3.3 Remark ......................................................................................................................... 15
4 Variable Representation ............................................................................... 17
5 Overview of GEA Toolbox Structure .......................................................... 195.1 Naming Convention...................................................................................................... 20 5.2 Calling Tree .................................................................................................................. 21 5.3 Demo / Startup function ............................................................................................... 21 5.4 Toolbox functions (Predefined algorithms).................................................................. 22 5.5 Evolutionary Algorithm - Main function ..................................................................... 22 5.5.1..22....tialIni................................................ion.izat........................................................................5.5.2Generational loop of the EA ......................................................................................................225.5.3Fitness assignment by ranking ...................................................................................................235.5.4....oi.neltceS................................................................................................................32................5.5.5........................................23..................................overrosson/Cnati................................ceRibmo5.5.6................tutaM....oi.n................................................42................................................................5.5.7Evaluation ..................................................................................................................................245.5.8Reinsertion .................................................................................................................................255.5.9Migration ...................................................................................................................................255.5.1062................................................................................................................tion................itepmoC5.5.11Visualization ..............................................................................................................................265.6 Utility functions............................................................................................................ 26
6 Data Structures of the GEATbx .................................................................. 276.1 Chromosomes (genotype / individuals)........................................................................ 27 6.2 Phenotypes (decision variables / individuals) .............................................................. 27 6.3 Objective function values ............................................................................................. 28 6.4 Fitness values................................................................................................................ 28 6.5 Multiple subpopulations ............................................................................................... 29
7 How to Approach new Optimization Problems ......................................... 317.1 Classifying the Problem and Defining the Objective Function.................................... 32 7.2 Investigating the System Behavior ............................................................................... 32 One and Two-dimensional Slices (Variational Diagrams)......................................................................33Multi-dimensional Visualization .............................................................................................................34Decreasing the System Size/Dimension ...................................................................................................357.3 Selecting the Optimization Method.............................................................................. 35 7.4 Executing and Evaluating Optimizations ..................................................................... 36
8 Visualization of Evolutionary Algorithms .................................................. 398.1 Properties of the objective function.............................................................................. 39 8.2 Direct visualization of the objective function .............................................................. 39 8.3 High-dimensional visualization.................................................................................... 39
9 Combination of Options to Algorithms....................................................... 419.1 Common options for most optimizations ..................................................................... 41 9.2 Options for real-valued representation and globally oriented search ........................... 41
List of Figures Fig. 2-1: Output in Matlab command window at start of optimization run (used options) ................3Fig. 2-2: Status information displayed in command window during optimization (some lines removed)..............................................................................................................................4Fig. 2-3: Graphical output during optimization ..................................................................................4Fig. 2-4: Result information displayed in command window at the end of the optimization (some parts have been removed) .........................................................................................4Fig 2-5: Demonstrationdemogeatbx: option selection in menu (top: objective function, . bottom: evolutionary algorithm to apply) ............................................................................6Fig. 2-6: Graphical output during optimization of first own objective function ................................8Fig. 5-1: Layer model of the GEATbx .............................................................................................19
....................1..on............................repablentatresenadoinreisocvn4b.TambCo:-1snoitaniiravfo
1Fig. 7-1. Procedure for solving optimization problems using evolutionary algorithms ...................31Fig. 7-2. Structure of the system to be optimized as objective function ..........................................32
List of Tables
iii
Tab. 5-1:
7Naming convention of the GEATbx ..................................................................................20
List of Tables
eneGehtfoeertioutolEvdanctimhTrotiAglanyrbx).GEATox(oolbiFCallingg.5-2:2.................
1 Introduction
The GEATbx (Genetic and Evolutionary Algorithm Toolbox for use with Matlab) contains a broad range of tools for solving real-world optimization problems. They not only cover pure op-timization, but also the preparation of the problem to be solved, the visualization of the optimiza-tion process, the reporting and saving of results, and as well as some other special tools. This Tutorial provides an introduction to the main GEATbx functions. The steps necessary for the efficient application of the GEATbx are explained. Nevertheless, this tutorial does not and cannot cover all the functions and aspects of the GEATbx. (Remember, you can always refer to the im-plemented code.) The first steps for a 'Quick Start' are described in Chapter 2 and some examples are given. You can try these examples immediately and see the results seconds later. The examples use some of the GEATbx demos, giving a head start to those eager to try out the GEATbx. From there on you have at least two ways of proceeding with this tutorial. When using the GEATbx you need to know how to implement your problem ('Writing Objective Functions'). The procedure for doing so is described in Chapter 3. Another important aspect which must be considered is the format of the 'Variable Representation', see Chapter 4. The structure of the GEATbx is described in 'Overview of GEA Toolbox Structure' in an explana-tion of the 'Calling Tree' of the functions, see Chapter 5. A brief overview of the interconnection between the GEATbx functions is also provided in this chapter. The GEATbx functions follow a 'Naming Convention', see Section 5.1. The 'Data Structures of the GEATbx' are documented in Chapter 6. All the direct algorithm documentation is done inside the Matlab m-files (help name_of_m_file). An extensive help text is provided for each function explaining the purpose and syntax and including illustrative examples. The M-function index (only in the on-line docu-mentation) contains this information and additionally the dependencies between the functions (which function calls which other functions). Years of work using the GEATbx to solve real-world problems has shown us, amongst other things, that the approach to new optimization problems is always one of the most important as-pects. Chapter 7, 'How to Approach new Optimization Problems', explains a number of tips and steps. If any part of the documentation does not address your problem, you can always contact the tech-nical support for the GEATbx by email (support@geatbx.com).
2 Quick Start
The Genetic and Evolutionary Algorithm Toolbox (GEATbx) provides a number of demos. All these functions are calleddemo*.m(for instancedemofun1). The demo-functions provide ready-to-run examples and can be called directly after the installation. All necessary parameters are al-ready set.
2.1 First demonstration
As a first example, run the first demonstration function in Matlab: demofun1; This demo defines a number of evolutionary algorithm options, starts the optimization, displays the EA options employed on the screen (see figure 2-1), optimizes the objective function objfun1intermediate information during the optimization in the Matlab command win-, returns dow (see figure 2-2 and 2-4), and visualizes the results graphically every few generations (see figure 2-3). The output on your screen might be slightly different, but the examples below give you a general idea of the output visualization. Below the output figures some of the options inside demofun1are explained. Fig. 2-1: Output in Matlab command window at start of optimization run (used options) Evolutionary Optimization Objective function: objfun1 Date: 22-Dec-2002 Time: 22:12:66  number of variables: 10  boundaries of variables: -512  512 Evolutionary algorithm parameters:  subpopulations = 4 individuals = 25 (at start per subpopulation)  termination 1: max. generations = 400;  variable format = 0 (real values - phenotype == genotype)  selection  function = selsus  pressure = 1.7  gen. gap = 0.9  reinsertion  rate = 1  recombination  name = recdis recdis reclin recdis  rate = 1  mutation  name = mutreal   rate = 1  range = 0.1 0.01 0.001 0.0001  precision = 16  regional model  migration  rate = 0.1 interval = 20  output  results on screen every 5 generation  grafical display of results every 10 generation  method = 111111  style 614143 =
4
2 Quick Start
Fig. 2-2: Status information displayed in command window during optimization (some lines removed) Generation f-Count Obj. Function Term: 1 Time: cpu/gen, full  5. 451 40519 [ 1.25%] ( 0.00min 00:00:02)  10. 888 30140 [ 2.50%] ( 0.00min 00:00:03)  15. 1331 12935 [ 3.75%] ( 0.00min 00:00:06)  20. 1776 8572.8 [ 5.00%] ( 0.00min 00:00:06)  25. 2217 4910.8 [ 6.25%] ( 0.00min 00:00:08)  30. 2660 3644.4 [ 7.50%] ( 0.00min 00:00:09)  35. 3100 2414.4 [ 8.75%] ( 0.00min 00:00:11)  40. 3540 1210.6 [ 10.00%] ( 0.00min 00:00:11)  45. 3979 678.95 [ 11.25%] ( 0.00min 00:00:13)  50. 4418 208.31 [ 12.50%] ( 0.00min 00:00:14)   200. 17636 1.1752e-005 [ 50.00%] ( 0.00min 00:00:54)  205. 18076 8.6381e-006 [ 51.25%] ( 0.00min 00:00:56)  210. 18516 8.6179e-006 [ 52.50%] ( 0.00min 00:00:57)  215. 18956 5.6262e-006 [ 53.75%] ( 0.00min 00:00:58)  220. 19396 4.2513e-006 [ 55.00%] ( 0.00min 00:00:59)   370. 32604 4.4879e-008 [ 92.50%] ( 0.00min 00:01:38)  375. 33044 3.9711e-008 [ 93.75%] ( 0.00min 00:01:40)  380. 33484 3.4701e-008 [ 95.00%] ( 0.00min 00:01:41)  385. 33928 3.2459e-008 [ 96.25%] ( 0.00min 00:01:42)  390. 34368 3.1356e-008 [ 97.50%] ( 0.00min 00:01:43)  395. 34808 1.4482e-008 [ 98.75%] ( 0.00min 00:01:45)  400. 35248 1.4482e-008 [ 100.00%] ( 0.00min 00:01:46) Fig. 2-3: Graphical output during optimization
Fig. 2-4: Result information displayed in command window at the end of the optimization (some parts have been removed) End of optimization: max. generations (400 generations; 1.78 time minutes) Best Objective value: 1.44825e-008 in Generation 393 Best Individual: -2.734e-005 -1.4079e-005 2.419e-005 -2.9976e-005  -2.8788e-005 9.4641e-005 -1.3272e-005 3.2009e-005  2.7127e-005 -1.8188e-005
2.1 First demonstration
5
A number of options are defined indemofun1. Most of these options are not really necessary for a first demo function. However, you can use this function as a template. Let's have a look at some of the options. The first step provides us with the default parameters for real valued parameters. More informa-tion can be found atPredefined Evolutionary Algorithms (in Parameter options). % Get default parameters for real variables GeaOpt =tbx3real; The second step is to set number of subpopulations (here 5 subpopulations) and number of indi-viduals per subpopulation (here a different number for each subpopulation, 50 individuals for the first subpopulation, 30 individuals in the second subpopulation and so on). Another useful pa-rameter defines, how often textual status information is displayed during an optimization (here every 5 generations). % Define special parameters GeaOpt = geaoptset( GeaOpt ...  , 'NumberSubpopulation', 5 ...  , 'NumberIndividuals', [50, 30, 20, 20, 10] ...  , 'Output.TextInterval ...', 5  ); The definition of the objective function is quite important. Here we use one of the many example objective functions of the GEATbx,objfun1implementing the hyper sphere function. The ob-jective function is implemented in an m-function. Thus, we simply provide the name of this m-function: % Define objective function to use objfun = 'objfun1'; All the example objective functions of the GEATbx not only contain the definition of the func-tion, but also all the necessary parameters for the application of the function: boundaries of the variables (VLUB: vector of lower and upper bounds), a short textual description, the best objec-tive value (when known), and the corresponding variable values. Thus, the GEATbx can always "ask" the current objective function for the parameters needed. A gateway function to access these parameters is provided. % Get variable boundaries from objective function VLUB =compdiv('getdata objfun', objfun, 1); % GEATbx v.3.3 _ VLUB =geaobjpara(objfun, 1); % GEATbx v.3.4 and newer A full description of the gateway into the objective functions is given in 'Writing Objective Func-tions', Chapter 3. Now all options are defined. Thus, the evolutionary algorithm implemented ingeamain2can be called: % Start optimization [xnew, GeaOpt] =geamain2(objfun, GeaOpt, VLUB); During the optimization status information and visualization output are displayed on the screen (see figure 2-2, 2-4, and 2-3). If you want to have a look at the search space of the objective function (visualizing the first 2 di-mensions): % Do a mesh plot of the objective function plotmesh(objfun, [-100,-100;100,100]);