Quantcast

GPGenotype.fillPopulation -- not implemented??

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

GPGenotype.fillPopulation -- not implemented??

disgruntled_young_man
So I was going about my night, enjoying coding in Java because it's such a fun language, and after attempting to remove all chromosomes in my population that were the same (to only have uniques) I received an error during evolve because there was  < the expected population size before the evolution started:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
        at java.util.Vector.get(Vector.java:694)
        at org.jgap.gp.impl.TournamentSelector.select(TournamentSelector.java:91)
        at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:732)
        at backtest_gp.Backtest_GP.<init>(Backtest_GP.java:353)
        at backtest_gp.Backtest_GP.main(Backtest_GP.java:369)

----------

So I'm all like, "that's cool, I remember seeing a sweet function called 'fillPopulation', I'll just give that a whirl!"

Much to my dismay:

Exception in thread "main" org.jgap.InvalidConfigurationException: No initializer found for class class org.jgap.gp.impl.GPProgram
        at org.jgap.gp.impl.GPGenotype.fillPopulation(GPGenotype.java:1205)
        at backtest_gp.Backtest_GP.<init>(Backtest_GP.java:313)
        at backtest_gp.Backtest_GP.main(Backtest_GP.java:369)

Huh.  That's weird.  Alright I'll be proactive and check the source for GPGenotype...WHA?!


public void fillPopulation(final int a_num)
      throws InvalidConfigurationException {
    IGPProgram sampleProg = getGPConfiguration().getPrototypeProgram();
    if (sampleProg == null) {
      /**@todo care about*/
    }
    Class sampleClass = sampleProg.getClass();
    IInitializer chromIniter = getGPConfiguration().getJGAPFactory().
        getInitializerFor(sampleProg, sampleClass);
    if (chromIniter == null) {
      throw new InvalidConfigurationException("No initializer found for class "
          + sampleClass);
    }
    try {
      for (int i = 0; i < a_num; i++) {
        /**@todo implement filling up population*/
//        getGPPopulation().addChromosome( (IChromosome) chromIniter.perform(sampleProg,
//            sampleClass, null));
      }
    } catch (Exception ex) {
      throw new IllegalStateException(ex);
    }
  }



Come on, really?  Ugh.  Any ETA on when this could be done?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: GPGenotype.fillPopulation -- not implemented??

Klaus Meffert-5
Could you kindly send a sample source code to me that exposes the below
mentioned problems?

Thanx and best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: disgruntled_young_man [mailto:[hidden email]]
> Sent: Friday, February 03, 2012 3:54 AM
> To: [hidden email]
> Subject: [jgap-users] GPGenotype.fillPopulation -- not implemented??
>
>
> So I was going about my night, enjoying coding in Java
> because it's such a fun language, and after attempting to
> remove all chromosomes in my population that were the same
> (to only have uniques) I received an error during evolve
> because there was  < the expected population size before the
> evolution started:
>
> Exception in thread "main"
> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
> at java.util.Vector.get(Vector.java:694)
> at
> org.jgap.gp.impl.TournamentSelector.select(TournamentSelector.java:91)
> at org.jgap.gp.impl.GPGenotype.evolve(GPGenotype.java:732)
> at backtest_gp.Backtest_GP.<init>(Backtest_GP.java:353)
> at backtest_gp.Backtest_GP.main(Backtest_GP.java:369)
>
> ----------
>
> So I'm all like, "that's cool, I remember seeing a sweet
> function called 'fillPopulation', I'll just give that a whirl!"
>
> Much to my dismay:
>
> Exception in thread "main"
> org.jgap.InvalidConfigurationException: No initializer found
> for class class org.jgap.gp.impl.GPProgram
> at
> org.jgap.gp.impl.GPGenotype.fillPopulation(GPGenotype.java:1205)
> at backtest_gp.Backtest_GP.<init>(Backtest_GP.java:313)
> at backtest_gp.Backtest_GP.main(Backtest_GP.java:369)
>
> Huh.  That's weird.  Alright I'll be proactive and check the
> source for GPGenotype...WHA?!
>
>
> public void fillPopulation(final int a_num)
>       throws InvalidConfigurationException {
>     IGPProgram sampleProg =
> getGPConfiguration().getPrototypeProgram();
>     if (sampleProg == null) {
>       /**@todo care about*/
>     }
>     Class sampleClass = sampleProg.getClass();
>     IInitializer chromIniter = getGPConfiguration().getJGAPFactory().
>         getInitializerFor(sampleProg, sampleClass);
>     if (chromIniter == null) {
>       throw new InvalidConfigurationException("No initializer
> found for class "
>           + sampleClass);
>     }
>     try {
>       for (int i = 0; i < a_num; i++) {
>         /**@todo implement filling up population*/
> //        getGPPopulation().addChromosome( (IChromosome)
> chromIniter.perform(sampleProg,
> //            sampleClass, null));
>       }
>     } catch (Exception ex) {
>       throw new IllegalStateException(ex);
>     }
>   }
>
>
>
> Come on, really?  Ugh.  Any ETA on when this could be done?
> --
> View this message in context:
> http://old.nabble.com/GPGenotype.fillPopulation----not-impleme
> nted---tp33254179p33254179.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> --------------------------------------------------------------
> ----------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft
> developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,
> CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> jgap-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgap-users


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Loading...