Example #1
0
 private EvolutionStrategyMainLoop(EvolutionStrategyMainLoop original, Cloner cloner)
     : base(original, cloner)
 {
 }
 private EvolutionStrategyMainLoop(EvolutionStrategyMainLoop original, Cloner cloner)
   : base(original, cloner) {
 }
Example #3
0
        public EvolutionStrategy()
            : base()
        {
            Parameters.Add(new ValueParameter <IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
            Parameters.Add(new ValueParameter <BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <IntValue>("PopulationSize", "µ (mu) - the size of the population.", new IntValue(20)));
            Parameters.Add(new ValueParameter <IntValue>("ParentsPerChild", "ρ (rho) - how many parents should be recombined.", new IntValue(1)));
            Parameters.Add(new ValueParameter <IntValue>("Children", "λ (lambda) - the size of the offspring population.", new IntValue(100)));
            Parameters.Add(new ValueParameter <IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
            Parameters.Add(new ValueParameter <BoolValue>("PlusSelection", "True for plus selection (elitist population), false for comma selection (non-elitist population).", new BoolValue(true)));
            Parameters.Add(new FixedValueParameter <BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false))
            {
                Hidden = true
            });
            Parameters.Add(new OptionalConstrainedValueParameter <ICrossover>("Recombinator", "The operator used to cross solutions."));
            Parameters.Add(new ConstrainedValueParameter <IManipulator>("Mutator", "The operator used to mutate solutions."));
            Parameters.Add(new OptionalConstrainedValueParameter <IStrategyParameterCreator>("StrategyParameterCreator", "The operator that creates the strategy parameters."));
            Parameters.Add(new OptionalConstrainedValueParameter <IStrategyParameterCrossover>("StrategyParameterCrossover", "The operator that recombines the strategy parameters."));
            Parameters.Add(new OptionalConstrainedValueParameter <IStrategyParameterManipulator>("StrategyParameterManipulator", "The operator that manipulates the strategy parameters."));
            Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));

            RandomCreator             randomCreator           = new RandomCreator();
            SolutionsCreator          solutionsCreator        = new SolutionsCreator();
            SubScopesCounter          subScopesCounter        = new SubScopesCounter();
            UniformSubScopesProcessor strategyVectorProcessor = new UniformSubScopesProcessor();
            Placeholder               strategyVectorCreator   = new Placeholder();
            ResultsCollector          resultsCollector        = new ResultsCollector();
            EvolutionStrategyMainLoop mainLoop = new EvolutionStrategyMainLoop();

            OperatorGraph.InitialOperator = randomCreator;

            randomCreator.RandomParameter.ActualName          = "Random";
            randomCreator.SeedParameter.ActualName            = SeedParameter.Name;
            randomCreator.SeedParameter.Value                 = null;
            randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
            randomCreator.SetSeedRandomlyParameter.Value      = null;
            randomCreator.Successor = solutionsCreator;

            solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
            solutionsCreator.Successor = subScopesCounter;

            subScopesCounter.Name = "Initialize EvaluatedSolutions";
            subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
            subScopesCounter.Successor = strategyVectorProcessor;

            strategyVectorProcessor.Operator  = strategyVectorCreator;
            strategyVectorProcessor.Successor = resultsCollector;

            strategyVectorCreator.OperatorParameter.ActualName = "StrategyParameterCreator";

            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
            resultsCollector.ResultsParameter.ActualName = "Results";
            resultsCollector.Successor = mainLoop;

            mainLoop.RandomParameter.ActualName             = RandomCreator.RandomParameter.ActualName;
            mainLoop.PopulationSizeParameter.ActualName     = PopulationSizeParameter.Name;
            mainLoop.ParentsPerChildParameter.ActualName    = ParentsPerChildParameter.Name;
            mainLoop.ChildrenParameter.ActualName           = ChildrenParameter.Name;
            mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
            mainLoop.PlusSelectionParameter.ActualName      = PlusSelectionParameter.Name;
            mainLoop.ReevaluateElitesParameter.ActualName   = ReevaluateElitesParameter.Name;
            mainLoop.MutatorParameter.ActualName            = MutatorParameter.Name;
            mainLoop.RecombinatorParameter.ActualName       = RecombinatorParameter.Name;
            mainLoop.AnalyzerParameter.ActualName           = AnalyzerParameter.Name;
            mainLoop.ResultsParameter.ActualName            = "Results";
            mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";

            qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
            ParameterizeAnalyzers();
            UpdateAnalyzers();

            Initialize();
        }
    public EvolutionStrategy()
      : base() {
      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "µ (mu) - the size of the population.", new IntValue(20)));
      Parameters.Add(new ValueParameter<IntValue>("ParentsPerChild", "ρ (rho) - how many parents should be recombined.", new IntValue(1)));
      Parameters.Add(new ValueParameter<IntValue>("Children", "λ (lambda) - the size of the offspring population.", new IntValue(100)));
      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
      Parameters.Add(new ValueParameter<BoolValue>("PlusSelection", "True for plus selection (elitist population), false for comma selection (non-elitist population).", new BoolValue(true)));
      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
      Parameters.Add(new OptionalConstrainedValueParameter<ICrossover>("Recombinator", "The operator used to cross solutions."));
      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
      Parameters.Add(new OptionalConstrainedValueParameter<IStrategyParameterCreator>("StrategyParameterCreator", "The operator that creates the strategy parameters."));
      Parameters.Add(new OptionalConstrainedValueParameter<IStrategyParameterCrossover>("StrategyParameterCrossover", "The operator that recombines the strategy parameters."));
      Parameters.Add(new OptionalConstrainedValueParameter<IStrategyParameterManipulator>("StrategyParameterManipulator", "The operator that manipulates the strategy parameters."));
      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));

      RandomCreator randomCreator = new RandomCreator();
      SolutionsCreator solutionsCreator = new SolutionsCreator();
      SubScopesCounter subScopesCounter = new SubScopesCounter();
      UniformSubScopesProcessor strategyVectorProcessor = new UniformSubScopesProcessor();
      Placeholder strategyVectorCreator = new Placeholder();
      ResultsCollector resultsCollector = new ResultsCollector();
      EvolutionStrategyMainLoop mainLoop = new EvolutionStrategyMainLoop();
      OperatorGraph.InitialOperator = randomCreator;

      randomCreator.RandomParameter.ActualName = "Random";
      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
      randomCreator.SeedParameter.Value = null;
      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
      randomCreator.SetSeedRandomlyParameter.Value = null;
      randomCreator.Successor = solutionsCreator;

      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
      solutionsCreator.Successor = subScopesCounter;

      subScopesCounter.Name = "Initialize EvaluatedSolutions";
      subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
      subScopesCounter.Successor = strategyVectorProcessor;

      strategyVectorProcessor.Operator = strategyVectorCreator;
      strategyVectorProcessor.Successor = resultsCollector;

      strategyVectorCreator.OperatorParameter.ActualName = "StrategyParameterCreator";

      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
      resultsCollector.ResultsParameter.ActualName = "Results";
      resultsCollector.Successor = mainLoop;

      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
      mainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
      mainLoop.ParentsPerChildParameter.ActualName = ParentsPerChildParameter.Name;
      mainLoop.ChildrenParameter.ActualName = ChildrenParameter.Name;
      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
      mainLoop.PlusSelectionParameter.ActualName = PlusSelectionParameter.Name;
      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
      mainLoop.RecombinatorParameter.ActualName = RecombinatorParameter.Name;
      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
      mainLoop.ResultsParameter.ActualName = "Results";
      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";

      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
      ParameterizeAnalyzers();
      UpdateAnalyzers();

      Initialize();
    }