explicit reduction of population size on each generation

View: New views
1 Messages — Rating Filter:   Alert me  

explicit reduction of population size on each generation

by Jonathan Shore :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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