コード例 #1
0
        public AlpsGeneticAlgorithmMainOperator()
            : base()
        {
            Parameters.Add(new ValueLookupParameter <IRandom>("Random", "A pseudo random number generator."));

            Parameters.Add(new ValueLookupParameter <IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
            Parameters.Add(new ValueLookupParameter <IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The value which represents the quality of a solution."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));

            Parameters.Add(new ValueLookupParameter <IntValue>("PopulationSize", "The size of the population of solutions in each layer."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Selector", "The operator used to select solutions for reproduction."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Crossover", "The operator used to cross solutions."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Mutator", "The operator used to mutate solutions."));
            Parameters.Add(new ValueLookupParameter <PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
            Parameters.Add(new ValueLookupParameter <IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
            Parameters.Add(new ValueLookupParameter <BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation."));

            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Age", "The age of individuals."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("AgeIncrement", "The value the age the individuals is incremented if they survives a generation."));


            var numberOfSelectedParentsCalculator = new ExpressionCalculator()
            {
                Name = "NumberOfSelectedParents = 2 * (PopulationSize - (PlusSelection ? 0 : Elites))"
            };
            var selector = new Placeholder()
            {
                Name = "Selector (Placeholder)"
            };
            var subScopesProcessor1        = new SubScopesProcessor();
            var childrenCreator            = new ChildrenCreator();
            var uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
            var crossover = new Placeholder()
            {
                Name = "Crossover (Placeholder)"
            };
            var stochasticBranch = new StochasticBranch()
            {
                Name = "MutationProbability"
            };
            var mutator = new Placeholder()
            {
                Name = "Mutator (Placeholder)"
            };
            var ageCalculator = new WeightingReducer()
            {
                Name = "Calculate Age"
            };
            var subScopesRemover           = new SubScopesRemover();
            var uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
            var evaluator = new Placeholder()
            {
                Name = "Evaluator (Placeholder)"
            };
            var subScopesCounter = new SubScopesCounter()
            {
                Name = "Increment EvaluatedSolutions"
            };
            var replacementBranch = new ConditionalBranch()
            {
                Name = "PlusSelection?"
            };
            var replacementMergingReducer = new MergingReducer();
            var replacementBestSelector   = new BestSelector();
            var replacementRightReducer   = new RightReducer();
            var subScopesProcessor2       = new SubScopesProcessor();
            var bestSelector           = new BestSelector();
            var rightReducer           = new RightReducer();
            var mergingReducer         = new MergingReducer();
            var reevaluateElitesBranch = new ConditionalBranch()
            {
                Name = "Reevaluate elites ?"
            };
            var incrementAgeProcessor = new UniformSubScopesProcessor();
            var ageIncrementor        = new DoubleCounter()
            {
                Name = "Increment Age"
            };

            OperatorGraph.InitialOperator = numberOfSelectedParentsCalculator;

            numberOfSelectedParentsCalculator.CollectedValues.Add(new LookupParameter <IntValue>(PopulationSizeParameter.Name));
            numberOfSelectedParentsCalculator.CollectedValues.Add(new LookupParameter <IntValue>(ElitesParameter.Name));
            numberOfSelectedParentsCalculator.CollectedValues.Add(new LookupParameter <BoolValue>(PlusSelectionParameter.Name));
            numberOfSelectedParentsCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes";
            numberOfSelectedParentsCalculator.ExpressionParameter.Value            = new StringValue("PopulationSize 0 Elites PlusSelection if - 2 * toint");
            numberOfSelectedParentsCalculator.Successor = selector;

            selector.OperatorParameter.ActualName = SelectorParameter.Name;
            selector.Successor = subScopesProcessor1;

            subScopesProcessor1.Operators.Add(new EmptyOperator());
            subScopesProcessor1.Operators.Add(childrenCreator);
            subScopesProcessor1.Successor = replacementBranch;

            childrenCreator.ParentsPerChild = new IntValue(2);
            childrenCreator.Successor       = uniformSubScopesProcessor1;

            uniformSubScopesProcessor1.Operator  = crossover;
            uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2;

            crossover.OperatorParameter.ActualName = CrossoverParameter.Name;
            crossover.Successor = stochasticBranch;

            stochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
            stochasticBranch.RandomParameter.ActualName      = RandomParameter.Name;
            stochasticBranch.FirstBranch  = mutator;
            stochasticBranch.SecondBranch = null;
            stochasticBranch.Successor    = ageCalculator;

            mutator.OperatorParameter.ActualName = MutatorParameter.Name;
            mutator.Successor = null;

            ageCalculator.ParameterToReduce.ActualName = AgeParameter.Name;
            ageCalculator.TargetParameter.ActualName   = AgeParameter.Name;
            ageCalculator.WeightParameter.ActualName   = AgeInheritanceParameter.Name;
            ageCalculator.Successor = subScopesRemover;

            subScopesRemover.RemoveAllSubScopes = true;
            subScopesRemover.Successor          = null;

            uniformSubScopesProcessor2.Parallel.Value = true;
            uniformSubScopesProcessor2.Operator       = evaluator;
            uniformSubScopesProcessor2.Successor      = subScopesCounter;

            evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
            evaluator.Successor = null;

            subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
            subScopesCounter.AccumulateParameter.Value = new BoolValue(true);
            subScopesCounter.Successor = null;

            replacementBranch.ConditionParameter.ActualName = PlusSelectionParameter.Name;
            replacementBranch.TrueBranch  = replacementMergingReducer;
            replacementBranch.FalseBranch = subScopesProcessor2;
            replacementBranch.Successor   = incrementAgeProcessor;

            replacementMergingReducer.Successor = replacementBestSelector;

            replacementBestSelector.NumberOfSelectedSubScopesParameter.ActualName = PopulationSizeParameter.Name;
            replacementBestSelector.CopySelected = new BoolValue(false);
            replacementBestSelector.Successor    = replacementRightReducer;

            replacementRightReducer.Successor = reevaluateElitesBranch;

            subScopesProcessor2.Operators.Add(bestSelector);
            subScopesProcessor2.Operators.Add(new EmptyOperator());
            subScopesProcessor2.Successor = mergingReducer;

            bestSelector.CopySelected = new BoolValue(false);
            bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
            bestSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name;
            bestSelector.QualityParameter.ActualName = QualityParameter.Name;
            bestSelector.Successor = rightReducer;

            rightReducer.Successor = reevaluateElitesBranch;

            mergingReducer.Successor = null;

            reevaluateElitesBranch.ConditionParameter.ActualName = ReevaluateElitesParameter.Name;
            reevaluateElitesBranch.TrueBranch  = uniformSubScopesProcessor2;
            reevaluateElitesBranch.FalseBranch = null;
            reevaluateElitesBranch.Successor   = null;


            incrementAgeProcessor.Operator  = ageIncrementor;
            incrementAgeProcessor.Successor = null;

            ageIncrementor.ValueParameter.ActualName     = AgeParameter.Name;
            ageIncrementor.IncrementParameter.Value      = null;
            ageIncrementor.IncrementParameter.ActualName = AgeIncrementParameter.Name;
            ageIncrementor.Successor = null;
        }
コード例 #2
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();
        }
コード例 #3
0
        public ParticleSwarmOptimization()
            : 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>("SwarmSize", "Size of the particle swarm.", new IntValue(10)));
            Parameters.Add(new ValueParameter <IntValue>("MaxIterations", "Maximal number of iterations.", new IntValue(1000)));
            Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
            Parameters.Add(new ValueParameter <DoubleValue>("Inertia", "Inertia weight on a particle's movement (omega).", new DoubleValue(1)));
            Parameters.Add(new ValueParameter <DoubleValue>("PersonalBestAttraction", "Weight for particle's pull towards its personal best soution (phi_p).", new DoubleValue(-0.01)));
            Parameters.Add(new ValueParameter <DoubleValue>("NeighborBestAttraction", "Weight for pull towards the neighborhood best solution or global best solution in case of a totally connected topology (phi_g).", new DoubleValue(3.7)));
            Parameters.Add(new ConstrainedValueParameter <IParticleCreator>("ParticleCreator", "Operator that creates a new particle."));
            Parameters.Add(new ConstrainedValueParameter <IParticleUpdater>("ParticleUpdater", "Operator that updates a particle."));
            Parameters.Add(new OptionalConstrainedValueParameter <ITopologyInitializer>("TopologyInitializer", "Creates neighborhood description vectors."));
            Parameters.Add(new OptionalConstrainedValueParameter <ITopologyUpdater>("TopologyUpdater", "Updates the neighborhood description vectors."));
            Parameters.Add(new OptionalConstrainedValueParameter <IDiscreteDoubleValueModifier>("InertiaUpdater", "Updates the omega parameter."));
            Parameters.Add(new ConstrainedValueParameter <ISwarmUpdater>("SwarmUpdater", "Encoding-specific parameter which is provided by the problem. May provide additional encoding-specific parameters, such as velocity bounds for real valued problems"));
            ParticleUpdaterParameter.Hidden = true;

            RandomCreator   randomCreator          = new RandomCreator();
            VariableCreator variableCreator        = new VariableCreator();
            Assigner        currentInertiaAssigner = new Assigner();

            solutionsCreator = new SolutionsCreator();
            SubScopesCounter subScopesCounter = new SubScopesCounter();
            Placeholder      topologyInitializerPlaceholder = new Placeholder();

            mainLoop = new ParticleSwarmOptimizationMainLoop();

            OperatorGraph.InitialOperator = randomCreator;

            randomCreator.SetSeedRandomlyParameter.Value = null;
            randomCreator.SeedParameter.Value            = null;
            randomCreator.Successor = variableCreator;

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Iterations", new IntValue(0)));
            variableCreator.Successor = currentInertiaAssigner;

            currentInertiaAssigner.Name = "CurrentInertia := Inertia";
            currentInertiaAssigner.LeftSideParameter.ActualName  = "CurrentInertia";
            currentInertiaAssigner.RightSideParameter.ActualName = "Inertia";
            currentInertiaAssigner.Successor = solutionsCreator;

            solutionsCreator.NumberOfSolutionsParameter.ActualName = "SwarmSize";
            ParameterizeSolutionsCreator();
            solutionsCreator.Successor = subScopesCounter;

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

            topologyInitializerPlaceholder.Name = "(TopologyInitializer)";
            topologyInitializerPlaceholder.OperatorParameter.ActualName = "TopologyInitializer";
            topologyInitializerPlaceholder.Successor = mainLoop;

            mainLoop.AnalyzerParameter.ActualName               = AnalyzerParameter.Name;
            mainLoop.InertiaParameter.ActualName                = "CurrentInertia";
            mainLoop.MaxIterationsParameter.ActualName          = MaxIterationsParameter.Name;
            mainLoop.NeighborBestAttractionParameter.ActualName = NeighborBestAttractionParameter.Name;
            mainLoop.InertiaUpdaterParameter.ActualName         = InertiaUpdaterParameter.Name;
            mainLoop.ParticleUpdaterParameter.ActualName        = ParticleUpdaterParameter.Name;
            mainLoop.PersonalBestAttractionParameter.ActualName = PersonalBestAttractionParameter.Name;
            mainLoop.RandomParameter.ActualName          = randomCreator.RandomParameter.ActualName;
            mainLoop.SwarmSizeParameter.ActualName       = SwarmSizeParameter.Name;
            mainLoop.TopologyUpdaterParameter.ActualName = TopologyUpdaterParameter.Name;
            mainLoop.RandomParameter.ActualName          = randomCreator.RandomParameter.ActualName;
            mainLoop.ResultsParameter.ActualName         = "Results";

            InitializeAnalyzers();
            InitializeParticleCreator();
            InitializeSwarmUpdater();
            ParameterizeSolutionsCreator();
            UpdateAnalyzers();
            UpdateInertiaUpdater();
            InitInertiaUpdater();
            UpdateTopologyInitializer();
            Initialize();
            ParameterizeMainLoop();
        }
コード例 #4
0
        public OffspringSelectionEvolutionStrategy()
            : 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>("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()));

            Parameters.Add(new ValueLookupParameter <DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
            Parameters.Add(new ValueLookupParameter <IntValue>("SelectedParents", "How much parents should be selected each time the offspring selection step is performed until the population is filled. This parameter should be about the same or twice the size of PopulationSize for smaller problems, and less for large problems.", new IntValue(40)));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
            Parameters.Add(new ValueParameter <IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions.", new IntValue(int.MaxValue)));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("ComparisonFactor", "The comparison factor is used to determine whether the offspring should be compared to the better parent, the worse parent or a quality value linearly interpolated between them. It is in the range [0;1].", new DoubleValue(0.5)));



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

            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.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";

            mainLoop.SuccessRatioParameter.ActualName              = SuccessRatioParameter.Name;
            mainLoop.MaximumSelectionPressureParameter.ActualName  = MaximumSelectionPressureParameter.Name;
            mainLoop.MaximumEvaluatedSolutionsParameter.ActualName = MaximumEvaluatedSolutionsParameter.Name;
            mainLoop.SelectedParentsParameter.ActualName           = SelectedParentsParameter.Name;
            mainLoop.ComparisonFactorParameter.ActualName          = ComparisonFactorParameter.Name;
            mainLoop.CurrentSuccessRatioParameter.ActualName       = "CurrentSuccessRatio";
            mainLoop.SelectionPressureParameter.ActualName         = "SelectionPressure";

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

            Initialize();
        }
コード例 #5
0
        private void Initialize()
        {
            #region Create parameters
            Parameters.Add(new ValueLookupParameter <IRandom>("Random", "A pseudo random number generator."));
            Parameters.Add(new ValueLookupParameter <BoolArray>("Maximization", "True if an objective should be maximized, or false if it should be minimized."));
            Parameters.Add(new ScopeTreeLookupParameter <DoubleArray>("Qualities", "The vector of quality values."));
            Parameters.Add(new ValueLookupParameter <IntValue>("PopulationSize", "The population size."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Selector", "The operator used to select solutions for reproduction."));
            Parameters.Add(new ValueLookupParameter <PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on a solution."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Crossover", "The operator used to cross solutions."));
            Parameters.Add(new ValueLookupParameter <PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Mutator", "The operator used to mutate solutions."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
            Parameters.Add(new ValueLookupParameter <VariableCollection>("Results", "The variable collection where results should be stored."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Analyzer", "The operator used to analyze each generation."));
            Parameters.Add(new LookupParameter <IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("DominateOnEqualQualities", "Flag which determines wether solutions with equal quality values should be treated as dominated."));
            #endregion

            #region Create operators
            VariableCreator           variableCreator            = new VariableCreator();
            ResultsCollector          resultsCollector1          = new ResultsCollector();
            Placeholder               analyzer1                  = new Placeholder();
            Placeholder               selector                   = new Placeholder();
            SubScopesProcessor        subScopesProcessor1        = new SubScopesProcessor();
            ChildrenCreator           childrenCreator            = new ChildrenCreator();
            UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
            StochasticBranch          crossoverStochasticBranch  = new StochasticBranch();
            Placeholder               crossover                  = new Placeholder();
            ParentCopyCrossover       noCrossover                = new ParentCopyCrossover();
            StochasticBranch          mutationStochasticBranch   = new StochasticBranch();
            Placeholder               mutator                    = new Placeholder();
            SubScopesRemover          subScopesRemover           = new SubScopesRemover();
            UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
            Placeholder               evaluator                  = new Placeholder();
            SubScopesCounter          subScopesCounter           = new SubScopesCounter();
            MergingReducer            mergingReducer             = new MergingReducer();
            RankAndCrowdingSorter     rankAndCrowdingSorter      = new RankAndCrowdingSorter();
            LeftSelector              leftSelector               = new LeftSelector();
            RightReducer              rightReducer               = new RightReducer();
            IntCounter        intCounter        = new IntCounter();
            Comparator        comparator        = new Comparator();
            Placeholder       analyzer2         = new Placeholder();
            ConditionalBranch conditionalBranch = new ConditionalBranch();

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Generations", new IntValue(0)));

            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            analyzer1.Name = "Analyzer";
            analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;

            selector.Name = "Selector";
            selector.OperatorParameter.ActualName = SelectorParameter.Name;

            childrenCreator.ParentsPerChild = new IntValue(2);

            crossoverStochasticBranch.ProbabilityParameter.ActualName = CrossoverProbabilityParameter.Name;
            crossoverStochasticBranch.RandomParameter.ActualName      = RandomParameter.Name;

            crossover.Name = "Crossover";
            crossover.OperatorParameter.ActualName = CrossoverParameter.Name;

            noCrossover.Name = "Clone parent";
            noCrossover.RandomParameter.ActualName = RandomParameter.Name;

            mutationStochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
            mutationStochasticBranch.RandomParameter.ActualName      = RandomParameter.Name;

            mutator.Name = "Mutator";
            mutator.OperatorParameter.ActualName = MutatorParameter.Name;

            subScopesRemover.RemoveAllSubScopes = true;

            uniformSubScopesProcessor2.Parallel.Value = true;

            evaluator.Name = "Evaluator";
            evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;

            subScopesCounter.Name = "Increment EvaluatedSolutions";
            subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;

            rankAndCrowdingSorter.DominateOnEqualQualitiesParameter.ActualName = DominateOnEqualQualitiesParameter.Name;
            rankAndCrowdingSorter.CrowdingDistanceParameter.ActualName         = "CrowdingDistance";
            rankAndCrowdingSorter.RankParameter.ActualName = "Rank";

            leftSelector.CopySelected = new BoolValue(false);
            leftSelector.NumberOfSelectedSubScopesParameter.ActualName = PopulationSizeParameter.Name;

            intCounter.Increment = new IntValue(1);
            intCounter.ValueParameter.ActualName = "Generations";

            comparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            comparator.LeftSideParameter.ActualName  = "Generations";
            comparator.ResultParameter.ActualName    = "Terminate";
            comparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;

            analyzer2.Name = "Analyzer";
            analyzer2.OperatorParameter.ActualName = "Analyzer";

            conditionalBranch.ConditionParameter.ActualName = "Terminate";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator = variableCreator;
            variableCreator.Successor     = resultsCollector1;
            resultsCollector1.Successor   = analyzer1;
            analyzer1.Successor           = selector;
            selector.Successor            = subScopesProcessor1;
            subScopesProcessor1.Operators.Add(new EmptyOperator());
            subScopesProcessor1.Operators.Add(childrenCreator);
            subScopesProcessor1.Successor          = mergingReducer;
            childrenCreator.Successor              = uniformSubScopesProcessor1;
            uniformSubScopesProcessor1.Operator    = crossoverStochasticBranch;
            uniformSubScopesProcessor1.Successor   = uniformSubScopesProcessor2;
            crossoverStochasticBranch.FirstBranch  = crossover;
            crossoverStochasticBranch.SecondBranch = noCrossover;
            crossoverStochasticBranch.Successor    = mutationStochasticBranch;
            crossover.Successor   = null;
            noCrossover.Successor = null;
            mutationStochasticBranch.FirstBranch  = mutator;
            mutationStochasticBranch.SecondBranch = null;
            mutationStochasticBranch.Successor    = subScopesRemover;
            mutator.Successor                    = null;
            subScopesRemover.Successor           = null;
            uniformSubScopesProcessor2.Operator  = evaluator;
            uniformSubScopesProcessor2.Successor = subScopesCounter;
            evaluator.Successor                  = null;
            subScopesCounter.Successor           = null;
            mergingReducer.Successor             = rankAndCrowdingSorter;
            rankAndCrowdingSorter.Successor      = leftSelector;
            leftSelector.Successor               = rightReducer;
            rightReducer.Successor               = intCounter;
            intCounter.Successor                 = comparator;
            comparator.Successor                 = analyzer2;
            analyzer2.Successor                  = conditionalBranch;
            conditionalBranch.FalseBranch        = selector;
            conditionalBranch.TrueBranch         = null;
            conditionalBranch.Successor          = null;
            #endregion
        }
コード例 #6
0
        public AlpsGeneticAlgorithm()
            : base()
        {
            #region Add parameters
            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 FixedValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze all individuals from all layers combined.", new MultiAnalyzer()));
            Parameters.Add(new FixedValueParameter <MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));

            Parameters.Add(new ValueParameter <IntValue>("NumberOfLayers", "The number of layers.", new IntValue(10)));
            Parameters.Add(new ValueParameter <IntValue>("PopulationSize", "The size of the population of solutions in each layer.", new IntValue(100)));

            Parameters.Add(new ConstrainedValueParameter <ISelector>("Selector", "The operator used to select solutions for reproduction."));
            Parameters.Add(new ConstrainedValueParameter <ICrossover>("Crossover", "The operator used to cross solutions."));
            Parameters.Add(new ConstrainedValueParameter <IManipulator>("Mutator", "The operator used to mutate solutions."));
            Parameters.Add(new ValueParameter <PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
            Parameters.Add(new ValueParameter <IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
            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 ValueParameter <BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation.", new BoolValue(false)));

            Parameters.Add(new ValueParameter <EnumValue <AgingScheme> >("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue <AgingScheme>(ALPS.AgingScheme.Polynomial)));
            Parameters.Add(new ValueParameter <IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers.", new IntValue(20)));
            Parameters.Add(new ValueParameter <DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.", new DoubleValue(1.0))
            {
                Hidden = true
            });
            Parameters.Add(new ValueParameter <IntArray>("AgeLimits", "The maximum age an individual is allowed to reach in a certain layer.", new IntArray(new int[0]))
            {
                Hidden = true
            });

            Parameters.Add(new ValueParameter <IntValue>("MatingPoolRange", "The range of layers used for creating a mating pool. (1 = current + previous layer)", new IntValue(1))
            {
                Hidden = true
            });
            Parameters.Add(new ValueParameter <BoolValue>("ReduceToPopulationSize", "Reduce the CurrentPopulationSize after elder migration to PopulationSize", new BoolValue(true))
            {
                Hidden = true
            });

            Parameters.Add(new ValueParameter <MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()));
            #endregion

            #region Create operators
            var globalRandomCreator = new RandomCreator();
            var layer0Creator       = new SubScopesCreator()
            {
                Name = "Create Layer Zero"
            };
            var layer0Processor        = new SubScopesProcessor();
            var localRandomCreator     = new LocalRandomCreator();
            var layerSolutionsCreator  = new SolutionsCreator();
            var initializeAgeProcessor = new UniformSubScopesProcessor();
            var initializeAge          = new VariableCreator()
            {
                Name = "Initialize Age"
            };
            var initializeCurrentPopulationSize = new SubScopesCounter()
            {
                Name = "Initialize CurrentPopulationCounter"
            };
            var initializeLocalEvaluatedSolutions = new Assigner()
            {
                Name = "Initialize LayerEvaluatedSolutions"
            };
            var initializeGlobalEvaluatedSolutions = new DataReducer()
            {
                Name = "Initialize EvaluatedSolutions"
            };
            var resultsCollector = new ResultsCollector();
            var mainLoop         = new AlpsGeneticAlgorithmMainLoop();
            #endregion

            #region Create and parameterize operator graph
            OperatorGraph.InitialOperator = globalRandomCreator;

            globalRandomCreator.RandomParameter.ActualName          = "GlobalRandom";
            globalRandomCreator.SeedParameter.Value                 = null;
            globalRandomCreator.SeedParameter.ActualName            = SeedParameter.Name;
            globalRandomCreator.SetSeedRandomlyParameter.Value      = null;
            globalRandomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
            globalRandomCreator.Successor = layer0Creator;

            layer0Creator.NumberOfSubScopesParameter.Value = new IntValue(1);
            layer0Creator.Successor = layer0Processor;

            layer0Processor.Operators.Add(localRandomCreator);
            layer0Processor.Successor = initializeGlobalEvaluatedSolutions;

            localRandomCreator.Successor = layerSolutionsCreator;

            layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
            layerSolutionsCreator.Successor = initializeAgeProcessor;

            initializeAgeProcessor.Operator  = initializeAge;
            initializeAgeProcessor.Successor = initializeCurrentPopulationSize;

            initializeCurrentPopulationSize.ValueParameter.ActualName = "CurrentPopulationSize";
            initializeCurrentPopulationSize.Successor = initializeLocalEvaluatedSolutions;

            initializeAge.CollectedValues.Add(new ValueParameter <DoubleValue>("Age", new DoubleValue(0)));
            initializeAge.Successor = null;

            initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName  = "LayerEvaluatedSolutions";
            initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "CurrentPopulationSize";
            initializeLocalEvaluatedSolutions.Successor = null;

            initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum;
            initializeGlobalEvaluatedSolutions.TargetOperation.Value.Value    = ReductionOperations.Assign;
            initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName   = "LayerEvaluatedSolutions";
            initializeGlobalEvaluatedSolutions.TargetParameter.ActualName     = "EvaluatedSolutions";
            initializeGlobalEvaluatedSolutions.Successor = resultsCollector;

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

            mainLoop.GlobalRandomParameter.ActualName          = "GlobalRandom";
            mainLoop.LocalRandomParameter.ActualName           = localRandomCreator.LocalRandomParameter.Name;
            mainLoop.EvaluatedSolutionsParameter.ActualName    = "EvaluatedSolutions";
            mainLoop.AnalyzerParameter.ActualName              = AnalyzerParameter.Name;
            mainLoop.LayerAnalyzerParameter.ActualName         = LayerAnalyzerParameter.Name;
            mainLoop.NumberOfLayersParameter.ActualName        = NumberOfLayersParameter.Name;
            mainLoop.PopulationSizeParameter.ActualName        = PopulationSizeParameter.Name;
            mainLoop.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
            mainLoop.SelectorParameter.ActualName              = SelectorParameter.Name;
            mainLoop.CrossoverParameter.ActualName             = CrossoverParameter.Name;
            mainLoop.MutatorParameter.ActualName             = MutatorParameter.Name;
            mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
            mainLoop.ElitesParameter.ActualName           = ElitesParameter.Name;
            mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
            mainLoop.PlusSelectionParameter.ActualName    = PlusSelectionParameter.Name;
            mainLoop.AgeParameter.ActualName                    = "Age";
            mainLoop.AgeGapParameter.ActualName                 = AgeGapParameter.Name;
            mainLoop.AgeInheritanceParameter.ActualName         = AgeInheritanceParameter.Name;
            mainLoop.AgeLimitsParameter.ActualName              = AgeLimitsParameter.Name;
            mainLoop.MatingPoolRangeParameter.ActualName        = MatingPoolRangeParameter.Name;
            mainLoop.ReduceToPopulationSizeParameter.ActualName = ReduceToPopulationSizeParameter.Name;
            mainLoop.TerminatorParameter.ActualName             = TerminatorParameter.Name;
            #endregion

            #region Set selectors
            foreach (var selector in ApplicationManager.Manager.GetInstances <ISelector>().Where(s => !(s is IMultiObjectiveSelector)).OrderBy(s => Name))
            {
                SelectorParameter.ValidValues.Add(selector);
            }
            var defaultSelector = SelectorParameter.ValidValues.OfType <GeneralizedRankSelector>().FirstOrDefault();
            if (defaultSelector != null)
            {
                defaultSelector.PressureParameter.Value = new DoubleValue(4.0);
                SelectorParameter.Value = defaultSelector;
            }
            #endregion

            #region Create analyzers
            qualityAnalyzer              = new BestAverageWorstQualityAnalyzer();
            layerQualityAnalyzer         = new BestAverageWorstQualityAnalyzer();
            ageAnalyzer                  = new OldestAverageYoungestAgeAnalyzer();
            layerAgeAnalyzer             = new OldestAverageYoungestAgeAnalyzer();
            ageDistributionAnalyzer      = new AgeDistributionAnalyzer();
            layerAgeDistributionAnalyzer = new AgeDistributionAnalyzer();
            #endregion

            #region Create terminators
            generationsTerminator = new ComparisonTerminator <IntValue>("Generations", ComparisonType.Less, new IntValue(1000))
            {
                Name = "Generations"
            };
            evaluationsTerminator = new ComparisonTerminator <IntValue>("EvaluatedSolutions", ComparisonType.Less, new IntValue(int.MaxValue))
            {
                Name = "Evaluations"
            };
            qualityTerminator = new SingleObjectiveQualityTerminator()
            {
                Name = "Quality"
            };
            executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
            #endregion

            #region Parameterize
            UpdateAnalyzers();
            ParameterizeAnalyzers();

            ParameterizeSelectors();

            UpdateTerminators();

            ParameterizeAgeLimits();
            #endregion

            Initialize();
        }
        private CombinedOperator CreateLayerOpener()
        {
            var layerOpener = new CombinedOperator()
            {
                Name = "Open new Layer if needed"
            };
            var maxLayerReached = new Comparator()
            {
                Name = "MaxLayersReached = OpenLayers >= NumberOfLayers"
            };
            var maxLayerReachedBranch = new ConditionalBranch()
            {
                Name = "MaxLayersReached?"
            };
            var openNewLayerCalculator = new ExpressionCalculator()
            {
                Name = "OpenNewLayer = Generations >= AgeLimits[OpenLayers - 1]"
            };
            var openNewLayerBranch = new ConditionalBranch()
            {
                Name = "OpenNewLayer?"
            };
            var layerCreator = new LastLayerCloner()
            {
                Name = "Create Layer"
            };
            var updateLayerNumber = new Assigner()
            {
                Name = "Layer = OpenLayers"
            };
            var historyWiper = new ResultsHistoryWiper()
            {
                Name = "Clear History in Results"
            };
            var createChildrenViaCrossover        = new AlpsOffspringSelectionGeneticAlgorithmMainOperator();
            var incrEvaluatedSolutionsForNewLayer = new SubScopesCounter()
            {
                Name = "Update EvaluatedSolutions"
            };
            var incrOpenLayers = new IntCounter()
            {
                Name = "Incr. OpenLayers"
            };
            var newLayerResultsCollector = new ResultsCollector()
            {
                Name = "Collect new Layer Results"
            };

            layerOpener.OperatorGraph.InitialOperator = maxLayerReached;

            maxLayerReached.LeftSideParameter.ActualName  = "OpenLayers";
            maxLayerReached.RightSideParameter.ActualName = NumberOfLayersParameter.Name;
            maxLayerReached.ResultParameter.ActualName    = "MaxLayerReached";
            maxLayerReached.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maxLayerReached.Successor  = maxLayerReachedBranch;

            maxLayerReachedBranch.ConditionParameter.ActualName = "MaxLayerReached";
            maxLayerReachedBranch.FalseBranch = openNewLayerCalculator;

            openNewLayerCalculator.CollectedValues.Add(new LookupParameter <IntArray>(AgeLimitsParameter.Name));
            openNewLayerCalculator.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            openNewLayerCalculator.CollectedValues.Add(new LookupParameter <IntValue>(NumberOfLayersParameter.Name));
            openNewLayerCalculator.CollectedValues.Add(new LookupParameter <IntValue>("OpenLayers"));
            openNewLayerCalculator.ExpressionResultParameter.ActualName = "OpenNewLayer";
            openNewLayerCalculator.ExpressionParameter.Value            = new StringValue("Generations 1 + AgeLimits OpenLayers 1 - [] >");
            openNewLayerCalculator.Successor = openNewLayerBranch;

            openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer";
            openNewLayerBranch.TrueBranch = layerCreator;

            layerCreator.NewLayerOperator = updateLayerNumber;
            layerCreator.Successor        = incrOpenLayers;

            updateLayerNumber.LeftSideParameter.ActualName  = "Layer";
            updateLayerNumber.RightSideParameter.ActualName = "OpenLayers";
            updateLayerNumber.Successor = historyWiper;

            historyWiper.ResultsParameter.ActualName = "LayerResults";
            historyWiper.Successor = createChildrenViaCrossover;

            // Maybe use only crossover and no elitism instead of "default operator"
            createChildrenViaCrossover.RandomParameter.ActualName                           = LocalRandomParameter.Name;
            createChildrenViaCrossover.EvaluatorParameter.ActualName                        = EvaluatorParameter.Name;
            createChildrenViaCrossover.EvaluatedSolutionsParameter.ActualName               = "LayerEvaluatedSolutions";
            createChildrenViaCrossover.QualityParameter.ActualName                          = QualityParameter.Name;
            createChildrenViaCrossover.MaximizationParameter.ActualName                     = MaximizationParameter.Name;
            createChildrenViaCrossover.PopulationSizeParameter.ActualName                   = PopulationSizeParameter.Name;
            createChildrenViaCrossover.SelectorParameter.ActualName                         = SelectorParameter.Name;
            createChildrenViaCrossover.CrossoverParameter.ActualName                        = CrossoverParameter.Name;
            createChildrenViaCrossover.MutatorParameter.ActualName                          = MutatorParameter.ActualName;
            createChildrenViaCrossover.MutationProbabilityParameter.ActualName              = MutationProbabilityParameter.Name;
            createChildrenViaCrossover.ElitesParameter.ActualName                           = ElitesParameter.Name;
            createChildrenViaCrossover.ReevaluateElitesParameter.ActualName                 = ReevaluateElitesParameter.Name;
            createChildrenViaCrossover.ComparisonFactorParameter.ActualName                 = ComparisonFactorParameter.Name;
            createChildrenViaCrossover.SuccessRatioParameter.ActualName                     = SuccessRatioParameter.Name;
            createChildrenViaCrossover.CurrentSuccessRatioParameter.ActualName              = "CurrentSuccessRatio";
            createChildrenViaCrossover.SelectionPressureParameter.ActualName                = "SelectionPressure";
            createChildrenViaCrossover.MaximumSelectionPressureParameter.ActualName         = MaximumSelectionPressureParameter.Name;
            createChildrenViaCrossover.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
            createChildrenViaCrossover.FillPopulationWithParentsParameter.ActualName        = FillPopulationWithParentsParameter.Name;
            createChildrenViaCrossover.AgeParameter.ActualName            = AgeParameter.Name;
            createChildrenViaCrossover.AgeInheritanceParameter.ActualName = AgeInheritanceParameter.Name;
            createChildrenViaCrossover.AgeIncrementParameter.Value        = new DoubleValue(0.0);
            createChildrenViaCrossover.Successor = incrEvaluatedSolutionsForNewLayer;

            incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
            incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true);

            incrOpenLayers.ValueParameter.ActualName = "OpenLayers";
            incrOpenLayers.Increment = new IntValue(1);
            incrOpenLayers.Successor = newLayerResultsCollector;

            newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter <ResultCollection>("LayerResults", "Result set for each layer", "LayerResults"));
            newLayerResultsCollector.CopyValue = new BoolValue(false);
            newLayerResultsCollector.Successor = null;

            return(layerOpener);
        }
        private CombinedOperator CreateEldersEmigrator()
        {
            var eldersEmigrator = new CombinedOperator()
            {
                Name = "Emigrate Elders"
            };
            var selectorProsessor    = new UniformSubScopesProcessor();
            var eldersSelector       = new EldersSelector();
            var shiftToRightMigrator = new UnidirectionalRingMigrator()
            {
                Name = "Shift elders to next layer"
            };
            var mergingProsessor             = new UniformSubScopesProcessor();
            var mergingReducer               = new MergingReducer();
            var subScopesCounter             = new SubScopesCounter();
            var reduceToPopulationSizeBranch = new ConditionalBranch()
            {
                Name = "ReduceToPopulationSize?"
            };
            var countCalculator = new ExpressionCalculator()
            {
                Name = "CurrentPopulationSize = Min(CurrentPopulationSize, PopulationSize)"
            };
            var bestSelector = new BestSelector();
            var rightReducer = new RightReducer();

            eldersEmigrator.OperatorGraph.InitialOperator = selectorProsessor;

            selectorProsessor.Operator  = eldersSelector;
            selectorProsessor.Successor = shiftToRightMigrator;

            eldersSelector.AgeParameter.ActualName            = AgeParameter.Name;
            eldersSelector.AgeLimitsParameter.ActualName      = AgeLimitsParameter.Name;
            eldersSelector.NumberOfLayersParameter.ActualName = NumberOfLayersParameter.Name;
            eldersSelector.LayerParameter.ActualName          = "Layer";
            eldersSelector.Successor = null;

            shiftToRightMigrator.ClockwiseMigrationParameter.Value = new BoolValue(true);
            shiftToRightMigrator.Successor = mergingProsessor;

            mergingProsessor.Operator = mergingReducer;

            mergingReducer.Successor = subScopesCounter;

            subScopesCounter.ValueParameter.ActualName = CurrentPopulationSizeParameter.Name;
            subScopesCounter.AccumulateParameter.Value = new BoolValue(false);
            subScopesCounter.Successor = reduceToPopulationSizeBranch;

            reduceToPopulationSizeBranch.ConditionParameter.ActualName = ReduceToPopulationSizeParameter.Name;
            reduceToPopulationSizeBranch.TrueBranch = countCalculator;

            countCalculator.CollectedValues.Add(new LookupParameter <IntValue>(PopulationSizeParameter.Name));
            countCalculator.CollectedValues.Add(new LookupParameter <IntValue>(CurrentPopulationSizeParameter.Name));
            countCalculator.ExpressionParameter.Value            = new StringValue("CurrentPopulationSize PopulationSize CurrentPopulationSize PopulationSize < if toint");
            countCalculator.ExpressionResultParameter.ActualName = CurrentPopulationSizeParameter.Name;
            countCalculator.Successor = bestSelector;

            bestSelector.NumberOfSelectedSubScopesParameter.ActualName = CurrentPopulationSizeParameter.Name;
            bestSelector.CopySelected = new BoolValue(false);
            bestSelector.Successor    = rightReducer;

            return(eldersEmigrator);
        }
コード例 #9
0
        private void Initialize()
        {
            #region Create parameters
            Parameters.Add(new ValueLookupParameter <IRandom>("Random", "A pseudo random number generator."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
            Parameters.Add(new LookupParameter <DoubleValue>("Quality", "The value which represents the quality of a solution."));
            Parameters.Add(new LookupParameter <DoubleValue>("BestLocalQuality", "The value which represents the best quality found so far."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestKnownQuality", "The problem's best known quality value found so far."));
            Parameters.Add(new LookupParameter <DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
            Parameters.Add(new LookupParameter <IntValue>("Iterations", "The number of iterations performed."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MaximumIterations", "The maximum number of generations which should be processed."));
            Parameters.Add(new ValueLookupParameter <VariableCollection>("Results", "The variable collection where results should be stored."));

            Parameters.Add(new ValueLookupParameter <IOperator>("MoveGenerator", "The operator that generates the moves."));
            Parameters.Add(new ValueLookupParameter <IOperator>("MoveMaker", "The operator that performs a move and updates the quality."));
            Parameters.Add(new ValueLookupParameter <IOperator>("MoveEvaluator", "The operator that evaluates a move."));

            Parameters.Add(new ValueLookupParameter <IOperator>("Analyzer", "The operator used to analyze the solution and moves."));
            Parameters.Add(new LookupParameter <IntValue>("EvaluatedMoves", "The number of evaluated moves."));
            #endregion

            #region Create operators
            SubScopesProcessor        subScopesProcessor0    = new SubScopesProcessor();
            Assigner                  bestQualityInitializer = new Assigner();
            Placeholder               analyzer1                   = new Placeholder();
            ResultsCollector          resultsCollector1           = new ResultsCollector();
            SubScopesProcessor        mainProcessor               = new SubScopesProcessor();
            Placeholder               moveGenerator               = new Placeholder();
            UniformSubScopesProcessor moveEvaluationProcessor     = new UniformSubScopesProcessor();
            Placeholder               moveEvaluator               = new Placeholder();
            SubScopesCounter          subScopesCounter            = new SubScopesCounter();
            BestSelector              bestSelector                = new BestSelector();
            SubScopesProcessor        moveMakingProcessor         = new SubScopesProcessor();
            UniformSubScopesProcessor selectedMoveMakingProcessor = new UniformSubScopesProcessor();
            QualityComparator         qualityComparator           = new QualityComparator();
            ConditionalBranch         improvesQualityBranch       = new ConditionalBranch();
            Placeholder               moveMaker                   = new Placeholder();
            Assigner                  bestQualityUpdater          = new Assigner();
            ResultsCollector          resultsCollector2           = new ResultsCollector();
            MergingReducer            mergingReducer              = new MergingReducer();
            Placeholder               analyzer2                   = new Placeholder();
            SubScopesRemover          subScopesRemover            = new SubScopesRemover();
            IntCounter                iterationsCounter           = new IntCounter();
            Comparator                iterationsComparator        = new Comparator();
            ConditionalBranch         iterationsTermination       = new ConditionalBranch();

            bestQualityInitializer.Name = "Initialize BestQuality";
            bestQualityInitializer.LeftSideParameter.ActualName  = BestLocalQualityParameter.Name;
            bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;

            analyzer1.Name = "Analyzer (placeholder)";
            analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;

            resultsCollector1.CopyValue = new BoolValue(false);
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>(IterationsParameter.Name));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>(BestLocalQualityParameter.Name, null, BestLocalQualityParameter.Name));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            moveGenerator.Name = "MoveGenerator (placeholder)";
            moveGenerator.OperatorParameter.ActualName = MoveGeneratorParameter.Name;

            moveEvaluationProcessor.Parallel = new BoolValue(true);

            moveEvaluator.Name = "MoveEvaluator (placeholder)";
            moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;

            subScopesCounter.Name = "Increment EvaluatedMoves";
            subScopesCounter.ValueParameter.ActualName = EvaluatedMovesParameter.Name;

            bestSelector.CopySelected = new BoolValue(false);
            bestSelector.MaximizationParameter.ActualName         = MaximizationParameter.Name;
            bestSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
            bestSelector.QualityParameter.ActualName = MoveQualityParameter.Name;

            qualityComparator.LeftSideParameter.ActualName  = MoveQualityParameter.Name;
            qualityComparator.RightSideParameter.ActualName = QualityParameter.Name;
            qualityComparator.ResultParameter.ActualName    = "IsBetter";

            improvesQualityBranch.ConditionParameter.ActualName = "IsBetter";

            moveMaker.Name = "MoveMaker (placeholder)";
            moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;

            bestQualityUpdater.Name = "Update BestQuality";
            bestQualityUpdater.LeftSideParameter.ActualName  = BestLocalQualityParameter.Name;
            bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;

            resultsCollector2.CopyValue = new BoolValue(false);
            resultsCollector2.CollectedValues.Add(new LookupParameter <DoubleValue>(BestLocalQualityParameter.Name, null, BestLocalQualityParameter.Name));
            resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;

            analyzer2.Name = "Analyzer (placeholder)";
            analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;

            subScopesRemover.RemoveAllSubScopes = true;

            iterationsCounter.Name      = "Iterations Counter";
            iterationsCounter.Increment = new IntValue(1);
            iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name;

            iterationsComparator.Name       = "Iterations >= MaximumIterations";
            iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            iterationsComparator.LeftSideParameter.ActualName  = IterationsParameter.Name;
            iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
            iterationsComparator.ResultParameter.ActualName    = "Terminate";

            iterationsTermination.Name = "Iterations Termination Condition";
            iterationsTermination.ConditionParameter.ActualName = "Terminate";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator = subScopesProcessor0; // don't change this without adapting the constructor of LocalSearchImprovementOperator
            subScopesProcessor0.Operators.Add(bestQualityInitializer);
            subScopesProcessor0.Successor    = resultsCollector1;
            bestQualityInitializer.Successor = analyzer1;
            analyzer1.Successor         = null;
            resultsCollector1.Successor = mainProcessor;
            mainProcessor.Operators.Add(moveGenerator);
            mainProcessor.Successor           = iterationsCounter;
            moveGenerator.Successor           = moveEvaluationProcessor;
            moveEvaluationProcessor.Operator  = moveEvaluator;
            moveEvaluationProcessor.Successor = subScopesCounter;
            moveEvaluator.Successor           = null;
            subScopesCounter.Successor        = bestSelector;
            bestSelector.Successor            = moveMakingProcessor;
            moveMakingProcessor.Operators.Add(new EmptyOperator());
            moveMakingProcessor.Operators.Add(selectedMoveMakingProcessor);
            moveMakingProcessor.Successor        = mergingReducer;
            selectedMoveMakingProcessor.Operator = qualityComparator;
            qualityComparator.Successor          = improvesQualityBranch;
            improvesQualityBranch.TrueBranch     = moveMaker;
            improvesQualityBranch.FalseBranch    = null;
            improvesQualityBranch.Successor      = null;
            moveMaker.Successor               = bestQualityUpdater;
            bestQualityUpdater.Successor      = null;
            mergingReducer.Successor          = analyzer2;
            analyzer2.Successor               = subScopesRemover;
            subScopesRemover.Successor        = null;
            iterationsCounter.Successor       = iterationsComparator;
            iterationsComparator.Successor    = iterationsTermination;
            iterationsTermination.TrueBranch  = null;
            iterationsTermination.FalseBranch = mainProcessor;
            #endregion
        }
コード例 #10
0
        public CMAEvolutionStrategy()
            : base()
        {
            Parameters.Add(new FixedValueParameter <IntValue>(SeedName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
            Parameters.Add(new FixedValueParameter <BoolValue>(SetSeedRandomlyName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
            Parameters.Add(new FixedValueParameter <IntValue>(PopulationSizeName, "λ (lambda) - the size of the offspring population.", new IntValue(20)));
            Parameters.Add(new FixedValueParameter <IntValue>(InitialIterationsName, "The number of iterations that should be performed with only axis parallel mutation.", new IntValue(0)));
            Parameters.Add(new FixedValueParameter <DoubleArray>(InitialSigmaName, "The initial sigma can be a single value or a value for each dimension. All values need to be > 0.", new DoubleArray(new[] { 0.5 })));
            Parameters.Add(new OptionalValueParameter <IntValue>(MuName, "Optional, the mu best offspring that should be considered for update of the new mean and strategy parameters. If not given it will be automatically calculated."));
            Parameters.Add(new ConstrainedValueParameter <ICMARecombinator>(CMARecombinatorName, "The operator used to calculate the new mean."));
            Parameters.Add(new ConstrainedValueParameter <ICMAManipulator>(CMAMutatorName, "The operator used to manipulate a point."));
            Parameters.Add(new ConstrainedValueParameter <ICMAInitializer>(CMAInitializerName, "The operator that initializes the covariance matrix and strategy parameters."));
            Parameters.Add(new ConstrainedValueParameter <ICMAUpdater>(CMAUpdaterName, "The operator that updates the covariance matrix and strategy parameters."));
            Parameters.Add(new ValueParameter <MultiAnalyzer>(AnalyzerName, "The operator used to analyze each generation.", new MultiAnalyzer()));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumGenerationsName, "The maximum number of generations which should be processed.", new IntValue(1000)));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumEvaluatedSolutionsName, "The maximum number of evaluated solutions that should be computed.", new IntValue(int.MaxValue)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(TargetQualityName, "(stopFitness) Surpassing this quality value terminates the algorithm.", new DoubleValue(double.NaN)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(MinimumQualityChangeName, "(stopTolFun) If the range of fitness values is less than a certain value the algorithm terminates (set to 0 or positive value to enable).", new DoubleValue(double.NaN)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(MinimumQualityHistoryChangeName, "(stopTolFunHist) If the range of fitness values is less than a certain value for a certain time the algorithm terminates (set to 0 or positive to enable).", new DoubleValue(double.NaN)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(MinimumStandardDeviationName, "(stopTolXFactor) If the standard deviation falls below a certain value the algorithm terminates (set to 0 or positive to enable).", new DoubleValue(double.NaN)));
            Parameters.Add(new FixedValueParameter <DoubleValue>(MaximumStandardDeviationChangeName, "(stopTolUpXFactor) If the standard deviation changes by a value larger than this parameter the algorithm stops (set to a value > 0 to enable).", new DoubleValue(double.NaN)));

            var randomCreator    = new RandomCreator();
            var variableCreator  = new VariableCreator();
            var resultsCollector = new ResultsCollector();
            var cmaInitializer   = new Placeholder();

            solutionCreator = new Placeholder();
            var subScopesCreator = new SubScopesCreator();
            var ussp1            = new UniformSubScopesProcessor();

            populationSolutionCreator = new Placeholder();
            var cmaMutator = new Placeholder();
            var ussp2      = new UniformSubScopesProcessor();

            evaluator = new Placeholder();
            var subScopesCounter = new SubScopesCounter();

            sorter = new SubScopesSorter();
            var analyzer           = new Placeholder();
            var cmaRecombinator    = new Placeholder();
            var generationsCounter = new IntCounter();
            var cmaUpdater         = new Placeholder();

            terminator = new Terminator();

            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 = variableCreator;

            variableCreator.Name = "Initialize Variables";
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("EvaluatedSolutions", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Generations", new IntValue(0)));
            variableCreator.Successor = resultsCollector;

            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("EvaluatedSolutions"));
            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            resultsCollector.ResultsParameter.ActualName = "Results";
            resultsCollector.Successor = cmaInitializer;

            cmaInitializer.Name = "Initialize Strategy Parameters";
            cmaInitializer.OperatorParameter.ActualName = CMAInitializerParameter.Name;
            cmaInitializer.Successor = subScopesCreator;

            subScopesCreator.NumberOfSubScopesParameter.ActualName = PopulationSizeParameter.Name;
            subScopesCreator.Successor = ussp1;

            ussp1.Name      = "Create population";
            ussp1.Parallel  = new BoolValue(false);
            ussp1.Operator  = populationSolutionCreator;
            ussp1.Successor = solutionCreator;

            populationSolutionCreator.Name = "Initialize arx";
            // populationSolutionCreator.OperatorParameter will be wired
            populationSolutionCreator.Successor = null;

            solutionCreator.Name = "Initialize xmean";
            // solutionCreator.OperatorParameter will be wired
            solutionCreator.Successor = cmaMutator;

            cmaMutator.Name = "Sample population";
            cmaMutator.OperatorParameter.ActualName = CMAMutatorParameter.Name;
            cmaMutator.Successor = ussp2;

            ussp2.Name      = "Evaluate offspring";
            ussp2.Parallel  = new BoolValue(true);
            ussp2.Operator  = evaluator;
            ussp2.Successor = subScopesCounter;

            evaluator.Name = "Evaluator";
            // evaluator.OperatorParameter will be wired
            evaluator.Successor = null;

            subScopesCounter.Name = "Count EvaluatedSolutions";
            subScopesCounter.AccumulateParameter.Value = new BoolValue(true);
            subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
            subScopesCounter.Successor = sorter;

            // sorter.ValueParameter will be wired
            // sorter.DescendingParameter will be wired
            sorter.Successor = analyzer;

            analyzer.Name = "Analyzer";
            analyzer.OperatorParameter.ActualName = AnalyzerParameter.Name;
            analyzer.Successor = cmaRecombinator;

            cmaRecombinator.Name = "Create new xmean";
            cmaRecombinator.OperatorParameter.ActualName = CMARecombinatorParameter.Name;
            cmaRecombinator.Successor = generationsCounter;

            generationsCounter.Name = "Generations++";
            generationsCounter.IncrementParameter.Value  = new IntValue(1);
            generationsCounter.ValueParameter.ActualName = "Generations";
            generationsCounter.Successor = cmaUpdater;

            cmaUpdater.Name = "Update distributions";
            cmaUpdater.OperatorParameter.ActualName = CMAUpdaterParameter.Name;
            cmaUpdater.Successor = terminator;

            terminator.Continue  = cmaMutator;
            terminator.Terminate = null;

            qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
            cmaAnalyzer     = new CMAAnalyzer();

            InitializeOperators();
            RegisterEventHandlers();
            Parameterize();
        }
コード例 #11
0
        private void Initialize()
        {
            #region Create parameters
            Parameters.Add(new ValueLookupParameter <IRandom>("Random", "A pseudo random number generator."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
            Parameters.Add(new LookupParameter <DoubleValue>("Quality", "The value which represents the quality of a solution."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
            Parameters.Add(new LookupParameter <DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
            Parameters.Add(new LookupParameter <DoubleValue>("Temperature", "The current temperature."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("StartTemperature", "The initial temperature."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("EndTemperature", "The end temperature."));
            Parameters.Add(new ValueLookupParameter <IntValue>("InnerIterations", "The amount of inner iterations (number of moves before temperature is adjusted again)."));
            Parameters.Add(new LookupParameter <IntValue>("Iterations", "The number of iterations."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MaximumIterations", "The maximum number of iterations which should be processed."));

            Parameters.Add(new ValueLookupParameter <IOperator>("MoveGenerator", "The operator that generates the moves."));
            Parameters.Add(new ValueLookupParameter <IOperator>("MoveEvaluator", "The operator that evaluates a move."));
            Parameters.Add(new ValueLookupParameter <IOperator>("MoveMaker", "The operator that performs a move and updates the quality."));
            Parameters.Add(new ValueLookupParameter <IOperator>("AnnealingOperator", "The operator that modifies the temperature."));

            Parameters.Add(new ValueLookupParameter <IOperator>("Analyzer", "The operator used to analyze each generation."));
            Parameters.Add(new ValueLookupParameter <VariableCollection>("Results", "The variable collection where results should be stored."));
            Parameters.Add(new LookupParameter <IntValue>("EvaluatedMoves", "The number of evaluated moves."));
            #endregion

            #region Create operators
            Assigner                       temperatureInitializer = new Assigner();
            ResultsCollector               resultsCollector1      = new ResultsCollector();
            SubScopesProcessor             subScopesProcessor0    = new SubScopesProcessor();
            Placeholder                    analyzer1               = new Placeholder();
            SubScopesProcessor             sssp                    = new SubScopesProcessor();
            ResultsCollector               resultsCollector        = new ResultsCollector();
            Placeholder                    annealingOperator       = new Placeholder();
            UniformSubScopesProcessor      mainProcessor           = new UniformSubScopesProcessor();
            Placeholder                    moveGenerator           = new Placeholder();
            UniformSubScopesProcessor      moveEvaluationProcessor = new UniformSubScopesProcessor();
            Placeholder                    moveEvaluator           = new Placeholder();
            SubScopesCounter               subScopesCounter        = new SubScopesCounter();
            ProbabilisticQualityComparator qualityComparator       = new ProbabilisticQualityComparator();
            ConditionalBranch              improvesQualityBranch   = new ConditionalBranch();
            Placeholder                    moveMaker               = new Placeholder();
            SubScopesRemover               subScopesRemover        = new SubScopesRemover();
            IntCounter                     iterationsCounter       = new IntCounter();
            Comparator                     iterationsComparator    = new Comparator();
            SubScopesProcessor             subScopesProcessor1     = new SubScopesProcessor();
            Placeholder                    analyzer2               = new Placeholder();
            ConditionalBranch              iterationsTermination   = new ConditionalBranch();

            temperatureInitializer.LeftSideParameter.ActualName  = TemperatureParameter.ActualName;
            temperatureInitializer.RightSideParameter.ActualName = StartTemperatureParameter.Name;

            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>(IterationsParameter.Name));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            analyzer1.Name = "Analyzer (placeholder)";
            analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;

            annealingOperator.Name = "Annealing operator (placeholder)";
            annealingOperator.OperatorParameter.ActualName = AnnealingOperatorParameter.Name;

            moveGenerator.Name = "Move generator (placeholder)";
            moveGenerator.OperatorParameter.ActualName = MoveGeneratorParameter.Name;

            moveEvaluator.Name = "Move evaluator (placeholder)";
            moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;

            subScopesCounter.Name = "Increment EvaluatedMoves";
            subScopesCounter.ValueParameter.ActualName = EvaluatedMovesParameter.Name;

            qualityComparator.LeftSideParameter.ActualName  = MoveQualityParameter.Name;
            qualityComparator.RightSideParameter.ActualName = QualityParameter.Name;
            qualityComparator.ResultParameter.ActualName    = "IsBetter";
            qualityComparator.DampeningParameter.ActualName = "Temperature";

            improvesQualityBranch.ConditionParameter.ActualName = "IsBetter";

            moveMaker.Name = "Move maker (placeholder)";
            moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;

            subScopesRemover.RemoveAllSubScopes = true;

            iterationsCounter.Name      = "Increment Iterations";
            iterationsCounter.Increment = new IntValue(1);
            iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name;

            iterationsComparator.Name = "Iterations >= MaximumIterations";
            iterationsComparator.LeftSideParameter.ActualName  = IterationsParameter.Name;
            iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
            iterationsComparator.ResultParameter.ActualName    = "Terminate";
            iterationsComparator.Comparison.Value = ComparisonType.GreaterOrEqual;

            analyzer2.Name = "Analyzer (placeholder)";
            analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;

            iterationsTermination.Name = "Iterations termination condition";
            iterationsTermination.ConditionParameter.ActualName = "Terminate";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator    = temperatureInitializer;
            temperatureInitializer.Successor = resultsCollector1;
            resultsCollector1.Successor      = subScopesProcessor0;
            subScopesProcessor0.Operators.Add(analyzer1);
            subScopesProcessor0.Successor = sssp;
            analyzer1.Successor           = null;
            sssp.Operators.Add(resultsCollector);
            sssp.Successor                    = annealingOperator;
            resultsCollector.Successor        = null;
            annealingOperator.Successor       = mainProcessor;
            mainProcessor.Operator            = moveGenerator;
            mainProcessor.Successor           = iterationsCounter;
            moveGenerator.Successor           = moveEvaluationProcessor;
            moveEvaluationProcessor.Operator  = moveEvaluator;
            moveEvaluationProcessor.Successor = subScopesCounter;
            moveEvaluator.Successor           = qualityComparator;
            qualityComparator.Successor       = improvesQualityBranch;
            improvesQualityBranch.TrueBranch  = moveMaker;
            improvesQualityBranch.FalseBranch = null;
            improvesQualityBranch.Successor   = null;
            moveMaker.Successor               = null;
            subScopesCounter.Successor        = subScopesRemover;
            subScopesRemover.Successor        = null;
            iterationsCounter.Successor       = iterationsComparator;
            iterationsComparator.Successor    = subScopesProcessor1;
            subScopesProcessor1.Operators.Add(analyzer2);
            subScopesProcessor1.Successor     = iterationsTermination;
            iterationsTermination.TrueBranch  = null;
            iterationsTermination.FalseBranch = annealingOperator;
            #endregion
        }