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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using HeuristicLab.Analysis;
|
---|
26 | using HeuristicLab.Common;
|
---|
27 | using HeuristicLab.Core;
|
---|
28 | using HeuristicLab.Data;
|
---|
29 | using HeuristicLab.Operators;
|
---|
30 | using HeuristicLab.Optimization;
|
---|
31 | using HeuristicLab.Optimization.Operators;
|
---|
32 | using HeuristicLab.Parameters;
|
---|
33 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
34 | using HeuristicLab.PluginInfrastructure;
|
---|
35 | using HeuristicLab.Selection;
|
---|
36 |
|
---|
37 | namespace 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> ImmigrationSelectorParameter {
|
---|
73 | get { return (ValueLookupParameter<IOperator>)Parameters["ImmigrationSelector"]; }
|
---|
74 | }
|
---|
75 | public ValueLookupParameter<IntValue> PopulationSizeParameter {
|
---|
76 | get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
|
---|
77 | }
|
---|
78 | public ValueLookupParameter<IntValue> MaximumMigrationsParameter {
|
---|
79 | get { return (ValueLookupParameter<IntValue>)Parameters["MaximumMigrations"]; }
|
---|
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 ValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter {
|
---|
112 | get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorLowerBound"]; }
|
---|
113 | }
|
---|
114 | public ValueLookupParameter<DoubleValue> ComparisonFactorUpperBoundParameter {
|
---|
115 | get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorUpperBound"]; }
|
---|
116 | }
|
---|
117 | public ValueLookupParameter<IOperator> ComparisonFactorModifierParameter {
|
---|
118 | get { return (ValueLookupParameter<IOperator>)Parameters["ComparisonFactorModifier"]; }
|
---|
119 | }
|
---|
120 | public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
|
---|
121 | get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
|
---|
122 | }
|
---|
123 | public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
|
---|
124 | get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
|
---|
125 | }
|
---|
126 | #endregion
|
---|
127 |
|
---|
128 | [StorableConstructor]
|
---|
129 | private IslandOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base() { }
|
---|
130 | public IslandOffspringSelectionGeneticAlgorithmMainLoop()
|
---|
131 | : base() {
|
---|
132 | #region Create parameters
|
---|
133 | Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
|
---|
134 | Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
|
---|
135 | Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
|
---|
136 | Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
|
---|
137 | Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfIslands", "The number of islands."));
|
---|
138 | Parameters.Add(new ValueLookupParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases."));
|
---|
139 | Parameters.Add(new ValueLookupParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands."));
|
---|
140 | Parameters.Add(new ValueLookupParameter<IOperator>("Migrator", "The migration strategy."));
|
---|
141 | Parameters.Add(new ValueLookupParameter<IOperator>("EmigrantsSelector", "Selects the individuals that will be migrated."));
|
---|
142 | Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationSelector", "Selects the population from the unification of the original population and the immigrants."));
|
---|
143 | Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
|
---|
144 | Parameters.Add(new ValueLookupParameter<IntValue>("MaximumMigrations", "The maximum number of migrations after which the operator should terminate."));
|
---|
145 | Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
|
---|
146 | Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions."));
|
---|
147 | Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
|
---|
148 | Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
|
---|
149 | Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
|
---|
150 | Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
|
---|
151 | Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
|
---|
152 | Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
|
---|
153 | Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
|
---|
154 | Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved."));
|
---|
155 | Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start)."));
|
---|
156 | Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end)."));
|
---|
157 | Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
|
---|
158 | Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
|
---|
159 | 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."));
|
---|
160 | #endregion
|
---|
161 |
|
---|
162 | #region Create operators
|
---|
163 | VariableCreator variableCreator = new VariableCreator();
|
---|
164 | UniformSubScopesProcessor ussp0 = new UniformSubScopesProcessor();
|
---|
165 | VariableCreator islandVariableCreator = new VariableCreator();
|
---|
166 | Assigner islandVariableAssigner = new Assigner();
|
---|
167 | BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer();
|
---|
168 | BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator();
|
---|
169 | BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
|
---|
170 | BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();
|
---|
171 | DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector();
|
---|
172 | QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
|
---|
173 | ResultsCollector resultsCollector = new ResultsCollector();
|
---|
174 | UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor();
|
---|
175 | OffspringSelectionGeneticAlgorithmMainLoop mainLoop = new OffspringSelectionGeneticAlgorithmMainLoop();
|
---|
176 | Placeholder emigrantsSelector = new Placeholder();
|
---|
177 | Placeholder migrator = new Placeholder();
|
---|
178 | UniformSubScopesProcessor ussp2 = new UniformSubScopesProcessor();
|
---|
179 | IntCounter maximumGenerationsCounter = new IntCounter();
|
---|
180 | MergingReducer mergingReducer = new MergingReducer();
|
---|
181 | Placeholder immigrationSelector = new Placeholder();
|
---|
182 | RightReducer rightReducer = new RightReducer();
|
---|
183 | IntCounter migrationsCounter = new IntCounter();
|
---|
184 | Comparator maxMigrationsComparator = new Comparator();
|
---|
185 | BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
|
---|
186 | BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator3 = new BestAverageWorstQualityCalculator();
|
---|
187 | DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector();
|
---|
188 | QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
|
---|
189 | ConditionalBranch migrationTerminationCondition = new ConditionalBranch();
|
---|
190 |
|
---|
191 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
|
---|
192 |
|
---|
193 | islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection()));
|
---|
194 |
|
---|
195 | islandVariableAssigner.LeftSideParameter.ActualName = "MaximumGenerations";
|
---|
196 | islandVariableAssigner.RightSideParameter.ActualName = "MigrationInterval";
|
---|
197 |
|
---|
198 | bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
|
---|
199 | bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
200 | bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
|
---|
201 |
|
---|
202 | bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality";
|
---|
203 | bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality";
|
---|
204 | bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
205 | bestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name;
|
---|
206 | bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality";
|
---|
207 |
|
---|
208 | bestQualityMemorizer2.BestQualityParameter.ActualName = "BestQuality";
|
---|
209 | bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
210 | bestQualityMemorizer2.QualityParameter.ActualName = "BestQuality";
|
---|
211 |
|
---|
212 | bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
|
---|
213 | bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestBestQuality";
|
---|
214 | bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
215 | bestAverageWorstQualityCalculator2.QualityParameter.ActualName = "CurrentBestQuality";
|
---|
216 | bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
|
---|
217 |
|
---|
218 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality"));
|
---|
219 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality"));
|
---|
220 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality"));
|
---|
221 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
222 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
223 | dataTableValuesCollector1.DataTableParameter.ActualName = "BestQualities";
|
---|
224 |
|
---|
225 | qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
|
---|
226 | qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
227 | qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
|
---|
228 | qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
|
---|
229 |
|
---|
230 | resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
|
---|
231 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality"));
|
---|
232 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality"));
|
---|
233 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality"));
|
---|
234 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
235 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
236 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
|
---|
237 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
|
---|
238 | resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("BestQualities"));
|
---|
239 | resultsCollector.CollectedValues.Add(new SubScopesLookupParameter<ResultCollection>("IslandResults", "Result set for each island"));
|
---|
240 | resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
|
---|
241 |
|
---|
242 | mainLoop.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
243 | mainLoop.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
244 | mainLoop.QualityParameter.ActualName = QualityParameter.Name;
|
---|
245 | mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
|
---|
246 | mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
|
---|
247 | mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
|
---|
248 | mainLoop.MaximumGenerationsParameter.ActualName = "MaximumGenerations";
|
---|
249 | mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
|
---|
250 | mainLoop.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
|
---|
251 | mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
|
---|
252 | mainLoop.RandomParameter.ActualName = RandomParameter.Name;
|
---|
253 | mainLoop.ResultsParameter.ActualName = "IslandResults";
|
---|
254 | mainLoop.VisualizerParameter.ActualName = VisualizerParameter.Name;
|
---|
255 | mainLoop.VisualizationParameter.ActualName = VisualizationParameter.Name;
|
---|
256 | mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
|
---|
257 | mainLoop.ComparisonFactorLowerBoundParameter.ActualName = ComparisonFactorLowerBoundParameter.Name;
|
---|
258 | mainLoop.ComparisonFactorModifierParameter.ActualName = ComparisonFactorModifierParameter.Name;
|
---|
259 | mainLoop.ComparisonFactorUpperBoundParameter.ActualName = ComparisonFactorUpperBoundParameter.Name;
|
---|
260 | mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
|
---|
261 | mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
|
---|
262 |
|
---|
263 | maximumGenerationsCounter.ValueParameter.ActualName = "MaximumGenerations";
|
---|
264 | maximumGenerationsCounter.Increment = null;
|
---|
265 | maximumGenerationsCounter.IncrementParameter.ActualName = "MigrationInterval";
|
---|
266 |
|
---|
267 | emigrantsSelector.Name = "Emigrants Selector (placeholder)";
|
---|
268 | emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
|
---|
269 |
|
---|
270 | migrator.Name = "Migrator (placeholder)";
|
---|
271 | migrator.OperatorParameter.ActualName = MigratorParameter.Name;
|
---|
272 |
|
---|
273 | immigrationSelector.Name = "Immigration Selector (placeholder)";
|
---|
274 | immigrationSelector.OperatorParameter.ActualName = ImmigrationSelectorParameter.Name;
|
---|
275 |
|
---|
276 | migrationsCounter.Name = "Migrations + 1";
|
---|
277 | migrationsCounter.IncrementParameter.Value = new IntValue(1);
|
---|
278 | migrationsCounter.ValueParameter.ActualName = "Migrations";
|
---|
279 |
|
---|
280 | maxMigrationsComparator.Name = "Migrations >= MaximumMigration ?";
|
---|
281 | maxMigrationsComparator.LeftSideParameter.ActualName = "Migrations";
|
---|
282 | maxMigrationsComparator.RightSideParameter.ActualName = MaximumMigrationsParameter.Name;
|
---|
283 | maxMigrationsComparator.Comparison.Value = ComparisonType.GreaterOrEqual;
|
---|
284 | maxMigrationsComparator.ResultParameter.ActualName = "MigrationTerminate";
|
---|
285 |
|
---|
286 | bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality";
|
---|
287 | bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
288 | bestQualityMemorizer3.QualityParameter.ActualName = "BestQuality";
|
---|
289 |
|
---|
290 | bestAverageWorstQualityCalculator3.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
|
---|
291 | bestAverageWorstQualityCalculator3.BestQualityParameter.ActualName = "CurrentBestBestQuality";
|
---|
292 | bestAverageWorstQualityCalculator3.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
293 | bestAverageWorstQualityCalculator3.QualityParameter.ActualName = "CurrentBestQuality";
|
---|
294 | bestAverageWorstQualityCalculator3.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
|
---|
295 |
|
---|
296 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality"));
|
---|
297 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality"));
|
---|
298 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality"));
|
---|
299 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
300 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
301 | dataTableValuesCollector2.DataTableParameter.ActualName = "BestQualities";
|
---|
302 |
|
---|
303 | qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
|
---|
304 | qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
305 | qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
|
---|
306 | qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
|
---|
307 |
|
---|
308 | migrationTerminationCondition.ConditionParameter.ActualName = "MigrationTerminate";
|
---|
309 | #endregion
|
---|
310 |
|
---|
311 | #region Create operator graph
|
---|
312 | OperatorGraph.InitialOperator = variableCreator;
|
---|
313 | variableCreator.Successor = ussp0;
|
---|
314 | ussp0.Operator = islandVariableCreator;
|
---|
315 | ussp0.Successor = bestQualityMemorizer2;
|
---|
316 | islandVariableCreator.Successor = islandVariableAssigner;
|
---|
317 | islandVariableAssigner.Successor = bestQualityMemorizer1;
|
---|
318 | bestQualityMemorizer1.Successor = bestAverageWorstQualityCalculator1;
|
---|
319 | bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator2;
|
---|
320 | bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector1;
|
---|
321 | dataTableValuesCollector1.Successor = qualityDifferenceCalculator1;
|
---|
322 | qualityDifferenceCalculator1.Successor = resultsCollector;
|
---|
323 | resultsCollector.Successor = ussp1;
|
---|
324 | ussp1.Operator = mainLoop;
|
---|
325 | ussp1.Successor = migrator;
|
---|
326 | mainLoop.Successor = maximumGenerationsCounter;
|
---|
327 | maximumGenerationsCounter.Successor = emigrantsSelector;
|
---|
328 | emigrantsSelector.Successor = null;
|
---|
329 | migrator.Successor = ussp2;
|
---|
330 | ussp2.Operator = mergingReducer;
|
---|
331 | ussp2.Successor = migrationsCounter;
|
---|
332 | mergingReducer.Successor = immigrationSelector;
|
---|
333 | immigrationSelector.Successor = rightReducer;
|
---|
334 | rightReducer.Successor = null;
|
---|
335 | migrationsCounter.Successor = maxMigrationsComparator;
|
---|
336 | maxMigrationsComparator.Successor = bestQualityMemorizer3;
|
---|
337 | bestQualityMemorizer3.Successor = bestAverageWorstQualityCalculator3;
|
---|
338 | bestAverageWorstQualityCalculator3.Successor = dataTableValuesCollector2;
|
---|
339 | dataTableValuesCollector2.Successor = qualityDifferenceCalculator2;
|
---|
340 | qualityDifferenceCalculator2.Successor = migrationTerminationCondition;
|
---|
341 | migrationTerminationCondition.FalseBranch = ussp1;
|
---|
342 | migrationTerminationCondition.TrueBranch = null;
|
---|
343 | migrationTerminationCondition.Successor = null;
|
---|
344 | #endregion
|
---|
345 | }
|
---|
346 | }
|
---|
347 | }
|
---|