Evolution/Evolution/Alterers/ReverseAlterer.cs
/// <summary>
/// Applies the alterer on the parents and returns the offspring
/// </summary>
/// <param name="parents">The parents.</param>
/// <returns></returns>
Applies the alterer on the parents and returns the offspring
Applies the alterer on the parents and returns the offspring
public IList<Individual<G, F>> Apply(IList<Individual<G, F>> parents)
        {
            List<G> offspring = new List<G>(parents.Select(g => g.Genotype));
            int numberOfMutations = (int) (parents.Count*Probability);
            foreach (
                int location in RandomGenerator.GetInstance().IntSequence(0, offspring.Count).Take(numberOfMutations))
            {
                offspring[location] = Mutate(offspring[location]);
            }
            return Individual<G, F>.FromGenotypes(offspring).ToList();
        }
public IList < Individual < G , F > > Apply ( IList < Individual < G , F > > parents ) { List < G > offspring = new List < G > ( parents . Select ( g => g . Genotype ) ) ; int numberOfMutations = ( int ) ( parents . Count * Probability ) ; foreach ( int location in RandomGenerator . GetInstance ( ) . IntSequence ( 0 , offspring . Count ) . Take ( numberOfMutations ) ) { offspring [ location ] = Mutate ( offspring [ location ] ) ; } return Individual < G , F > . FromGenotypes ( offspring ) . ToList ( ) ; }
Applies the alterer on the parents and returns the offspring
Applies the alterer on the parents and returns the offspring
None
parents
IList<Individual<G, F>>
None