Changeset 3611
- Timestamp:
- 05/04/10 20:09:14 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r3609 r3611 171 171 QualityDifferenceCalculator islandQualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 172 172 Placeholder islandVisualizer2 = new Placeholder(); 173 // END GA mainloop173 IntCounter generationsCounter = new IntCounter(); 174 174 IntCounter generationsSinceLastMigrationCounter = new IntCounter(); 175 175 Comparator migrationComparator = new Comparator(); … … 182 182 UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor(); 183 183 Placeholder immigrationReplacer = new Placeholder(); 184 IntCounter generationsCounter = new IntCounter();185 184 Comparator generationsComparator = new Comparator(); 186 185 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); … … 272 271 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 273 272 274 // START GA mainloop275 273 selector.Name = "Selector (placeholder)"; 276 274 selector.OperatorParameter.ActualName = SelectorParameter.Name; … … 321 319 islandVisualizer2.Name = "Visualizer"; 322 320 islandVisualizer2.OperatorParameter.ActualName = "Visualizer"; 323 // END GA mainloop 324 321 322 generationsCounter.Name = "Generations + 1"; 323 generationsCounter.Increment = new IntValue(1); 324 generationsCounter.ValueParameter.ActualName = "Generations"; 325 326 generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1"; 325 327 generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration"; 326 328 generationsSinceLastMigrationCounter.Increment = new IntValue(1); 327 329 330 migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?"; 328 331 migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 329 332 migrationComparator.Comparison = new Comparison(ComparisonType.Equal); … … 331 334 migrationComparator.ResultParameter.ActualName = "Migrate"; 332 335 336 migrationBranch.Name = "Migrate?"; 333 337 migrationBranch.ConditionParameter.ActualName = "Migrate"; 334 338 335 resetGenerationsSinceLastMigrationAssigner.Name = "Reset Counter";339 resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration"; 336 340 resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 337 341 resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0); … … 350 354 immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name; 351 355 352 generationsCounter.Name = "Generations + 1"; 353 generationsCounter.Increment = new IntValue(1); 354 generationsCounter.ValueParameter.ActualName = "Generations"; 355 356 generationsComparator.Name = "Generations >= MaximumGenerations ?"; 356 357 generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 357 358 generationsComparator.LeftSideParameter.ActualName = "Generations"; … … 385 386 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 386 387 388 generationsTerminationCondition.Name = "Terminate?"; 387 389 generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations"; 388 390 #endregion … … 406 408 resultsCollector.Successor = uniformSubScopesProcessor1; 407 409 uniformSubScopesProcessor1.Operator = selector; 408 uniformSubScopesProcessor1.Successor = generations SinceLastMigrationCounter;410 uniformSubScopesProcessor1.Successor = generationsCounter; 409 411 selector.Successor = subScopesProcessor1; 410 412 subScopesProcessor1.Operators.Add(new EmptyOperator()); … … 432 434 islandQualityDifferenceCalculator2.Successor = islandVisualizer2; 433 435 islandVisualizer2.Successor = null; 436 generationsCounter.Successor = generationsSinceLastMigrationCounter; 434 437 generationsSinceLastMigrationCounter.Successor = migrationComparator; 435 438 migrationComparator.Successor = migrationBranch; 436 439 migrationBranch.TrueBranch = resetGenerationsSinceLastMigrationAssigner; 437 440 migrationBranch.FalseBranch = null; 438 migrationBranch.Successor = generationsCo unter;441 migrationBranch.Successor = generationsComparator; 439 442 resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter; 440 443 migrationsCounter.Successor = uniformSubScopesProcessor3; … … 444 447 uniformSubScopesProcessor4.Operator = immigrationReplacer; 445 448 uniformSubScopesProcessor4.Successor = null; 446 generationsCounter.Successor = generationsComparator;447 449 generationsComparator.Successor = bestQualityMemorizer3; 448 450 bestQualityMemorizer3.Successor = bestQualityMemorizer4; -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.csproj
r3479 r3611 80 80 </ItemGroup> 81 81 <ItemGroup> 82 <Compile Include="OffspringSelectionGeneticAlgorithmMainLoop.cs" /> 82 83 <Compile Include="SASEGASA.cs" /> 83 84 <Compile Include="SASEGASAMainLoop.cs" /> … … 86 87 <Compile Include="IslandOffspringSelectionGeneticAlgorithmMainLoop.cs" /> 87 88 <Compile Include="OffspringSelectionGeneticAlgorithm.cs" /> 88 <Compile Include="OffspringSelectionGeneticAlgorithmMain Loop.cs" />89 <Compile Include="OffspringSelectionGeneticAlgorithmMainOperator.cs" /> 89 90 <Compile Include="Properties\AssemblyInfo.cs" /> 90 91 </ItemGroup> -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r3479 r3611 76 76 get { return (ConstrainedValueParameter<ISelector>)Parameters["EmigrantsSelector"]; } 77 77 } 78 private ConstrainedValueParameter<I Selector> ImmigrationSelectorParameter {79 get { return (ConstrainedValueParameter<I Selector>)Parameters["ImmigrationSelector"]; }78 private ConstrainedValueParameter<IReplacer> ImmigrationReplacerParameter { 79 get { return (ConstrainedValueParameter<IReplacer>)Parameters["ImmigrationReplacer"]; } 80 80 } 81 81 private ValueParameter<IntValue> PopulationSizeParameter { 82 82 get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; } 83 83 } 84 private ValueParameter<IntValue> Maximum MigrationsParameter {85 get { return (ValueParameter<IntValue>)Parameters["Maximum Migrations"]; }84 private ValueParameter<IntValue> MaximumGenerationsParameter { 85 get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; } 86 86 } 87 87 private ConstrainedValueParameter<ISelector> SelectorParameter { … … 152 152 set { EmigrantsSelectorParameter.Value = value; } 153 153 } 154 public I Selector ImmigrationSelector {155 get { return Immigration SelectorParameter.Value; }156 set { Immigration SelectorParameter.Value = value; }154 public IReplacer ImmigrationReplacer { 155 get { return ImmigrationReplacerParameter.Value; } 156 set { ImmigrationReplacerParameter.Value = value; } 157 157 } 158 158 public IntValue PopulationSize { … … 160 160 set { PopulationSizeParameter.Value = value; } 161 161 } 162 public IntValue Maximum Migrations {163 get { return Maximum MigrationsParameter.Value; }164 set { Maximum MigrationsParameter.Value = value; }162 public IntValue MaximumGenerations { 163 get { return MaximumGenerationsParameter.Value; } 164 set { MaximumGenerationsParameter.Value = value; } 165 165 } 166 166 public ISelector Selector { … … 218 218 private List<IDiscreteDoubleValueModifier> comparisonFactorModifiers; 219 219 private List<ISelector> emigrantsSelectors; 220 private List<I Selector> immigrationSelectors;220 private List<IReplacer> immigrationReplacers; 221 221 private List<IMigrator> migrators; 222 222 private RandomCreator RandomCreator { … … 245 245 Parameters.Add(new ConstrainedValueParameter<IMigrator>("Migrator", "The migration strategy.")); 246 246 Parameters.Add(new ConstrainedValueParameter<ISelector>("EmigrantsSelector", "Selects the individuals that will be migrated.")); 247 Parameters.Add(new ConstrainedValueParameter<I Selector>("ImmigrationSelector", "Selects the population from the unification of the original population and the immigrants."));247 Parameters.Add(new ConstrainedValueParameter<IReplacer>("ImmigrationReplacer", "Selects the population from the unification of the original population and the immigrants.")); 248 248 Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions of each island.", new IntValue(100))); 249 Parameters.Add(new ValueParameter<IntValue>("Maximum Migrations", "The maximum number of migrations that should occur.", new IntValue(100)));249 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(100))); 250 250 Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction.")); 251 251 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); … … 287 287 288 288 mainLoop.EmigrantsSelectorParameter.ActualName = EmigrantsSelectorParameter.Name; 289 mainLoop.Immigration SelectorParameter.ActualName = ImmigrationSelectorParameter.Name;290 mainLoop.Maximum MigrationsParameter.ActualName = MaximumMigrationsParameter.Name;289 mainLoop.ImmigrationReplacerParameter.ActualName = ImmigrationReplacerParameter.Name; 290 mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; 291 291 mainLoop.MigrationIntervalParameter.ActualName = MigrationIntervalParameter.Name; 292 292 mainLoop.MigrationRateParameter.ActualName = MigrationRateParameter.Name; … … 301 301 mainLoop.ResultsParameter.ActualName = "Results"; 302 302 mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 303 mainLoop.ComparisonFactorParameter.ActualName = "ComparisonFactor"; 303 304 mainLoop.ComparisonFactorLowerBoundParameter.ActualName = ComparisonFactorLowerBoundParameter.Name; 304 305 mainLoop.ComparisonFactorModifierParameter.ActualName = ComparisonFactorModifierParameter.Name; … … 392 393 } 393 394 private void MaximumMigrationsParameter_ValueChanged(object sender, EventArgs e) { 394 Maximum Migrations.ValueChanged += new EventHandler(MaximumMigrations_ValueChanged);395 MaximumGenerations.ValueChanged += new EventHandler(MaximumMigrations_ValueChanged); 395 396 ParameterizeComparisonFactorModifiers(); 396 397 } … … 424 425 MigrationIntervalParameter.ValueChanged += new EventHandler(MigrationIntervalParameter_ValueChanged); 425 426 MigrationInterval.ValueChanged += new EventHandler(MigrationInterval_ValueChanged); 426 Maximum MigrationsParameter.ValueChanged += new EventHandler(MaximumMigrationsParameter_ValueChanged);427 Maximum Migrations.ValueChanged += new EventHandler(MaximumMigrations_ValueChanged);427 MaximumGenerationsParameter.ValueChanged += new EventHandler(MaximumMigrationsParameter_ValueChanged); 428 MaximumGenerations.ValueChanged += new EventHandler(MaximumMigrations_ValueChanged); 428 429 if (Problem != null) { 429 430 UpdateCrossovers(); … … 455 456 emigrantsSelectors = new List<ISelector>(); 456 457 emigrantsSelectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)); 457 immigration Selectors = new List<ISelector>();458 immigration Selectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name));458 immigrationReplacers = new List<IReplacer>(); 459 immigrationReplacers.AddRange(ApplicationManager.Manager.GetInstances<IReplacer>().OrderBy(x => x.Name)); 459 460 ParameterizeSelectors(); 460 461 } … … 480 481 ParameterizeStochasticOperator(selector); 481 482 } 482 foreach (ISelector selector in immigrationSelectors) { 483 selector.CopySelected = new BoolValue(false); 484 selector.NumberOfSelectedSubScopesParameter.Value = PopulationSize; 483 foreach (IReplacer selector in immigrationReplacers) { 485 484 ParameterizeStochasticOperator(selector); 486 485 } … … 494 493 selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 495 494 } 496 foreach (ISingleObjective Selector selector in immigrationSelectors.OfType<ISingleObjectiveSelector>()) {497 selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;498 selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;495 foreach (ISingleObjectiveReplacer replacer in immigrationReplacers.OfType<ISingleObjectiveReplacer>()) { 496 replacer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 497 replacer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 499 498 } 500 499 } … … 503 502 foreach (IDiscreteDoubleValueModifier modifier in comparisonFactorModifiers) { 504 503 modifier.IndexParameter.ActualName = "Generations"; 505 modifier.EndIndexParameter.Value = new IntValue(MigrationInterval.Value * Maximum Migrations.Value);504 modifier.EndIndexParameter.Value = new IntValue(MigrationInterval.Value * MaximumGenerations.Value); 506 505 modifier.EndValueParameter.ActualName = ComparisonFactorUpperBoundParameter.Name; 507 506 modifier.StartIndexParameter.Value = new IntValue(0); … … 533 532 } 534 533 535 oldSelector = ImmigrationSelectorParameter.Value;536 Immigration SelectorParameter.ValidValues.Clear();537 foreach (I Selector selector in immigrationSelectors)538 Immigration SelectorParameter.ValidValues.Add(selector);534 IReplacer oldReplacer = ImmigrationReplacerParameter.Value; 535 ImmigrationReplacerParameter.ValidValues.Clear(); 536 foreach (IReplacer replacer in immigrationReplacers) 537 ImmigrationReplacerParameter.ValidValues.Add(replacer); 539 538 if (oldSelector != null) { 540 I Selector selector = ImmigrationSelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());541 if ( selector != null) ImmigrationSelectorParameter.Value = selector;539 IReplacer replacer = ImmigrationReplacerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType()); 540 if (replacer != null) ImmigrationReplacerParameter.Value = replacer; 542 541 } 543 542 } -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs
r3479 r3611 70 70 get { return (ValueLookupParameter<IOperator>)Parameters["EmigrantsSelector"]; } 71 71 } 72 public ValueLookupParameter<IOperator> Immigration SelectorParameter {73 get { return (ValueLookupParameter<IOperator>)Parameters["Immigration Selector"]; }72 public ValueLookupParameter<IOperator> ImmigrationReplacerParameter { 73 get { return (ValueLookupParameter<IOperator>)Parameters["ImmigrationReplacer"]; } 74 74 } 75 75 public ValueLookupParameter<IntValue> PopulationSizeParameter { 76 76 get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; } 77 77 } 78 public ValueLookupParameter<IntValue> Maximum MigrationsParameter {79 get { return (ValueLookupParameter<IntValue>)Parameters["Maximum Migrations"]; }78 public ValueLookupParameter<IntValue> MaximumGenerationsParameter { 79 get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; } 80 80 } 81 81 public ValueLookupParameter<IOperator> SelectorParameter { … … 108 108 public ValueLookupParameter<DoubleValue> SuccessRatioParameter { 109 109 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } 110 } 111 public LookupParameter<DoubleValue> ComparisonFactorParameter { 112 get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; } 110 113 } 111 114 public ValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter { … … 140 143 Parameters.Add(new ValueLookupParameter<IOperator>("Migrator", "The migration strategy.")); 141 144 Parameters.Add(new ValueLookupParameter<IOperator>("EmigrantsSelector", "Selects the individuals that will be migrated.")); 142 Parameters.Add(new ValueLookupParameter<IOperator>("Immigration Selector", "Selects the population from the unification of the original population andthe immigrants."));145 Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationReplacer", "Replaces part of the original population with the immigrants.")); 143 146 Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions.")); 144 Parameters.Add(new ValueLookupParameter<IntValue>("Maximum Migrations", "The maximum number of migrations after which the operator should terminate."));147 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.")); 145 148 Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction.")); 146 149 Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions.")); … … 153 156 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions.")); 154 157 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.")); 158 Parameters.Add(new LookupParameter<DoubleValue>("ComparisonFactor", "The comparison factor is used to determine whether the offspring should be compared to the better parent, the worse parent or a quality value linearly interpolated between them. It is in the range [0;1].")); 155 159 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).")); 156 160 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end).")); … … 162 166 #region Create operators 163 167 VariableCreator variableCreator = new VariableCreator(); 164 UniformSubScopesProcessor u ssp0 = new UniformSubScopesProcessor();168 UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor(); 165 169 VariableCreator islandVariableCreator = new VariableCreator(); 166 Assigner islandVariableAssigner = new Assigner(); 170 BestQualityMemorizer islandBestQualityMemorizer1 = new BestQualityMemorizer(); 171 BestAverageWorstQualityCalculator islandBestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator(); 172 DataTableValuesCollector islandDataTableValuesCollector1 = new DataTableValuesCollector(); 173 DataTableValuesCollector islandDataTableValuesCollector2 = new DataTableValuesCollector(); 174 QualityDifferenceCalculator islandQualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 175 Placeholder islandVisualizer1 = new Placeholder(); 176 ResultsCollector islandResultsCollector = new ResultsCollector(); 167 177 BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer(); 178 BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer(); 168 179 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator(); 169 BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();170 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();171 180 DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector(); 181 DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector(); 172 182 QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 173 183 ResultsCollector resultsCollector = new ResultsCollector(); 174 UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor(); 175 OffspringSelectionGeneticAlgorithmMainLoop mainLoop = new OffspringSelectionGeneticAlgorithmMainLoop(); 184 Placeholder comparisonFactorModifier = new Placeholder(); 185 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); 186 ConditionalBranch islandTerminatedBySelectionPressure1 = new ConditionalBranch(); 187 OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator(); 188 BestQualityMemorizer islandBestQualityMemorizer2 = new BestQualityMemorizer(); 189 BestAverageWorstQualityCalculator islandBestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator(); 190 DataTableValuesCollector islandDataTableValuesCollector3 = new DataTableValuesCollector(); 191 DataTableValuesCollector islandDataTableValuesCollector4 = new DataTableValuesCollector(); 192 QualityDifferenceCalculator islandQualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 193 Placeholder islandVisualizer2 = new Placeholder(); 194 IntCounter islandEvaluatedSolutionsCounter = new IntCounter(); 195 Comparator islandSelectionPressureComparator = new Comparator(); 196 ConditionalBranch islandTerminatedBySelectionPressure2 = new ConditionalBranch(); 197 IntCounter terminatedIslandsCounter = new IntCounter(); 198 IntCounter generationsCounter = new IntCounter(); 199 IntCounter generationsSinceLastMigrationCounter = new IntCounter(); 200 Comparator migrationComparator = new Comparator(); 201 ConditionalBranch migrationBranch = new ConditionalBranch(); 202 Assigner resetTerminatedIslandsAssigner = new Assigner(); 203 Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner(); 204 IntCounter migrationsCounter = new IntCounter(); 205 UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); 206 Assigner reviveIslandAssigner = new Assigner(); 176 207 Placeholder emigrantsSelector = new Placeholder(); 177 208 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(); 209 UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor(); 210 Placeholder immigrationReplacer = new Placeholder(); 211 Comparator generationsComparator = new Comparator(); 212 Comparator terminatedIslandsComparator = new Comparator(); 185 213 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); 186 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator3 = new BestAverageWorstQualityCalculator(); 187 DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector(); 214 BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer(); 215 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator(); 216 DataTableValuesCollector dataTableValuesCollector3 = new DataTableValuesCollector(); 217 DataTableValuesCollector dataTableValuesCollector4 = new DataTableValuesCollector(); 188 218 QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 189 ConditionalBranch migrationTerminationCondition = new ConditionalBranch(); 219 ConditionalBranch generationsTerminationCondition = new ConditionalBranch(); 220 ConditionalBranch terminatedIslandsCondition = new ConditionalBranch(); 190 221 191 222 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0))); 223 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 224 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0))); 225 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TerminatedIslands", new IntValue(0))); 226 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0))); 227 228 islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection())); 229 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandEvaluatedSolutions", new IntValue(0))); 230 islandVariableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("TerminateSelectionPressure", new BoolValue(false))); 231 islandVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0))); 232 233 islandBestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 234 islandBestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name; 235 islandBestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name; 236 237 islandBestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 238 islandBestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality"; 239 islandBestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name; 240 islandBestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name; 241 islandBestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 192 242 193 islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection())); 194 195 islandVariableAssigner.LeftSideParameter.ActualName = "MaximumGenerations"; 196 islandVariableAssigner.RightSideParameter.ActualName = "MigrationInterval"; 243 islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality")); 244 islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality")); 245 islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality")); 246 islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 247 islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 248 islandDataTableValuesCollector1.DataTableParameter.ActualName = "BestQualities"; 249 250 islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Selection Pressure", null, "SelectionPressure")); 251 islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Maximum Selection Pressure", null, MaximumSelectionPressureParameter.Name)); 252 islandDataTableValuesCollector2.DataTableParameter.ActualName = "SelectionPressures"; 253 254 islandQualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 255 islandQualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 256 islandQualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 257 islandQualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality"; 258 259 islandResultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 260 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 261 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 262 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 263 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 264 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 265 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest")); 266 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 267 islandResultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "IslandEvaluatedSolutions")); 268 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Curent Comparison Factor", null, "ComparisonFactor")); 269 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Selection Pressure", null, "SelectionPressure")); 270 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Success Ratio", null, "CurrentSuccessRatio")); 271 islandResultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name)); 272 islandResultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities")); 273 islandResultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("SelectionPressures")); 274 islandResultsCollector.ResultsParameter.ActualName = "IslandResults"; 197 275 198 276 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 199 277 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"; 278 bestQualityMemorizer1.QualityParameter.ActualName = "BestQuality"; 279 280 bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 209 281 bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name; 210 282 bestQualityMemorizer2.QualityParameter.ActualName = "BestQuality"; 211 283 212 bestAverageWorstQualityCalculator 2.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";213 bestAverageWorstQualityCalculator 2.BestQualityParameter.ActualName = "CurrentBestBestQuality";214 bestAverageWorstQualityCalculator 2.MaximizationParameter.ActualName = MaximizationParameter.Name;215 bestAverageWorstQualityCalculator 2.QualityParameter.ActualName = "CurrentBestQuality";216 bestAverageWorstQualityCalculator 2.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";284 bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageBestQuality"; 285 bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestBestQuality"; 286 bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name; 287 bestAverageWorstQualityCalculator1.QualityParameter.ActualName = "CurrentBestQuality"; 288 bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstBestQuality"; 217 289 218 290 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality")); … … 223 295 dataTableValuesCollector1.DataTableParameter.ActualName = "BestQualities"; 224 296 297 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Maximum Selection Pressure", null, MaximumSelectionPressureParameter.Name)); 298 dataTableValuesCollector2.CollectedValues.Add(new SubScopesLookupParameter<DoubleValue>("Selection Pressure Island", null, "SelectionPressure")); 299 dataTableValuesCollector2.DataTableParameter.ActualName = "SelectionPressures"; 300 225 301 qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 226 302 qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; … … 229 305 230 306 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Migrations")); 307 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 308 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions")); 231 309 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality")); 232 310 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality")); … … 237 315 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 238 316 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("BestQualities")); 317 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("SelectionPressures")); 239 318 resultsCollector.CollectedValues.Add(new SubScopesLookupParameter<ResultCollection>("IslandResults", "Result set for each island")); 240 319 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 241 320 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; 321 comparisonFactorModifier.Name = "ComparisonFactorModifier (Placeholder)"; 322 comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name; 323 324 islandTerminatedBySelectionPressure1.Name = "Island Terminated ?"; 325 islandTerminatedBySelectionPressure1.ConditionParameter.ActualName = "TerminateSelectionPressure"; 326 327 mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; 328 mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name; 329 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 330 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 331 mainOperator.EvaluatedSolutionsParameter.ActualName = "IslandEvaluatedSolutions"; 332 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 333 mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name; 334 mainOperator.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name; 335 mainOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 336 mainOperator.MutatorParameter.ActualName = MutatorParameter.Name; 337 mainOperator.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 338 mainOperator.QualityParameter.ActualName = QualityParameter.Name; 339 mainOperator.RandomParameter.ActualName = RandomParameter.Name; 340 mainOperator.SelectionPressureParameter.ActualName = "SelectionPressure"; 341 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 342 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 343 344 islandBestQualityMemorizer2.BestQualityParameter.ActualName = "BestQuality"; 345 islandBestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name; 346 islandBestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name; 347 348 islandBestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 349 islandBestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestQuality"; 350 islandBestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name; 351 islandBestAverageWorstQualityCalculator2.QualityParameter.ActualName = QualityParameter.Name; 352 islandBestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 353 354 islandDataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality")); 355 islandDataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality")); 356 islandDataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality")); 357 islandDataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 358 islandDataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 359 islandDataTableValuesCollector3.DataTableParameter.ActualName = "BestQualities"; 360 361 islandDataTableValuesCollector4.CollectedValues.Add(new LookupParameter<DoubleValue>("Selection Pressure", null, "SelectionPressure")); 362 islandDataTableValuesCollector4.CollectedValues.Add(new LookupParameter<DoubleValue>("Maximum Selection Pressure", null, MaximumSelectionPressureParameter.Name)); 363 islandDataTableValuesCollector4.DataTableParameter.ActualName = "SelectionPressures"; 364 365 islandQualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 366 islandQualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 367 islandQualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 368 islandQualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 369 370 islandEvaluatedSolutionsCounter.Name = "Update EvaluatedSolutions"; 371 islandEvaluatedSolutionsCounter.ValueParameter.ActualName = "EvaluatedSolutions"; 372 islandEvaluatedSolutionsCounter.Increment = null; 373 islandEvaluatedSolutionsCounter.IncrementParameter.ActualName = "IslandEvaluatedSolutions"; 374 375 islandSelectionPressureComparator.Name = "SelectionPressure >= MaximumSelectionPressure ?"; 376 islandSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure"; 377 islandSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 378 islandSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name; 379 islandSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure"; 380 381 islandTerminatedBySelectionPressure2.Name = "Island Terminated ?"; 382 islandTerminatedBySelectionPressure2.ConditionParameter.ActualName = "TerminateSelectionPressure"; 383 384 terminatedIslandsCounter.Name = "TerminatedIslands + 1"; 385 terminatedIslandsCounter.ValueParameter.ActualName = "TerminatedIslands"; 386 terminatedIslandsCounter.Increment = new IntValue(1); 387 388 generationsCounter.Name = "Generations + 1"; 389 generationsCounter.ValueParameter.ActualName = "Generations"; 390 generationsCounter.Increment = new IntValue(1); 391 392 generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1"; 393 generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration"; 394 generationsSinceLastMigrationCounter.Increment = new IntValue(1); 395 396 migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?"; 397 migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 398 migrationComparator.Comparison = new Comparison(ComparisonType.Equal); 399 migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name; 400 migrationComparator.ResultParameter.ActualName = "Migrate"; 401 402 migrationBranch.Name = "Migrate?"; 403 migrationBranch.ConditionParameter.ActualName = "Migrate"; 404 405 resetTerminatedIslandsAssigner.Name = "Reset TerminatedIslands"; 406 resetTerminatedIslandsAssigner.LeftSideParameter.ActualName = "TerminatedIslands"; 407 resetTerminatedIslandsAssigner.RightSideParameter.Value = new IntValue(0); 408 409 resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration"; 410 resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 411 resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0); 275 412 276 413 migrationsCounter.Name = "Migrations + 1"; … … 278 415 migrationsCounter.ValueParameter.ActualName = "Migrations"; 279 416 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 417 reviveIslandAssigner.Name = "Revive Island"; 418 reviveIslandAssigner.LeftSideParameter.ActualName = "TerminateSelectionPressure"; 419 reviveIslandAssigner.RightSideParameter.Value = new BoolValue(false); 420 421 emigrantsSelector.Name = "Emigrants Selector (placeholder)"; 422 emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name; 423 424 migrator.Name = "Migrator (placeholder)"; 425 migrator.OperatorParameter.ActualName = MigratorParameter.Name; 426 427 immigrationReplacer.Name = "Immigration Replacer (placeholder)"; 428 immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name; 429 430 generationsComparator.Name = "Generations >= MaximumGenerations ?"; 431 generationsComparator.LeftSideParameter.ActualName = "Generations"; 432 generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 433 generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name; 434 generationsComparator.ResultParameter.ActualName = "TerminateGenerations"; 435 436 terminatedIslandsComparator.Name = "All Islands terminated ?"; 437 terminatedIslandsComparator.LeftSideParameter.ActualName = "TerminatedIslands"; 438 terminatedIslandsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 439 terminatedIslandsComparator.RightSideParameter.ActualName = NumberOfIslandsParameter.Name; 440 terminatedIslandsComparator.ResultParameter.ActualName = "TerminateTerminatedIslands"; 441 286 442 bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality"; 287 443 bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name; 288 444 bestQualityMemorizer3.QualityParameter.ActualName = "BestQuality"; 289 445 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"; 446 bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 447 bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name; 448 bestQualityMemorizer4.QualityParameter.ActualName = "BestQuality"; 449 450 bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageBestQuality"; 451 bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestBestQuality"; 452 bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name; 453 bestAverageWorstQualityCalculator2.QualityParameter.ActualName = "CurrentBestQuality"; 454 bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstBestQuality"; 455 456 dataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality")); 457 dataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average BestQuality", null, "CurrentAverageBestQuality")); 458 dataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst BestQuality", null, "CurrentWorstBestQuality")); 459 dataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 460 dataTableValuesCollector3.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 461 dataTableValuesCollector3.DataTableParameter.ActualName = "BestQualities"; 462 463 dataTableValuesCollector4.CollectedValues.Add(new LookupParameter<DoubleValue>("Maximum Selection Pressure", null, MaximumSelectionPressureParameter.Name)); 464 dataTableValuesCollector4.CollectedValues.Add(new SubScopesLookupParameter<DoubleValue>("Selection Pressure Island", null, "SelectionPressure")); 465 dataTableValuesCollector4.DataTableParameter.ActualName = "SelectionPressures"; 302 466 303 467 qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; … … 306 470 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 307 471 308 migrationTerminationCondition.ConditionParameter.ActualName = "MigrationTerminate"; 472 generationsTerminationCondition.Name = "Terminate (MaxGenerations) ?"; 473 generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations"; 474 475 terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?"; 476 terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands"; 309 477 #endregion 310 478 311 479 #region Create operator graph 312 480 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; 481 variableCreator.Successor = uniformSubScopesProcessor0; 482 uniformSubScopesProcessor0.Operator = islandVariableCreator; 483 uniformSubScopesProcessor0.Successor = bestQualityMemorizer1; 484 islandVariableCreator.Successor = islandBestQualityMemorizer1; 485 islandBestQualityMemorizer1.Successor = islandBestAverageWorstQualityCalculator1; 486 islandBestAverageWorstQualityCalculator1.Successor = islandDataTableValuesCollector1; 487 islandDataTableValuesCollector1.Successor = islandDataTableValuesCollector2; 488 islandDataTableValuesCollector2.Successor = islandQualityDifferenceCalculator1; 489 islandQualityDifferenceCalculator1.Successor = islandVisualizer1; 490 islandVisualizer1.Successor = islandResultsCollector; 491 islandResultsCollector.Successor = null; 492 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 493 bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1; 494 bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1; 495 dataTableValuesCollector1.Successor = dataTableValuesCollector2; 496 dataTableValuesCollector2.Successor = qualityDifferenceCalculator1; 322 497 qualityDifferenceCalculator1.Successor = resultsCollector; 323 resultsCollector.Successor = ussp1; 324 ussp1.Operator = mainLoop; 325 ussp1.Successor = migrator; 326 mainLoop.Successor = maximumGenerationsCounter; 327 maximumGenerationsCounter.Successor = emigrantsSelector; 498 resultsCollector.Successor = comparisonFactorModifier; 499 comparisonFactorModifier.Successor = uniformSubScopesProcessor1; 500 uniformSubScopesProcessor1.Operator = islandTerminatedBySelectionPressure1; 501 uniformSubScopesProcessor1.Successor = generationsCounter; 502 islandTerminatedBySelectionPressure1.TrueBranch = null; 503 islandTerminatedBySelectionPressure1.FalseBranch = mainOperator; 504 islandTerminatedBySelectionPressure1.Successor = null; 505 mainOperator.Successor = islandBestQualityMemorizer2; 506 islandBestQualityMemorizer2.Successor = islandBestAverageWorstQualityCalculator2; 507 islandBestAverageWorstQualityCalculator2.Successor = islandDataTableValuesCollector3; 508 islandDataTableValuesCollector3.Successor = islandDataTableValuesCollector4; 509 islandDataTableValuesCollector4.Successor = islandQualityDifferenceCalculator2; 510 islandQualityDifferenceCalculator2.Successor = islandVisualizer2; 511 islandVisualizer2.Successor = islandEvaluatedSolutionsCounter; 512 islandEvaluatedSolutionsCounter.Successor = islandSelectionPressureComparator; 513 islandSelectionPressureComparator.Successor = islandTerminatedBySelectionPressure2; 514 islandTerminatedBySelectionPressure2.TrueBranch = terminatedIslandsCounter; 515 islandTerminatedBySelectionPressure2.FalseBranch = null; 516 islandTerminatedBySelectionPressure2.Successor = null; 517 generationsCounter.Successor = generationsSinceLastMigrationCounter; 518 generationsSinceLastMigrationCounter.Successor = migrationComparator; 519 migrationComparator.Successor = migrationBranch; 520 migrationBranch.TrueBranch = resetTerminatedIslandsAssigner; 521 migrationBranch.FalseBranch = null; 522 migrationBranch.Successor = generationsComparator; 523 resetTerminatedIslandsAssigner.Successor = resetGenerationsSinceLastMigrationAssigner; 524 resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter; 525 migrationsCounter.Successor = uniformSubScopesProcessor2; 526 uniformSubScopesProcessor2.Operator = reviveIslandAssigner; 527 uniformSubScopesProcessor2.Successor = migrator; 528 reviveIslandAssigner.Successor = emigrantsSelector; 328 529 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; 530 migrator.Successor = uniformSubScopesProcessor3; 531 uniformSubScopesProcessor3.Operator = immigrationReplacer; 532 uniformSubScopesProcessor3.Successor = null; 533 immigrationReplacer.Successor = null; 534 generationsComparator.Successor = terminatedIslandsComparator; 535 terminatedIslandsComparator.Successor = bestQualityMemorizer3; 536 bestQualityMemorizer3.Successor = bestQualityMemorizer4; 537 bestQualityMemorizer4.Successor = bestAverageWorstQualityCalculator2; 538 bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector3; 539 dataTableValuesCollector3.Successor = dataTableValuesCollector4; 540 dataTableValuesCollector4.Successor = qualityDifferenceCalculator2; 541 qualityDifferenceCalculator2.Successor = generationsTerminationCondition; 542 generationsTerminationCondition.TrueBranch = null; 543 generationsTerminationCondition.FalseBranch = terminatedIslandsCondition; 544 generationsTerminationCondition.Successor = null; 545 terminatedIslandsCondition.TrueBranch = null; 546 terminatedIslandsCondition.FalseBranch = comparisonFactorModifier; 547 terminatedIslandsCondition.Successor = null; 344 548 #endregion 345 549 }
Note: See TracChangeset
for help on using the changeset viewer.