Print

Print


On Jan 23, 2010, at 2:20 AM, Jake Pacheco wrote:

> Thanks very much, I was referring to GP. Does this mean that  
> individuals
> form one generation are never carried straight over to another (i.e.  
> they
> are always cloned)?

Yes, they're always cloned, except possibly in Breeders where you just  
move over some elites to join the population (mu+lambda or
a generational breeder with elitism).  If all your individuals are  
formed by sucking them through a breeding pipeline, even if it's just  
reproduction, they're cloned.

> For my application, in clone(), I think i need to do
> bar = new ArrayList();
> since i want the array list to be empty at the start of every  
> generation
> (you were correct, I do not want them pointing to the same place).  
> So, foo2
> and foo3 both are in the new population and foo2.bar and foo3.bar  
> are both
> empty.

Sounds fine.  But what I would do, to stay ECJ-ish, is to create an  
ArrayList in your setup() method, then clone that ArrayList in your  
clone method.  Should work either way.

> Can foo ever be in the new population as well (say, if the  
> individual it is
> a part of is carried over unaltered)?

Only if the Breeder does it: mostly if you're doing some kind of  
elitism.  The default ECJ setup for GP does not do this.

Sean