Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs @ 3721

Last change on this file since 3721 was 3715, checked in by abeham, 15 years ago

#893

  • prevented exception in the algorithms when an operator parameter from the problem is missing
File size: 26.7 KB
RevLine 
[3429]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using HeuristicLab.Analysis;
26using HeuristicLab.Common;
27using HeuristicLab.Core;
28using HeuristicLab.Data;
29using HeuristicLab.Operators;
30using HeuristicLab.Optimization;
31using HeuristicLab.Optimization.Operators;
32using HeuristicLab.Parameters;
33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
34using HeuristicLab.PluginInfrastructure;
35using HeuristicLab.Selection;
36
37namespace HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm {
38  /// <summary>
[3479]39  /// An island offspring selection genetic algorithm main loop operator.
[3429]40  /// </summary>
[3479]41  [Item("IslandOffspringSelectionGeneticAlgorithmMainLoop", "An island offspring selection genetic algorithm main loop operator.")]
[3429]42  [StorableClass]
[3479]43  public sealed class IslandOffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
[3429]44    #region Parameter Properties
45    public ValueLookupParameter<IRandom> RandomParameter {
46      get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; }
47    }
48    public ValueLookupParameter<BoolValue> MaximizationParameter {
49      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
50    }
[3659]51    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
52      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
[3429]53    }
54    public ValueLookupParameter<DoubleValue> BestKnownQualityParameter {
55      get { return (ValueLookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
56    }
57    public ValueLookupParameter<IntValue> NumberOfIslandsParameter {
58      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfIslands"]; }
59    }
60    public ValueLookupParameter<IntValue> MigrationIntervalParameter {
61      get { return (ValueLookupParameter<IntValue>)Parameters["MigrationInterval"]; }
62    }
63    public ValueLookupParameter<PercentValue> MigrationRateParameter {
64      get { return (ValueLookupParameter<PercentValue>)Parameters["MigrationRate"]; }
65    }
66    public ValueLookupParameter<IOperator> MigratorParameter {
67      get { return (ValueLookupParameter<IOperator>)Parameters["Migrator"]; }
68    }
69    public ValueLookupParameter<IOperator> EmigrantsSelectorParameter {
70      get { return (ValueLookupParameter<IOperator>)Parameters["EmigrantsSelector"]; }
71    }
[3611]72    public ValueLookupParameter<IOperator> ImmigrationReplacerParameter {
73      get { return (ValueLookupParameter<IOperator>)Parameters["ImmigrationReplacer"]; }
[3429]74    }
75    public ValueLookupParameter<IntValue> PopulationSizeParameter {
76      get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
77    }
[3611]78    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
79      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
[3429]80    }
81    public ValueLookupParameter<IOperator> SelectorParameter {
82      get { return (ValueLookupParameter<IOperator>)Parameters["Selector"]; }
83    }
84    public ValueLookupParameter<IOperator> CrossoverParameter {
85      get { return (ValueLookupParameter<IOperator>)Parameters["Crossover"]; }
86    }
87    public ValueLookupParameter<PercentValue> MutationProbabilityParameter {
88      get { return (ValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; }
89    }
90    public ValueLookupParameter<IOperator> MutatorParameter {
91      get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; }
92    }
93    public ValueLookupParameter<IOperator> EvaluatorParameter {
94      get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
95    }
96    public ValueLookupParameter<IntValue> ElitesParameter {
97      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
98    }
99    public ValueLookupParameter<ResultCollection> ResultsParameter {
100      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
101    }
102    public ValueLookupParameter<IOperator> VisualizerParameter {
103      get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; }
104    }
105    public LookupParameter<IItem> VisualizationParameter {
106      get { return (LookupParameter<IItem>)Parameters["Visualization"]; }
107    }
108    public ValueLookupParameter<DoubleValue> SuccessRatioParameter {
109      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
110    }
[3611]111    public LookupParameter<DoubleValue> ComparisonFactorParameter {
112      get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; }
113    }
[3429]114    public ValueLookupParameter<IOperator> ComparisonFactorModifierParameter {
115      get { return (ValueLookupParameter<IOperator>)Parameters["ComparisonFactorModifier"]; }
116    }
117    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
118      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
119    }
120    public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
121      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
122    }
[3654]123    public ValueLookupParameter<IOperator> AnalyzerParameter {
124      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
125    }
126    public ValueLookupParameter<IOperator> IslandAnalyzerParameter {
127      get { return (ValueLookupParameter<IOperator>)Parameters["IslandAnalyzer"]; }
128    }
[3429]129    #endregion
130
131    [StorableConstructor]
[3479]132    private IslandOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base() { }
133    public IslandOffspringSelectionGeneticAlgorithmMainLoop()
[3429]134      : base() {
135      #region Create parameters
136      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
137      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
[3659]138      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
[3429]139      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
140      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfIslands", "The number of islands."));
141      Parameters.Add(new ValueLookupParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases."));
142      Parameters.Add(new ValueLookupParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands."));
143      Parameters.Add(new ValueLookupParameter<IOperator>("Migrator", "The migration strategy."));
144      Parameters.Add(new ValueLookupParameter<IOperator>("EmigrantsSelector", "Selects the individuals that will be migrated."));
[3611]145      Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationReplacer", "Replaces part of the original population with the immigrants."));
[3429]146      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
[3611]147      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed."));
[3429]148      Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
149      Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions."));
150      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
151      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
152      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
153      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
154      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
155      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
156      Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
157      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
[3611]158      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]."));
[3429]159      Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
160      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
161      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."));
[3654]162      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the islands."));
163      Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
[3429]164      #endregion
165
166      #region Create operators
167      VariableCreator variableCreator = new VariableCreator();
[3611]168      UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
[3429]169      VariableCreator islandVariableCreator = new VariableCreator();
[3654]170      Placeholder islandAnalyzer1 = new Placeholder();
171      ResultsCollector islandResultsCollector1 = new ResultsCollector();
[3698]172      Placeholder comparisonFactorModifier1 = new Placeholder();
[3654]173      Placeholder analyzer1 = new Placeholder();
174      ResultsCollector resultsCollector1 = new ResultsCollector();
175      ResultsCollector resultsCollector2 = new ResultsCollector();
[3611]176      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
177      ConditionalBranch islandTerminatedBySelectionPressure1 = new ConditionalBranch();
178      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
[3654]179      Placeholder islandAnalyzer2 = new Placeholder();
180      ResultsCollector islandResultsCollector2 = new ResultsCollector();
[3611]181      IntCounter islandEvaluatedSolutionsCounter = new IntCounter();
[3615]182      Assigner islandEvaluatedSolutionsAssigner = new Assigner();
[3611]183      Comparator islandSelectionPressureComparator = new Comparator();
184      ConditionalBranch islandTerminatedBySelectionPressure2 = new ConditionalBranch();
185      IntCounter terminatedIslandsCounter = new IntCounter();
186      IntCounter generationsCounter = new IntCounter();
187      IntCounter generationsSinceLastMigrationCounter = new IntCounter();
188      Comparator migrationComparator = new Comparator();
189      ConditionalBranch migrationBranch = new ConditionalBranch();
190      Assigner resetTerminatedIslandsAssigner = new Assigner();
191      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
192      IntCounter migrationsCounter = new IntCounter();
193      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
194      Assigner reviveIslandAssigner = new Assigner();
[3429]195      Placeholder emigrantsSelector = new Placeholder();
196      Placeholder migrator = new Placeholder();
[3611]197      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
198      Placeholder immigrationReplacer = new Placeholder();
199      Comparator generationsComparator = new Comparator();
200      Comparator terminatedIslandsComparator = new Comparator();
[3698]201      Placeholder comparisonFactorModifier2 = new Placeholder();
[3654]202      Placeholder analyzer2 = new Placeholder();
203      ResultsCollector resultsCollector3 = new ResultsCollector();
[3611]204      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
205      ConditionalBranch terminatedIslandsCondition = new ConditionalBranch();
[3429]206
207      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
[3611]208      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
209      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
210      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedIslands", new IntValue(0)));
211      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
212
[3654]213      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
[3611]214      islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandEvaluatedSolutions", new IntValue(0)));
215      islandVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
216      islandVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
[3429]217
[3654]218      islandAnalyzer1.Name = "Island Analyzer (placeholder)";
219      islandAnalyzer1.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
[3429]220
[3654]221      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", null, "SelectionPressure"));
222      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", null, "CurrentSuccessRatio"));
223      islandResultsCollector1.ResultsParameter.ActualName = "Results";
[3611]224
[3698]225      comparisonFactorModifier1.Name = "Initialize Comparison Factor (Placeholder)";
226      comparisonFactorModifier1.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
227
[3654]228      analyzer1.Name = "Analyzer (placeholder)";
229      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
[3611]230
[3673]231      resultsCollector1.CopyValue = new BoolValue(false);
[3654]232      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
233      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
[3698]234      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Comparison Factor", null, "ComparisonFactor"));
[3659]235      resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("IslandResults", "Result set for each island", "Results"));
[3654]236      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
[3611]237
[3673]238      resultsCollector2.CopyValue = new BoolValue(true);
239      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
[3654]240      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
[3611]241
242      islandTerminatedBySelectionPressure1.Name = "Island Terminated ?";
243      islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";
[3429]244
[3611]245      mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
246      mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
247      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
248      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
249      mainOperator.EvaluatedSolutionsParameter.ActualName = "IslandEvaluatedSolutions";
250      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
251      mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name;
252      mainOperator.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
253      mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
254      mainOperator.MutatorParameter.ActualName = MutatorParameter.Name;
255      mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
256      mainOperator.QualityParameter.ActualName = QualityParameter.Name;
257      mainOperator.RandomParameter.ActualName = RandomParameter.Name;
258      mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure";
259      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
260      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
261
[3654]262      islandAnalyzer2.Name = "Island Analyzer (placeholder)";
263      islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
[3611]264
[3654]265      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", null, "SelectionPressure"));
266      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", null, "CurrentSuccessRatio"));
267      islandResultsCollector2.ResultsParameter.ActualName = "Results";
[3611]268
269      islandEvaluatedSolutionsCounter.Name = "Update EvaluatedSolutions";
270      islandEvaluatedSolutionsCounter.ValueParameter.ActualName = "EvaluatedSolutions";
271      islandEvaluatedSolutionsCounter.Increment = null;
272      islandEvaluatedSolutionsCounter.IncrementParameter.ActualName = "IslandEvaluatedSolutions";
273
[3615]274      islandEvaluatedSolutionsAssigner.Name = "Reset EvaluatedSolutions";
275      islandEvaluatedSolutionsAssigner.LeftSideParameter.ActualName = "IslandEvaluatedSolutions";
276      islandEvaluatedSolutionsAssigner.RightSideParameter.Value = new IntValue(0);
277
[3611]278      islandSelectionPressureComparator.Name = "SelectionPressure >= MaximumSelectionPressure ?";
279      islandSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
280      islandSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
281      islandSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
282      islandSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";
283
284      islandTerminatedBySelectionPressure2.Name = "Island Terminated ?";
285      islandTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";
286
287      terminatedIslandsCounter.Name = "TerminatedIslands + 1";
288      terminatedIslandsCounter.ValueParameter.ActualName = "TerminatedIslands";
289      terminatedIslandsCounter.Increment = new IntValue(1);
290
291      generationsCounter.Name = "Generations + 1";
292      generationsCounter.ValueParameter.ActualName = "Generations";
293      generationsCounter.Increment = new IntValue(1);
294
295      generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1";
296      generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration";
297      generationsSinceLastMigrationCounter.Increment = new IntValue(1);
298
299      migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?";
300      migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
301      migrationComparator.Comparison = new Comparison(ComparisonType.Equal);
302      migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
303      migrationComparator.ResultParameter.ActualName = "Migrate";
304
305      migrationBranch.Name = "Migrate?";
306      migrationBranch.ConditionParameter.ActualName = "Migrate";
307
308      resetTerminatedIslandsAssigner.Name = "Reset TerminatedIslands";
309      resetTerminatedIslandsAssigner.LeftSideParameter.ActualName = "TerminatedIslands";
310      resetTerminatedIslandsAssigner.RightSideParameter.Value = new IntValue(0);
311
312      resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration";
313      resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
314      resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0);
315
316      migrationsCounter.Name = "Migrations + 1";
317      migrationsCounter.IncrementParameter.Value = new IntValue(1);
318      migrationsCounter.ValueParameter.ActualName = "Migrations";
319
320      reviveIslandAssigner.Name = "Revive Island";
321      reviveIslandAssigner.LeftSideParameter.ActualName = "TerminateSelectionPressure";
322      reviveIslandAssigner.RightSideParameter.Value = new BoolValue(false);
323
[3429]324      emigrantsSelector.Name = "Emigrants Selector (placeholder)";
325      emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
326
327      migrator.Name = "Migrator (placeholder)";
328      migrator.OperatorParameter.ActualName = MigratorParameter.Name;
329
[3611]330      immigrationReplacer.Name = "Immigration Replacer (placeholder)";
331      immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;
[3429]332
[3611]333      generationsComparator.Name = "Generations >= MaximumGenerations ?";
334      generationsComparator.LeftSideParameter.ActualName = "Generations";
335      generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
336      generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
337      generationsComparator.ResultParameter.ActualName = "TerminateGenerations";
[3429]338
[3611]339      terminatedIslandsComparator.Name = "All Islands terminated ?";
340      terminatedIslandsComparator.LeftSideParameter.ActualName = "TerminatedIslands";
341      terminatedIslandsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
342      terminatedIslandsComparator.RightSideParameter.ActualName = NumberOfIslandsParameter.Name;
343      terminatedIslandsComparator.ResultParameter.ActualName = "TerminateTerminatedIslands";
[3429]344
[3698]345      comparisonFactorModifier2.Name = "Update Comparison Factor (Placeholder)";
346      comparisonFactorModifier2.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
347
[3654]348      analyzer2.Name = "Analyzer (placeholder)";
349      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
[3429]350
[3673]351      resultsCollector3.CopyValue = new BoolValue(true);
[3654]352      resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
353      resultsCollector3.ResultsParameter.ActualName = ResultsParameter.Name;
[3429]354
[3611]355      generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?";
356      generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";
357
358      terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
359      terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";
[3429]360      #endregion
361
362      #region Create operator graph
363      OperatorGraph.InitialOperator = variableCreator;
[3611]364      variableCreator.Successor = uniformSubScopesProcessor0;
365      uniformSubScopesProcessor0.Operator = islandVariableCreator;
[3698]366      uniformSubScopesProcessor0.Successor = comparisonFactorModifier1;
[3654]367      islandVariableCreator.Successor = islandAnalyzer1;
368      islandAnalyzer1.Successor = islandResultsCollector1;
369      islandResultsCollector1.Successor = null;
[3698]370      comparisonFactorModifier1.Successor = analyzer1;
[3654]371      analyzer1.Successor = resultsCollector1;
372      resultsCollector1.Successor = resultsCollector2;
[3698]373      resultsCollector2.Successor = uniformSubScopesProcessor1;
[3611]374      uniformSubScopesProcessor1.Operator = islandTerminatedBySelectionPressure1;
375      uniformSubScopesProcessor1.Successor = generationsCounter;
376      islandTerminatedBySelectionPressure1.TrueBranch = null;
377      islandTerminatedBySelectionPressure1.FalseBranch = mainOperator;
378      islandTerminatedBySelectionPressure1.Successor = null;
[3654]379      mainOperator.Successor = islandAnalyzer2;
380      islandAnalyzer2.Successor = islandResultsCollector2;
381      islandResultsCollector2.Successor = islandEvaluatedSolutionsCounter;
[3615]382      islandEvaluatedSolutionsCounter.Successor = islandEvaluatedSolutionsAssigner;
383      islandEvaluatedSolutionsAssigner.Successor = islandSelectionPressureComparator;
[3611]384      islandSelectionPressureComparator.Successor = islandTerminatedBySelectionPressure2;
385      islandTerminatedBySelectionPressure2.TrueBranch = terminatedIslandsCounter;
386      islandTerminatedBySelectionPressure2.FalseBranch = null;
387      islandTerminatedBySelectionPressure2.Successor = null;
388      generationsCounter.Successor = generationsSinceLastMigrationCounter;
389      generationsSinceLastMigrationCounter.Successor = migrationComparator;
390      migrationComparator.Successor = migrationBranch;
391      migrationBranch.TrueBranch = resetTerminatedIslandsAssigner;
392      migrationBranch.FalseBranch = null;
393      migrationBranch.Successor = generationsComparator;
394      resetTerminatedIslandsAssigner.Successor = resetGenerationsSinceLastMigrationAssigner;
395      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
396      migrationsCounter.Successor = uniformSubScopesProcessor2;
397      uniformSubScopesProcessor2.Operator = reviveIslandAssigner;
398      uniformSubScopesProcessor2.Successor = migrator;
399      reviveIslandAssigner.Successor = emigrantsSelector;
[3429]400      emigrantsSelector.Successor = null;
[3611]401      migrator.Successor = uniformSubScopesProcessor3;
402      uniformSubScopesProcessor3.Operator = immigrationReplacer;
403      uniformSubScopesProcessor3.Successor = null;
404      immigrationReplacer.Successor = null;
405      generationsComparator.Successor = terminatedIslandsComparator;
[3698]406      terminatedIslandsComparator.Successor = comparisonFactorModifier2;
407      comparisonFactorModifier2.Successor = analyzer2;
[3654]408      analyzer2.Successor = resultsCollector3;
409      resultsCollector3.Successor = generationsTerminationCondition;
[3611]410      generationsTerminationCondition.TrueBranch = null;
411      generationsTerminationCondition.FalseBranch = terminatedIslandsCondition;
412      generationsTerminationCondition.Successor = null;
413      terminatedIslandsCondition.TrueBranch = null;
[3698]414      terminatedIslandsCondition.FalseBranch = uniformSubScopesProcessor1;
[3611]415      terminatedIslandsCondition.Successor = null;
[3429]416      #endregion
417    }
[3715]418
419    public override IOperation Apply() {
420      if (CrossoverParameter.ActualValue == null)
421        return null;
422      return base.Apply();
423    }
[3429]424  }
425}
Note: See TracBrowser for help on using the repository browser.