Print

Print


I am writing a variant of mutation class as described in Tutorial 2. 
All the individuals are mutated and sent to another custom class for evaluation.
Then produce(...) method is returned. However, I override finishProducing(...) that waits until
all the evaluation results of parent and child individuals are obtained.

 As soon as the evaluation of a parent and its child individual is available, it requires to 
put either parent or child in corresponding individual index ie. in q index using the following
method inside mutation class.

But, I never get the original(parent) individual in q index though I set 
parents genome there.  I can't understand where I am missing.

public static void setBetterOne(someobject which has q, parent[q] genome and child[q] genome)
{
  Individual ind = ((Individual)(state.population.subpops[0].individuals[someobj.q]));
  IntegerVectorIndividual indiv = (IntegerVectorIndividual)ind;
  if (parent is better)
      indiv.genome[x] = parent[q]'s genome
  else
     indiv.genome[x] = child[q]'s genome
}


I understand that "ind" in above method provides the reference of q'th individual of subpopulation 0?
So, now if I change the genome of ind here then why can't I see that change on next step ie. evaluate() method 
of problem class or the selection methods?

Thanks in advance,
-Bari