Print

Print


Hello,

I have a problem using Simple Typed Genetic Programming (STGP). I really
fail to see what my fault is. Hopefully someone can help me out.

I use 3 functions: if, and, or with respectively 3, 2, 2 arguments.
I also have a set of terminals. No distinction is made between the terminals.

The typing I want to use is, when I use capital t (T) I'm talking about a
terminal:
-The function or can only accept terminals as its arguments. This is because
an or is extremely slow in my system. So only or(T,T) is acceptable.
-The function and can accept anything but an if as its argument. So
and(T,T), and(and(T,T),T), and(T,or(T,T) etc are all acceptable.
-The function if is a little more complicated. The first argument should
accept anything but an if. The other two arguments can be anything. So
if(T,T,T), if(T,and(T,T),or(T,T)), if(and(or(T,T),T), T, and(T,or(T,T))) are
all acceptable.

What I want shouldn't be hard and yet I can't make it work. Here are my
parameters. The tree returns a void-sort-of basically this means the root is
an if (this is what I want).

The only thing that works is that the first argument of an if never is
another if. The rest simply fails. It's a very frustrating problem which has
kept me busy all day :s

# Atomic Typing
gp.type.a.0.name = void-sort-of
gp.type.a.1.name = nil
gp.type.a.2.name = or-sort-of
gp.type.a.size = 3

# Set Typing
gp.type.s.0.name = if-type
gp.type.s.0.size = 3
gp.type.s.0.member.0 = void-sort-of
gp.type.s.0.member.1 = or-sort-of
gp.type.s.0.member.2 = nil
gp.type.s.1.name = or-nil
gp.type.s.1.size = 2
gp.type.s.1.member.0 = or-sort-of
gp.type.s.1.member.1 = nil
gp.type.s.size = 2

gp.nc.0 = ec.gp.GPNodeConstraints
# Constraints for if
gp.nc.0.name = if-constraint
gp.nc.0.returns = void-sort-of
gp.nc.0.size = 3
gp.nc.0.child.0 = or-nil
gp.nc.0.child.1 = if-type
gp.nc.0.child.2 = if-type

gp.nc.1 = ec.gp.GPNodeConstraints
# Constraints for and
gp.nc.1.name = and-constraint
gp.nc.1.returns = or-nil
gp.nc.1.size = 2
gp.nc.1.child.0 = or-nil
gp.nc.1.child.1 = or-nil

gp.nc.2 = ec.gp.GPNodeConstraints
# Constraints for terminals
gp.nc.2.name = nc0
gp.nc.2.returns = nil
gp.nc.2.size = 0

gp.nc.3 = ec.gp.GPNodeConstraints
# Constraints for or
gp.nc.3.name = or-constraint
gp.nc.3.returns = or-sort-of
gp.nc.3.size = 2
gp.nc.3.child.0 = nil
gp.nc.3.child.1 = nil

gp.nc.size = 4

of course I also have:
gp.fs.0.func.0.nc = and-constraint
gp.fs.0.func.1.nc = or-constraint
gp.fs.0.func.2.nc = if-constraint