public ArithmeticSpecimen(ArithmeticSpecimen parent1, ArithmeticSpecimen parent2) { fittingFunction = parent1.fittingFunction; Genes = new double[parent1.Genes.Length]; for (int i = 0; i < Genes.Length; i++) { Genes[i] = (parent1.Genes[i] + parent2.Genes[i]) / 2; } }
private double GetResultOfFitFunctionForMultidimensionalFucntion(ArithmeticSpecimen s) { double result = 0; for (int i = 1; i < s.Genes.Length; i++) { result += (Math.Pow(1 - s.Genes[i - 1], 2)) + (100 * Math.Pow(s.Genes[i] - Math.Pow(s.Genes[i - 1], 2), 2)); // Rosenbrock Function (Multidimensional) } return(result); }