Print

Print


Hi all,

Attached is my params file. I have an "mkrule" node which has two  
children, the first of which is a "rule" node.

Some "rule" nodes take more "rule" nodes as children, or they can  
also take an "end" node instead of a "rule" node. The "end" node  
essentially ends the chain.

Thus, you can have something like this:

mkrule -> rule -> rule -> rule -> end

or this:

mkrule -> rule -> end

but not this:

mkrule -> end


So I defined a type set "rule-or-end" which contains the types rule  
and end. Now "mkrule" takes a rule as a parameter, and any rule takes  
a rule-or-end as a parameter.

The problem is that when I do this, I get this warning and exception:

WARNING:
In function set f0 for the GPTreeConstraints tc0, no terminals are  
given with the return type rule 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
Initializing Generation 0
Exception in thread "main" java.lang.IllegalArgumentException: n must  
be positive
	at ec.util.MersenneTwisterFast.nextInt(MersenneTwisterFast.java:1081)

The problem is that I can't make end return a rule (which would  
satisfy having a terminal of return type rule), because then mkrule - 
 > end becomes a possibility.

Any idea how to solve this?

Thanks!

--Rob