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 ScopeTreeLookupParameter<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 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>("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>("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<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 ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
      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 ValueLookupParameter<DoubleValue>("ComparisonFactorStart", "The initial value for the comparison factor."));
      Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
      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 LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
      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."));
      #endregion

      #region Create operators
      VariableCreator variableCreator = new VariableCreator();
      Assigner comparisonFactorInitializer = new Assigner();
      Placeholder analyzer1 = new Placeholder();
      ResultsCollector resultsCollector1 = new ResultsCollector();
      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
      IntCounter generationsCounter = new IntCounter();
      Comparator maxGenerationsComparator = new Comparator();
      Comparator maxSelectionPressureComparator = new Comparator();
      Comparator maxEvaluatedSolutionsComparator = new Comparator();
      Placeholder comparisonFactorModifier = new Placeholder();
      Placeholder analyzer2 = new Placeholder();
      ConditionalBranch conditionalBranch1 = new ConditionalBranch();
      ConditionalBranch conditionalBranch2 = new ConditionalBranch();
      ConditionalBranch conditionalBranch3 = new ConditionalBranch();

      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class OffspringSelectionGeneticAlgorithm expects this to be called Generations
      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentSuccessRatio", new DoubleValue(0)));

      comparisonFactorInitializer.Name = "Initialize ComparisonFactor (placeholder)";
      comparisonFactorInitializer.LeftSideParameter.ActualName = ComparisonFactorParameter.Name;
      comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

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

      resultsCollector1.CopyValue = new BoolValue(false);
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Comparison Factor", null, ComparisonFactorParameter.Name));
      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

      mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
      mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
      mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name;
      mainOperator.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
      mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
      mainOperator.MutatorParameter.ActualName = MutatorParameter.Name;
      mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
      mainOperator.QualityParameter.ActualName = QualityParameter.Name;
      mainOperator.RandomParameter.ActualName = RandomParameter.Name;
      mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure";
      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;

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

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

      maxSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      maxSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
      maxSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";
      maxSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;

      maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
      maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
      maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

      comparisonFactorModifier.Name = "Update ComparisonFactor (placeholder)";
      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

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

      conditionalBranch1.Name = "MaximumSelectionPressure reached?";
      conditionalBranch1.ConditionParameter.ActualName = "TerminateSelectionPressure";

      conditionalBranch2.Name = "MaximumGenerations reached?";
      conditionalBranch2.ConditionParameter.ActualName = "TerminateMaximumGenerations";

      conditionalBranch3.Name = "MaximumEvaluatedSolutions reached?";
      conditionalBranch3.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = variableCreator;
      variableCreator.Successor = comparisonFactorInitializer;
      comparisonFactorInitializer.Successor = analyzer1;
      analyzer1.Successor = resultsCollector1;
      resultsCollector1.Successor = mainOperator;
      mainOperator.Successor = generationsCounter;
      generationsCounter.Successor = maxGenerationsComparator;
      maxGenerationsComparator.Successor = maxSelectionPressureComparator;
      maxSelectionPressureComparator.Successor = maxEvaluatedSolutionsComparator;
      maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
      comparisonFactorModifier.Successor = analyzer2;
      analyzer2.Successor = conditionalBranch1;
      conditionalBranch1.FalseBranch = conditionalBranch2;
      conditionalBranch1.TrueBranch = null;
      conditionalBranch1.Successor = null;
      conditionalBranch2.FalseBranch = conditionalBranch3;
      conditionalBranch2.TrueBranch = null;
      conditionalBranch2.Successor = null;
      conditionalBranch3.FalseBranch = mainOperator;
      conditionalBranch3.TrueBranch = null;
      conditionalBranch3.Successor = null;
      #endregion
    }
 private OffspringSelectionGeneticAlgorithmMainOperator(OffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)
   : base(original, cloner) {
 }
 private OffspringSelectionGeneticAlgorithmMainOperator(OffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)
     : base(original, cloner)
 {
 }
示例#4
0
    public SASEGASAMainLoop()
      : base() {
      #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 ScopeTreeLookupParameter<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 ValueLookupParameter<IntValue>("NumberOfVillages", "The initial number of villages."));
      Parameters.Add(new ValueLookupParameter<IntValue>("MigrationInterval", "The fixed period after which migration occurs."));
      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>("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>("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<ResultCollection>("Results", "The results collection to store the results."));
      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the villages."));
      Parameters.Add(new ValueLookupParameter<IOperator>("VillageAnalyzer", "The operator used to analyze each village."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
      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 ValueLookupParameter<DoubleValue>("ComparisonFactorStart", "The lower bound of the comparison factor (start)."));
      Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left."));
      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum genreation 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 LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
      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."));
      #endregion

      #region Create operators
      VariableCreator variableCreator = new VariableCreator();
      Assigner maxSelPressAssigner = new Assigner();
      Assigner villageCountAssigner = new Assigner();
      Assigner comparisonFactorInitializer = new Assigner();
      UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
      VariableCreator villageVariableCreator = new VariableCreator();
      Placeholder villageAnalyzer1 = new Placeholder();
      ResultsCollector villageResultsCollector1 = new ResultsCollector();
      Placeholder analyzer1 = new Placeholder();
      ResultsCollector resultsCollector1 = new ResultsCollector();
      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
      ConditionalBranch villageTerminatedBySelectionPressure1 = new ConditionalBranch();
      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
      Placeholder villageAnalyzer2 = new Placeholder();
      ResultsCollector villageResultsCollector2 = new ResultsCollector();
      Comparator villageSelectionPressureComparator = new Comparator();
      ConditionalBranch villageTerminatedBySelectionPressure2 = new ConditionalBranch();
      IntCounter terminatedVillagesCounter = new IntCounter();
      IntCounter generationsCounter = new IntCounter();
      IntCounter generationsSinceLastReunificationCounter = new IntCounter();
      Comparator reunificationComparator1 = new Comparator();
      ConditionalBranch reunificationConditionalBranch1 = new ConditionalBranch();
      Comparator reunificationComparator2 = new Comparator();
      ConditionalBranch reunificationConditionalBranch2 = new ConditionalBranch();
      Comparator reunificationComparator3 = new Comparator();
      ConditionalBranch reunificationConditionalBranch3 = new ConditionalBranch();
      Assigner resetTerminatedVillagesAssigner = new Assigner();
      Assigner resetGenerationsSinceLastReunificationAssigner = new Assigner();
      SASEGASAReunificator reunificator = new SASEGASAReunificator();
      IntCounter reunificationCounter = new IntCounter();
      Placeholder comparisonFactorModifier = new Placeholder();
      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
      Assigner villageReviver = new Assigner();
      Comparator villageCountComparator = new Comparator();
      ConditionalBranch villageCountConditionalBranch = new ConditionalBranch();
      Assigner finalMaxSelPressAssigner = new Assigner();
      Comparator maximumGenerationsComparator = new Comparator();
      Comparator maximumEvaluatedSolutionsComparator = new Comparator();
      Placeholder analyzer2 = new Placeholder();
      ConditionalBranch terminationCondition = new ConditionalBranch();
      ConditionalBranch maximumGenerationsTerminationCondition = new ConditionalBranch();
      ConditionalBranch maximumEvaluatedSolutionsTerminationCondition = new ConditionalBranch();

      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Reunifications", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class SASEGASA expects this to be called Generations
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastReunification", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedVillages", new IntValue(0)));

      villageCountAssigner.LeftSideParameter.ActualName = "VillageCount";
      villageCountAssigner.RightSideParameter.ActualName = NumberOfVillagesParameter.Name;

      maxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure";
      maxSelPressAssigner.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;

      comparisonFactorInitializer.LeftSideParameter.ActualName = ComparisonFactorParameter.Name;
      comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

      villageVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
      villageVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
      villageVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
      villageVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentSuccessRatio", new DoubleValue(0)));

      villageAnalyzer1.Name = "Village Analyzer (placeholder)";
      villageAnalyzer1.OperatorParameter.ActualName = VillageAnalyzerParameter.Name;

      villageResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
      villageResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
      villageResultsCollector1.ResultsParameter.ActualName = "Results";

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

      resultsCollector1.CopyValue = new BoolValue(false);
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("ComparisonFactor", null, ComparisonFactorParameter.Name));
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Terminated Villages", null, "TerminatedVillages"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Total Active Villages", null, "VillageCount"));
      resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("VillageResults", "Result set for each village", "Results"));
      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

      villageTerminatedBySelectionPressure1.Name = "Village Terminated ?";
      villageTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";

      mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
      mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
      mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name;
      mainOperator.MaximumSelectionPressureParameter.ActualName = "CurrentMaximumSelectionPressure";
      mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
      mainOperator.MutatorParameter.ActualName = MutatorParameter.Name;
      mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
      mainOperator.QualityParameter.ActualName = QualityParameter.Name;
      mainOperator.RandomParameter.ActualName = RandomParameter.Name;
      mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure";
      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;

      villageAnalyzer2.Name = "Village Analyzer (placeholder)";
      villageAnalyzer2.OperatorParameter.ActualName = VillageAnalyzerParameter.Name;

      villageResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
      villageResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
      villageResultsCollector2.ResultsParameter.ActualName = "Results";

      villageSelectionPressureComparator.Name = "SelectionPressure >= CurrentMaximumSelectionPressure ?";
      villageSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
      villageSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      villageSelectionPressureComparator.RightSideParameter.ActualName = "CurrentMaximumSelectionPressure";
      villageSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";

      villageTerminatedBySelectionPressure2.Name = "Village Terminated ?";
      villageTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";

      terminatedVillagesCounter.Name = "TerminatedVillages + 1";
      terminatedVillagesCounter.ValueParameter.ActualName = "TerminatedVillages";
      terminatedVillagesCounter.Increment = new IntValue(1);

      generationsCounter.Name = "Generations + 1";
      generationsCounter.ValueParameter.ActualName = "Generations";
      generationsCounter.Increment = new IntValue(1);

      generationsSinceLastReunificationCounter.Name = "GenerationsSinceLastReunification + 1";
      generationsSinceLastReunificationCounter.ValueParameter.ActualName = "GenerationsSinceLastReunification";
      generationsSinceLastReunificationCounter.Increment = new IntValue(1);

      reunificationComparator1.Name = "TerminatedVillages = VillageCount ?";
      reunificationComparator1.LeftSideParameter.ActualName = "TerminatedVillages";
      reunificationComparator1.Comparison = new Comparison(ComparisonType.Equal);
      reunificationComparator1.RightSideParameter.ActualName = "VillageCount";
      reunificationComparator1.ResultParameter.ActualName = "Reunificate";

      reunificationConditionalBranch1.Name = "Reunificate ?";
      reunificationConditionalBranch1.ConditionParameter.ActualName = "Reunificate";

      reunificationComparator2.Name = "GenerationsSinceLastReunification = MigrationInterval ?";
      reunificationComparator2.LeftSideParameter.ActualName = "GenerationsSinceLastReunification";
      reunificationComparator2.Comparison = new Comparison(ComparisonType.Equal);
      reunificationComparator2.RightSideParameter.ActualName = "MigrationInterval";
      reunificationComparator2.ResultParameter.ActualName = "Reunificate";

      reunificationConditionalBranch2.Name = "Reunificate ?";
      reunificationConditionalBranch2.ConditionParameter.ActualName = "Reunificate";

      // if there's just one village left and we're getting to this point SASEGASA terminates
      reunificationComparator3.Name = "VillageCount <= 1 ?";
      reunificationComparator3.LeftSideParameter.ActualName = "VillageCount";
      reunificationComparator3.RightSideParameter.Value = new IntValue(1);
      reunificationComparator3.Comparison.Value = ComparisonType.LessOrEqual;
      reunificationComparator3.ResultParameter.ActualName = "TerminateSASEGASA";

      reunificationConditionalBranch3.Name = "Skip reunification?";
      reunificationConditionalBranch3.ConditionParameter.ActualName = "TerminateSASEGASA";

      resetTerminatedVillagesAssigner.Name = "Reset TerminatedVillages";
      resetTerminatedVillagesAssigner.LeftSideParameter.ActualName = "TerminatedVillages";
      resetTerminatedVillagesAssigner.RightSideParameter.Value = new IntValue(0);

      resetGenerationsSinceLastReunificationAssigner.Name = "Reset GenerationsSinceLastReunification";
      resetGenerationsSinceLastReunificationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastReunification";
      resetGenerationsSinceLastReunificationAssigner.RightSideParameter.Value = new IntValue(0);

      reunificator.VillageCountParameter.ActualName = "VillageCount";

      reunificationCounter.ValueParameter.ActualName = "Reunifications"; // this variable is referenced in SASEGASA, do not change!
      reunificationCounter.IncrementParameter.Value = new IntValue(1);

      comparisonFactorModifier.Name = "Update comparison factor (placeholder)";
      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

      villageReviver.Name = "Village Reviver";
      villageReviver.LeftSideParameter.ActualName = "TerminateSelectionPressure";
      villageReviver.RightSideParameter.Value = new BoolValue(false);

      villageCountComparator.Name = "VillageCount == 1 ?";
      villageCountComparator.LeftSideParameter.ActualName = "VillageCount";
      villageCountComparator.RightSideParameter.Value = new IntValue(1);
      villageCountComparator.Comparison.Value = ComparisonType.Equal;
      villageCountComparator.ResultParameter.ActualName = "ChangeMaxSelPress";

      villageCountConditionalBranch.Name = "Change max selection pressure?";
      villageCountConditionalBranch.ConditionParameter.ActualName = "ChangeMaxSelPress";

      finalMaxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure";
      finalMaxSelPressAssigner.RightSideParameter.ActualName = FinalMaximumSelectionPressureParameter.Name;

      // if Generations is reaching MaximumGenerations we're also terminating
      maximumGenerationsComparator.LeftSideParameter.ActualName = "Generations";
      maximumGenerationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
      maximumGenerationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      maximumGenerationsComparator.ResultParameter.ActualName = "TerminateMaximumGenerations";

      maximumEvaluatedSolutionsComparator.Name = "EvaluatedSolutions >= MaximumEvaluatedSolutions";
      maximumEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      maximumEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
      maximumEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
      maximumEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

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

      terminationCondition.ConditionParameter.ActualName = "TerminateSASEGASA";
      maximumGenerationsTerminationCondition.ConditionParameter.ActualName = "TerminateMaximumGenerations";
      maximumEvaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = variableCreator;
      variableCreator.Successor = maxSelPressAssigner;
      maxSelPressAssigner.Successor = villageCountAssigner;
      villageCountAssigner.Successor = comparisonFactorInitializer;
      comparisonFactorInitializer.Successor = uniformSubScopesProcessor0;
      uniformSubScopesProcessor0.Operator = villageVariableCreator;
      uniformSubScopesProcessor0.Successor = analyzer1;
      villageVariableCreator.Successor = villageAnalyzer1;
      villageAnalyzer1.Successor = villageResultsCollector1;
      analyzer1.Successor = resultsCollector1;
      resultsCollector1.Successor = uniformSubScopesProcessor1;
      uniformSubScopesProcessor1.Operator = villageTerminatedBySelectionPressure1;
      uniformSubScopesProcessor1.Successor = generationsCounter;
      villageTerminatedBySelectionPressure1.TrueBranch = null;
      villageTerminatedBySelectionPressure1.FalseBranch = mainOperator;
      villageTerminatedBySelectionPressure1.Successor = null;
      mainOperator.Successor = villageAnalyzer2;
      villageAnalyzer2.Successor = villageResultsCollector2;
      villageResultsCollector2.Successor = villageSelectionPressureComparator;
      villageSelectionPressureComparator.Successor = villageTerminatedBySelectionPressure2;
      villageTerminatedBySelectionPressure2.TrueBranch = terminatedVillagesCounter;
      villageTerminatedBySelectionPressure2.FalseBranch = null;
      villageTerminatedBySelectionPressure2.Successor = null;
      terminatedVillagesCounter.Successor = null;
      generationsCounter.Successor = generationsSinceLastReunificationCounter;
      generationsSinceLastReunificationCounter.Successor = reunificationComparator1;
      reunificationComparator1.Successor = reunificationConditionalBranch1;
      reunificationConditionalBranch1.TrueBranch = reunificationComparator3;
      reunificationConditionalBranch1.FalseBranch = reunificationComparator2;
      reunificationConditionalBranch1.Successor = maximumGenerationsComparator;
      reunificationComparator2.Successor = reunificationConditionalBranch2;
      reunificationConditionalBranch2.TrueBranch = reunificationComparator3;
      reunificationConditionalBranch2.FalseBranch = null;
      reunificationConditionalBranch2.Successor = null;
      reunificationComparator3.Successor = reunificationConditionalBranch3;
      reunificationConditionalBranch3.TrueBranch = null;
      reunificationConditionalBranch3.FalseBranch = resetTerminatedVillagesAssigner;
      reunificationConditionalBranch3.Successor = null;
      resetTerminatedVillagesAssigner.Successor = resetGenerationsSinceLastReunificationAssigner;
      resetGenerationsSinceLastReunificationAssigner.Successor = reunificator;
      reunificator.Successor = reunificationCounter;
      reunificationCounter.Successor = comparisonFactorModifier;
      comparisonFactorModifier.Successor = uniformSubScopesProcessor2;
      uniformSubScopesProcessor2.Operator = villageReviver;
      uniformSubScopesProcessor2.Successor = villageCountComparator;
      villageReviver.Successor = null;
      villageCountComparator.Successor = villageCountConditionalBranch;
      villageCountConditionalBranch.TrueBranch = finalMaxSelPressAssigner;
      villageCountConditionalBranch.FalseBranch = null;
      villageCountConditionalBranch.Successor = null;
      finalMaxSelPressAssigner.Successor = null;
      maximumGenerationsComparator.Successor = maximumEvaluatedSolutionsComparator;
      maximumEvaluatedSolutionsComparator.Successor = analyzer2;
      analyzer2.Successor = terminationCondition;
      terminationCondition.TrueBranch = null;
      terminationCondition.FalseBranch = maximumGenerationsTerminationCondition;
      terminationCondition.Successor = null;
      maximumGenerationsTerminationCondition.TrueBranch = null;
      maximumGenerationsTerminationCondition.FalseBranch = maximumEvaluatedSolutionsTerminationCondition;
      maximumGenerationsTerminationCondition.Successor = null;
      maximumEvaluatedSolutionsTerminationCondition.TrueBranch = null;
      maximumEvaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
      maximumEvaluatedSolutionsTerminationCondition.Successor = null;
      #endregion
    }
    public IslandOffspringSelectionGeneticAlgorithmMainLoop()
      : base() {
      #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 ScopeTreeLookupParameter<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 ValueLookupParameter<IntValue>("NumberOfIslands", "The number of islands."));
      Parameters.Add(new ValueLookupParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases."));
      Parameters.Add(new ValueLookupParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands."));
      Parameters.Add(new ValueLookupParameter<IOperator>("Migrator", "The migration strategy."));
      Parameters.Add(new ValueLookupParameter<IOperator>("EmigrantsSelector", "Selects the individuals that will be migrated."));
      Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationReplacer", "Replaces part of the original population with the immigrants."));
      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed."));
      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>("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>("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<ResultCollection>("Results", "The results collection to store the results."));
      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
      Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
      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 ValueLookupParameter<DoubleValue>("ComparisonFactorStart", "The initial value for the comparison factor."));
      Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
      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<IOperator>("Analyzer", "The operator used to the analyze the islands."));
      Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
      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."));
      #endregion

      #region Create operators
      VariableCreator variableCreator = new VariableCreator();
      UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
      VariableCreator islandVariableCreator = new VariableCreator();
      Placeholder islandAnalyzer1 = new Placeholder();
      ResultsCollector islandResultsCollector1 = new ResultsCollector();
      Assigner comparisonFactorInitializer = new Assigner();
      Placeholder analyzer1 = new Placeholder();
      ResultsCollector resultsCollector1 = new ResultsCollector();
      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
      ConditionalBranch islandTerminatedBySelectionPressure1 = new ConditionalBranch();
      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
      Placeholder islandAnalyzer2 = new Placeholder();
      ResultsCollector islandResultsCollector2 = new ResultsCollector();
      Comparator islandSelectionPressureComparator = new Comparator();
      ConditionalBranch islandTerminatedBySelectionPressure2 = new ConditionalBranch();
      IntCounter terminatedIslandsCounter = new IntCounter();
      IntCounter generationsCounter = new IntCounter();
      IntCounter generationsSinceLastMigrationCounter = new IntCounter();
      Comparator migrationComparator = new Comparator();
      ConditionalBranch migrationBranch = new ConditionalBranch();
      Assigner resetTerminatedIslandsAssigner = new Assigner();
      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
      IntCounter migrationsCounter = new IntCounter();
      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
      Assigner reviveIslandAssigner = new Assigner();
      Placeholder emigrantsSelector = new Placeholder();
      Placeholder migrator = new Placeholder();
      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
      Placeholder immigrationReplacer = new Placeholder();
      Comparator generationsComparator = new Comparator();
      Comparator terminatedIslandsComparator = new Comparator();
      Comparator maxEvaluatedSolutionsComparator = new Comparator();
      Placeholder comparisonFactorModifier = new Placeholder();
      Placeholder analyzer2 = new Placeholder();
      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
      ConditionalBranch terminatedIslandsCondition = new ConditionalBranch();
      ConditionalBranch evaluatedSolutionsTerminationCondition = new ConditionalBranch();

      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class IslandOffspringSelectionGeneticAlgorithm expects this to be called Generations
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedIslands", new IntValue(0)));

      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>(ResultsParameter.Name, new ResultCollection()));
      islandVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
      islandVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));

      islandAnalyzer1.Name = "Island Analyzer (placeholder)";
      islandAnalyzer1.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;

      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
      islandResultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

      comparisonFactorInitializer.Name = "Initialize Comparison Factor";
      comparisonFactorInitializer.LeftSideParameter.ActualName = ComparisonFactorParameter.Name;
      comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

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

      resultsCollector1.CopyValue = new BoolValue(false);
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Comparison Factor", null, ComparisonFactorParameter.Name));
      resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("IslandResults", "Result set for each island", ResultsParameter.Name));
      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

      islandTerminatedBySelectionPressure1.Name = "Island Terminated ?";
      islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";

      mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
      mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
      mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name;
      mainOperator.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
      mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
      mainOperator.MutatorParameter.ActualName = MutatorParameter.Name;
      mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
      mainOperator.QualityParameter.ActualName = QualityParameter.Name;
      mainOperator.RandomParameter.ActualName = RandomParameter.Name;
      mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure";
      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;

      islandAnalyzer2.Name = "Island Analyzer (placeholder)";
      islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;

      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
      islandResultsCollector2.ResultsParameter.ActualName = "Results";

      islandSelectionPressureComparator.Name = "SelectionPressure >= MaximumSelectionPressure ?";
      islandSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
      islandSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      islandSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
      islandSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";

      islandTerminatedBySelectionPressure2.Name = "Island Terminated ?";
      islandTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";

      terminatedIslandsCounter.Name = "TerminatedIslands + 1";
      terminatedIslandsCounter.ValueParameter.ActualName = "TerminatedIslands";
      terminatedIslandsCounter.Increment = new IntValue(1);

      generationsCounter.Name = "Generations + 1";
      generationsCounter.ValueParameter.ActualName = "Generations";
      generationsCounter.Increment = new IntValue(1);

      generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1";
      generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration";
      generationsSinceLastMigrationCounter.Increment = new IntValue(1);

      migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?";
      migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
      migrationComparator.Comparison = new Comparison(ComparisonType.Equal);
      migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
      migrationComparator.ResultParameter.ActualName = "Migrate";

      migrationBranch.Name = "Migrate?";
      migrationBranch.ConditionParameter.ActualName = "Migrate";

      resetTerminatedIslandsAssigner.Name = "Reset TerminatedIslands";
      resetTerminatedIslandsAssigner.LeftSideParameter.ActualName = "TerminatedIslands";
      resetTerminatedIslandsAssigner.RightSideParameter.Value = new IntValue(0);

      resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration";
      resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
      resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0);

      migrationsCounter.Name = "Migrations + 1";
      migrationsCounter.IncrementParameter.Value = new IntValue(1);
      migrationsCounter.ValueParameter.ActualName = "Migrations";

      reviveIslandAssigner.Name = "Revive Island";
      reviveIslandAssigner.LeftSideParameter.ActualName = "TerminateSelectionPressure";
      reviveIslandAssigner.RightSideParameter.Value = new BoolValue(false);

      emigrantsSelector.Name = "Emigrants Selector (placeholder)";
      emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;

      migrator.Name = "Migrator (placeholder)";
      migrator.OperatorParameter.ActualName = MigratorParameter.Name;

      immigrationReplacer.Name = "Immigration Replacer (placeholder)";
      immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;

      generationsComparator.Name = "Generations >= MaximumGenerations ?";
      generationsComparator.LeftSideParameter.ActualName = "Generations";
      generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
      generationsComparator.ResultParameter.ActualName = "TerminateGenerations";

      terminatedIslandsComparator.Name = "All Islands terminated ?";
      terminatedIslandsComparator.LeftSideParameter.ActualName = "TerminatedIslands";
      terminatedIslandsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      terminatedIslandsComparator.RightSideParameter.ActualName = NumberOfIslandsParameter.Name;
      terminatedIslandsComparator.ResultParameter.ActualName = "TerminateTerminatedIslands";

      maxEvaluatedSolutionsComparator.Name = "EvaluatedSolutions >= MaximumEvaluatedSolutions ?";
      maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
      maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
      maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
      maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

      comparisonFactorModifier.Name = "Update Comparison Factor (Placeholder)";
      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

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

      generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?";
      generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";

      terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
      terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";

      evaluatedSolutionsTerminationCondition.Name = "Terminate (EvaluatedSolutions) ?";
      evaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = variableCreator;
      variableCreator.Successor = uniformSubScopesProcessor0;
      uniformSubScopesProcessor0.Operator = islandVariableCreator;
      uniformSubScopesProcessor0.Successor = comparisonFactorInitializer;
      islandVariableCreator.Successor = islandAnalyzer1;
      islandAnalyzer1.Successor = islandResultsCollector1;
      islandResultsCollector1.Successor = null;
      comparisonFactorInitializer.Successor = analyzer1;
      analyzer1.Successor = resultsCollector1;
      resultsCollector1.Successor = uniformSubScopesProcessor1;
      uniformSubScopesProcessor1.Operator = islandTerminatedBySelectionPressure1;
      uniformSubScopesProcessor1.Successor = generationsCounter;
      islandTerminatedBySelectionPressure1.TrueBranch = null;
      islandTerminatedBySelectionPressure1.FalseBranch = mainOperator;
      islandTerminatedBySelectionPressure1.Successor = null;
      mainOperator.Successor = islandAnalyzer2;
      islandAnalyzer2.Successor = islandResultsCollector2;
      islandResultsCollector2.Successor = islandSelectionPressureComparator;
      islandSelectionPressureComparator.Successor = islandTerminatedBySelectionPressure2;
      islandTerminatedBySelectionPressure2.TrueBranch = terminatedIslandsCounter;
      islandTerminatedBySelectionPressure2.FalseBranch = null;
      islandTerminatedBySelectionPressure2.Successor = null;
      generationsCounter.Successor = generationsSinceLastMigrationCounter;
      generationsSinceLastMigrationCounter.Successor = migrationComparator;
      migrationComparator.Successor = migrationBranch;
      migrationBranch.TrueBranch = resetTerminatedIslandsAssigner;
      migrationBranch.FalseBranch = null;
      migrationBranch.Successor = generationsComparator;
      resetTerminatedIslandsAssigner.Successor = resetGenerationsSinceLastMigrationAssigner;
      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
      migrationsCounter.Successor = uniformSubScopesProcessor2;
      uniformSubScopesProcessor2.Operator = reviveIslandAssigner;
      uniformSubScopesProcessor2.Successor = migrator;
      reviveIslandAssigner.Successor = emigrantsSelector;
      emigrantsSelector.Successor = null;
      migrator.Successor = uniformSubScopesProcessor3;
      uniformSubScopesProcessor3.Operator = immigrationReplacer;
      uniformSubScopesProcessor3.Successor = null;
      immigrationReplacer.Successor = null;
      generationsComparator.Successor = terminatedIslandsComparator;
      terminatedIslandsComparator.Successor = maxEvaluatedSolutionsComparator;
      maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
      comparisonFactorModifier.Successor = analyzer2;
      analyzer2.Successor = generationsTerminationCondition;
      generationsTerminationCondition.TrueBranch = null;
      generationsTerminationCondition.FalseBranch = terminatedIslandsCondition;
      generationsTerminationCondition.Successor = null;
      terminatedIslandsCondition.TrueBranch = null;
      terminatedIslandsCondition.FalseBranch = evaluatedSolutionsTerminationCondition;
      terminatedIslandsCondition.Successor = null;
      evaluatedSolutionsTerminationCondition.TrueBranch = null;
      evaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
      evaluatedSolutionsTerminationCondition.Successor = null;
      #endregion
    }
        public IslandOffspringSelectionGeneticAlgorithmMainLoop()
            : base()
        {
            #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 ScopeTreeLookupParameter <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 ValueLookupParameter <IntValue>("NumberOfIslands", "The number of islands."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MigrationInterval", "The number of generations that should pass between migration phases."));
            Parameters.Add(new ValueLookupParameter <PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Migrator", "The migration strategy."));
            Parameters.Add(new ValueLookupParameter <IOperator>("EmigrantsSelector", "Selects the individuals that will be migrated."));
            Parameters.Add(new ValueLookupParameter <IOperator>("ImmigrationReplacer", "Replaces part of the original population with the immigrants."));
            Parameters.Add(new ValueLookupParameter <IntValue>("PopulationSize", "The size of the population of solutions."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MaximumGenerations", "The maximum number of generations that should be processed."));
            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>("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>("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 <ResultCollection>("Results", "The results collection to store the results."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Visualizer", "The operator used to visualize solutions."));
            Parameters.Add(new LookupParameter <IItem>("Visualization", "The item which represents the visualization of solutions."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
            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 ValueLookupParameter <DoubleValue>("ComparisonFactorStart", "The initial value for the comparison factor."));
            Parameters.Add(new ValueLookupParameter <IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
            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 <IOperator>("Analyzer", "The operator used to the analyze the islands."));
            Parameters.Add(new ValueLookupParameter <IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
            Parameters.Add(new LookupParameter <IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
            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."));
            #endregion

            #region Create operators
            VariableCreator           variableCreator             = new VariableCreator();
            UniformSubScopesProcessor uniformSubScopesProcessor0  = new UniformSubScopesProcessor();
            VariableCreator           islandVariableCreator       = new VariableCreator();
            Placeholder               islandAnalyzer1             = new Placeholder();
            ResultsCollector          islandResultsCollector1     = new ResultsCollector();
            Assigner                  comparisonFactorInitializer = new Assigner();
            Placeholder               analyzer1                                  = new Placeholder();
            ResultsCollector          resultsCollector1                          = new ResultsCollector();
            UniformSubScopesProcessor uniformSubScopesProcessor1                 = new UniformSubScopesProcessor();
            ConditionalBranch         islandTerminatedBySelectionPressure1       = new ConditionalBranch();
            OffspringSelectionGeneticAlgorithmMainOperator mainOperator          = new OffspringSelectionGeneticAlgorithmMainOperator();
            Placeholder               islandAnalyzer2                            = new Placeholder();
            ResultsCollector          islandResultsCollector2                    = new ResultsCollector();
            Comparator                islandSelectionPressureComparator          = new Comparator();
            ConditionalBranch         islandTerminatedBySelectionPressure2       = new ConditionalBranch();
            IntCounter                terminatedIslandsCounter                   = new IntCounter();
            IntCounter                generationsCounter                         = new IntCounter();
            IntCounter                generationsSinceLastMigrationCounter       = new IntCounter();
            Comparator                migrationComparator                        = new Comparator();
            ConditionalBranch         migrationBranch                            = new ConditionalBranch();
            Assigner                  resetTerminatedIslandsAssigner             = new Assigner();
            Assigner                  resetGenerationsSinceLastMigrationAssigner = new Assigner();
            IntCounter                migrationsCounter                          = new IntCounter();
            UniformSubScopesProcessor uniformSubScopesProcessor2                 = new UniformSubScopesProcessor();
            Assigner                  reviveIslandAssigner                       = new Assigner();
            Placeholder               emigrantsSelector                          = new Placeholder();
            Placeholder               migrator = new Placeholder();
            UniformSubScopesProcessor uniformSubScopesProcessor3      = new UniformSubScopesProcessor();
            Placeholder               immigrationReplacer             = new Placeholder();
            Comparator                generationsComparator           = new Comparator();
            Comparator                terminatedIslandsComparator     = new Comparator();
            Comparator                maxEvaluatedSolutionsComparator = new Comparator();
            Placeholder               comparisonFactorModifier        = new Placeholder();
            Placeholder               analyzer2 = new Placeholder();
            ConditionalBranch         generationsTerminationCondition        = new ConditionalBranch();
            ConditionalBranch         terminatedIslandsCondition             = new ConditionalBranch();
            ConditionalBranch         evaluatedSolutionsTerminationCondition = new ConditionalBranch();

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Migrations", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Generations", new IntValue(0))); // Class IslandOffspringSelectionGeneticAlgorithm expects this to be called Generations
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("TerminatedIslands", new IntValue(0)));

            islandVariableCreator.CollectedValues.Add(new ValueParameter <ResultCollection>(ResultsParameter.Name, new ResultCollection()));
            islandVariableCreator.CollectedValues.Add(new ValueParameter <BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
            islandVariableCreator.CollectedValues.Add(new ValueParameter <DoubleValue>("SelectionPressure", new DoubleValue(0)));

            islandAnalyzer1.Name = "Island Analyzer (placeholder)";
            islandAnalyzer1.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;

            islandResultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
            islandResultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
            islandResultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            comparisonFactorInitializer.Name = "Initialize Comparison Factor";
            comparisonFactorInitializer.LeftSideParameter.ActualName  = ComparisonFactorParameter.Name;
            comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

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

            resultsCollector1.CopyValue = new BoolValue(false);
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Migrations"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Comparison Factor", null, ComparisonFactorParameter.Name));
            resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter <ResultCollection>("IslandResults", "Result set for each island", ResultsParameter.Name));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            islandTerminatedBySelectionPressure1.Name = "Island Terminated ?";
            islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";

            mainOperator.ComparisonFactorParameter.ActualName    = ComparisonFactorParameter.Name;
            mainOperator.CrossoverParameter.ActualName           = CrossoverParameter.Name;
            mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
            mainOperator.ElitesParameter.ActualName                           = ElitesParameter.Name;
            mainOperator.ReevaluateElitesParameter.ActualName                 = ReevaluateElitesParameter.Name;
            mainOperator.EvaluatedSolutionsParameter.ActualName               = EvaluatedSolutionsParameter.Name;
            mainOperator.EvaluatorParameter.ActualName                        = EvaluatorParameter.Name;
            mainOperator.MaximizationParameter.ActualName                     = MaximizationParameter.Name;
            mainOperator.MaximumSelectionPressureParameter.ActualName         = MaximumSelectionPressureParameter.Name;
            mainOperator.MutationProbabilityParameter.ActualName              = MutationProbabilityParameter.Name;
            mainOperator.MutatorParameter.ActualName                          = MutatorParameter.Name;
            mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
            mainOperator.QualityParameter.ActualName                          = QualityParameter.Name;
            mainOperator.RandomParameter.ActualName                           = RandomParameter.Name;
            mainOperator.SelectionPressureParameter.ActualName                = "SelectionPressure";
            mainOperator.SelectorParameter.ActualName                         = SelectorParameter.Name;
            mainOperator.SuccessRatioParameter.ActualName                     = SuccessRatioParameter.Name;
            mainOperator.FillPopulationWithParentsParameter.ActualName        = FillPopulationWithParentsParameter.Name;

            islandAnalyzer2.Name = "Island Analyzer (placeholder)";
            islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;

            islandResultsCollector2.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
            islandResultsCollector2.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
            islandResultsCollector2.ResultsParameter.ActualName = "Results";

            islandSelectionPressureComparator.Name = "SelectionPressure >= MaximumSelectionPressure ?";
            islandSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
            islandSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            islandSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
            islandSelectionPressureComparator.ResultParameter.ActualName    = "TerminateSelectionPressure";

            islandTerminatedBySelectionPressure2.Name = "Island Terminated ?";
            islandTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";

            terminatedIslandsCounter.Name = "TerminatedIslands + 1";
            terminatedIslandsCounter.ValueParameter.ActualName = "TerminatedIslands";
            terminatedIslandsCounter.Increment = new IntValue(1);

            generationsCounter.Name = "Generations + 1";
            generationsCounter.ValueParameter.ActualName = "Generations";
            generationsCounter.Increment = new IntValue(1);

            generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1";
            generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration";
            generationsSinceLastMigrationCounter.Increment = new IntValue(1);

            migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?";
            migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
            migrationComparator.Comparison = new Comparison(ComparisonType.Equal);
            migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
            migrationComparator.ResultParameter.ActualName    = "Migrate";

            migrationBranch.Name = "Migrate?";
            migrationBranch.ConditionParameter.ActualName = "Migrate";

            resetTerminatedIslandsAssigner.Name = "Reset TerminatedIslands";
            resetTerminatedIslandsAssigner.LeftSideParameter.ActualName = "TerminatedIslands";
            resetTerminatedIslandsAssigner.RightSideParameter.Value     = new IntValue(0);

            resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration";
            resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
            resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value     = new IntValue(0);

            migrationsCounter.Name = "Migrations + 1";
            migrationsCounter.IncrementParameter.Value  = new IntValue(1);
            migrationsCounter.ValueParameter.ActualName = "Migrations";

            reviveIslandAssigner.Name = "Revive Island";
            reviveIslandAssigner.LeftSideParameter.ActualName = "TerminateSelectionPressure";
            reviveIslandAssigner.RightSideParameter.Value     = new BoolValue(false);

            emigrantsSelector.Name = "Emigrants Selector (placeholder)";
            emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;

            migrator.Name = "Migrator (placeholder)";
            migrator.OperatorParameter.ActualName = MigratorParameter.Name;

            immigrationReplacer.Name = "Immigration Replacer (placeholder)";
            immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;

            generationsComparator.Name = "Generations >= MaximumGenerations ?";
            generationsComparator.LeftSideParameter.ActualName = "Generations";
            generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
            generationsComparator.ResultParameter.ActualName    = "TerminateGenerations";

            terminatedIslandsComparator.Name = "All Islands terminated ?";
            terminatedIslandsComparator.LeftSideParameter.ActualName = "TerminatedIslands";
            terminatedIslandsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            terminatedIslandsComparator.RightSideParameter.ActualName = NumberOfIslandsParameter.Name;
            terminatedIslandsComparator.ResultParameter.ActualName    = "TerminateTerminatedIslands";

            maxEvaluatedSolutionsComparator.Name       = "EvaluatedSolutions >= MaximumEvaluatedSolutions ?";
            maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName  = EvaluatedSolutionsParameter.Name;
            maxEvaluatedSolutionsComparator.ResultParameter.ActualName    = "TerminateEvaluatedSolutions";
            maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

            comparisonFactorModifier.Name = "Update Comparison Factor (Placeholder)";
            comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

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

            generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?";
            generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";

            terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
            terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";

            evaluatedSolutionsTerminationCondition.Name = "Terminate (EvaluatedSolutions) ?";
            evaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator         = variableCreator;
            variableCreator.Successor             = uniformSubScopesProcessor0;
            uniformSubScopesProcessor0.Operator   = islandVariableCreator;
            uniformSubScopesProcessor0.Successor  = comparisonFactorInitializer;
            islandVariableCreator.Successor       = islandAnalyzer1;
            islandAnalyzer1.Successor             = islandResultsCollector1;
            islandResultsCollector1.Successor     = null;
            comparisonFactorInitializer.Successor = analyzer1;
            analyzer1.Successor                                  = resultsCollector1;
            resultsCollector1.Successor                          = uniformSubScopesProcessor1;
            uniformSubScopesProcessor1.Operator                  = islandTerminatedBySelectionPressure1;
            uniformSubScopesProcessor1.Successor                 = generationsCounter;
            islandTerminatedBySelectionPressure1.TrueBranch      = null;
            islandTerminatedBySelectionPressure1.FalseBranch     = mainOperator;
            islandTerminatedBySelectionPressure1.Successor       = null;
            mainOperator.Successor                               = islandAnalyzer2;
            islandAnalyzer2.Successor                            = islandResultsCollector2;
            islandResultsCollector2.Successor                    = islandSelectionPressureComparator;
            islandSelectionPressureComparator.Successor          = islandTerminatedBySelectionPressure2;
            islandTerminatedBySelectionPressure2.TrueBranch      = terminatedIslandsCounter;
            islandTerminatedBySelectionPressure2.FalseBranch     = null;
            islandTerminatedBySelectionPressure2.Successor       = null;
            generationsCounter.Successor                         = generationsSinceLastMigrationCounter;
            generationsSinceLastMigrationCounter.Successor       = migrationComparator;
            migrationComparator.Successor                        = migrationBranch;
            migrationBranch.TrueBranch                           = resetTerminatedIslandsAssigner;
            migrationBranch.FalseBranch                          = null;
            migrationBranch.Successor                            = generationsComparator;
            resetTerminatedIslandsAssigner.Successor             = resetGenerationsSinceLastMigrationAssigner;
            resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
            migrationsCounter.Successor                          = uniformSubScopesProcessor2;
            uniformSubScopesProcessor2.Operator                  = reviveIslandAssigner;
            uniformSubScopesProcessor2.Successor                 = migrator;
            reviveIslandAssigner.Successor                       = emigrantsSelector;
            emigrantsSelector.Successor                          = null;
            migrator.Successor = uniformSubScopesProcessor3;
            uniformSubScopesProcessor3.Operator       = immigrationReplacer;
            uniformSubScopesProcessor3.Successor      = null;
            immigrationReplacer.Successor             = null;
            generationsComparator.Successor           = terminatedIslandsComparator;
            terminatedIslandsComparator.Successor     = maxEvaluatedSolutionsComparator;
            maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
            comparisonFactorModifier.Successor        = analyzer2;
            analyzer2.Successor = generationsTerminationCondition;
            generationsTerminationCondition.TrueBranch         = null;
            generationsTerminationCondition.FalseBranch        = terminatedIslandsCondition;
            generationsTerminationCondition.Successor          = null;
            terminatedIslandsCondition.TrueBranch              = null;
            terminatedIslandsCondition.FalseBranch             = evaluatedSolutionsTerminationCondition;
            terminatedIslandsCondition.Successor               = null;
            evaluatedSolutionsTerminationCondition.TrueBranch  = null;
            evaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
            evaluatedSolutionsTerminationCondition.Successor   = null;
            #endregion
        }
        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 ScopeTreeLookupParameter <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 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>("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>("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 <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 ValueLookupParameter <DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
            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 ValueLookupParameter <DoubleValue>("ComparisonFactorStart", "The initial value for the comparison factor."));
            Parameters.Add(new ValueLookupParameter <IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
            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 LookupParameter <IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
            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."));
            #endregion

            #region Create operators
            VariableCreator  variableCreator             = new VariableCreator();
            Assigner         comparisonFactorInitializer = new Assigner();
            Placeholder      analyzer1         = new Placeholder();
            ResultsCollector resultsCollector1 = new ResultsCollector();
            OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
            IntCounter        generationsCounter              = new IntCounter();
            Comparator        maxGenerationsComparator        = new Comparator();
            Comparator        maxSelectionPressureComparator  = new Comparator();
            Comparator        maxEvaluatedSolutionsComparator = new Comparator();
            Placeholder       comparisonFactorModifier        = new Placeholder();
            Placeholder       analyzer2          = new Placeholder();
            ConditionalBranch conditionalBranch1 = new ConditionalBranch();
            ConditionalBranch conditionalBranch2 = new ConditionalBranch();
            ConditionalBranch conditionalBranch3 = new ConditionalBranch();

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Generations", new IntValue(0))); // Class OffspringSelectionGeneticAlgorithm expects this to be called Generations
            variableCreator.CollectedValues.Add(new ValueParameter <DoubleValue>("SelectionPressure", new DoubleValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <DoubleValue>("CurrentSuccessRatio", new DoubleValue(0)));

            comparisonFactorInitializer.Name = "Initialize ComparisonFactor (placeholder)";
            comparisonFactorInitializer.LeftSideParameter.ActualName  = ComparisonFactorParameter.Name;
            comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

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

            resultsCollector1.CopyValue = new BoolValue(false);
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Comparison Factor", null, ComparisonFactorParameter.Name));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            mainOperator.ComparisonFactorParameter.ActualName    = ComparisonFactorParameter.Name;
            mainOperator.CrossoverParameter.ActualName           = CrossoverParameter.Name;
            mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
            mainOperator.ElitesParameter.ActualName                           = ElitesParameter.Name;
            mainOperator.ReevaluateElitesParameter.ActualName                 = ReevaluateElitesParameter.Name;
            mainOperator.EvaluatedSolutionsParameter.ActualName               = EvaluatedSolutionsParameter.Name;
            mainOperator.EvaluatorParameter.ActualName                        = EvaluatorParameter.Name;
            mainOperator.MaximizationParameter.ActualName                     = MaximizationParameter.Name;
            mainOperator.MaximumSelectionPressureParameter.ActualName         = MaximumSelectionPressureParameter.Name;
            mainOperator.MutationProbabilityParameter.ActualName              = MutationProbabilityParameter.Name;
            mainOperator.MutatorParameter.ActualName                          = MutatorParameter.Name;
            mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
            mainOperator.QualityParameter.ActualName                          = QualityParameter.Name;
            mainOperator.RandomParameter.ActualName                           = RandomParameter.Name;
            mainOperator.SelectionPressureParameter.ActualName                = "SelectionPressure";
            mainOperator.SelectorParameter.ActualName                         = SelectorParameter.Name;
            mainOperator.SuccessRatioParameter.ActualName                     = SuccessRatioParameter.Name;
            mainOperator.FillPopulationWithParentsParameter.ActualName        = FillPopulationWithParentsParameter.Name;

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

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

            maxSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maxSelectionPressureComparator.LeftSideParameter.ActualName  = "SelectionPressure";
            maxSelectionPressureComparator.ResultParameter.ActualName    = "TerminateSelectionPressure";
            maxSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;

            maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName  = EvaluatedSolutionsParameter.Name;
            maxEvaluatedSolutionsComparator.ResultParameter.ActualName    = "TerminateEvaluatedSolutions";
            maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

            comparisonFactorModifier.Name = "Update ComparisonFactor (placeholder)";
            comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

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

            conditionalBranch1.Name = "MaximumSelectionPressure reached?";
            conditionalBranch1.ConditionParameter.ActualName = "TerminateSelectionPressure";

            conditionalBranch2.Name = "MaximumGenerations reached?";
            conditionalBranch2.ConditionParameter.ActualName = "TerminateMaximumGenerations";

            conditionalBranch3.Name = "MaximumEvaluatedSolutions reached?";
            conditionalBranch3.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator         = variableCreator;
            variableCreator.Successor             = comparisonFactorInitializer;
            comparisonFactorInitializer.Successor = analyzer1;
            analyzer1.Successor                       = resultsCollector1;
            resultsCollector1.Successor               = mainOperator;
            mainOperator.Successor                    = generationsCounter;
            generationsCounter.Successor              = maxGenerationsComparator;
            maxGenerationsComparator.Successor        = maxSelectionPressureComparator;
            maxSelectionPressureComparator.Successor  = maxEvaluatedSolutionsComparator;
            maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
            comparisonFactorModifier.Successor        = analyzer2;
            analyzer2.Successor                       = conditionalBranch1;
            conditionalBranch1.FalseBranch            = conditionalBranch2;
            conditionalBranch1.TrueBranch             = null;
            conditionalBranch1.Successor              = null;
            conditionalBranch2.FalseBranch            = conditionalBranch3;
            conditionalBranch2.TrueBranch             = null;
            conditionalBranch2.Successor              = null;
            conditionalBranch3.FalseBranch            = mainOperator;
            conditionalBranch3.TrueBranch             = null;
            conditionalBranch3.Successor              = null;
            #endregion
        }
示例#8
0
        public SASEGASAMainLoop()
            : base()
        {
            #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 ScopeTreeLookupParameter <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 ValueLookupParameter <IntValue>("NumberOfVillages", "The initial number of villages."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MigrationInterval", "The fixed period after which migration occurs."));
            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>("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>("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 <ResultCollection>("Results", "The results collection to store the results."));
            Parameters.Add(new ValueLookupParameter <IOperator>("Analyzer", "The operator used to the analyze the villages."));
            Parameters.Add(new ValueLookupParameter <IOperator>("VillageAnalyzer", "The operator used to analyze each village."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
            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 ValueLookupParameter <DoubleValue>("ComparisonFactorStart", "The lower bound of the comparison factor (start)."));
            Parameters.Add(new ValueLookupParameter <IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left."));
            Parameters.Add(new ValueLookupParameter <IntValue>("MaximumGenerations", "The maximum genreation 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 LookupParameter <IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
            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."));
            #endregion

            #region Create operators
            VariableCreator           variableCreator             = new VariableCreator();
            Assigner                  maxSelPressAssigner         = new Assigner();
            Assigner                  villageCountAssigner        = new Assigner();
            Assigner                  comparisonFactorInitializer = new Assigner();
            UniformSubScopesProcessor uniformSubScopesProcessor0  = new UniformSubScopesProcessor();
            VariableCreator           villageVariableCreator      = new VariableCreator();
            Placeholder               villageAnalyzer1            = new Placeholder();
            ResultsCollector          villageResultsCollector1    = new ResultsCollector();
            Placeholder               analyzer1                                      = new Placeholder();
            ResultsCollector          resultsCollector1                              = new ResultsCollector();
            UniformSubScopesProcessor uniformSubScopesProcessor1                     = new UniformSubScopesProcessor();
            ConditionalBranch         villageTerminatedBySelectionPressure1          = new ConditionalBranch();
            OffspringSelectionGeneticAlgorithmMainOperator mainOperator              = new OffspringSelectionGeneticAlgorithmMainOperator();
            Placeholder               villageAnalyzer2                               = new Placeholder();
            ResultsCollector          villageResultsCollector2                       = new ResultsCollector();
            Comparator                villageSelectionPressureComparator             = new Comparator();
            ConditionalBranch         villageTerminatedBySelectionPressure2          = new ConditionalBranch();
            IntCounter                terminatedVillagesCounter                      = new IntCounter();
            IntCounter                generationsCounter                             = new IntCounter();
            IntCounter                generationsSinceLastReunificationCounter       = new IntCounter();
            Comparator                reunificationComparator1                       = new Comparator();
            ConditionalBranch         reunificationConditionalBranch1                = new ConditionalBranch();
            Comparator                reunificationComparator2                       = new Comparator();
            ConditionalBranch         reunificationConditionalBranch2                = new ConditionalBranch();
            Comparator                reunificationComparator3                       = new Comparator();
            ConditionalBranch         reunificationConditionalBranch3                = new ConditionalBranch();
            Assigner                  resetTerminatedVillagesAssigner                = new Assigner();
            Assigner                  resetGenerationsSinceLastReunificationAssigner = new Assigner();
            SASEGASAReunificator      reunificator                                   = new SASEGASAReunificator();
            IntCounter                reunificationCounter                           = new IntCounter();
            Placeholder               comparisonFactorModifier                       = new Placeholder();
            UniformSubScopesProcessor uniformSubScopesProcessor2                     = new UniformSubScopesProcessor();
            Assigner                  villageReviver                                 = new Assigner();
            Comparator                villageCountComparator                         = new Comparator();
            ConditionalBranch         villageCountConditionalBranch                  = new ConditionalBranch();
            Assigner                  finalMaxSelPressAssigner                       = new Assigner();
            Comparator                maximumGenerationsComparator                   = new Comparator();
            Comparator                maximumEvaluatedSolutionsComparator            = new Comparator();
            Placeholder               analyzer2                                      = new Placeholder();
            ConditionalBranch         terminationCondition                           = new ConditionalBranch();
            ConditionalBranch         maximumGenerationsTerminationCondition         = new ConditionalBranch();
            ConditionalBranch         maximumEvaluatedSolutionsTerminationCondition  = new ConditionalBranch();

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Reunifications", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Generations", new IntValue(0))); // Class SASEGASA expects this to be called Generations
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("GenerationsSinceLastReunification", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("TerminatedVillages", new IntValue(0)));

            villageCountAssigner.LeftSideParameter.ActualName  = "VillageCount";
            villageCountAssigner.RightSideParameter.ActualName = NumberOfVillagesParameter.Name;

            maxSelPressAssigner.LeftSideParameter.ActualName  = "CurrentMaximumSelectionPressure";
            maxSelPressAssigner.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;

            comparisonFactorInitializer.LeftSideParameter.ActualName  = ComparisonFactorParameter.Name;
            comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;

            villageVariableCreator.CollectedValues.Add(new ValueParameter <ResultCollection>("Results", new ResultCollection()));
            villageVariableCreator.CollectedValues.Add(new ValueParameter <BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
            villageVariableCreator.CollectedValues.Add(new ValueParameter <DoubleValue>("SelectionPressure", new DoubleValue(0)));
            villageVariableCreator.CollectedValues.Add(new ValueParameter <DoubleValue>("CurrentSuccessRatio", new DoubleValue(0)));

            villageAnalyzer1.Name = "Village Analyzer (placeholder)";
            villageAnalyzer1.OperatorParameter.ActualName = VillageAnalyzerParameter.Name;

            villageResultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
            villageResultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
            villageResultsCollector1.ResultsParameter.ActualName = "Results";

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

            resultsCollector1.CopyValue = new BoolValue(false);
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Generations"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <DoubleValue>("ComparisonFactor", null, ComparisonFactorParameter.Name));
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Terminated Villages", null, "TerminatedVillages"));
            resultsCollector1.CollectedValues.Add(new LookupParameter <IntValue>("Total Active Villages", null, "VillageCount"));
            resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter <ResultCollection>("VillageResults", "Result set for each village", "Results"));
            resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;

            villageTerminatedBySelectionPressure1.Name = "Village Terminated ?";
            villageTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";

            mainOperator.ComparisonFactorParameter.ActualName    = ComparisonFactorParameter.Name;
            mainOperator.CrossoverParameter.ActualName           = CrossoverParameter.Name;
            mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
            mainOperator.ElitesParameter.ActualName                           = ElitesParameter.Name;
            mainOperator.ReevaluateElitesParameter.ActualName                 = ReevaluateElitesParameter.Name;
            mainOperator.EvaluatedSolutionsParameter.ActualName               = EvaluatedSolutionsParameter.Name;
            mainOperator.EvaluatorParameter.ActualName                        = EvaluatorParameter.Name;
            mainOperator.MaximizationParameter.ActualName                     = MaximizationParameter.Name;
            mainOperator.MaximumSelectionPressureParameter.ActualName         = "CurrentMaximumSelectionPressure";
            mainOperator.MutationProbabilityParameter.ActualName              = MutationProbabilityParameter.Name;
            mainOperator.MutatorParameter.ActualName                          = MutatorParameter.Name;
            mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
            mainOperator.QualityParameter.ActualName                          = QualityParameter.Name;
            mainOperator.RandomParameter.ActualName                           = RandomParameter.Name;
            mainOperator.SelectionPressureParameter.ActualName                = "SelectionPressure";
            mainOperator.SelectorParameter.ActualName                         = SelectorParameter.Name;
            mainOperator.SuccessRatioParameter.ActualName                     = SuccessRatioParameter.Name;
            mainOperator.FillPopulationWithParentsParameter.ActualName        = FillPopulationWithParentsParameter.Name;

            villageAnalyzer2.Name = "Village Analyzer (placeholder)";
            villageAnalyzer2.OperatorParameter.ActualName = VillageAnalyzerParameter.Name;

            villageResultsCollector2.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Success Ratio", "Indicates how many successful children were already found during a generation (relative to the population size).", "CurrentSuccessRatio"));
            villageResultsCollector2.CollectedValues.Add(new LookupParameter <DoubleValue>("Current Selection Pressure", "Displays the rising selection pressure during a generation.", "SelectionPressure"));
            villageResultsCollector2.ResultsParameter.ActualName = "Results";

            villageSelectionPressureComparator.Name = "SelectionPressure >= CurrentMaximumSelectionPressure ?";
            villageSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
            villageSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            villageSelectionPressureComparator.RightSideParameter.ActualName = "CurrentMaximumSelectionPressure";
            villageSelectionPressureComparator.ResultParameter.ActualName    = "TerminateSelectionPressure";

            villageTerminatedBySelectionPressure2.Name = "Village Terminated ?";
            villageTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";

            terminatedVillagesCounter.Name = "TerminatedVillages + 1";
            terminatedVillagesCounter.ValueParameter.ActualName = "TerminatedVillages";
            terminatedVillagesCounter.Increment = new IntValue(1);

            generationsCounter.Name = "Generations + 1";
            generationsCounter.ValueParameter.ActualName = "Generations";
            generationsCounter.Increment = new IntValue(1);

            generationsSinceLastReunificationCounter.Name = "GenerationsSinceLastReunification + 1";
            generationsSinceLastReunificationCounter.ValueParameter.ActualName = "GenerationsSinceLastReunification";
            generationsSinceLastReunificationCounter.Increment = new IntValue(1);

            reunificationComparator1.Name = "TerminatedVillages = VillageCount ?";
            reunificationComparator1.LeftSideParameter.ActualName = "TerminatedVillages";
            reunificationComparator1.Comparison = new Comparison(ComparisonType.Equal);
            reunificationComparator1.RightSideParameter.ActualName = "VillageCount";
            reunificationComparator1.ResultParameter.ActualName    = "Reunificate";

            reunificationConditionalBranch1.Name = "Reunificate ?";
            reunificationConditionalBranch1.ConditionParameter.ActualName = "Reunificate";

            reunificationComparator2.Name = "GenerationsSinceLastReunification = MigrationInterval ?";
            reunificationComparator2.LeftSideParameter.ActualName = "GenerationsSinceLastReunification";
            reunificationComparator2.Comparison = new Comparison(ComparisonType.Equal);
            reunificationComparator2.RightSideParameter.ActualName = "MigrationInterval";
            reunificationComparator2.ResultParameter.ActualName    = "Reunificate";

            reunificationConditionalBranch2.Name = "Reunificate ?";
            reunificationConditionalBranch2.ConditionParameter.ActualName = "Reunificate";

            // if there's just one village left and we're getting to this point SASEGASA terminates
            reunificationComparator3.Name = "VillageCount <= 1 ?";
            reunificationComparator3.LeftSideParameter.ActualName = "VillageCount";
            reunificationComparator3.RightSideParameter.Value     = new IntValue(1);
            reunificationComparator3.Comparison.Value             = ComparisonType.LessOrEqual;
            reunificationComparator3.ResultParameter.ActualName   = "TerminateSASEGASA";

            reunificationConditionalBranch3.Name = "Skip reunification?";
            reunificationConditionalBranch3.ConditionParameter.ActualName = "TerminateSASEGASA";

            resetTerminatedVillagesAssigner.Name = "Reset TerminatedVillages";
            resetTerminatedVillagesAssigner.LeftSideParameter.ActualName = "TerminatedVillages";
            resetTerminatedVillagesAssigner.RightSideParameter.Value     = new IntValue(0);

            resetGenerationsSinceLastReunificationAssigner.Name = "Reset GenerationsSinceLastReunification";
            resetGenerationsSinceLastReunificationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastReunification";
            resetGenerationsSinceLastReunificationAssigner.RightSideParameter.Value     = new IntValue(0);

            reunificator.VillageCountParameter.ActualName = "VillageCount";

            reunificationCounter.ValueParameter.ActualName = "Reunifications"; // this variable is referenced in SASEGASA, do not change!
            reunificationCounter.IncrementParameter.Value  = new IntValue(1);

            comparisonFactorModifier.Name = "Update comparison factor (placeholder)";
            comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;

            villageReviver.Name = "Village Reviver";
            villageReviver.LeftSideParameter.ActualName = "TerminateSelectionPressure";
            villageReviver.RightSideParameter.Value     = new BoolValue(false);

            villageCountComparator.Name = "VillageCount == 1 ?";
            villageCountComparator.LeftSideParameter.ActualName = "VillageCount";
            villageCountComparator.RightSideParameter.Value     = new IntValue(1);
            villageCountComparator.Comparison.Value             = ComparisonType.Equal;
            villageCountComparator.ResultParameter.ActualName   = "ChangeMaxSelPress";

            villageCountConditionalBranch.Name = "Change max selection pressure?";
            villageCountConditionalBranch.ConditionParameter.ActualName = "ChangeMaxSelPress";

            finalMaxSelPressAssigner.LeftSideParameter.ActualName  = "CurrentMaximumSelectionPressure";
            finalMaxSelPressAssigner.RightSideParameter.ActualName = FinalMaximumSelectionPressureParameter.Name;

            // if Generations is reaching MaximumGenerations we're also terminating
            maximumGenerationsComparator.LeftSideParameter.ActualName  = "Generations";
            maximumGenerationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
            maximumGenerationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maximumGenerationsComparator.ResultParameter.ActualName = "TerminateMaximumGenerations";

            maximumEvaluatedSolutionsComparator.Name       = "EvaluatedSolutions >= MaximumEvaluatedSolutions";
            maximumEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
            maximumEvaluatedSolutionsComparator.LeftSideParameter.ActualName  = EvaluatedSolutionsParameter.Name;
            maximumEvaluatedSolutionsComparator.ResultParameter.ActualName    = "TerminateEvaluatedSolutions";
            maximumEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";

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

            terminationCondition.ConditionParameter.ActualName = "TerminateSASEGASA";
            maximumGenerationsTerminationCondition.ConditionParameter.ActualName        = "TerminateMaximumGenerations";
            maximumEvaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator         = variableCreator;
            variableCreator.Successor             = maxSelPressAssigner;
            maxSelPressAssigner.Successor         = villageCountAssigner;
            villageCountAssigner.Successor        = comparisonFactorInitializer;
            comparisonFactorInitializer.Successor = uniformSubScopesProcessor0;
            uniformSubScopesProcessor0.Operator   = villageVariableCreator;
            uniformSubScopesProcessor0.Successor  = analyzer1;
            villageVariableCreator.Successor      = villageAnalyzer1;
            villageAnalyzer1.Successor            = villageResultsCollector1;
            analyzer1.Successor                                       = resultsCollector1;
            resultsCollector1.Successor                               = uniformSubScopesProcessor1;
            uniformSubScopesProcessor1.Operator                       = villageTerminatedBySelectionPressure1;
            uniformSubScopesProcessor1.Successor                      = generationsCounter;
            villageTerminatedBySelectionPressure1.TrueBranch          = null;
            villageTerminatedBySelectionPressure1.FalseBranch         = mainOperator;
            villageTerminatedBySelectionPressure1.Successor           = null;
            mainOperator.Successor                                    = villageAnalyzer2;
            villageAnalyzer2.Successor                                = villageResultsCollector2;
            villageResultsCollector2.Successor                        = villageSelectionPressureComparator;
            villageSelectionPressureComparator.Successor              = villageTerminatedBySelectionPressure2;
            villageTerminatedBySelectionPressure2.TrueBranch          = terminatedVillagesCounter;
            villageTerminatedBySelectionPressure2.FalseBranch         = null;
            villageTerminatedBySelectionPressure2.Successor           = null;
            terminatedVillagesCounter.Successor                       = null;
            generationsCounter.Successor                              = generationsSinceLastReunificationCounter;
            generationsSinceLastReunificationCounter.Successor        = reunificationComparator1;
            reunificationComparator1.Successor                        = reunificationConditionalBranch1;
            reunificationConditionalBranch1.TrueBranch                = reunificationComparator3;
            reunificationConditionalBranch1.FalseBranch               = reunificationComparator2;
            reunificationConditionalBranch1.Successor                 = maximumGenerationsComparator;
            reunificationComparator2.Successor                        = reunificationConditionalBranch2;
            reunificationConditionalBranch2.TrueBranch                = reunificationComparator3;
            reunificationConditionalBranch2.FalseBranch               = null;
            reunificationConditionalBranch2.Successor                 = null;
            reunificationComparator3.Successor                        = reunificationConditionalBranch3;
            reunificationConditionalBranch3.TrueBranch                = null;
            reunificationConditionalBranch3.FalseBranch               = resetTerminatedVillagesAssigner;
            reunificationConditionalBranch3.Successor                 = null;
            resetTerminatedVillagesAssigner.Successor                 = resetGenerationsSinceLastReunificationAssigner;
            resetGenerationsSinceLastReunificationAssigner.Successor  = reunificator;
            reunificator.Successor                                    = reunificationCounter;
            reunificationCounter.Successor                            = comparisonFactorModifier;
            comparisonFactorModifier.Successor                        = uniformSubScopesProcessor2;
            uniformSubScopesProcessor2.Operator                       = villageReviver;
            uniformSubScopesProcessor2.Successor                      = villageCountComparator;
            villageReviver.Successor                                  = null;
            villageCountComparator.Successor                          = villageCountConditionalBranch;
            villageCountConditionalBranch.TrueBranch                  = finalMaxSelPressAssigner;
            villageCountConditionalBranch.FalseBranch                 = null;
            villageCountConditionalBranch.Successor                   = null;
            finalMaxSelPressAssigner.Successor                        = null;
            maximumGenerationsComparator.Successor                    = maximumEvaluatedSolutionsComparator;
            maximumEvaluatedSolutionsComparator.Successor             = analyzer2;
            analyzer2.Successor                                       = terminationCondition;
            terminationCondition.TrueBranch                           = null;
            terminationCondition.FalseBranch                          = maximumGenerationsTerminationCondition;
            terminationCondition.Successor                            = null;
            maximumGenerationsTerminationCondition.TrueBranch         = null;
            maximumGenerationsTerminationCondition.FalseBranch        = maximumEvaluatedSolutionsTerminationCondition;
            maximumGenerationsTerminationCondition.Successor          = null;
            maximumEvaluatedSolutionsTerminationCondition.TrueBranch  = null;
            maximumEvaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
            maximumEvaluatedSolutionsTerminationCondition.Successor   = null;
            #endregion
        }