[3429] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[5445] | 3 | * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[3429] | 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 |
|
---|
[4722] | 22 | using HeuristicLab.Common;
|
---|
[3429] | 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Data;
|
---|
| 25 | using HeuristicLab.Operators;
|
---|
| 26 | using HeuristicLab.Optimization;
|
---|
| 27 | using HeuristicLab.Optimization.Operators;
|
---|
| 28 | using HeuristicLab.Parameters;
|
---|
| 29 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 30 |
|
---|
| 31 | namespace HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm {
|
---|
| 32 | /// <summary>
|
---|
[3479] | 33 | /// An island offspring selection genetic algorithm main loop operator.
|
---|
[3429] | 34 | /// </summary>
|
---|
[3479] | 35 | [Item("IslandOffspringSelectionGeneticAlgorithmMainLoop", "An island offspring selection genetic algorithm main loop operator.")]
|
---|
[3429] | 36 | [StorableClass]
|
---|
[3479] | 37 | public sealed class IslandOffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
|
---|
[3429] | 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 | }
|
---|
[3659] | 45 | public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
|
---|
| 46 | get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
|
---|
[3429] | 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 | }
|
---|
[3611] | 66 | public ValueLookupParameter<IOperator> ImmigrationReplacerParameter {
|
---|
| 67 | get { return (ValueLookupParameter<IOperator>)Parameters["ImmigrationReplacer"]; }
|
---|
[3429] | 68 | }
|
---|
| 69 | public ValueLookupParameter<IntValue> PopulationSizeParameter {
|
---|
| 70 | get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
|
---|
| 71 | }
|
---|
[3611] | 72 | public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
|
---|
| 73 | get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
|
---|
[3429] | 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 | }
|
---|
[3611] | 105 | public LookupParameter<DoubleValue> ComparisonFactorParameter {
|
---|
| 106 | get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; }
|
---|
| 107 | }
|
---|
[3744] | 108 | public ValueLookupParameter<DoubleValue> ComparisonFactorStartParameter {
|
---|
| 109 | get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorStart"]; }
|
---|
| 110 | }
|
---|
[3429] | 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 | }
|
---|
[3654] | 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 | }
|
---|
[5356] | 126 | public LookupParameter<IntValue> EvaluatedSolutionsParameter {
|
---|
| 127 | get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
|
---|
| 128 | }
|
---|
[3429] | 129 | #endregion
|
---|
| 130 |
|
---|
| 131 | [StorableConstructor]
|
---|
[4722] | 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 | }
|
---|
[3479] | 139 | public IslandOffspringSelectionGeneticAlgorithmMainLoop()
|
---|
[3429] | 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."));
|
---|
[3659] | 144 | Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
|
---|
[3429] | 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."));
|
---|
[3611] | 151 | Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationReplacer", "Replaces part of the original population with the immigrants."));
|
---|
[3429] | 152 | Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
|
---|
[3611] | 153 | Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed."));
|
---|
[3429] | 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."));
|
---|
[5208] | 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."));
|
---|
[3429] | 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."));
|
---|
[3611] | 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]."));
|
---|
[3744] | 165 | Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorStart", "The initial value for the comparison factor."));
|
---|
[3429] | 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."));
|
---|
[3654] | 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."));
|
---|
[5356] | 171 | Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
|
---|
[3429] | 172 | #endregion
|
---|
| 173 |
|
---|
| 174 | #region Create operators
|
---|
| 175 | VariableCreator variableCreator = new VariableCreator();
|
---|
[3611] | 176 | UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
|
---|
[3429] | 177 | VariableCreator islandVariableCreator = new VariableCreator();
|
---|
[3654] | 178 | Placeholder islandAnalyzer1 = new Placeholder();
|
---|
| 179 | ResultsCollector islandResultsCollector1 = new ResultsCollector();
|
---|
[3744] | 180 | Assigner comparisonFactorInitializer = new Assigner();
|
---|
[3654] | 181 | Placeholder analyzer1 = new Placeholder();
|
---|
| 182 | ResultsCollector resultsCollector1 = new ResultsCollector();
|
---|
[3611] | 183 | UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
|
---|
| 184 | ConditionalBranch islandTerminatedBySelectionPressure1 = new ConditionalBranch();
|
---|
| 185 | OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
|
---|
[3654] | 186 | Placeholder islandAnalyzer2 = new Placeholder();
|
---|
| 187 | ResultsCollector islandResultsCollector2 = new ResultsCollector();
|
---|
[3611] | 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();
|
---|
[3429] | 200 | Placeholder emigrantsSelector = new Placeholder();
|
---|
| 201 | Placeholder migrator = new Placeholder();
|
---|
[3611] | 202 | UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
|
---|
| 203 | Placeholder immigrationReplacer = new Placeholder();
|
---|
| 204 | Comparator generationsComparator = new Comparator();
|
---|
| 205 | Comparator terminatedIslandsComparator = new Comparator();
|
---|
[3891] | 206 | Comparator maxEvaluatedSolutionsComparator = new Comparator();
|
---|
[3744] | 207 | Placeholder comparisonFactorModifier = new Placeholder();
|
---|
[3654] | 208 | Placeholder analyzer2 = new Placeholder();
|
---|
[3611] | 209 | ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
|
---|
| 210 | ConditionalBranch terminatedIslandsCondition = new ConditionalBranch();
|
---|
[3891] | 211 | ConditionalBranch evaluatedSolutionsTerminationCondition = new ConditionalBranch();
|
---|
[3429] | 212 |
|
---|
| 213 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
|
---|
[3750] | 214 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class IslandOffspringSelectionGeneticAlgorithm expects this to be called Generations
|
---|
[3611] | 215 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
|
---|
| 216 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedIslands", new IntValue(0)));
|
---|
| 217 |
|
---|
[3744] | 218 | islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>(ResultsParameter.Name, new ResultCollection()));
|
---|
[3611] | 219 | islandVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false)));
|
---|
| 220 | islandVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
|
---|
[3429] | 221 |
|
---|
[3654] | 222 | islandAnalyzer1.Name = "Island Analyzer (placeholder)";
|
---|
| 223 | islandAnalyzer1.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
|
---|
[3429] | 224 |
|
---|
[6630] | 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"));
|
---|
[3744] | 227 | islandResultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
|
---|
[3611] | 228 |
|
---|
[3744] | 229 | comparisonFactorInitializer.Name = "Initialize Comparison Factor";
|
---|
| 230 | comparisonFactorInitializer.LeftSideParameter.ActualName = ComparisonFactorParameter.Name;
|
---|
| 231 | comparisonFactorInitializer.RightSideParameter.ActualName = ComparisonFactorStartParameter.Name;
|
---|
[3698] | 232 |
|
---|
[3654] | 233 | analyzer1.Name = "Analyzer (placeholder)";
|
---|
| 234 | analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
|
---|
[3611] | 235 |
|
---|
[3673] | 236 | resultsCollector1.CopyValue = new BoolValue(false);
|
---|
[3654] | 237 | resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
|
---|
| 238 | resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
|
---|
[3744] | 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));
|
---|
[3654] | 241 | resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
|
---|
[3611] | 242 |
|
---|
| 243 | islandTerminatedBySelectionPressure1.Name = "Island Terminated ?";
|
---|
| 244 | islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure";
|
---|
[3429] | 245 |
|
---|
[3611] | 246 | mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name;
|
---|
| 247 | mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
|
---|
| 248 | mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
|
---|
| 249 | mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
|
---|
[5356] | 250 | mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
|
---|
[3611] | 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 |
|
---|
[3654] | 263 | islandAnalyzer2.Name = "Island Analyzer (placeholder)";
|
---|
| 264 | islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name;
|
---|
[3611] | 265 |
|
---|
[6630] | 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"));
|
---|
[3654] | 268 | islandResultsCollector2.ResultsParameter.ActualName = "Results";
|
---|
[3611] | 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 |
|
---|
[3429] | 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 |
|
---|
[3611] | 322 | immigrationReplacer.Name = "Immigration Replacer (placeholder)";
|
---|
| 323 | immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;
|
---|
[3429] | 324 |
|
---|
[3611] | 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";
|
---|
[3429] | 330 |
|
---|
[3611] | 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";
|
---|
[3429] | 336 |
|
---|
[3891] | 337 | maxEvaluatedSolutionsComparator.Name = "EvaluatedSolutions >= MaximumEvaluatedSolutions ?";
|
---|
| 338 | maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
|
---|
[5356] | 339 | maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
|
---|
[3891] | 340 | maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
|
---|
| 341 | maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
|
---|
| 342 |
|
---|
[3744] | 343 | comparisonFactorModifier.Name = "Update Comparison Factor (Placeholder)";
|
---|
| 344 | comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
|
---|
[3698] | 345 |
|
---|
[3654] | 346 | analyzer2.Name = "Analyzer (placeholder)";
|
---|
| 347 | analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
|
---|
[3429] | 348 |
|
---|
[3611] | 349 | generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?";
|
---|
| 350 | generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";
|
---|
| 351 |
|
---|
| 352 | terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
|
---|
| 353 | terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";
|
---|
[3891] | 354 |
|
---|
| 355 | evaluatedSolutionsTerminationCondition.Name = "Terminate (EvaluatedSolutions) ?";
|
---|
| 356 | evaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
|
---|
[3429] | 357 | #endregion
|
---|
| 358 |
|
---|
| 359 | #region Create operator graph
|
---|
| 360 | OperatorGraph.InitialOperator = variableCreator;
|
---|
[3611] | 361 | variableCreator.Successor = uniformSubScopesProcessor0;
|
---|
| 362 | uniformSubScopesProcessor0.Operator = islandVariableCreator;
|
---|
[3744] | 363 | uniformSubScopesProcessor0.Successor = comparisonFactorInitializer;
|
---|
[3654] | 364 | islandVariableCreator.Successor = islandAnalyzer1;
|
---|
| 365 | islandAnalyzer1.Successor = islandResultsCollector1;
|
---|
| 366 | islandResultsCollector1.Successor = null;
|
---|
[3744] | 367 | comparisonFactorInitializer.Successor = analyzer1;
|
---|
[3654] | 368 | analyzer1.Successor = resultsCollector1;
|
---|
[5356] | 369 | resultsCollector1.Successor = uniformSubScopesProcessor1;
|
---|
[3611] | 370 | uniformSubScopesProcessor1.Operator = islandTerminatedBySelectionPressure1;
|
---|
| 371 | uniformSubScopesProcessor1.Successor = generationsCounter;
|
---|
| 372 | islandTerminatedBySelectionPressure1.TrueBranch = null;
|
---|
| 373 | islandTerminatedBySelectionPressure1.FalseBranch = mainOperator;
|
---|
| 374 | islandTerminatedBySelectionPressure1.Successor = null;
|
---|
[3654] | 375 | mainOperator.Successor = islandAnalyzer2;
|
---|
| 376 | islandAnalyzer2.Successor = islandResultsCollector2;
|
---|
[5356] | 377 | islandResultsCollector2.Successor = islandSelectionPressureComparator;
|
---|
[3611] | 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;
|
---|
[3429] | 394 | emigrantsSelector.Successor = null;
|
---|
[3611] | 395 | migrator.Successor = uniformSubScopesProcessor3;
|
---|
| 396 | uniformSubScopesProcessor3.Operator = immigrationReplacer;
|
---|
| 397 | uniformSubScopesProcessor3.Successor = null;
|
---|
| 398 | immigrationReplacer.Successor = null;
|
---|
| 399 | generationsComparator.Successor = terminatedIslandsComparator;
|
---|
[3891] | 400 | terminatedIslandsComparator.Successor = maxEvaluatedSolutionsComparator;
|
---|
| 401 | maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
|
---|
[3744] | 402 | comparisonFactorModifier.Successor = analyzer2;
|
---|
[5356] | 403 | analyzer2.Successor = generationsTerminationCondition;
|
---|
[3611] | 404 | generationsTerminationCondition.TrueBranch = null;
|
---|
| 405 | generationsTerminationCondition.FalseBranch = terminatedIslandsCondition;
|
---|
| 406 | generationsTerminationCondition.Successor = null;
|
---|
| 407 | terminatedIslandsCondition.TrueBranch = null;
|
---|
[3891] | 408 | terminatedIslandsCondition.FalseBranch = evaluatedSolutionsTerminationCondition;
|
---|
[3611] | 409 | terminatedIslandsCondition.Successor = null;
|
---|
[3891] | 410 | evaluatedSolutionsTerminationCondition.TrueBranch = null;
|
---|
| 411 | evaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
|
---|
| 412 | evaluatedSolutionsTerminationCondition.Successor = null;
|
---|
[3429] | 413 | #endregion
|
---|
| 414 | }
|
---|
[3715] | 415 |
|
---|
| 416 | public override IOperation Apply() {
|
---|
| 417 | if (CrossoverParameter.ActualValue == null)
|
---|
| 418 | return null;
|
---|
| 419 | return base.Apply();
|
---|
| 420 | }
|
---|
[3429] | 421 | }
|
---|
| 422 | }
|
---|