Quantcast

Using DoubleGene

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

Using DoubleGene

Andy Culham


Hello.  Please forgive me is this is a stupid question, but I am new to this and I am stumped.  I recently installed JGAP to use within a Java project I am working on.  I wanted to first set up a simple test problem for myself in which JGAP would just find me the maximum of some nice function (for which I know the maximum).  I chose to use the 2 dimensional function exp(-x*x - y*y), for which the unique max is at (0,0).  I used this for my fitness function.  When I implement this using IntegerGene(-10,10) it works perfectly.  However, when I use DoubleGene(-10.0,10.0) it does not work any longer.   I have not changed anything in the code except for the necessary changes to make everything now pass doubles instead of ints (i.e. accessor functions, etc.)  Is there some trick to using DoubleGene that I do not know about?  This problem is very simple yet the algorithm seems to have a great deal of difficulty finding the max.  Any help would be greatly appreciated.  Thank you.

Andrew Culham



 

------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ jgap-devl mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/jgap-devl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Using DoubleGene

Klaus Meffert
Andrew,
 
after you sent me your example, things got clearer to me. Your fitness function writes:
 
  if (x == 0 && y == 0){
   fun = Math.pow(10,7);  }
  else{
   fun = Math.min(1 / (Math.exp(x*x + y*y) - 1), Math.pow(10,6));
  }
it returns the highest values (best fitness in your case) for x and y equalling zero.
 
Using integer genes with a range from -10 to 10 means 21 (10+10+1, the 1 for the zero) possibilities in total per gene.
Using a double gene with the same range means endlees possibilities per gene.
This is number one. Number two is that in your fitness function there is a discontinuity, namely at (0,0). Thou, if a tuple of double genes does not hit the (0,0) then it optimizes the else-part of your function!
 
Thouh, the problem here lies in the problem to solve.. It is a problem that could not be solved with an evolutionary algorithm (nor with most other approaches). Try to use a fitness function with continuous
 
Also see the example in class examples.functionFinder.FormulaFinder (maybe you need to download the 3rd-party-package of JGAP for that).
 
Best
 
Klaus
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Andy Culham
Sent: Wednesday, October 12, 2005 7:58 PM
To: [hidden email]
Subject: [jgap-devl] Using DoubleGene


Hello.  Please forgive me is this is a stupid question, but I am new to this and I am stumped.  I recently installed JGAP to use within a Java project I am working on.  I wanted to first set up a simple test problem for myself in which JGAP would just find me the maximum of some nice function (for which I know the maximum).  I chose to use the 2 dimensional function exp(-x*x - y*y), for which the unique max is at (0,0).  I used this for my fitness function.  When I implement this using IntegerGene(-10,10) it works perfectly.  However, when I use DoubleGene(-10.0,10.0) it does not work any longer.   I have not changed anything in the code except for the necessary changes to make everything now pass doubles instead of ints (i.e. accessor functions, etc.)  Is there some trick to using DoubleGene that I do not know about?  This problem is very simple yet the algorithm seems to have a great deal of difficulty finding the max.  Any help would be greatly appreciated.  Thank you.

Andrew Culham

Loading...