Evolution/Evolution/Algorithms/EasyGa.cs
/// <summary>
/// Returns the first population for this algorithm
/// </summary>
/// <returns></returns>
Returns the first population for this algorithm
Returns the first population for this algorithm
public IList<Individual<G, F>> Initialize()
        {
            List<Individual<G, F>> firstGeneration = new List<Individual<G, F>>();
            foreach (object item in Breeders)
            {
                IBreeder<G> breeder = item as IBreeder<G>;
                if (breeder != null)
                {
                    firstGeneration.AddRange(Individual<G, F>.FromGenotypes(breeder.Breed()));
                }
                else
                {
                    IAlterer<G, F> alterer = item as IAlterer<G, F>;
                    Debug.Assert(alterer != null);
                    firstGeneration = alterer.Apply(firstGeneration).ToList();
                }
            }
            firstGeneration = UpdateFitness(firstGeneration).ToList();
            return firstGeneration;
        }
public IList < Individual < G , F > > Initialize ( ) { List < Individual < G , F > > firstGeneration = new List < Individual < G , F > > ( ) ; foreach ( object item in Breeders ) { IBreeder < G > breeder = item as IBreeder < G > ; if ( breeder != null ) { firstGeneration . AddRange ( Individual < G , F > . FromGenotypes ( breeder . Breed ( ) ) ) ; } else { IAlterer < G , F > alterer = item as IAlterer < G , F > ; Debug . Assert ( alterer != null ) ; firstGeneration = alterer . Apply ( firstGeneration ) . ToList ( ) ; } } firstGeneration = UpdateFitness ( firstGeneration ) . ToList ( ) ; return firstGeneration ; }
Returns the first population for this algorithm
Returns the first population for this algorithm
None