List <PhenoType> GenerateOffspring() { List <PhenoType> offspring = new List <PhenoType>(); List <PhenoType> populationBuffer = evoManager.Population; int id = 0; for (int i = 0; i < evoManager.N / 2; i++) { int ind1 = Random.Range(0, populationBuffer.Count); PhenoType p1 = populationBuffer[ind1]; populationBuffer.RemoveAt(ind1); int ind2 = Random.Range(0, populationBuffer.Count); PhenoType p2 = populationBuffer[ind2]; populationBuffer.RemoveAt(ind2); PhenoType[] children = evolver.HUXCrossover(p1, p2); children[0].Id = id; id++; children[1].Id = id; id++; offspring.Add(children[0]); offspring.Add(children[1]); } return(offspring); }