Print

Print


Dr Sean Luke
I implemented an extension to Subpopulation overriding the emptyClone() method for my GP code which reduces the population size by 10% every generation. But i am getting following exception at crossover, without changes things are fine. This is still the older version of ECJ before your changes. Do i have to implement something else in by sub population extension or do something else to other parts of code so that "shrinkage" in population over generation takes place?

public Group emptyClone()
    {
        try
            {?
            Subpopulation p = (Subpopulation)clone();
            p.species = species; 
            int totalNumberOfIndividuals = (int)(individuals.length -0.10*individuals.length); //reduce by 10% compound for triangular generation
            p.individuals = new Individual[totalNumberOfIndividuals];  // empty
            return p;   
            }
        catch (CloneNotSupportedException e) { throw new InternalError(); } 
        }

java.lang.ArrayIndexOutOfBoundsException: 1001
at ec.gp.koza.CrossoverPipeline.produce(CrossoverPipeline.java:423)
at ec.breed.MultiBreedingPipeline.produce(MultiBreedingPipeline.java:130)
at ec.simple.SimpleBreeder.breedPopChunk(SimpleBreeder.java:182)
at ec.simple.SimpleBreeder.breedPopulation(SimpleBreeder.java:119)
at ec.simple.SimpleEvolutionState.evolve(SimpleEvolutionState.java:119)
at ec.EvolutionState.run(EvolutionState.java:371)
at ec.Evolve.main(Evolve.java:655)

My breeding pipeline looks like
pop.subpop.0.species.pipe.num-sources = 3
pop.subpop.0.species.pipe.source.0 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.0.prob = 1
pop.subpop.0.species.pipe.source.1 = ec.gp.breed.MutateERCPipeline
pop.subpop.0.species.pipe.source.1.prob = 1
pop.subpop.0.species.pipe.source.1.source.0 = ec.select.TournamentSelection 
pop.subpop.0.species.pipe.source.1.ns.0 = ec.gp.koza.KozaNodeSelector
pop.subpop.0.species.pipe.source.2 = ec.gp.koza.MutationPipeline
pop.subpop.0.species.pipe.source.2.prob = 1