I'm one step further with the issue
in the code for the Uniform builder (array index out of bound exception).
I analyzed the code a little and wondered about a data structure (multi-dim
array) that is initialized using particular size variables, and later iterated,
but using different size variables as iteration bounds. Here the suspicious
code:
Uniform.java: method "preProcess",
line 267
// set up
the arrays
NUMTREESOFTYPE
= new BigInteger[functionsets.length][numAtomicTypes+numSetTypes][maxtreesize+1];
NUMTREESROOTEDBYNODE
= new BigInteger[functionsets.length][numfuncnodes][maxtreesize+1];
NUMCHILDPERMUTATIONS
= new BigInteger[functionsets.length][numfuncnodes][maxtreesize+1][maxtreesize+1][maxarity];
ROOT_D =
new UniformGPNodeStorage[functionsets.length][numAtomicTypes+numSetTypes][maxtreesize+1][];
ROOT_D_ZERO
= new boolean[functionsets.length][numAtomicTypes+numSetTypes][maxtreesize+1];
CHILD_D
= new double[functionsets.length][numfuncnodes][maxtreesize+1][maxtreesize+1][];
>>> The last line is the interesting
one: Note that the 3rd and 4th dimension will be initialized using the
value of 'maxtreesize' (by the way, using the same variable two times here
seems to me suspicious, but this is also done in the 3rd line).
Now consider the code when the 'CHILD_D'
structure will be processed:
Uniform.java: method "computePercentages",
line 404
// load
CHILD_D
for(int
f = 0;f<NUMCHILDPERMUTATIONS.length;f++)
for(int p=0;p<NUMCHILDPERMUTATIONS[f].length;p++)
for(int o=0;o<maxtreesize+1;o++)
for(int c=0;c<maxarity;c++)
{
CHILD_D[f][p][o][c] = new double[o+1];
>>> Here, the second last code
line (not the brace) is interesting: the loop will iterate using 'maxarity'
as upper bound. Compared to the definition of 'CHILD_D', this seems to
be erroneous to me (since maxarity might be greater than maxtreesize --
and actually is in my case).
As an experiment, I changed the line
from above to the following:
CHILD_D
= new double[functionsets.length][numfuncnodes][maxtreesize+1][maxarity/*maxtreesize+1*/][];
Now my code works, the Uniform builder
does not produce any array exceptions anymore -- however, now I'm not sure
whether my change is semantically correct and whether it only works for
some instances.
Could anyone familiar with the code
of Uniform please check this out?
Thanks in advance,
Stefan
Mit freundlichen Grüßen / Kind regards
Stefan Wappler
DaimlerChrysler Automotive IT Institute
Ernst-Reuter-Platz 7
10587 Berlin/Germany
Phone +49 (0)30 39982 358
Fax +49 (0)711 3052 160825
mailto: [log in to unmask]
Re: Exception during percentage computation
in UNIFORM
Eesh, that is one seriously big parameter file.
Uniform is a complex monster, and it's been a while since I've
revisited it. It could possibly have something with you changing
bytes to ints, but I doubt it. I'll have to stare at this for a bit,
but it'd really help if you could construct a small, simple example
which fails. This may be impossible -- it may be the size which is
causing the problem, though I doubt it -- but it'd help a lot if it
can be done.
In the meantime, if you're using Uniform because it is notionally
capable of handling tree generation even when there aren't terminals
for a given return type, I have a modified version of a number of
newly-modified standard tree generators I can throw at you (I'm
looking for volunteers to test them).