// Create new generation from the parents void Repopulate() { int pos = size_main; for (int i1 = 0; i1 < size_main; i1++) { for (int i2 = 0; i2 < size_main; i2++) { Individuals[pos] = IndividCreater.CreateIndivid(Individuals[i1], Individuals[i2], i1 == i2); pos++; } } }
public Population() { // Create array for entire population Individuals = new Individ[size_main + size_other]; // Create compileable individuals for (int i = 0; i < Individuals.Length; i++) { Individuals[i] = IndividCreater.CreateIndivid(); } // Sortinf individuals for further selection top as parents // and rest to delete and replace by new generation Array.Sort <Individ>(Individuals, IndividComparizon); }