public void CopyIndividuals(Population population) { Individuals.Clear(); foreach (Individual item in population.Individuals) { Individual tmp = new Individual(); tmp.Copy(item); Individuals.Add(tmp); } }
public void Evolve() { var nextGen = new List <Tree <T> >(MaxPop); var selection = Tournament(); nextGen.AddRange(Crossover(selection)); nextGen.AddRange(Mutate(selection)); nextGen.AddRange(Elitism()); nextGen.AddRange(RampedHalfNHalf(MaxPop - nextGen.Count, MaxDepth, Terminals, Functions, GrowTerminalChance)); Individuals.Clear(); Individuals = nextGen; }
/// <summary> /// Sets all Individuals in the Subpopulation to null, preparing it to be reused. /// </summary> public void Clear() { Individuals.Clear(); }
public virtual void Clear( ) => Individuals.Clear( );