As far as I understand, "nil" is just the name for a type. There is no
difference if you changethe name from "nil" to "int", "float". There is
no predefined type.
In order to create your own type, you need to do three things, create
the type, create the type constraint and bind the constraint to the
operators you defined for the type.
# Define some primitive types
gp.type.a.size = 2
gp.type.a.0.name = boolean
gp.type.a.1.name = float
gp.type.s.size = 0
# Define method signatures
gp.nc.size = X
# Logical function
gp.nc.1 = ec.gp.GPNodeConstraints
gp.nc.1.name = boolean-to-boolean
gp.nc.1.returns = boolean
gp.nc.1.size = 2
gp.nc.1.child.0 = boolean
gp.nc.1.child.1 = boolean
# DEfine the operators
gp.fs.0.func.0 = ec.app.policyevolution.gp.fuzzymembership.func.And
gp.fs.0.func.0.nc = boolean-to-boolean
gp.fs.0.func.1 = ec.app.policyevolution.gp.fuzzymembership.func.Or
gp.fs.0.func.1.nc = boolean-to-boolean
Hope that helps.
Yow Tzu Lim
Lawrence Tsang wrote:
> Hi All,
> I am a new comer to the ECJ software who are studying Tutorial4 to
> run a Genetic Programming example on Symbolic Regression Problem.
> In this example, I find that the "nil" GPType is used for the
> arguments and the return type of the "Add", "Sub" and "Mul" GPNodes.
> Could I have some information on what this "nil" GPType stand for and
> could I define my own GPTypes for the GPNodeConstraints of these GPNodes ?
> Thanks in advance for any suggestion.