Exemple #1
0
        private Individual GetParent()
        {
            // Grab two candidate parents from the population.
            var(candidate1, candidate2) = WorldHelper.GetCandidateParents(this.Population);

            // Perform the tournament selection
            return(WorldHelper.TournamentSelection(candidate1, candidate2));
        }
        public void EnsureCandidateParentsUniqueTest()
        {
            var population = DefaultPopulationHelper.GetTestPopulation();

            for (int i = 0; i < 10; i++)
            {
                var(candidateA, candidateB) = WorldHelper.GetCandidateParents(population);

                Assert.IsFalse(candidateA.Sequence.SequenceEqual(candidateB.Sequence));
            }
        }