예제 #1
0
        public void TestMutate()
        {
            CChromosome rFirst = new CChromosome(m_rLaw);

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine(rFirst.ToString());
                rFirst.Mutate();
                Console.WriteLine(rFirst.ToString());
                Console.WriteLine();
            }
        }
예제 #2
0
        public void TestCrossBreeding()
        {
            CChromosome rFirst  = new CChromosome(m_rLaw),
                        rSecond = new CChromosome(m_rLaw),
                        rChild  = null;

            Console.WriteLine(rFirst.ToString());
            Console.WriteLine(rSecond.ToString());
            rChild = rFirst.Crossbreeding(rSecond);
            Console.WriteLine(rChild.ToString());
            rChild = rSecond.Crossbreeding(rFirst);
            Console.WriteLine(rChild.ToString());
        }
예제 #3
0
        public void TestEvolution()
        {
            m_rGenetic.InitializeGroup();
            Console.WriteLine(m_rGenetic.ShowPopulation());

            while (m_rGenetic.IsNotEndOfEvolution())
            {
                m_rGenetic.Evolution();
            }
            CChromosome rBestChromosome = m_rGenetic.GetBestChromosome();

            Console.WriteLine(m_rGraph.ToString());
            Console.WriteLine(rBestChromosome.ToString());
            Console.WriteLine(m_rGraph.UpdateGrade(rBestChromosome));
        }