January 2011


Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Sun, 30 Jan 2011 19:50:31 -0500
text/plain (55 lines)
On Jan 17, 2011, at 3:15 AM, Nikola Nikolovski wrote:

> I have tried to set up the genome size in the program code.
> (I am loading the parameters from the file, however I want to set up  
> some
> parameters in the program code.)
> I plan also to "move" all the parameters from .params file to the  
> program code.
> Currently I can not somehow access the .setGenomeLength, for  
> particular
> individual althoug I can access some of the other functions like
> .genotypeToStringForHumans():
> public void evaluate(final EvolutionState state,
>                             final Individual[] ind, // the individuals
>                             final boolean[] updateFitness, // should  
> this
> individuals' fitness be updated?
>                                                                // to
>                             final boolean countVictoriesOnly, // can  
> be
> neglected in cooperative coevolution
>                             int[] subpops, final int threadnum) {
>                            // evaluate together
>                 ind[0].setGenomeLength(10);      ->> problem is here !

This doesn't make much sense.  Why would you change the genome length  
when you're about to evaluate an Individual?

At any rate, ECJ generates individuals from cloning them from a  
prototypical Individual held in the Species.  For Subpopuation 0, the  
prototypical individual is


If you change the genome here, all future individuals cloned from this  
Individual will be of the given genome.  But be careful: when you  
change the genome length you also must ensure that the minGenes and  
maxGenes arrays in your [Float|Integer]VectorSpecies are also the  
proper length, or that the VectorSpecies.dynamicInitialSize variable  
is set to true, else you'll get some warnings because ECJ can't tell  
whether the gene values being mutated are properly within bounds.

I would do this by making your own subclass of VectorSpecies (or  
perhaps FloatVectorSpecies) and overriding setup() to call  
super.setup(), then change the min/max gene values and the  
prototypical individual's genome length.