Print

Print


Thank you for your quick reply!

I added this to my params file and it seems to work:

# without this no "If" function is used (never)!!!!!!
gp.tc.0.returns = void-sort-of

# To make sure that 'Or' and 'And' do not accept 'If' as an argument:
gp.type.a.0.name = void-sort-of
gp.type.a.1.name = nil
gp.type.a.size = 2

gp.type.s.0.name = boolean-and-void
gp.type.s.0.size = 2
gp.type.s.0.member.0 = void-sort-of
gp.type.s.0.member.1 = nil
gp.type.s.size = 1

gp.nc.0 = ec.gp.GPNodeConstraints
gp.nc.0.name = if-constraint
gp.nc.0.returns = void-sort-of
gp.nc.0.size = 3
gp.nc.0.child.0 = nil
gp.nc.0.child.1 = boolean-and-void
gp.nc.0.child.2 = boolean-and-void

gp.nc.1 = ec.gp.GPNodeConstraints
gp.nc.1.name = boolean-constraint
gp.nc.1.returns = nil
gp.nc.1.size = 2
gp.nc.1.child.0 = nil
gp.nc.1.child.1 = nil

gp.nc.2 = ec.gp.GPNodeConstraints
gp.nc.2.name = nc0
gp.nc.2.returns = nil
gp.nc.2.size = 0

gp.nc.size = 3


I used 'nil' instead of 'boolean' but it doesn't matter. I also made sure
that the first argument of the 'if' does not accept another 'if'. But that's
not very important.

I do  get a warning when running the code:
WARNING:
In function set f0 for the GPTreeConstraints tc0, no terminals are given
with the return type void-sort-of which is required by other functions in
the function set or by the tree's return type.  Nearly all tree-builders in
ECJ require the ability to add a terminal of any type for which there is a
nonterminal, and at any time.  Without terminals, your code may not work. 
One common indication that a tree-builder has failed due to this problem is
if you get the MersenneTwister error 'n must be positive'.
PARAMETER: gp.tc.0


However, it works fine so there's no problem for me now ;-)

It does seem however that the second and third parameter of 'if' is most of
the time 'or' or 'and'. Another 'if' would be much better but that doesn't
happen often. Is it possible to give a bias towards 'if', to create more ifs
and less 'and' or 'or' ?