Evolution/Evolution/Core/Recombinator.cs
/// <summary>
/// Returns the result of applying the alterer over the individuals.
/// </summary>
/// <param name="individuals">Input individuals</param>
/// <returns>
/// Output individuals
/// </returns>
Returns the result of applying the alterer over the individuals.
Returns the result of applying the alterer over the individuals .
public IList<Individual<G, F>> Apply(IList<Individual<G, F>> individuals)
        {
            List<Individual<G, F>> offspring = new List<Individual<G, F>>();
            int recombinations =
                (int)
                    (NumberOfRecombinations*
                     (RecombinationType == RecombinatioNumberType.Probability ? (double)individuals.Count / NumberOfParents : 1.0));
            for (int i = 0; i < recombinations; i++)
            {
                IList<Individual<G, F>> parents = individuals.RandomTake(NumberOfParents).ToList();
                offspring.AddRange(Alterer.Apply(parents));
            }
            return offspring;
        }
public IList < Individual < G , F > > Apply ( IList < Individual < G , F > > individuals ) { List < Individual < G , F > > offspring = new List < Individual < G , F > > ( ) ; int recombinations = ( int ) ( NumberOfRecombinations * ( RecombinationType == RecombinatioNumberType . Probability ? ( double ) individuals . Count / NumberOfParents : 1.0 ) ) ; for ( int i = 0 ; i < recombinations ; i ++ ) { IList < Individual < G , F > > parents = individuals . RandomTake ( NumberOfParents ) . ToList ( ) ; offspring . AddRange ( Alterer . Apply ( parents ) ) ; } return offspring ; }
Returns the result of applying the alterer over the individuals.
Returns the result of applying the alterer over the individuals .
None
individuals
IList<Individual<G, F>>
None