Beispiel #1
0
        /// <summary>
        /// Before we start GP prepare all neccessery information
        /// </summary>
        /// <param name="termSet"></param>
        /// <param name="funSet"></param>
        /// <param name="gpParams"></param>
        public void PrepareAlgorithm(GPTerminalSet termSet, GPFunctionSet funSet, GPParameters gpParams = null)
        {
            m_IterationCounter = 0;
            if (Population == null)
            {
                Population = new CHPopulation();
            }

            Population.InitPopulation(termSet, funSet, gpParams);
            Population.CalculatePopulation();

            IsAlgorthmPrepared = true;

            StopIteration = false;


            //calculate model and prediction
            GPChromosome ch = Population.bestChromosome as GPChromosome;

            double[][] model      = CalculateModel(ch);
            double[][] prediction = CalculateModel(ch, false);

            //Report the evolution has been started
            if (ReportEvolution != null)
            {
                ReportEvolution(this,
                                new ProgressIndicatorEventArgs()
                {
                    ReportType       = ProgramState.Started,
                    AverageFitness   = Population.fitnessAvg,
                    BestChromosome   = Population.bestChromosome,
                    CurrentIteration = 0, LearnOutput = model, PredicOutput = prediction
                });
            }
        }
Beispiel #2
0
 public GPFactory()
 {
     Population = new CHPopulation();
 }