private void DieOfAge(int maxAge) { if (PopulationList.Exists(x => x.Age > maxAge)) { PopulationList = PopulationList.OrderBy(x => x.Age).ToList(); NeuronNet firstOld = PopulationList.First(x => x.Age > maxAge); int index = PopulationList.IndexOf(firstOld); PopulationList.RemoveRange(index, PopulationList.Count - index); PopulationList = PopulationList.OrderBy(x => x.Error).ToList(); } }
private void SortPopulation() { PopulationList = PopulationList.OrderBy(x => x.Error).ToList(); }