GPLAB
A Genetic Programmin g Toolbox for MATLAB
Sara Silva
ECOS - Evolutionary and Complex Systems Group
University of Coimbra
Portugal
Ver sio n 2
May 2004
Contents
1 Introduction 5
1.1 Update from version 1.x . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Operational structure 7
2.1 Main modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 GEN POP . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 GENERATION . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.3 SET VARS . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Working variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 The layman . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.2 The regular user . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.3 The advanced researcher . . . . . . . . . . . . . . . . . . . 12
2.4 Plug and play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4.1 Building plug and play f unct ions . . . . . . . . . . . . . . 12
2.4.2 Using new plug and play functions . . . . . . . . . . . . . 12
2.4.3 Integrating new plug and play functions in GPLAB . . . 13
3 Parameters 14
3.1 Tree initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2 Tree depth and size limits . . . . . . . . . . . . . . . . . . . . . . 18
3.3 Functions and terminals . . . . . . . . . . . . . . . . . . . . . . . 19
3.4 Genetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5 Validating new individuals . . . . . . . . . . . . . . . . . . . . . . 24
3.6 Selection for reproduction . . . . . . . . . . . . . . . . . . . . . . 25
3.7 Expected number of children . . . . . . . . . . . . . . . . . . . . 26
3.8 Measuring fitness . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.9 Measuring complexity and diversity . . . . . . . . . . . . . . . . . 29
3.10 Generation gap . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.11 Survival . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.12 Operator probabilities in runtime . . . . . . . . . . . . . . . . . . 31
3.13 Initial operator probabilities . . . . . . . . . . . . . . . . . . . . . 32
3.14 Stop conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1
3.15 Saving results to file . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.16 Runtime t e xtual output . . . . . . . . . . . . . . . . . . . . . . . 33
3.17 Runtime graphical output . . . . . . . . . . . . . . . . . . . . . . 34
4 State 38
4.1 Population . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Tree depth/size . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.3 Functions and terminals . . . . . . . . . . . . . . . . . . . . . . . 41
4.4 Operator probabilities and frequencies . . . . . . . . . . . . . . . 41
4.5 Population fit ness . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.6 Fitness statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.7 Best individual . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.8 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.9 Complexity and diversity statistics/history . . . . . . . . . . . . 43
5 Offline graphical output 44
5.1 Accuracy versus Complexity . . . . . . . . . . . . . . . . . . . . . 44
5.2 Pareto front . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.3 Desired versus Obtained . . . . . . . . . . . . . . . . . . . . . . . 44
5.4 Operator Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.5 Tree visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6 Summary of toolbox functions 48
6.1 Demonstration functions . . . . . . . . . . . . . . . . . . . . . . . 48
6.2 Running the algorithm and testing result . . . . . . . . . . . . . 48
6.3 Parameter and state setting . . . . . . . . . . . . . . . . . . . . . 48
6.4 Automatic variable checking . . . . . . . . . . . . . . . . . . . . . 49
6.5 Description of parameter and state variables . . . . . . . . . . . . 49
6.6 Creation of new generations . . . . . . . . . . . . . . . . . . . . . 49
6.7 Creation of new individuals . . . . . . . . . . . . . . . . . . . . . 50
6.8 Filtering of new individuals . . . . . . . . . . . . . . . . . . . . . 50
6.9 Protected and logical functions . . . . . . . . . . . . . . . . . . . 50
6.10 Artificial ant functions . . . . . . . . . . . . . . . . . . . . . . . . 51
6.11 Tree manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.12 Data manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.13 Expected number of children . . . . . . . . . . . . . . . . . . . . 52
6.14 Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.15 Genetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.16 Fitness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.17 Diversity measures . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.18 Automatic operator probability adaptation . . . . . . . . . . . . 53
6.19 Runtime graphical output . . . . . . . . . . . . . . . . . . . . . . 53
6.20 Offline graphical out put . . . . . . . . . . . . . . . . . . . . . . . 53
6.21 Utilitarian functions . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.22 Text input files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.23 License file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2
List of Tables
3.1 Location of parameters in this manual . . . . . . . . . . . . . . . 14
3.1 continued . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Possible and default values of the parameters . . . . . . . . . . . 16
3.2 continued . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3 Protected and logical functions for use with GPLAB . . . . . . . 21
3.4 List of filters for each combination of parameters . . . . . . . . . 25
4.1 Location of state variables in this manual . . . . . . . . . . . . . 38
4.1 continued . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3
List of Figures
2.1 Operational structure of the GPLAB toolbox . . . . . . . . . . . 8
3.1 Graphical output produced by the ’plotfitness’ option in the
graphics parameter . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2 Graphical output produced by the ’plotdiversity’ option in the
graphics parameter . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3 Graphical output produced by the ’plotcomplexity’ option in
the graphics parameter . . . . . . . . . . . . . . . . . . . . . . . 37
3.4 Graphical output produced by the ’plotoperators’ option in the
graphics parameter . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.1 Graphical output produced by the function accuracy
complexity 45
5.2 Graphical output produced by the function plotpareto . . . . . 46
5.3 Graphical output produced by the function desired
obtained . 46
5.4 Graphical output produced by the function operator
evolution 47
5.5 Graphical output produced by the function drawtree . . . . . . 47
4