ECJ-INTEREST-L Archives

January 2011

ECJ-INTEREST-L@LISTSERV.GMU.EDU

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
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Sun, 30 Jan 2011 19:50:31 -0500
Content-Type:
text/plain
Parts/Attachments:
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

	state.population.subpops[0].species.i_prototype;

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.

Sean

ATOM RSS1 RSS2