protected ParameterOptimizationProblem(IParameterVectorEvaluator evaluator) : base(evaluator, new UniformRandomRealVectorCreator()) { Parameters.Add(new FixedValueParameter <IntValue>(ProblemSizeParameterName, "The dimension of the parameter vector that is to be optimized.", new IntValue(1))); Parameters.Add(new ValueParameter <DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If the number of bounds is smaller than the problem size then the bounds are reused in a cyclic manner.", new DoubleMatrix(new double[, ] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" }))); Parameters.Add(new ValueParameter <StringArray>(ParameterNamesParameterName, "The element names which are used to calculate the quality of a parameter vector.", new StringArray(new string[] { "Parameter0" }))); SolutionCreator.LengthParameter.ActualName = "ProblemSize"; Operators.AddRange(ApplicationManager.Manager.GetInstances <IRealVectorOperator>()); strategyVectorCreator = new StdDevStrategyVectorCreator(); strategyVectorCreator.LengthParameter.ActualName = ProblemSizeParameter.Name; strategyVectorCrossover = new StdDevStrategyVectorCrossover(); strategyVectorManipulator = new StdDevStrategyVectorManipulator(); strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(0.5); strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(0.5); Operators.Add(strategyVectorCreator); Operators.Add(strategyVectorCrossover); Operators.Add(strategyVectorManipulator); Operators.Add(new BestSolutionAnalyzer()); Operators.Add(new BestSolutionsAnalyzer()); UpdateParameters(); UpdateStrategyVectorBounds(); RegisterEventHandlers(); }
public SingleObjectiveTestFunctionProblem() : base(new AckleyEvaluator(), new UniformRandomRealVectorCreator()) { Parameters.Add(new ValueParameter <DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.", Evaluator.Bounds)); Parameters.Add(new ValueParameter <IntValue>("ProblemSize", "The dimension of the problem.", new IntValue(2))); Parameters.Add(new OptionalValueParameter <RealVector>("BestKnownSolution", "The best known solution for this test function instance.")); Maximization.Value = Evaluator.Maximization; BestKnownQuality = new DoubleValue(Evaluator.BestKnownQuality); strategyVectorCreator = new StdDevStrategyVectorCreator(); strategyVectorCreator.LengthParameter.ActualName = ProblemSizeParameter.Name; strategyVectorCrossover = new StdDevStrategyVectorCrossover(); strategyVectorManipulator = new StdDevStrategyVectorManipulator(); strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(0.5); strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(0.5); SolutionCreator.RealVectorParameter.ActualName = "Point"; ParameterizeSolutionCreator(); ParameterizeEvaluator(); InitializeOperators(); RegisterEventHandlers(); UpdateStrategyVectorBounds(); }
protected ParameterOptimizationProblem(ParameterOptimizationProblem original, Cloner cloner) : base(original, cloner) { strategyVectorCreator = cloner.Clone(original.strategyVectorCreator); strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover); strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator); RegisterEventHandlers(); }
private SingleObjectiveTestFunctionProblem(SingleObjectiveTestFunctionProblem original, Cloner cloner) : base(original, cloner) { strategyVectorCreator = cloner.Clone(original.strategyVectorCreator); strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover); strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator); RegisterEventHandlers(); }
private EvolutionStrategy CreateEsGriewankSample() { EvolutionStrategy es = new EvolutionStrategy(); #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 = "Evolution Strategy - Griewank"; es.Description = "An evolution strategy which solves the 10-dimensional Griewank test function"; es.Problem = problem; SamplesUtils.ConfigureEvolutionStrategyParameters <AverageCrossover, NormalAllPositionsManipulator, StdDevStrategyVectorCreator, StdDevStrategyVectorCrossover, StdDevStrategyVectorManipulator>( es, 20, 500, 2, 200, 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); }