Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1888_OaaS/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs @ 16654

Last change on this file since 16654 was 7259, checked in by swagner, 13 years ago

Updated year of copyrights to 2012 (#1716)

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