public List <Representation> GenerateDescendants() { // We need as many descendants as we have parents // Parent count will be an even number // parents will be processed by sexual operator in pairs as they are ordered in the parents list List <Representation> descendants = new List <Representation>(descendantsPopulationCount); for (int i = 0; i < parents.Count; i = i + 2) { // Step 1: Both parents will undergo mutation separately Representation mutatedMother = MutateMember(parents[i]); if (StaticOperations.ValidateRepresentation(mutatedMother) == false) { throw new NotSupportedException(); } Representation mutatedFather = MutateMember(parents[i + 1]); if (StaticOperations.ValidateRepresentation(mutatedFather) == false) { throw new NotSupportedException(); } // Step 2: Attempt crossover for mutated parents List <Representation> children = CrossOverMembers(mutatedMother, mutatedFather); foreach (Representation representation in children) { if (StaticOperations.ValidateRepresentation(representation) == false) { throw new NotSupportedException(); } } descendants.AddRange(children); } return(descendants); }