예제 #1
0
        public override Population Select(Population population)
        {
            // Search minimal chromosome value.
            double minValue = double.MaxValue;
            foreach (var chromosome in population.Chromosomes)
                if (chromosome.Value < minValue)
                    minValue = chromosome.Value;

            // Raise chromosome values if min value is below 0.
            if (minValue < 0)
            {
                double value = Math.Abs(minValue);
                foreach (var chromosome in population.Chromosomes)
                    chromosome.Value += value;
            }

            population.UpdateStats();

            CalculateSigma(population);
            Scale(population);

            return base.Select(population);
        }