Exemple #1
0
        public void Add(double val)
        {
            double roundedVal   = Math.Round(val, roundVal);
            double fitnessValue = fitnessFunction(txtFunction, val);

            if (!Double.IsNaN(fitnessValue))
            {
                Сhromosome nc = new Сhromosome(roundedVal, fitnessValue);

                bool alreadyExists = population.Any(x => x.value.Equals(roundedVal));
                if (!alreadyExists)
                {
                    population.Add(new Сhromosome(roundedVal, fitnessValue));
                }
            }
        }
Exemple #2
0
        private void Mutation(Сhromosome x)
        {
            double z = Mutation(x.value);

            Add(z);
        }
Exemple #3
0
        private void Cross(Сhromosome x, Сhromosome y)
        {
            double xy = Cross(x.value, y.value);

            Add(xy);
        }