コード例 #1
0
        private OffspringSelectionEvolutionStrategy CreateOSESGriewankSample()
        {
            OffspringSelectionEvolutionStrategy es = new OffspringSelectionEvolutionStrategy();

            #region Problem Configuration

            SingleObjectiveTestFunctionProblem problem = new SingleObjectiveTestFunctionProblem();

            problem.ProblemSize.Value              = 10;
            problem.EvaluatorParameter.Value       = new GriewankEvaluator();
            problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
            problem.Maximization.Value             = false;
            problem.Bounds = new DoubleMatrix(new double[, ] {
                { -600, 600 }
            });
            problem.BestKnownQuality.Value           = 0;
            problem.BestKnownSolutionParameter.Value = new RealVector(10);
            problem.Name        = "Single Objective Test Function";
            problem.Description = "Test function with real valued inputs and a single objective.";

            #endregion

            #region Algorithm Configuration

            es.Name        = "Offspring Selection Evolution Strategy - Griewank";
            es.Description = "An evolution strategy with offspring selection which solves the 10-dimensional Griewank test function";
            es.Problem     = problem;
            SamplesUtils.ConfigureOffspringSelectionEvolutionStrategyParameters <AverageCrossover, NormalAllPositionsManipulator,
                                                                                 StdDevStrategyVectorCreator, StdDevStrategyVectorCrossover, StdDevStrategyVectorManipulator>(es, 50, 1.0, 0.5, 100, 2, 100, false);

            StdDevStrategyVectorCreator strategyCreator = (StdDevStrategyVectorCreator)es.StrategyParameterCreator;
            strategyCreator.BoundsParameter.Value = new DoubleMatrix(new double[, ] {
                { 1, 20 }
            });

            StdDevStrategyVectorManipulator strategyManipulator =
                (StdDevStrategyVectorManipulator)es.StrategyParameterManipulator;
            strategyManipulator.BoundsParameter.Value = new DoubleMatrix(new double[, ] {
                { 1E-12, 30 }
            });
            strategyManipulator.GeneralLearningRateParameter.Value = new DoubleValue(0.22360679774997896);
            strategyManipulator.LearningRateParameter.Value        = new DoubleValue(0.39763536438352531);

            #endregion

            return(es);
        }