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; }
private void LoadingCompleted(IStorableContent content) { //if (error != null) throw error; UpdateRun("Algorithm loading complete", StrategyState.Running); if (content is HeuristicLab.Algorithms.EvolutionStrategy.EvolutionStrategy) { algorithm = content as HeuristicLab.Algorithms.EvolutionStrategy.EvolutionStrategy; VehicleRoutingProblem problem = algorithm.Problem as VehicleRoutingProblem; if (problem == null) { Console.WriteLine("Unsupported problem type detected."); return; } SetProblemInstance(problem); ParameterizeProblem(problem); ParameterizeAlgorithm(algorithm); RegisterAlgorithmEventHandlers(algorithm); try { algorithm.Start(); } catch (Exception exc) { Console.WriteLine("Error Loading: " + exc.Message); } } else { // TODO: update the run status to error... //_strategyState = StrategyState.Stopped; } }
private void ParameterizeAlgorithm(HeuristicLab.Algorithms.EvolutionStrategy.EvolutionStrategy algorithm) { //set all parameters of the algorithm, e.g. algorithm.MaximumGenerations = new IntValue(_run.GenerationsToRun); }
private EvolutionStrategy(EvolutionStrategy original, Cloner cloner) : base(original, cloner) { qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); Initialize(); }