AdjustFitnesses() { float total = 0; for (int i = 0; i < m_vecMembers.Count; i++) { CGenome member = m_vecMembers[i]; float fitness = member.Fitness(); if (m_iAge < _params.YoungAgeThreshold) { fitness *= _params.YoungFitnessBonus; } else if (m_iAge > _params.OldAgeThreshold) { fitness *= _params.OldAgePenalty; } total += fitness; // Calculation of fitness sharing float adjustedFitness = fitness / m_vecMembers.Count; member.SetAdjustedFitness(adjustedFitness); } }