private Individual <Element> SingleRouletteWheel <Element>(List <Individual <Element> > population, List <double> accumulatedProbabilities)
        {
            double probability = rng.Next();

            int selectedIndex = 0;

            for (; selectedIndex < accumulatedProbabilities.Count - 1 && accumulatedProbabilities[selectedIndex] <= probability; ++selectedIndex)
            {
                ;
            }

            return(population[selectedIndex]);
        }
Exemplo n.º 2
0
        public override List <double> Fill(List <double> solution)
        {
            for (int i = 0; i < solution.Capacity; ++i)
            {
                solution.Add(rng.Next(constraint.tGetLowerBound(i), constraint.tGetUpperBound(i)));
            }

            return(solution);
        }