Dear Sean,
I'm trying to use the GP system to heavily switch between types, like
integers and FP-numbers, but this just doesn't seem to work.. I will try to
elaborate the problem and hopefully you will be able to help me..I've read
about similar problems on the forum, but the solutions presented there
apparantly don't apply to me.
I'm trying to go from arrays of FP numbers to single FP numbers to integers
I would like to have operators on integers (+,-,*,/), operators on
floats(+,-,*,/), have declared them in seperate java files, two operators
to switch between float and int (<=, >=) and I would like for my root to
return an integer.
So Far I have got the following:
#return type of the tree
gp.tc.0.returns = int
gp.tc.0.init = ec.gp.build.Uniform
gp.tc.0.init.min-size = 5
gp.tc.0.init.max-size = 15
#3 atomic types
gp.type.a.size = 3
gp.type.a.0.name = float
gp.type.a.1.name = int
gp.type.a.2.name = nil
#different constraints set with the different atomic types
gp.nc.size = 6
gp.nc.0 = ec.gp.GPNodeConstraints
gp.nc.0.name = gene0
gp.nc.0.return = float
gp.nc.0.size = 0
gp.nc.1 = ec.gp.GPNodeConstraints
gp.nc.1.name = gene1
gp.nc.1.return = nil
gp.nc.1.size = 1
gp.nc.1.child.0 = nil
gp.nc.2 = ec.gp.GPNodeConstraints
gp.nc.2.name = float2
gp.nc.2.return = float
gp.nc.2.size = 2
gp.nc.2.child.0 = float
gp.nc.2.child.1 = float
gp.nc.3 = ec.gp.GPNodeConstraints
gp.nc.3.name = int2c
gp.nc.3.return = float
gp.nc.3.size = 2
gp.nc.3.child.0 = nil
gp.nc.3.child.1 = nil
gp.nc.4 = ec.gp.GPNodeConstraints
gp.nc.4.name = int2
gp.nc.4.return = int
gp.nc.4.size = 2
gp.nc.4.child.0 = int
gp.nc.4.child.1 = int
# We have ... functions in the function set. They are:
gp.fs.0.size = 11
gp.fs.0.func.0 = ec.app.simpleclassifier.func.GetGeneFloat
gp.fs.0.func.0.nc = gene0
gp.fs.0.func.1 = ec.app.simpleclassifier.func.Add
gp.fs.0.func.1.nc = float2
gp.fs.0.func.2 = ec.app.simpleclassifier.func.Sub
gp.fs.0.func.2.nc = float2
gp.fs.0.func.3 = ec.app.simpleclassifier.func.Mult
gp.fs.0.func.3.nc = float2
gp.fs.0.func.4 = ec.app.simpleclassifier.func.Div
gp.fs.0.func.4.nc =float2
gp.fs.0.func.5 = ec.app.simpleclassifier.func.SmallerOrEqual
gp.fs.0.func.5.nc = int2c
gp.fs.0.func.6 = ec.app.simpleclassifier.func.GreaterOrEqual
gp.fs.0.func.6.nc = int2c
gp.fs.0.func.7 = ec.app.simpleclassifier.func.AddInt
gp.fs.0.func.7.nc = int2
gp.fs.0.func.8 = ec.app.simpleclassifier.func.SubInt
gp.fs.0.func.8.nc = int2
gp.fs.0.func.9 = ec.app.simpleclassifier.func.MultInt
gp.fs.0.func.9.nc = int2
gp.fs.0.func.10 = ec.app.simpleclassifier.func.DivInt
gp.fs.0.func.10.nc = int2
Having this in my params file result int a lot of warnings and a crash,
apparantly if my root returns anything else then nil(and maybe something
else like in the nil-and-root example- I get an
arrayIndexOutOfBoundsException. Having the solution for nil-and-root the
only operations that the builder uses are the ones who return exactly that,
the others aren't even used for in between operations.
My datatype is of own creation
containing a array of floats: pattern
a singular float : floatValue
a singular int : intValue
In which I store all my data, do I have to have a different datatype file
for each return type? If yes How does this work, especially if changing from
type to type. If no what am I doing wrong?
Regards,
Allan
|