Ejemplo n.º 1
0
        public void ItCanUseUnorderedGenes()
        {
            var configuration = GATestHelper.GetTravelingSalesmanDefaultConfiguration();

            configuration.GeneSize = 11;
            var pool = PopulationGenerator.GenerateUnorderedPopulation(configuration, typeof(PhraseGene));

            var population = new UnorderedPopulation(GATestHelper.GetTravelingSalesmanDefaultConfiguration(), _pool, typeof(PhraseGene));

            Assert.IsNotNull(population.Configuration);
            Assert.IsNotNull(population.Chromosomes);
        }
Ejemplo n.º 2
0
        public void ItCanAddToTheNextGeneration()
        {
            var config     = GetUnorderedConfiguration();
            var population = GetUnorderedChromosomes(config);

            var up = new UnorderedPopulation(config, population, typeof(PhraseGene));

            Assert.IsNotNull(up);

            up.AddToNextGeneration(population[0]);
            Assert.AreEqual(1, up.NextGeneration.Count);
            Assert.AreEqual(0, up.OptionsInPool.Count);
        }