explicit reduction of population size on each generation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

explicit reduction of population size on each generation

Jonathan Shore
Hi,

I want to be able to explicitly control my population size with each generation.   I will be starting with a large population and reducing at some rate.   I am unclear on how to do this.   I tried the following:

        private static Genotype reduce (Genotype genotype, int nsize)
        {
                try
                {
                        List<IChromosome> chromosomes = genotype.getFittestChromosomes (nsize);
                       
                        Configuration gaconfig = genotype.getConfiguration ();
                        gaconfig.reset();
                        gaconfig.setPopulationSize (nsize);
                       
                        Population population = new Population (gaconfig, (IChromosome[])chromosomes.toArray ());
                        return new Genotype (gaconfig, population);
                }
                catch (InvalidConfigurationException e)
                        { throw new RuntimeException ("failed to configure GA", e); }
        }

However JGAP does not allow the configuration to be modified after it has been in use.   What is the best approach here?

---
Jonathan Shore
Systematic Trading Group