I am excited to see that JGAP is starting to include GP. I ran the examples.gp.MathProblem program and everything worked well. Since there's little documentation right now I tried modifying the example program to see if I could get it to do something different. I put in a fibonacci sequence instead of the original math formula for the problem. Because I would be dealing only with integers I removed the sin, cos and divide commands from the CommandGene, and changed all of the float references to int instead.
The problem came when the computeRawFitness(ProgramChromosome) method calls execute_int (instead of float). I traced the problem down to Variable.java, in the execute_int method it had: return ( (Integer) args[m_argnum]).intValue();
But the args array was empty, so I was getting an array out of bounds error.
I noticed that execute_float had a different line where it was simply returning the
Class variable called value. I changed execute_int to do the same (as int instead of float), and everything seemed to work... well... it didn't really solve the problem, but at least I am not getting exceptions anymore :)
Am I on the right track with that fix? Should I locally apply the same fix to the execute_* methods?
Great job with adding GP! I know other java packages are out there, but I've always liked JGAP, it's easy to use and the developers are very active on the project.