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

Last change on this file since 3654 was 3654, checked in by abeham, 12 years ago

#999

  • updated Island OSGA to soon to be changed analyzers
File size: 27.1 KB
Line 
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>
39  /// An island offspring selection genetic algorithm main loop operator.
40  /// </summary>
41  [Item("IslandOffspringSelectionGeneticAlgorithmMainLoop", "An island offspring selection genetic algorithm main loop operator.")]
42  [StorableClass]
43  public sealed class IslandOffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
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    }
51    public SubScopesLookupParameter<DoubleValue> QualityParameter {
52      get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; }
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    }
72    public ValueLookupParameter<IOperator> ImmigrationReplacerParameter {
73      get { return (ValueLookupParameter<IOperator>)Parameters["ImmigrationReplacer"]; }
74    }
75    public ValueLookupParameter<IntValue> PopulationSizeParameter {
76      get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
77    }
78    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
79      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
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    }
111    public LookupParameter<DoubleValue> ComparisonFactorParameter {
112      get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; }
113    }
114    public ValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter {
115      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorLowerBound"]; }
116    }
117    public ValueLookupParameter<DoubleValue> ComparisonFactorUpperBoundParameter {
118      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorUpperBound"]; }
119    }
120    public ValueLookupParameter<IOperator> ComparisonFactorModifierParameter {
121      get { return (ValueLookupParameter<IOperator>)Parameters["ComparisonFactorModifier"]; }
122    }
123    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
124      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
125    }
126    public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
127      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
128    }
129    public ValueLookupParameter<IOperator> AnalyzerParameter {
130      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
131    }
132    public ValueLookupParameter<IOperator> IslandAnalyzerParameter {
133      get { return (ValueLookupParameter<IOperator>)Parameters["IslandAnalyzer"]; }
134    }
135    #endregion
136
137    [StorableConstructor]
138    private IslandOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base() { }
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 SubScopesLookupParameter<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."));
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>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start)."));
166      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end)."));
167      Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
168      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
169      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."));
170      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the islands."));
171      Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
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      Placeholder analyzer1 = new Placeholder();
181      ResultsCollector resultsCollector1 = new ResultsCollector();
182      ResultsCollector resultsCollector2 = new ResultsCollector();
183      Placeholder comparisonFactorModifier = new Placeholder();
184      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
185      ConditionalBranch islandTerminatedBySelectionPressure1 = new ConditionalBranch();
186      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
187      Placeholder islandAnalyzer2 = new Placeholder();
188      ResultsCollector islandResultsCollector2 = new ResultsCollector();
189      IntCounter islandEvaluatedSolutionsCounter = new IntCounter();
190      Assigner islandEvaluatedSolutionsAssigner = new Assigner();
191      Comparator islandSelectionPressureComparator = new Comparator();
192      ConditionalBranch islandTerminatedBySelectionPressure2 = new ConditionalBranch();
193      IntCounter terminatedIslandsCounter = new IntCounter();
194      IntCounter generationsCounter = new IntCounter();
195      IntCounter generationsSinceLastMigrationCounter = new IntCounter();
196      Comparator migrationComparator = new Comparator();
197      ConditionalBranch migrationBranch = new ConditionalBranch();
198      Assigner resetTerminatedIslandsAssigner = new Assigner();
199      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
200      IntCounter migrationsCounter = new IntCounter();
201      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
202      Assigner reviveIslandAssigner = new Assigner();
203      Placeholder emigrantsSelector = new Placeholder();
204      Placeholder migrator = new Placeholder();
205      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
206      Placeholder immigrationReplacer = new Placeholder();
207      Comparator generationsComparator = new Comparator();
208      Comparator terminatedIslandsComparator = new Comparator();
209      Placeholder analyzer2 = new Placeholder();
210      ResultsCollector resultsCollector3 = new ResultsCollector();
211      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
212      ConditionalBranch terminatedIslandsCondition = new ConditionalBranch();
213
214      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
215      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
216      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
217      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedIslands", new IntValue(0)));
218      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
219
220      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
221      islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandEvaluatedSolutions", new IntValue(0)));
222      islandVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
223      islandVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
224
225      islandAnalyzer1.Name = "Island Analyzer (placeholder)";
226      islandAnalyzer1.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
227
228      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", null, "SelectionPressure"));
229      islandResultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", null, "CurrentSuccessRatio"));
230      islandResultsCollector1.ResultsParameter.ActualName = "Results";
231
232      analyzer1.Name = "Analyzer (placeholder)";
233      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
234
235      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
236      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
237      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
238      resultsCollector1.CollectedValues.Add(new SubScopesLookupParameter<ResultCollection>("IslandResults", "Result set for each island", "Results"));
239      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
240
241      resultsCollector2.Name = "Reference Island Results";
242      resultsCollector2.CopyValue = new BoolValue(false);
243      resultsCollector2.CollectedValues.Add(new SubScopesLookupParameter<ResultCollection>("IslandResults", "Result set for each island", "Results"));
244      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
245
246      comparisonFactorModifier.Name = "ComparisonFactorModifier (Placeholder)";
247      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
248
249      islandTerminatedBySelectionPressure1.Name = "Island Terminated ?";
250      islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";
251
252      mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
253      mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
254      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
255      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
256      mainOperator.EvaluatedSolutionsParameter.ActualName = "IslandEvaluatedSolutions";
257      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
258      mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name;
259      mainOperator.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
260      mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
261      mainOperator.MutatorParameter.ActualName = MutatorParameter.Name;
262      mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
263      mainOperator.QualityParameter.ActualName = QualityParameter.Name;
264      mainOperator.RandomParameter.ActualName = RandomParameter.Name;
265      mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure";
266      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
267      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
268
269      islandAnalyzer2.Name = "Island Analyzer (placeholder)";
270      islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
271
272      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", null, "SelectionPressure"));
273      islandResultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", null, "CurrentSuccessRatio"));
274      islandResultsCollector2.ResultsParameter.ActualName = "Results";
275
276      islandEvaluatedSolutionsCounter.Name = "Update EvaluatedSolutions";
277      islandEvaluatedSolutionsCounter.ValueParameter.ActualName = "EvaluatedSolutions";
278      islandEvaluatedSolutionsCounter.Increment = null;
279      islandEvaluatedSolutionsCounter.IncrementParameter.ActualName = "IslandEvaluatedSolutions";
280
281      islandEvaluatedSolutionsAssigner.Name = "Reset EvaluatedSolutions";
282      islandEvaluatedSolutionsAssigner.LeftSideParameter.ActualName = "IslandEvaluatedSolutions";
283      islandEvaluatedSolutionsAssigner.RightSideParameter.Value = new IntValue(0);
284
285      islandSelectionPressureComparator.Name = "SelectionPressure >= MaximumSelectionPressure ?";
286      islandSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
287      islandSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
288      islandSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
289      islandSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";
290
291      islandTerminatedBySelectionPressure2.Name = "Island Terminated ?";
292      islandTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure";
293
294      terminatedIslandsCounter.Name = "TerminatedIslands + 1";
295      terminatedIslandsCounter.ValueParameter.ActualName = "TerminatedIslands";
296      terminatedIslandsCounter.Increment = new IntValue(1);
297
298      generationsCounter.Name = "Generations + 1";
299      generationsCounter.ValueParameter.ActualName = "Generations";
300      generationsCounter.Increment = new IntValue(1);
301
302      generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1";
303      generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration";
304      generationsSinceLastMigrationCounter.Increment = new IntValue(1);
305
306      migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?";
307      migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
308      migrationComparator.Comparison = new Comparison(ComparisonType.Equal);
309      migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
310      migrationComparator.ResultParameter.ActualName = "Migrate";
311
312      migrationBranch.Name = "Migrate?";
313      migrationBranch.ConditionParameter.ActualName = "Migrate";
314
315      resetTerminatedIslandsAssigner.Name = "Reset TerminatedIslands";
316      resetTerminatedIslandsAssigner.LeftSideParameter.ActualName = "TerminatedIslands";
317      resetTerminatedIslandsAssigner.RightSideParameter.Value = new IntValue(0);
318
319      resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration";
320      resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
321      resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0);
322
323      migrationsCounter.Name = "Migrations + 1";
324      migrationsCounter.IncrementParameter.Value = new IntValue(1);
325      migrationsCounter.ValueParameter.ActualName = "Migrations";
326
327      reviveIslandAssigner.Name = "Revive Island";
328      reviveIslandAssigner.LeftSideParameter.ActualName = "TerminateSelectionPressure";
329      reviveIslandAssigner.RightSideParameter.Value = new BoolValue(false);
330
331      emigrantsSelector.Name = "Emigrants Selector (placeholder)";
332      emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
333
334      migrator.Name = "Migrator (placeholder)";
335      migrator.OperatorParameter.ActualName = MigratorParameter.Name;
336
337      immigrationReplacer.Name = "Immigration Replacer (placeholder)";
338      immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;
339
340      generationsComparator.Name = "Generations >= MaximumGenerations ?";
341      generationsComparator.LeftSideParameter.ActualName = "Generations";
342      generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
343      generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
344      generationsComparator.ResultParameter.ActualName = "TerminateGenerations";
345
346      terminatedIslandsComparator.Name = "All Islands terminated ?";
347      terminatedIslandsComparator.LeftSideParameter.ActualName = "TerminatedIslands";
348      terminatedIslandsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
349      terminatedIslandsComparator.RightSideParameter.ActualName = NumberOfIslandsParameter.Name;
350      terminatedIslandsComparator.ResultParameter.ActualName = "TerminateTerminatedIslands";
351
352      analyzer2.Name = "Analyzer (placeholder)";
353      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
354
355      resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
356      resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
357      resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
358      resultsCollector3.ResultsParameter.ActualName = ResultsParameter.Name;
359
360      generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?";
361      generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";
362
363      terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
364      terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";
365      #endregion
366
367      #region Create operator graph
368      OperatorGraph.InitialOperator = variableCreator;
369      variableCreator.Successor = uniformSubScopesProcessor0;
370      uniformSubScopesProcessor0.Operator = islandVariableCreator;
371      uniformSubScopesProcessor0.Successor = analyzer1;
372      islandVariableCreator.Successor = islandAnalyzer1;
373      islandAnalyzer1.Successor = islandResultsCollector1;
374      islandResultsCollector1.Successor = null;
375      analyzer1.Successor = resultsCollector1;
376      resultsCollector1.Successor = resultsCollector2;
377      resultsCollector2.Successor = comparisonFactorModifier;
378      comparisonFactorModifier.Successor = uniformSubScopesProcessor1;
379      uniformSubScopesProcessor1.Operator = islandTerminatedBySelectionPressure1;
380      uniformSubScopesProcessor1.Successor = generationsCounter;
381      islandTerminatedBySelectionPressure1.TrueBranch = null;
382      islandTerminatedBySelectionPressure1.FalseBranch = mainOperator;
383      islandTerminatedBySelectionPressure1.Successor = null;
384      mainOperator.Successor = islandAnalyzer2;
385      islandAnalyzer2.Successor = islandResultsCollector2;
386      islandResultsCollector2.Successor = islandEvaluatedSolutionsCounter;
387      islandEvaluatedSolutionsCounter.Successor = islandEvaluatedSolutionsAssigner;
388      islandEvaluatedSolutionsAssigner.Successor = islandSelectionPressureComparator;
389      islandSelectionPressureComparator.Successor = islandTerminatedBySelectionPressure2;
390      islandTerminatedBySelectionPressure2.TrueBranch = terminatedIslandsCounter;
391      islandTerminatedBySelectionPressure2.FalseBranch = null;
392      islandTerminatedBySelectionPressure2.Successor = null;
393      generationsCounter.Successor = generationsSinceLastMigrationCounter;
394      generationsSinceLastMigrationCounter.Successor = migrationComparator;
395      migrationComparator.Successor = migrationBranch;
396      migrationBranch.TrueBranch = resetTerminatedIslandsAssigner;
397      migrationBranch.FalseBranch = null;
398      migrationBranch.Successor = generationsComparator;
399      resetTerminatedIslandsAssigner.Successor = resetGenerationsSinceLastMigrationAssigner;
400      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
401      migrationsCounter.Successor = uniformSubScopesProcessor2;
402      uniformSubScopesProcessor2.Operator = reviveIslandAssigner;
403      uniformSubScopesProcessor2.Successor = migrator;
404      reviveIslandAssigner.Successor = emigrantsSelector;
405      emigrantsSelector.Successor = null;
406      migrator.Successor = uniformSubScopesProcessor3;
407      uniformSubScopesProcessor3.Operator = immigrationReplacer;
408      uniformSubScopesProcessor3.Successor = null;
409      immigrationReplacer.Successor = null;
410      generationsComparator.Successor = terminatedIslandsComparator;
411      terminatedIslandsComparator.Successor = analyzer2;
412      analyzer2.Successor = resultsCollector3;
413      resultsCollector3.Successor = generationsTerminationCondition;
414      generationsTerminationCondition.TrueBranch = null;
415      generationsTerminationCondition.FalseBranch = terminatedIslandsCondition;
416      generationsTerminationCondition.Successor = null;
417      terminatedIslandsCondition.TrueBranch = null;
418      terminatedIslandsCondition.FalseBranch = comparisonFactorModifier;
419      terminatedIslandsCondition.Successor = null;
420      #endregion
421    }
422  }
423}
Note: See TracBrowser for help on using the repository browser.