Print

Print


Ah.  The bleeding edge.

Individuals do indeed hold onto their fitnesses: they're only  
assigned fitnesses when they are first created by their respective  
subpopulations.  When an individual moves from one population to  
another -- using ec.exchange.InterPopulationExchange, for example,  
the fitness is retained because almost always such experiments  
presume that the subpopulations have just broken up the population  
into subchunks and thus all have the same fitness.

I didn't include a hook for individuals to be told that they had just  
been exchanged to a new subpopulation or new computer etc.  You'll  
have to hack ECJ for the moment to do such a thing.  You can get a  
new fitness with subpop.f_prototype.clone(); and then you just set  
the individual's fitness to that.  If you're doing  
ec.exchange.InterPopulationExchange, I'd override  
postBreedingExchange to go through the mailboxes for each  
subpopulation and replace the fitness of each individual  
appropriately, THEN call super.postBreedingExchange.  You also want  
to set the evaluated flag in each such individual to false so it  
fills out its new fitness on the upcoming evaluation.

If you want to somehow "transfer" the fitness from one form to  
another, you have to Think Deeply about what it means to do this  
first.  But if you just want to dump the fitness and let the  
individual use a new one, that should do the trick.

Sean


On Jun 12, 2006, at 8:35 AM, Hirsch Laurence wrote:

> I have been using subpopulations in ECJ 15 and it works very well.  I
> have recently been trying to make a modification such that the
> subpopulations have different fitness measures specified in the
> parameter file.  Perhaps I have this wrong but it seems that when an
> individual is transferred from one population it keeps its original
> fitness measure whereas I would prefer if it would then adopt the
> fitness measure of its new population.  Is there a recommended way  
> to do
> this?
>
> Thanks,
>
> Laurie Hirsch