Exemplo n.º 1
0
        public void TestSelection()
        {
            m_rPopulation = new CGroup(m_rGraph, m_rLaw);
            m_rPopulation.GenerateChromosomes(m_rLaw.PopulationSize);
            Console.WriteLine(m_rPopulation.ToString());
            CGroup rSelection = m_rPopulation.Selection();

            Console.WriteLine(m_rPopulation.m_sSelectionLog);
            Console.WriteLine(rSelection.ToString());
            Console.WriteLine(rSelection.Crossbreeding().ToString());

            double fLastBestGrade = m_rPopulation.GetBestGrade();

            Console.WriteLine(fLastBestGrade.ToString());
            fLastBestGrade = rSelection.GetBestGrade();
            Console.WriteLine(fLastBestGrade.ToString());
        }
Exemplo n.º 2
0
        public bool IsNotEndOfEvolution()
        {
            bool   bEvolutionNotEnded = true;
            double fCurrentBestGrade  = m_rPopulation.GetBestGrade();

            if (m_rLaw.WaitCounter > 0)
            {
                if (fCurrentBestGrade < m_fLastBestGrade)
                {
                    m_fLastBestGrade = fCurrentBestGrade;
                }
                else
                {
                    m_rLaw.DecWaitCounter();
                }
            }
            else
            {
                bEvolutionNotEnded = false;
            }
            return(bEvolutionNotEnded);
        }
Exemplo n.º 3
0
 public void InitializeGroup()
 {
     m_rPopulation = new CGroup(m_rUpdater, m_rLaw);
     m_rPopulation.GenerateChromosomes(m_rLaw.PopulationSize);
     m_fLastBestGrade = m_rPopulation.GetBestGrade();
 }