BIC_CW3_Report - Heriot

Bio-Inspired Computation
Coursework 3
Experimenting with Genetic Programming
F21BC
Boris Mocialov
(H00180016)
Heriot – Watt University, Edinburgh
December 2014
Date: 05.12.14
Contents
1.
Introduction..................................................................................................................................... 3
2.
Parameters ...................................................................................................................................... 3
2.1.
Chosen parameters .................................................................................................................. 3
2.2.
Rational .................................................................................................................................... 3
2.3.
Chosen values .......................................................................................................................... 3
2.4.
Alternatives .............................................................................................................................. 4
3.
Chosen problems............................................................................................................................. 5
4.
Experiments..................................................................................................................................... 5
4.1.
Ants .......................................................................................................................................... 5
4.2.
Regression (Tutorial 4) ............................................................................................................. 5
4.3.
Lawnmower ............................................................................................................................. 6
5.
Findings ........................................................................................................................................... 7
6.
Conclusion ....................................................................................................................................... 7
2
1. Introduction
This report is a response to the task of building an understanding of parameters in ECJ
framework as well as realization about how parameter choices and value setting affect the
performance as well as results of GP in practice. Report first discusses which parameters
were chosen to be tested for various problems, then alternatives of these parameters are
given. Later, results of experiments, using variations of presented parameters are
presented, where three different problems were tested with regards to the results achieved
by parameters values alteration. At the end a short discussion is given to support achieved
results. In Appendix reader will find excerpts of .param files that were altered.
2. Parameters
2.1. Chosen parameters
Type
# of threads and random seed
(sub)population size
Mutation
Crossover
Custom trees w/ adfs
Parameters
(breedthreads, evalthreads, seed.0 #);
(pop.subpops # & pop.subpop.0.size #);
(pop.subpop.0.species.pipe.0.source,
pop.subpop.0.species.pipe.source.0.prob);
(pop.subpop.0.species.pipe.source.0,
gp.koza.xover.source.0);
(pop.subpop.0.species.fitness, gp.nc [GP
node constraints], gp.tc [GP tree constraint],
species.ind.numtrees,
eval.problem.stack[.context]);
2.2. Rational







Seed # is an important parameter in a non-deterministic execution
(sub)population # decides the course of the execution
Mutation algorithm affects convergence rate
Crossover algorithm affects convergence rate
Fitness for evaluation of a solution
Number of trees > 1 – since we are using ADFs, > 1 trees represent 1 individual
Constraints on trees lead execution towards more structured solution
2.3. Chosen values
Parameter
breedthreads, evalthreads
seed #
pop.subpops
pop.subpop.0.size
Value
1
{10, 20, 140, 800, 3000, 4300, 5500, 10000}
1
{1024, 100, 100000}
3
pop.subpop.0.species.pipe.0.source
pop.subpop.0.species.pipe.source.0.prob
gp.koza.xover.source.0
pop.subpop.0.species.fitness
gp.nc
gp.tc
species.ind.numtrees
eval.problem.stack[.context]
{MutateSwapPipeline, CrossoverPipeline}
{0.1, 0.5}
{FirstSelection, TournamentSelection,
FitProportionateSelection}
{KozaFitness}
(size = 7, GPNodeConstraints )
(GPTreeConstraints, init=HalfBuilder, …)
4
ec.gp.ADFStack[ec.gp.ADFContext]
2.4. Alternatives
Possible standard classes include:
breedthreads, evalthreads
seed #
pop.subpops
pop.subpop.0.size
pop.subpop.0.species.pipe.0.source
pop.subpop.0.species.pipe.source.0.prob
gp.koza.xover.source.0
pop.subpop.0.species.fitness
species.ind.numtrees
eval.problem.stack[.context]
{N}
{N}
{N}
{N}
{CrossoverPipeline, MutationPipeline,
InternalCrossoverPipeline,
MutatePromotePipeline,
MutateDemotePipeline,
MutateSwapPipeline,
MutateOneNodePipeline, AllNodesPipeline,
RehangPipeline, MutateERCPipeline,
SizeFairCrossoverPipeline,
ReproductionPipeline,
MultiBreedingPipeline, InitializationPipeline,
BufferedBreedingPipeline,
ForceBreedingPipeline,
CheckingBreedingPipeline,
GenerationSwitchPipeline}
(0..1)
{FirstSelection, TournamentSelection,
FitProportionateSelection, RandomSelection,
SUSSelection, SigmaScalingSelection,
BoltzmanSelection, GreedyOverselection,
BestSelection, MultiSelection}
{SimpleFitness, KozaFitness}
{N}
ec.gp.ADFStack[ec.gp.ADFContext]
4
3. Chosen problems
1. Ants (food=89)
2. Regression (Tutorial 4)
3. Lawnmower (Recompiled for field=15x15)
Encoding of individual solutions of chosen problems is represented as a tree/trees. In
addition, evolution of chosen problems is deterministic – every time seed # is used, the
results after each run are the same. Therefore, it is easier to reason about solutions to these
problems.
4. Experiments
4.1. Ants
4.2. Regression (Tutorial 4)
5
4.3. Lawnmower
6
5. Findings
Most of the tests executed either in trivial time or fast enough time not to notice the delay.
Only those test that were performed with the subpopulation of 100000 were either
consuming too much memory or were taking too long to progress and, therefore, had to be
terminated. In cases when the solution was trivial enough, large amount of subpopulation
made computation converge to the most optimal solution at earlier Generations. Only in
cases with the use of ADFs, large amount of subpopulations never reached the solution, due
to ‘out of memory’ error. As it can be seen from experiments results, for every problem, the
use of the FirstSelection always leads to bad convergence results, while default setting as
well as specified Mutation [prob=0.1|0.5] always reach for the top (most optimal solution).
In experimented problems, the seed number did not make much of a difference in the
distribution of the fitness of solutions, therefore it is reasonable to assume that for major
changes, seed number can remain the same, while other parameters, such as selection and
mutation should be considered.
6. Conclusion
ECJ provides a powerful and dynamic tool for evolution of solutions to given problems.
Despite its power, the user must be careful in choosing a correct representation of a
population and a solution to be able to change parameters reasonably to affect the desired
solution.
7
Bibliography
Facility Overview. (n.d.). Retrieved 12 2014, from An Evolutionary Computation and Genetic
Programming System: http://cs.gmu.edu/~eclab/projects/ecj/docs/overview.html
How-to Implement Custom Genetic Programming Problems. (2014, 07). Retrieved 12 2014,
from HeuristicLab:
http://dev.heuristiclab.com/trac.fcgi/wiki/Documentation/Howto/Implement%20Genetic%
20Programming%20Problems#Thelawnmowerproblem
The ECJ Owner’s Manual. (2014, 08). Retrieved 12 2014, from An Evolutionary Computation
and Genetic Programming System:
http://cs.gmu.edu/~eclab/projects/ecj/docs/manual/manual.pdf
8
Appendix
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
#Number of threads and random number generator seeds
evalthreads = 1
breedthreads = 1
seed.0 = 4357
#increasing population
pop = ec.Population
pop.subpops = 1
pop.subpop.0 = ec.Subpopulation
pop.subpop.0.size =
1024
pop.subpop.0.duplicate-retries = 0
#mutation
pop.subpop.0.species.pipe.0.source=ec.gp.breed.MutateSwapPipeline
pop.subpop.0.species.pipe.source.0.prob = 0.5
#crossover
pop.subpop.0.species.pipe.source.0 = ec.gp.koza.CrossoverPipeline
gp.koza.xover.source.0 = ec.select.FitProportionateSelection
#parent.0 = ../../gp/koza/koza.params
#custom trees with adfs
pop.subpop.0.species.fitness = ec.gp.koza.KozaFitness
pop.subpop.0.species.pipe.source.0.maxdepth = 1
pop.subpop.0.species.pipe.source.1.build.0.max-depth = 20
pop.subpop.0.species.pipe.source.1.build.0.min-depth = 1
pop.subpop.0.species.pipe.source.0.prob = 0.9
pop.subpop.0.species.pipe.source.1.prob = 0.1
gp.koza.ns.terminals = 0.1
gp.koza.ns.nonterminals = 0.9
gp.koza.ns.root = 0.0
gp.koza.mutate.source.0 = ec.select.TournamentSelection
gp.koza.mutate.ns.0 = ec.gp.koza.KozaNodeSelector
gp.koza.mutate.build.0 = ec.gp.koza.GrowBuilder
gp.koza.mutate.maxdepth = 17
gp.koza.mutate.tries = 2
pop.subpop.0.species.pipe = ec.breed.MultiBreedingPipeline
pop.subpop.0.species.pipe.generate-max = false
pop.subpop.0.species.pipe.num-sources = 2
pop.subpop.0.species.pipe.source.0 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.1 = ec.gp.koza.MutationPipeline
breed.reproduce.source.0 = ec.select.TournamentSelection
gp.koza.xover.source.0 = ec.select.TournamentSelection
gp.koza.xover.source.1 = same
gp.koza.xover.ns.0 = ec.gp.koza.KozaNodeSelector
gp.koza.xover.ns.1 = same
gp.koza.xover.tries = 2
pop.subpop.0.species = ec.gp.GPSpecies
pop.subpop.0.species.ind =
ec.gp.GPIndividual
gp.koza.half.min-depth = 1
eval
= ec.simple.SimpleEvaluator
stat= ec.simple.SimpleStatistics
pop.subpop.0.species.pipe.0.source.0 = ec.select.TournamentSelection
select.tournament.size = 2
pop.subpop.0.species.pipe.0 = ec.gp.koza.MutationPipeline
pop.subpop.0.species.pipe.0.prob = 0.9
gp.koza.mutate.ns.0 = ec.gp.koza.KozaNodeSelector
gp.koza.mutate.build.0 = ec.gp.koza.GrowBuilder
state = ec.simple.SimpleEvolutionState
checkpoint = false
checkpoint-modulo = 1
prefix = ec
generations = 51
breed = ec.simple.SimpleBreeder
exch = ec.simple.SimpleExchanger
finish = ec.simple.SimpleFinisher
init = ec.gp.GPInitializer
gp.type.a.size = 1
gp.type.a.0.name = nil
#gp.type.s.size = 0
gp.nc.size = 7
gp.nc.0 = ec.gp.GPNodeConstraints
gp.nc.0.name = nc0
gp.nc.0.returns = nil
gp.nc.0.size = 0
gp.nc.1 = ec.gp.GPNodeConstraints
gp.nc.1.name = nc1
gp.nc.1.returns = nil
gp.nc.1.size = 1
gp.nc.1.child.0 = nil
gp.nc.2 = ec.gp.GPNodeConstraints
gp.nc.2.name = nc2
gp.nc.2.returns = nil
gp.nc.2.size = 2
gp.nc.2.child.0 = nil
gp.nc.2.child.1 = nil
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
gp.nc.3 = ec.gp.GPNodeConstraints
gp.nc.3.name = nc3
gp.nc.3.returns = nil
gp.nc.3.size = 3
gp.nc.3.child.0 = nil
gp.nc.3.child.1 = nil
gp.nc.3.child.2 = nil
gp.nc.4 = ec.gp.GPNodeConstraints
gp.nc.4.name = nc4
gp.nc.4.returns = nil
gp.nc.4.size = 4
gp.nc.4.child.0 = nil
gp.nc.4.child.1 = nil
gp.nc.4.child.2 = nil
gp.nc.4.child.3 = nil
gp.nc.5 = ec.gp.GPNodeConstraints
gp.nc.5.name = nc5
gp.nc.5.returns = nil
gp.nc.5.size = 5
gp.nc.5.child.0 = nil
gp.nc.5.child.1 = nil
gp.nc.5.child.2 = nil
gp.nc.5.child.3 = nil
gp.nc.5.child.4 = nil
gp.nc.6 = ec.gp.GPNodeConstraints
gp.nc.6.name = nc6
gp.nc.6.returns = nil
gp.nc.6.size = 6
gp.nc.6.child.0 = nil
gp.nc.6.child.1 = nil
gp.nc.6.child.2 = nil
gp.nc.6.child.3 = nil
gp.nc.6.child.4 = nil
gp.nc.6.child.5 = nil
gp.tc.size = 1
gp.tc.0 = ec.gp.GPTreeConstraints
gp.tc.0.init = ec.gp.koza.HalfBuilder
gp.tc.0.name = tc0
gp.tc.0.returns = nil
gp.koza.half.growp = 0.5
gp.koza.half.max-depth = 6
gp.nc.0.init.min-depth = 2
gp.nc.0.init.max-depth = 2
pop.subpop.0.species.ind.numtrees = 4
pop.subpop.0.species.ind.tree.0 = ec.gp.GPTree
pop.subpop.0.species.ind.tree.0.tc = tc0
pop.subpop.0.species.ind.tree.1 = ec.gp.GPTree
pop.subpop.0.species.ind.tree.1.tc = tc1
pop.subpop.0.species.ind.tree.2 = ec.gp.GPTree
pop.subpop.0.species.ind.tree.2.tc = tc2
pop.subpop.0.species.ind.tree.3 = ec.gp.GPTree
pop.subpop.0.species.ind.tree.3.tc = tc3
gp.tc.size = 4
gp.tc.0 = ec.gp.GPTreeConstraints
gp.tc.0.name = tc0
gp.tc.0.fset = f0
gp.tc.0.returns = nil
gp.tc.0.init = ec.gp.koza.HalfBuilder
gp.tc.0.init.growp = 0.5
gp.tc.0.init.min-depth = 2
gp.tc.0.init.max-depth = 2
gp.tc.1 = ec.gp.GPTreeConstraints
gp.tc.1.name = tc3
gp.tc.1.fset = f0
gp.tc.1.returns = nil
gp.tc.1.init = ec.gp.koza.HalfBuilder
gp.tc.1.init.growp = 0.5
gp.tc.1.init.min = 2
gp.tc.1.init.max = 10
gp.tc.2 = ec.gp.GPTreeConstraints
gp.tc.2.name = tc2
gp.tc.2.fset = f0
gp.tc.2.returns = nil
gp.tc.2.init = ec.gp.koza.HalfBuilder
gp.tc.2.init.growp = 0.5
gp.tc.2.init.min = 2
gp.tc.2.init.max = 10
gp.tc.3 = ec.gp.GPTreeConstraints
gp.tc.3.name = tc1
gp.tc.3.fset = f0
gp.tc.3.returns = nil
gp.tc.3.init = ec.gp.koza.HalfBuilder
gp.tc.3.init.growp = 0.5
gp.tc.3.init.min = 2
gp.tc.3.init.max = 10
eval.problem.stack = ec.gp.ADFStack
eval.problem.stack.context = ec.gp.ADFContext
#custom trees with adfs
9