Quantcast

jgap.gp.ProgramChromosome

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

jgap.gp.ProgramChromosome

Konrad Odell
Hi,

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.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jgap-devl mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-devl
Loading...