Пример #1
0
        /// <summary>
        /// Replace method
        /// </summary>
        /// <param name="parents">parents</param>
        /// <param name="offspring">offspring</param>
        /// <returns>new generation</returns>
        public Population Replace(Population parents, Population offspring)
        {
            Population merged = new Population();

            merged.AddAll((Population)parents.Clone());
            merged.AddAll((Population)offspring.Clone());

            return(merged);
        }
Пример #2
0
        public static Population <TGene, TAllele> ToPopulation <TGene, TAllele>(
            this IEnumerable <Phenotype <TGene, TAllele> > source)
            where TGene : IGene <TGene>
            where TAllele : IComparable <TAllele>, IConvertible
        {
            var population = new Population <TGene, TAllele>();

            population.AddAll(source);
            return(population);
        }