Print

Print


If you mean to select a random individual from the population, and  
you only have one subpopulation, then you just go into the  
subpopulation's individuals array and grab one.  Something along the  
lines of:

int numInds = state.population.subpops[0].individuals.length;
int randomIndex = state.random[thread].nextInt(numInds);
GPIndividual opponent = (GPIndividual)(state.population.subpops 
[0].individuals[randomIndex]);

On Aug 21, 2006, at 5:13 AM, Robert Baruch wrote:

> Hi all,
>
> I'm using ECJ 15. I'm having a difficult time finding an API  
> accessible through GPProblem.evaluate
> that will let me pick a random opponent individual to play against  
> the current individual under
> evaluation.
>
> Any ideas?
>
> Thanks!
>
> --Rob