Print

Print


ECJ can load whole populations or create them from scratch, neither  
of which you want in this case.  This is most easily done with a new  
subclass of Subpopulation, overriding Subpopulation.populate(...).   
Probably the easiest approach would be:

	- call super.populate(...) to fill the population with random  
individuals
	- overwrite individuals[0] with your custom individual, perhaps  
loaded from a file (see the two Individual.readIndividual(...)  
methods), or by constructing your individual programmatically and  
sticking it in.

ECJ's got several ways of reading and writing individuals, using  
DataInput/DataOutput, or text streams.

Sean

On Apr 12, 2007, at 11:23 AM, Chris McCubbin wrote:

> Sorry if this is a duplicate. I never saw my original message  
> appear on the
> list so I am re-sending this question.
>
> I have created a GP solver using ECJ. I would like to seed the first
> generation with a specific individual, and randomize the rest of the
> population as normal. How do I go about doing this? Do I have to  
> create a
> custom class that can read in some kind of serialized or text form  
> of the
> individual, then modify some class that creates the first  
> generation? Or is
> there a simpler way? Since this is a GP the individuals are fairly  
> complex
> (a rather large tree consisting of half a dozen node types).
>
> Thanks,
> Chris