Changeset 10197
- Timestamp:
- 12/05/13 15:21:24 (11 years ago)
- Location:
- branches/DataAnalysis.IslandAlgorithms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r10155 r10197 67 67 get { return (ValueParameter<IntValue>)Parameters["MigrationInterval"]; } 68 68 } 69 protected IFixedValueParameter<IntValue> AnalysisIntervalParameter { 70 get { return (IFixedValueParameter<IntValue>)Parameters["AnalysisInterval"]; } 71 } 69 72 protected ValueParameter<PercentValue> MigrationRateParameter { 70 73 get { return (ValueParameter<PercentValue>)Parameters["MigrationRate"]; } … … 130 133 get { return MigrationIntervalParameter.Value; } 131 134 set { MigrationIntervalParameter.Value = value; } 135 } 136 public int AnalysisInterval { 137 get { return AnalysisIntervalParameter.Value.Value; } 138 set { AnalysisIntervalParameter.Value.Value = value; } 132 139 } 133 140 public PercentValue MigrationRate { … … 218 225 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true }); 219 226 } 227 if (!Parameters.ContainsKey("ReevaluateImmigrants")) { 228 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateImmigrants", "Flag which indicates if inviduals should be reevaluated before they are immigrated.", new BoolValue(false)) { Hidden = true }); 229 } 230 if (!Parameters.ContainsKey("AnalysisInterval")) { 231 Parameters.Add(new ValueParameter<IntValue>("AnalysisInterval", "The number of generations that should pass between the analyzers should be executed (should be <= MigrationInteval).", new IntValue(20)) { Hidden = true }); 232 } 220 233 #endregion 221 234 … … 238 251 Parameters.Add(new ValueParameter<IntValue>("NumberOfIslands", "The number of islands.", new IntValue(5))); 239 252 Parameters.Add(new ValueParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases.", new IntValue(20))); 253 Parameters.Add(new ValueParameter<IntValue>("AnalysisInterval", "The number of generations that should pass between the analyzers should be executed (should be <= MigrationInteval).", new IntValue(20)) { Hidden = true }); 240 254 Parameters.Add(new ValueParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands.", new PercentValue(0.15))); 241 255 Parameters.Add(new ConstrainedValueParameter<IMigrator>("Migrator", "The migration strategy.")); -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r10155 r10197 56 56 get { return (ValueLookupParameter<IntValue>)Parameters["MigrationInterval"]; } 57 57 } 58 public IValueLookupParameter<IntValue> AnalysisIntervalParameter { 59 get { return (IValueLookupParameter<IntValue>)Parameters["AnalysisInterval"]; } 60 } 58 61 public ValueLookupParameter<PercentValue> MigrationRateParameter { 59 62 get { return (ValueLookupParameter<PercentValue>)Parameters["MigrationRate"]; } … … 115 118 public ValueLookupParameter<BoolValue> Migrate { 116 119 get { return (ValueLookupParameter<BoolValue>)Parameters["Migrate"]; } 120 } 121 public ILookupParameter<BoolValue> RunAnalysis { 122 get { return (ILookupParameter<BoolValue>)Parameters["RunAnalysis"]; } 117 123 } 118 124 … … 139 145 Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfIslands", "The number of islands.")); 140 146 Parameters.Add(new ValueLookupParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases.")); 147 Parameters.Add(new ValueLookupParameter<IntValue>("AnalysisInterval", "The number of generations that should pass between the analyzers should be executed (should be <= MigrationInteval).")); 141 148 Parameters.Add(new ValueLookupParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands.")); 142 149 Parameters.Add(new ValueLookupParameter<IOperator>("Migrator", "The migration strategy.")); … … 159 166 Parameters.Add(new LookupParameter<IntValue>("IslandEvaluatedSolutions", "The number of times a solution has been evaluated on one island.")); 160 167 Parameters.Add(new ValueLookupParameter<BoolValue>("Migrate", "Migrate the island?")); 168 Parameters.Add(new LookupParameter<BoolValue>("RunAnalysis", "Run Analyzers?")); 161 169 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateImmigrants", "Flag which indicates if inviduals should be reevaluated before they are immigrated.")); 162 170 #endregion … … 189 197 MergingReducer mergingReducer = new MergingReducer(); 190 198 IntCounter islandGenerationsCounter = new IntCounter(); 199 IntCounter generationsSinceLastMigrationCounter = new IntCounter(); 200 IntCounter generationsSinceLastAnalysisCounter = new IntCounter(); 191 201 Comparator checkIslandGenerationsReachedMaximum = new Comparator(); 192 202 ConditionalBranch checkContinueEvolution = new ConditionalBranch(); 203 Assigner resetGenerationsSinceLastMigration = new Assigner(); 204 Comparator checkIslandGenerationsForAnalysis = new Comparator(); 205 ConditionalBranch checkRunAnalysis = new ConditionalBranch(); 206 Assigner resetGenerationsSinceLastAnalysis = new Assigner(); 193 207 DataReducer generationsReducer = new DataReducer(); 194 208 DataReducer evaluatedSolutionsReducer = new DataReducer(); 209 DataReducer migrationDataReducer = new DataReducer(); 210 ConditionalBranch migrateIndividuals = new ConditionalBranch(); 195 211 Placeholder islandAnalyzer2 = new Placeholder(); 196 212 UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor(); … … 211 227 212 228 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0))); 213 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));214 229 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class IslandGeneticAlgorithm expects this to be called Generations 215 230 … … 217 232 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandGenerations", new IntValue(0))); 218 233 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandEvaluatedSolutions", new IntValue(0))); 234 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandGenerationsSinceLastMigration", new IntValue(0))); 235 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandGenerationsSinceLastAnalysis", new IntValue(0))); 219 236 220 237 islandAnalyzer1.Name = "Island Analyzer (placeholder)"; … … 271 288 islandGenerationsCounter.Increment = new IntValue(1); 272 289 273 checkIslandGenerationsReachedMaximum.LeftSideParameter.ActualName = IslandGenerations.Name; 290 generationsSinceLastMigrationCounter.Name = "Increment island generation since last migration"; 291 generationsSinceLastMigrationCounter.ValueParameter.ActualName = "IslandGenerationsSinceLastMigration"; 292 generationsSinceLastMigrationCounter.Increment = new IntValue(1); 293 294 generationsSinceLastAnalysisCounter.Name = "Increment island generation since last analysis"; 295 generationsSinceLastAnalysisCounter.ValueParameter.ActualName = "IslandGenerationsSinceLastAnalysis"; 296 generationsSinceLastAnalysisCounter.Increment = new IntValue(1); 297 298 checkIslandGenerationsReachedMaximum.LeftSideParameter.ActualName = "IslandGenerationsSinceLastMigration"; 274 299 checkIslandGenerationsReachedMaximum.RightSideParameter.ActualName = MigrationIntervalParameter.Name; 275 300 checkIslandGenerationsReachedMaximum.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 276 301 checkIslandGenerationsReachedMaximum.ResultParameter.ActualName = Migrate.Name; 277 302 303 resetGenerationsSinceLastMigration.Name = "Reset generations since last migration"; 304 resetGenerationsSinceLastMigration.LeftSideParameter.ActualName = "IslandGenerationsSinceLastMigration"; 305 resetGenerationsSinceLastMigration.RightSideParameter.Value = new IntValue(0); 306 resetGenerationsSinceLastMigration.Successor = resetGenerationsSinceLastAnalysis; 307 278 308 checkContinueEvolution.Name = "Migrate?"; 279 309 checkContinueEvolution.ConditionParameter.ActualName = Migrate.Name; 280 checkContinueEvolution.FalseBranch = selector; 310 checkContinueEvolution.TrueBranch = resetGenerationsSinceLastMigration; 311 checkContinueEvolution.FalseBranch = checkIslandGenerationsForAnalysis; 312 313 checkIslandGenerationsForAnalysis.LeftSideParameter.ActualName = "IslandGenerationsSinceLastAnalysis"; 314 checkIslandGenerationsForAnalysis.RightSideParameter.ActualName = AnalysisIntervalParameter.Name; 315 checkIslandGenerationsForAnalysis.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 316 checkIslandGenerationsForAnalysis.ResultParameter.ActualName = RunAnalysis.Name; 317 318 resetGenerationsSinceLastAnalysis.Name = "Reset generations since last analysis"; 319 resetGenerationsSinceLastAnalysis.LeftSideParameter.ActualName = "IslandGenerationsSinceLastAnalysis"; 320 resetGenerationsSinceLastAnalysis.RightSideParameter.Value = new IntValue(0); 321 322 checkRunAnalysis.Name = "Run Analyzers?"; 323 checkRunAnalysis.ConditionParameter.ActualName = RunAnalysis.Name; 324 checkRunAnalysis.TrueBranch = resetGenerationsSinceLastAnalysis; 325 checkRunAnalysis.FalseBranch = selector; 281 326 282 327 islandAnalyzer2.Name = "Island Analyzer (placeholder)"; … … 294 339 evaluatedSolutionsReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); 295 340 evaluatedSolutionsReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum); 341 342 migrationDataReducer.Name = "Collect Migration Flags"; 343 migrationDataReducer.ParameterToReduce.ActualName = Migrate.Name; 344 migrationDataReducer.TargetParameter.ActualName = Migrate.Name; 345 migrationDataReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.All); 346 migrationDataReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); 347 348 migrateIndividuals.Name = "Migrate?"; 349 migrateIndividuals.ConditionParameter.ActualName = Migrate.Name; 296 350 297 351 emigrantsSelector.Name = "Emigrants Selector (placeholder)"; … … 354 408 uniformSubScopesProcessor1.Successor = generationsReducer; 355 409 generationsReducer.Successor = evaluatedSolutionsReducer; 356 evaluatedSolutionsReducer.Successor = migrationsCounter; 410 evaluatedSolutionsReducer.Successor = migrationDataReducer; 411 migrationDataReducer.Successor = migrateIndividuals; 412 migrateIndividuals.TrueBranch = migrationsCounter; 413 migrateIndividuals.FalseBranch = generationsComparator; 357 414 migrationsCounter.Successor = uniformSubScopesProcessor5; 358 415 generationsAssigner.Successor = evaluatedSolutionsAssigner; … … 385 442 reevaluateElitesBranch.Successor = null; 386 443 islandAnalyzer2.Successor = islandGenerationsCounter; 387 islandGenerationsCounter.Successor = checkIslandGenerationsReachedMaximum; 444 islandGenerationsCounter.Successor = generationsSinceLastMigrationCounter; 445 generationsSinceLastMigrationCounter.Successor = generationsSinceLastAnalysisCounter; 446 generationsSinceLastAnalysisCounter.Successor = checkIslandGenerationsReachedMaximum; 388 447 checkIslandGenerationsReachedMaximum.Successor = checkContinueEvolution; 448 checkContinueEvolution.FalseBranch = checkIslandGenerationsForAnalysis; 449 checkIslandGenerationsForAnalysis.Successor = checkRunAnalysis; 389 450 uniformSubScopesProcessor5.Operator = emigrantsSelector; 390 451 emigrantsSelector.Successor = null; -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r10155 r10197 277 277 if (!Parameters.ContainsKey("ReevaluateElites")) { 278 278 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true }); 279 } 280 if (!Parameters.ContainsKey("ReevaluateImmigrants")) { 281 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateImmigrants", "Flag which indicates if inviduals should be reevaluated before they are immigrated.", new BoolValue(false)) { Hidden = true }); 279 282 } 280 283 #endregion
Note: See TracChangeset
for help on using the changeset viewer.