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)); } } }
private void Mutation(Сhromosome x) { double z = Mutation(x.value); Add(z); }
private void Cross(Сhromosome x, Сhromosome y) { double xy = Cross(x.value, y.value); Add(xy); }