public MQClientCounters(string name, bool ignoreCounters) { if (ignoreCounters) { return; } _messagesSentCount = Core.Counters.GetIntegerCounter(Category, name + @"\Messages Sent", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Messages); _messagesReceivedCount = Core.Counters.GetIntegerCounter(Category, name + @"\Messages Received", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Messages); _receptionTime = Core.Counters.GetDoubleCounter(Category, name + @"\Reception Time", CounterType.Average, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Milliseconds); _bytesSent = Core.Counters.GetIntegerCounter(Category, name + @"\Bytes Sent", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Bytes); _bytesReceived = Core.Counters.GetIntegerCounter(Category, name + @"\Bytes Received", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Bytes); }
public MQServerCounters(string name, bool ignoreCounters) { if (ignoreCounters) { return; } _currentMessages = Core.Counters.GetIntegerCounter(Category, name + @"\Current Messages", CounterType.Current, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Messages); _totalMessagesReceived = Core.Counters.GetIntegerCounter(Category, name + @"\Messages Received", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Messages); _totalMessagesProcessed = Core.Counters.GetIntegerCounter(Category, name + @"\Messages Processed", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Messages); _totalExceptions = Core.Counters.GetIntegerCounter(Category, name + @"\Exceptions", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Exceptions); _totalReceivingTime = Core.Counters.GetDoubleCounter(Category, name + @"\Receiving Time", CounterType.Average, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Milliseconds); _totalReceivingBytes = Core.Counters.GetIntegerCounter(Category, name + @"\Receiving Bytes", CounterType.Cumulative, CounterLevel.Framework, CounterKind.Messaging, CounterUnit.Bytes); }
public CacheClientPoolCounters(string name) { _existKeyTime = Core.Counters.GetDoubleCounter(Category, name + @"\Exists Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getByTagTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get By Tag Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getCreationDateTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get CreationDate Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getExpirationDateTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get ExpirationDate Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getKeysTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get Keys Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getMetaTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get Meta Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getMetaByTagTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get Meta By Tag Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _getOrSetTime = Core.Counters.GetDoubleCounter(Category, name + @"\Get Or Sets Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _removeTime = Core.Counters.GetDoubleCounter(Category, name + @"\Remove Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _removeByTagTime = Core.Counters.GetDoubleCounter(Category, name + @"\Remove By Tag Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _setTime = Core.Counters.GetDoubleCounter(Category, name + @"\Set Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _updateDataTime = Core.Counters.GetDoubleCounter(Category, name + @"\Update Data Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _copyTime = Core.Counters.GetDoubleCounter(Category, name + @"\Copy Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _setMultiTime = Core.Counters.GetDoubleCounter(Category, name + @"\Set Multi Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); _executeExtensionTime = Core.Counters.GetDoubleCounter(Category, name + @"\Execute Extension Time", CounterType.Average, CounterLevel.Framework, CounterKind.Cache, CounterUnit.Milliseconds); }
public DoubleCounterTest() { counter = new DoubleCounter(MonitorConfig.Build("Test")); }
private void Initialize() { 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 LookupParameter <IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 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 LookupParameter <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].")); Parameters.Add(new LookupParameter <DoubleValue>("CurrentSuccessRatio", "The current success ratio.")); Parameters.Add(new ValueLookupParameter <DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.")); Parameters.Add(new LookupParameter <DoubleValue>("SelectionPressure", "The actual selection pressure.")); Parameters.Add(new ValueLookupParameter <DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.")); Parameters.Add(new ValueLookupParameter <BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); Parameters.Add(new ValueLookupParameter <BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.")); 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 selector = new Placeholder(); var subScopesProcessor1 = new SubScopesProcessor(); var childrenCreator = new ChildrenCreator(); var osBeforeMutationBranch = new ConditionalBranch(); var uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); var crossover1 = new Placeholder(); var uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); var evaluator1 = new Placeholder(); var subScopesCounter1 = new SubScopesCounter(); var qualityComparer1 = new WeightedParentsQualityComparator(); var ageCalculator1 = new WeightingReducer() { Name = "Calculate Age" }; var subScopesRemover1 = new SubScopesRemover(); var uniformSubScopesProcessor3 = new UniformSubScopesProcessor(); var mutationBranch1 = new StochasticBranch(); var mutator1 = new Placeholder(); var variableCreator1 = new VariableCreator(); var variableCreator2 = new VariableCreator(); var conditionalSelector = new ConditionalSelector(); var subScopesProcessor2 = new SubScopesProcessor(); var uniformSubScopesProcessor4 = new UniformSubScopesProcessor(); var evaluator2 = new Placeholder(); var subScopesCounter2 = new SubScopesCounter(); var mergingReducer1 = new MergingReducer(); var uniformSubScopesProcessor5 = new UniformSubScopesProcessor(); var crossover2 = new Placeholder(); var mutationBranch2 = new StochasticBranch(); var mutator2 = new Placeholder(); var uniformSubScopesProcessor6 = new UniformSubScopesProcessor(); var evaluator3 = new Placeholder(); var subScopesCounter3 = new SubScopesCounter(); var qualityComparer2 = new WeightedParentsQualityComparator(); var ageCalculator2 = new WeightingReducer() { Name = "Calculate Age" }; var subScopesRemover2 = new SubScopesRemover(); var offspringSelector = new AlpsOffspringSelector(); var subScopesProcessor3 = new SubScopesProcessor(); var bestSelector = new BestSelector(); var worstSelector = new WorstSelector(); var rightReducer = new RightReducer(); var leftReducer = new LeftReducer(); var mergingReducer2 = new MergingReducer(); var reevaluateElitesBranch = new ConditionalBranch(); var uniformSubScopesProcessor7 = new UniformSubScopesProcessor(); var evaluator4 = new Placeholder(); var subScopesCounter4 = new SubScopesCounter(); var incrementAgeProcessor = new UniformSubScopesProcessor(); var ageIncrementor = new DoubleCounter() { Name = "Increment Age" }; OperatorGraph.InitialOperator = selector; selector.Name = "Selector (placeholder)"; selector.OperatorParameter.ActualName = SelectorParameter.Name; selector.Successor = subScopesProcessor1; subScopesProcessor1.Operators.Add(new EmptyOperator()); subScopesProcessor1.Operators.Add(childrenCreator); subScopesProcessor1.Successor = offspringSelector; childrenCreator.ParentsPerChild = new IntValue(2); childrenCreator.Successor = osBeforeMutationBranch; osBeforeMutationBranch.Name = "Apply OS before mutation?"; osBeforeMutationBranch.ConditionParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; osBeforeMutationBranch.TrueBranch = uniformSubScopesProcessor1; osBeforeMutationBranch.FalseBranch = uniformSubScopesProcessor5; osBeforeMutationBranch.Successor = null; uniformSubScopesProcessor1.Operator = crossover1; uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2; crossover1.Name = "Crossover (placeholder)"; crossover1.OperatorParameter.ActualName = CrossoverParameter.Name; crossover1.Successor = null; uniformSubScopesProcessor2.Parallel.Value = true; uniformSubScopesProcessor2.Operator = evaluator1; uniformSubScopesProcessor2.Successor = subScopesCounter1; evaluator1.Name = "Evaluator (placeholder)"; evaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name; evaluator1.Successor = qualityComparer1; subScopesCounter1.Name = "Increment EvaluatedSolutions"; subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; subScopesCounter1.Successor = uniformSubScopesProcessor3; uniformSubScopesProcessor3.Operator = mutationBranch1; uniformSubScopesProcessor3.Successor = conditionalSelector; qualityComparer1.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; qualityComparer1.LeftSideParameter.ActualName = QualityParameter.Name; qualityComparer1.MaximizationParameter.ActualName = MaximizationParameter.Name; qualityComparer1.RightSideParameter.ActualName = QualityParameter.Name; qualityComparer1.ResultParameter.ActualName = "SuccessfulOffspring"; qualityComparer1.Successor = ageCalculator1; ageCalculator1.ParameterToReduce.ActualName = AgeParameter.Name; ageCalculator1.TargetParameter.ActualName = AgeParameter.Name; ageCalculator1.WeightParameter.ActualName = AgeInheritanceParameter.Name; ageCalculator1.Successor = subScopesRemover1; subScopesRemover1.RemoveAllSubScopes = true; subScopesRemover1.Successor = null; mutationBranch1.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; mutationBranch1.RandomParameter.ActualName = RandomParameter.Name; mutationBranch1.FirstBranch = mutator1; mutationBranch1.SecondBranch = variableCreator2; mutationBranch1.Successor = null; mutator1.Name = "Mutator (placeholder)"; mutator1.OperatorParameter.ActualName = MutatorParameter.Name; mutator1.Successor = variableCreator1; variableCreator1.Name = "MutatedOffspring = true"; variableCreator1.CollectedValues.Add(new ValueParameter <BoolValue>("MutatedOffspring", null, new BoolValue(true), false)); variableCreator1.Successor = null; variableCreator2.Name = "MutatedOffspring = false"; variableCreator2.CollectedValues.Add(new ValueParameter <BoolValue>("MutatedOffspring", null, new BoolValue(false), false)); variableCreator2.Successor = null; conditionalSelector.ConditionParameter.ActualName = "MutatedOffspring"; conditionalSelector.ConditionParameter.Depth = 1; conditionalSelector.CopySelected.Value = false; conditionalSelector.Successor = subScopesProcessor2; subScopesProcessor2.Operators.Add(new EmptyOperator()); subScopesProcessor2.Operators.Add(uniformSubScopesProcessor4); subScopesProcessor2.Successor = mergingReducer1; mergingReducer1.Successor = null; uniformSubScopesProcessor4.Parallel.Value = true; uniformSubScopesProcessor4.Operator = evaluator2; uniformSubScopesProcessor4.Successor = subScopesCounter2; evaluator2.Name = "Evaluator (placeholder)"; evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name; evaluator2.Successor = null; subScopesCounter2.Name = "Increment EvaluatedSolutions"; subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; subScopesCounter2.Successor = null; uniformSubScopesProcessor5.Operator = crossover2; uniformSubScopesProcessor5.Successor = uniformSubScopesProcessor6; crossover2.Name = "Crossover (placeholder)"; crossover2.OperatorParameter.ActualName = CrossoverParameter.Name; crossover2.Successor = mutationBranch2; mutationBranch2.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; mutationBranch2.RandomParameter.ActualName = RandomParameter.Name; mutationBranch2.FirstBranch = mutator2; mutationBranch2.SecondBranch = null; mutationBranch2.Successor = null; mutator2.Name = "Mutator (placeholder)"; mutator2.OperatorParameter.ActualName = MutatorParameter.Name; mutator2.Successor = null; uniformSubScopesProcessor6.Parallel.Value = true; uniformSubScopesProcessor6.Operator = evaluator3; uniformSubScopesProcessor6.Successor = subScopesCounter3; evaluator3.Name = "Evaluator (placeholder)"; evaluator3.OperatorParameter.ActualName = EvaluatorParameter.Name; evaluator3.Successor = qualityComparer2; subScopesCounter3.Name = "Increment EvaluatedSolutions"; subScopesCounter3.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; qualityComparer2.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; qualityComparer2.LeftSideParameter.ActualName = QualityParameter.Name; qualityComparer2.MaximizationParameter.ActualName = MaximizationParameter.Name; qualityComparer2.RightSideParameter.ActualName = QualityParameter.Name; qualityComparer2.ResultParameter.ActualName = "SuccessfulOffspring"; qualityComparer2.Successor = ageCalculator2; ageCalculator2.ParameterToReduce.ActualName = AgeParameter.Name; ageCalculator2.TargetParameter.ActualName = AgeParameter.Name; ageCalculator2.WeightParameter.ActualName = AgeInheritanceParameter.Name; ageCalculator2.Successor = subScopesRemover2; subScopesRemover2.RemoveAllSubScopes = true; subScopesRemover2.Successor = null; subScopesCounter3.Successor = null; offspringSelector.CurrentSuccessRatioParameter.ActualName = CurrentSuccessRatioParameter.Name; offspringSelector.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name; offspringSelector.SelectionPressureParameter.ActualName = SelectionPressureParameter.Name; offspringSelector.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; offspringSelector.OffspringPopulationParameter.ActualName = "OffspringPopulation"; offspringSelector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners"; offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring"; offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; offspringSelector.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name; offspringSelector.OffspringCreator = selector; offspringSelector.Successor = subScopesProcessor3; subScopesProcessor3.Operators.Add(bestSelector); subScopesProcessor3.Operators.Add(worstSelector); subScopesProcessor3.Successor = mergingReducer2; 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; reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites"; reevaluateElitesBranch.Name = "Reevaluate elites ?"; reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7; reevaluateElitesBranch.FalseBranch = null; reevaluateElitesBranch.Successor = null; uniformSubScopesProcessor7.Parallel.Value = true; uniformSubScopesProcessor7.Operator = evaluator4; uniformSubScopesProcessor7.Successor = subScopesCounter4; evaluator4.Name = "Evaluator (placeholder)"; evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name; subScopesCounter4.Name = "Increment EvaluatedSolutions"; subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; subScopesCounter4.Successor = null; worstSelector.CopySelected = new BoolValue(false); worstSelector.MaximizationParameter.ActualName = MaximizationParameter.Name; worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name; worstSelector.QualityParameter.ActualName = QualityParameter.Name; worstSelector.Successor = leftReducer; leftReducer.Successor = null; mergingReducer2.Successor = incrementAgeProcessor; incrementAgeProcessor.Operator = ageIncrementor; incrementAgeProcessor.Successor = null; ageIncrementor.ValueParameter.ActualName = AgeParameter.Name; ageIncrementor.IncrementParameter.Value = null; ageIncrementor.IncrementParameter.ActualName = AgeIncrementParameter.Name; ageIncrementor.Successor = null; }
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; }
public AlpsNsga2MainOperator() : 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 <PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on a solution.")); 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 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.")); Parameters.Add(new ValueLookupParameter <BoolValue>("DominateOnEqualQualities", "Flag which determines whether solutions with equal quality values should be treated as dominated.")); var selector = new Placeholder { Name = "Selector (Placeholder)" }; var subScopesProcessor1 = new SubScopesProcessor(); var childrenCreator = new ChildrenCreator(); var uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); var crossoverStochasticBranch = new StochasticBranch { Name = "CrossoverProbability" }; var crossover = new Placeholder { Name = "Crossover (Placeholder)" }; var noCrossover = new ParentCopyCrossover(); var mutationStochasticBranch = 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 mergingReducer = new MergingReducer(); var rankAndCrowdingSorter1 = new RankAndCrowdingSorter(); var rankAndCrowdingSorter2 = new RankAndCrowdingSorter(); var leftSelector = new LeftSelector(); var rightReducer = new RightReducer(); var incrementAgeProcessor = new UniformSubScopesProcessor(); var ageIncrementer = new DoubleCounter { Name = "Increment Age" }; OperatorGraph.InitialOperator = rankAndCrowdingSorter1; rankAndCrowdingSorter1.DominateOnEqualQualitiesParameter.ActualName = DominateOnEqualQualitiesParameter.Name; rankAndCrowdingSorter1.CrowdingDistanceParameter.ActualName = "CrowdingDistance"; rankAndCrowdingSorter1.RankParameter.ActualName = "Rank"; rankAndCrowdingSorter1.Successor = selector; selector.OperatorParameter.ActualName = SelectorParameter.Name; selector.Successor = subScopesProcessor1; subScopesProcessor1.Operators.Add(new EmptyOperator()); subScopesProcessor1.Operators.Add(childrenCreator); subScopesProcessor1.Successor = mergingReducer; childrenCreator.ParentsPerChild = new IntValue(2); childrenCreator.Successor = uniformSubScopesProcessor1; uniformSubScopesProcessor1.Operator = crossoverStochasticBranch; uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2; crossoverStochasticBranch.ProbabilityParameter.ActualName = CrossoverProbabilityParameter.Name; crossoverStochasticBranch.RandomParameter.ActualName = RandomParameter.Name; crossoverStochasticBranch.FirstBranch = crossover; crossoverStochasticBranch.SecondBranch = noCrossover; crossoverStochasticBranch.Successor = mutationStochasticBranch; crossover.Name = "Crossover"; crossover.OperatorParameter.ActualName = CrossoverParameter.Name; crossover.Successor = null; noCrossover.Name = "Clone parent"; noCrossover.RandomParameter.ActualName = RandomParameter.Name; noCrossover.Successor = null; mutationStochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; mutationStochasticBranch.RandomParameter.ActualName = RandomParameter.Name; mutationStochasticBranch.FirstBranch = mutator; mutationStochasticBranch.SecondBranch = null; mutationStochasticBranch.Successor = ageCalculator; mutator.Name = "Mutator"; 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; mergingReducer.Successor = rankAndCrowdingSorter2; rankAndCrowdingSorter2.DominateOnEqualQualitiesParameter.ActualName = DominateOnEqualQualitiesParameter.Name; rankAndCrowdingSorter2.CrowdingDistanceParameter.ActualName = "CrowdingDistance"; rankAndCrowdingSorter2.RankParameter.ActualName = "Rank"; rankAndCrowdingSorter2.Successor = leftSelector; leftSelector.CopySelected = new BoolValue(false); leftSelector.NumberOfSelectedSubScopesParameter.ActualName = PopulationSizeParameter.Name; leftSelector.Successor = rightReducer; rightReducer.Successor = incrementAgeProcessor; incrementAgeProcessor.Operator = ageIncrementer; incrementAgeProcessor.Successor = null; ageIncrementer.ValueParameter.ActualName = AgeParameter.Name; ageIncrementer.IncrementParameter.Value = null; ageIncrementer.IncrementParameter.ActualName = AgeIncrementParameter.Name; ageIncrementer.Successor = null; }