/// <summary> /// Creates the next generation of programs. This method also keeps tabs on memory /// as it creates the new Population. If we run out of physical memory then the /// new Population size is changed to wherever we ran out of memory. /// </summary> /// <param name="nGeneration">Which generation is currently being processed</param> /// <param name="Population">Reference to the Population just computed for fitness</param> /// <param name="Fitness">Fitness object with the fitness computation results</param> /// <param name="AutoReproduce">List of programs to automatically reproduce into the next generation</param> /// <returns>Reference to the new Population to use</returns> public GPPopulation ComputeNext(int nGeneration, GPPopulation Population, GPFitness Fitness, List <GPProgram> AutoReproduce) { m_PopCurrent = Population; m_Fitness = Fitness; // // Setup the program selection delegate switch (m_ModelerConfig.Profile.Reproduction) { case GPEnums.Reproduction.Tournament: ExecProgramSelection = new DELProgramSelection(Fitness.FitnessSelection.SelectProgramTournament); break; case GPEnums.Reproduction.OverSelection: ExecProgramSelection = new DELProgramSelection(Fitness.FitnessSelection.SelectProgramOverSelection); break; } // // Create a Tree Factory object - It helps in support of the mutation and // crossover operations m_TreeFactory = new GPProgramTreeFactory(m_ModelerConfig, m_InputDimension); return(ComputeNext(Population, Fitness, AutoReproduce)); }
/// <summary> /// Constructor: Create the program factory that will be used by derived classes /// to create the individual programs. /// </summary> /// <param name="Config"></param> /// <param name="InputDimension"></param> public GPGeneratePopulation(GPModelerServer Config, short InputDimension) { m_Config = Config; // // Create a program tree factor that will be used for creating new // program trees. m_TreeFactory = new GPProgramTreeFactory(Config, InputDimension); }