Esempio n. 1
0
        protected ContinuousSolution Mutate(ContinuousSolution solution, double[] lower_bounds, double[] upper_bounds, object constraints)
        {
            ContinuousSolution child = MutateVector(solution, lower_bounds, upper_bounds, constraints);

            double[] child_strategy = MutateStrategy(solution.GetMutationStrategy());
            child.SetMutationStrategy(child_strategy);
            return(child);
        }
Esempio n. 2
0
        protected virtual ContinuousSolution MutateVector(ContinuousSolution solution, double[] lower_bounds, double[] upper_bounds, object constraints)
        {
            double[] x        = new double[mDimension];
            double[] strategy = solution.GetMutationStrategy();
            for (int i = 0; i < mDimension; ++i)
            {
                x[i] = solution[i] + RandomEngine.Gauss(0, strategy[i]);
                x[i] = System.Math.Max(lower_bounds[i], x[i]);
                x[i] = System.Math.Min(upper_bounds[i], x[i]);
            }

            return(new ContinuousSolution(x, double.MaxValue));
        }