Atm,

I've been unable to reproduce this behavior.  I've copied your custom produce() method into the OurVectorMutator class of Tutorial 2, and run it with very similar parameters to your own—but the children show up in the new population in the same order as their parents in the old population, which is what you're saying you expected (see attached screenshots).

Does your custom mutator override any other methods?

Siggy


On Wed, Feb 22, 2017 at 9:50 AM, BARI, ATM GOLAM <[log in to unmask]> wrote:
Thanks a lot for your reply.

What exactly are you doing in your VectorCrossoverPipeline.produce() method?
- Nothing. I just put it as it is.(see the param file please) 
I put chunk-size = genome-size in the param file which I understand does not execute the loop inside defaultCrossover() responsible for respective crosssover type operation. As a result, no cross-over.

If you are still pulling individuals from the source, then your population might be being affected by the TournamentSelection object.
- why it should be affected if I just pull the individuals from the source (may be pipeline or selection method) and do nothing operation on them but forward only. This is what I am exactly doing.

If you want the operators to do truly nothing to the population, I believe (after just glancing at ECJ's code) you can do true cloning by having your produce() method call Breeder.reproduce() and setting the 'produceChildrenFromSource' parameter to 'false'.
 - Is not that an extra work... produce() inside ec.vector.breed.VectroCrossooverPipeline() and ec.vector.Breed.VectorMutationPipeline() gets the individuals from their source and stick them into inds[q] location. So, if I want to do "nothing" in that individuals , Ill forward them as they are. Please let me correct if I am wrong. Please see the attached output. I get the individuals untouched but their indexes are not same from old to new population.

Please see the produce() method for mutator class below.  I just point old individual as parent and  new individual as child whose ie. q value index are same. But when this produce() hands over all the individuals to the breeder, the individuals remain intact but their indexes does not match.

public int produce(final int min, 
final int max, 
final int start,
final int subpopulation,
final Individual[] inds,
final EvolutionState state,
final int thread) {
int n = sources[0].produce(min,max,start,subpopulation,inds,state,thread);


if (!state.random[thread].nextBoolean(likelihood)) 
return reproduce(n, start, subpopulation, inds, state, thread, false);

if (!(sources[0] instanceof BreedingPipeline))
for(int q=start;q<n+start;q++)
inds[q] = (Individual)(inds[q].clone());

if (!(inds[start] instanceof IntegerVectorIndividual)) 
state.output.fatal("OurMutatorPipeline didn't get an IntegerVectorIndividual." +
"The offending individual is in subpopulation " + subpopulation + " and it's:" + inds[start]);

IntegerVectorSpecies species = (IntegerVectorSpecies)(inds[start].species);

       
IntegerVectorIndividual child, parent;
for(int q=start;q<n+start;q++) { //Iterates single time
//System.out.println("q " +q + " Individual Length " +inds.length);
child = (IntegerVectorIndividual)inds[q];
parent = (IntegerVectorIndividual)state.population.subpops[subpopulation].individuals[q];
System.out.println("Before Mutation, "+ " child Individual : "+child.genotypeToStringForHumans() + " parent Individual : " +parent.genotypeToStringForHumans());

for(int x=0;x<child.genome.length;x++) { //Does mutation
break;
//dummy                        
System.out.println("After Mutation, "+ " child Individual : "+child.genotypeToStringForHumans() + " parent Individual : " +parent.genotypeToStringForHumans());

parent.evaluated=false;

return n;
}
-agb

On Wed, Feb 22, 2017 at 9:11 AM, Eric 'Siggy' Scott <[log in to unmask]> wrote:
What exactly are you doing in your VectorCrossoverPipeline.produce() method?  If you are still pulling individuals from the source, then your population might be being affected by the TournamentSelection object.

If you want the operators to do truly nothing to the population, I believe (after just glancing at ECJ's code) you can do true cloning by having your produce() method call Breeder.reproduce() and setting the 'produceChildrenFromSource' parameter to 'false'.

Siggy

On Wed, Feb 22, 2017 at 8:44 AM, Atm Golam Bari <[log in to unmask]> wrote:
Hi,
I was just understanding how ECJ generational loop works. So, I disabled the cross over using chunk-size = genome size, override produce(....) of  ec.vector.breed.VectorCrossoverPipeline and did not do any mutation there. So, I expect the old and new individuals should be same throughout the run. I am getting ok that part.

>>But the index of the old individuals does not match with the index of new individuals. Say individual [10, 20] has index 0 at old population but it gets different index (say index 3) in new population.
>> I understand that newPop inside ec.simple.SimpleBreeder is the array that holds new population and state.population.subpops[subpopulation].individuals[] holds the old population at any time.

Would you please let me know whether I am missing. Here is the part of parameter file (attached file name : Capture.PNG) .
Thanks for your time,
agb




--

Ph.D student in Computer Science, George Mason University
CFO and Web Director, Journal of Mason Graduate Research



--
-Bari



--

Ph.D student in Computer Science, George Mason University
CFO and Web Director, Journal of Mason Graduate Research
http://mason.gmu.edu/~escott8/