internal void UpdateFitness() { double max = 0.0; double total = 0.0; //calculates the max and total fitness in one pass foreach (int index in members) { Organism <T> member = pop.GetMember(index); double fit = member.Fitness; if (fit > max) { max = fit; } total += fit; } //updates the average and max fitness avg_fit = total / members.Count; max_fit = max; //increments the age age = age + 1; }