Changeset 7401
- Timestamp:
- 01/24/12 13:33:38 (13 years ago)
- Location:
- branches/HiveHiveEngine
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveHiveEngine
- Property svn:mergeinfo changed
/trunk/sources merged: 7395,7397,7400
- Property svn:mergeinfo changed
-
branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r7392 r7401 242 242 OperatorGraph.InitialOperator = randomCreator; 243 243 244 randomCreator.RandomParameter.ActualName = " Random";244 randomCreator.RandomParameter.ActualName = "GlobalRandom"; 245 245 randomCreator.SeedParameter.ActualName = SeedParameter.Name; 246 246 randomCreator.SeedParameter.Value = null; … … 256 256 257 257 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 258 //don't create solutions in parallel because the hive engine would distribute these tasks 259 solutionsCreator.ParallelParameter.Value = new BoolValue(false); 258 260 solutionsCreator.Successor = null; 259 261 … … 416 418 } 417 419 } 420 private void ParameterizeStochasticOperatorForIsland(IOperator op) { 421 IStochasticOperator stochasticOp = op as IStochasticOperator; 422 if (stochasticOp != null) { 423 stochasticOp.RandomParameter.ActualName = "LocalRandom"; 424 stochasticOp.RandomParameter.Hidden = true; 425 } 426 } 418 427 private void ParameterizeSelectors() { 419 428 foreach (ISelector selector in SelectorParameter.ValidValues) { … … 421 430 selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize.Value - Elites.Value)); 422 431 selector.NumberOfSelectedSubScopesParameter.Hidden = true; 423 ParameterizeStochasticOperator (selector);432 ParameterizeStochasticOperatorForIsland(selector); 424 433 } 425 434 foreach (ISelector selector in EmigrantsSelectorParameter.ValidValues) { … … 489 498 ICrossover oldCrossover = CrossoverParameter.Value; 490 499 CrossoverParameter.ValidValues.Clear(); 491 foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name)) 500 foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name)) { 501 ParameterizeStochasticOperatorForIsland(crossover); 492 502 CrossoverParameter.ValidValues.Add(crossover); 503 } 493 504 if (oldCrossover != null) { 494 505 ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType()); … … 499 510 IManipulator oldMutator = MutatorParameter.Value; 500 511 MutatorParameter.ValidValues.Clear(); 501 foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name)) 512 foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name)) { 513 ParameterizeStochasticOperatorForIsland(mutator); 502 514 MutatorParameter.ValidValues.Add(mutator); 515 } 503 516 if (oldMutator != null) { 504 517 IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType()); -
branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r7259 r7401 104 104 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 105 105 } 106 public LookupParameter<IntValue> IslandGenerations { 107 get { return (LookupParameter<IntValue>)Parameters["IslandGenerations"]; } 108 } 109 public LookupParameter<IntValue> IslandEvaluatedSolutions { 110 get { return (LookupParameter<IntValue>)Parameters["IslandEvaluatedSolutions"]; } 111 } 112 public ValueLookupParameter<BoolValue> Migrate { 113 get { return (ValueLookupParameter<BoolValue>)Parameters["Migrate"]; } 114 } 106 115 #endregion 107 116 … … 133 142 Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.")); 134 143 Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions.")); 135 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."));144 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions.")); 136 145 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 137 146 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); … … 139 148 Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island.")); 140 149 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times a solution has been evaluated.")); 150 Parameters.Add(new LookupParameter<IntValue>("IslandGenerations", "The number of generations calculated on one island.")); 151 Parameters.Add(new LookupParameter<IntValue>("IslandEvaluatedSolutions", "The number of times a solution has been evaluated on one island.")); 152 Parameters.Add(new ValueLookupParameter<BoolValue>("Migrate", "Migrate the island?")); 141 153 #endregion 142 154 … … 146 158 VariableCreator islandVariableCreator = new VariableCreator(); 147 159 Placeholder islandAnalyzer1 = new Placeholder(); 160 LocalRandomCreator localRandomCreator = new LocalRandomCreator(); 148 161 Placeholder analyzer1 = new Placeholder(); 149 162 ResultsCollector resultsCollector1 = new ResultsCollector(); 150 163 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); 164 Assigner generationsAssigner = new Assigner(); 165 Assigner evaluatedSolutionsAssigner = new Assigner(); 151 166 Placeholder selector = new Placeholder(); 152 167 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); … … 164 179 RightReducer rightReducer = new RightReducer(); 165 180 MergingReducer mergingReducer = new MergingReducer(); 166 IntCounter generationsCounter = new IntCounter(); 167 UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor(); 181 IntCounter islandGenerationsCounter = new IntCounter(); 182 Comparator checkIslandGenerationsReachedMaximum = new Comparator(); 183 ConditionalBranch checkContinueEvolution = new ConditionalBranch(); 184 DataReducer generationsReducer = new DataReducer(); 185 DataReducer evaluatedSolutionsReducer = new DataReducer(); 168 186 Placeholder islandAnalyzer2 = new Placeholder(); 169 IntCounter generationsSinceLastMigrationCounter = new IntCounter();170 Comparator migrationComparator = new Comparator();171 ConditionalBranch migrationBranch = new ConditionalBranch();172 Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();173 IntCounter migrationsCounter = new IntCounter();174 187 UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor(); 175 188 Placeholder emigrantsSelector = new Placeholder(); 189 IntCounter migrationsCounter = new IntCounter(); 176 190 Placeholder migrator = new Placeholder(); 177 191 UniformSubScopesProcessor uniformSubScopesProcessor6 = new UniformSubScopesProcessor(); … … 181 195 ConditionalBranch generationsTerminationCondition = new ConditionalBranch(); 182 196 197 183 198 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0))); 184 199 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0))); … … 186 201 187 202 islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection())); 203 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandGenerations", new IntValue(0))); 204 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("IslandEvaluatedSolutions", new IntValue(0))); 188 205 189 206 islandAnalyzer1.Name = "Island Analyzer (placeholder)"; … … 198 215 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; 199 216 217 uniformSubScopesProcessor1.Parallel.Value = true; 218 219 generationsAssigner.Name = "Initialize Island Generations"; 220 generationsAssigner.LeftSideParameter.ActualName = IslandGenerations.Name; 221 generationsAssigner.RightSideParameter.Value = new IntValue(0); 222 223 evaluatedSolutionsAssigner.Name = "Initialize Island evaluated solutions"; 224 evaluatedSolutionsAssigner.LeftSideParameter.ActualName = IslandEvaluatedSolutions.Name; 225 evaluatedSolutionsAssigner.RightSideParameter.Value = new IntValue(0); 226 200 227 selector.Name = "Selector (placeholder)"; 201 228 selector.OperatorParameter.ActualName = SelectorParameter.Name; … … 207 234 208 235 stochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 209 stochasticBranch.RandomParameter.ActualName = RandomParameter.Name; 236 //set it to the random number generator of the island 237 stochasticBranch.RandomParameter.ActualName = "LocalRandom"; 210 238 211 239 mutator.Name = "Mutator (placeholder)"; … … 214 242 subScopesRemover.RemoveAllSubScopes = true; 215 243 216 uniformSubScopesProcessor3.Parallel.Value = true;217 218 244 evaluator.Name = "Evaluator (placeholder)"; 219 245 evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name; 220 246 221 247 subScopesCounter.Name = "Increment EvaluatedSolutions"; 222 subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;248 subScopesCounter.ValueParameter.ActualName = IslandEvaluatedSolutions.Name; 223 249 224 250 bestSelector.CopySelected = new BoolValue(false); … … 227 253 bestSelector.QualityParameter.ActualName = QualityParameter.Name; 228 254 255 islandGenerationsCounter.Name = "Increment island generatrions"; 256 islandGenerationsCounter.ValueParameter.ActualName = IslandGenerations.Name; 257 islandGenerationsCounter.Increment = new IntValue(1); 258 259 checkIslandGenerationsReachedMaximum.LeftSideParameter.ActualName = IslandGenerations.Name; 260 checkIslandGenerationsReachedMaximum.RightSideParameter.ActualName = MigrationIntervalParameter.Name; 261 checkIslandGenerationsReachedMaximum.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 262 checkIslandGenerationsReachedMaximum.ResultParameter.ActualName = Migrate.Name; 263 264 checkContinueEvolution.Name = "Migrate?"; 265 checkContinueEvolution.ConditionParameter.ActualName = Migrate.Name; 266 checkContinueEvolution.FalseBranch = selector; 267 229 268 islandAnalyzer2.Name = "Island Analyzer (placeholder)"; 230 269 islandAnalyzer2.OperatorParameter.ActualName = IslandAnalyzerParameter.Name; 231 270 232 generationsCounter.Name = "Generations + 1"; 233 generationsCounter.Increment = new IntValue(1); 234 generationsCounter.ValueParameter.ActualName = "Generations"; 235 236 generationsSinceLastMigrationCounter.Name = "GenerationsSinceLastMigration + 1"; 237 generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration"; 238 generationsSinceLastMigrationCounter.Increment = new IntValue(1); 239 240 migrationComparator.Name = "GenerationsSinceLastMigration = MigrationInterval ?"; 241 migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 242 migrationComparator.Comparison = new Comparison(ComparisonType.Equal); 243 migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name; 244 migrationComparator.ResultParameter.ActualName = "Migrate"; 245 246 migrationBranch.Name = "Migrate?"; 247 migrationBranch.ConditionParameter.ActualName = "Migrate"; 248 249 resetGenerationsSinceLastMigrationAssigner.Name = "Reset GenerationsSinceLastMigration"; 250 resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration"; 251 resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0); 252 253 migrationsCounter.Name = "Migrations + 1"; 254 migrationsCounter.IncrementParameter.Value = new IntValue(1); 255 migrationsCounter.ValueParameter.ActualName = "Migrations"; 271 generationsReducer.Name = "Increment Generations"; 272 generationsReducer.ParameterToReduce.ActualName = islandGenerationsCounter.ValueParameter.ActualName; 273 generationsReducer.TargetParameter.ActualName = "Generations"; 274 generationsReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Min); 275 generationsReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum); 276 277 evaluatedSolutionsReducer.Name = "Increment Evaluated Solutions"; 278 evaluatedSolutionsReducer.ParameterToReduce.ActualName = IslandEvaluatedSolutions.Name; 279 evaluatedSolutionsReducer.TargetParameter.ActualName = EvaluatedSolutionsParameter.Name; 280 evaluatedSolutionsReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); 281 evaluatedSolutionsReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum); 256 282 257 283 emigrantsSelector.Name = "Emigrants Selector (placeholder)"; 258 284 emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name; 285 286 migrationsCounter.Name = "Increment number of Migrations"; 287 migrationsCounter.ValueParameter.ActualName = "Migrations"; 288 migrationsCounter.Increment = new IntValue(1); 259 289 260 290 migrator.Name = "Migrator (placeholder)"; … … 283 313 uniformSubScopesProcessor0.Successor = analyzer1; 284 314 islandVariableCreator.Successor = islandAnalyzer1; 285 islandAnalyzer1.Successor = null; 315 islandAnalyzer1.Successor = localRandomCreator; 316 localRandomCreator.Successor = null; 286 317 analyzer1.Successor = resultsCollector1; 287 318 resultsCollector1.Successor = uniformSubScopesProcessor1; 288 uniformSubScopesProcessor1.Operator = selector; 289 uniformSubScopesProcessor1.Successor = generationsCounter; 319 uniformSubScopesProcessor1.Operator = generationsAssigner; 320 uniformSubScopesProcessor1.Successor = generationsReducer; 321 generationsReducer.Successor = evaluatedSolutionsReducer; 322 evaluatedSolutionsReducer.Successor = migrationsCounter; 323 migrationsCounter.Successor = uniformSubScopesProcessor5; 324 generationsAssigner.Successor = evaluatedSolutionsAssigner; 325 evaluatedSolutionsAssigner.Successor = selector; 290 326 selector.Successor = subScopesProcessor1; 291 327 subScopesProcessor1.Operators.Add(new EmptyOperator()); … … 305 341 evaluator.Successor = null; 306 342 subScopesCounter.Successor = null; 343 subScopesCounter.Successor = null; 307 344 subScopesProcessor2.Operators.Add(bestSelector); 308 345 subScopesProcessor2.Operators.Add(new EmptyOperator()); 309 346 subScopesProcessor2.Successor = mergingReducer; 347 mergingReducer.Successor = islandAnalyzer2; 310 348 bestSelector.Successor = rightReducer; 311 349 rightReducer.Successor = null; 312 mergingReducer.Successor = null; 313 generationsCounter.Successor = uniformSubScopesProcessor4; 314 uniformSubScopesProcessor4.Operator = islandAnalyzer2; 315 uniformSubScopesProcessor4.Successor = generationsSinceLastMigrationCounter; 316 islandAnalyzer2.Successor = null; 317 generationsSinceLastMigrationCounter.Successor = migrationComparator; 318 migrationComparator.Successor = migrationBranch; 319 migrationBranch.TrueBranch = resetGenerationsSinceLastMigrationAssigner; 320 migrationBranch.FalseBranch = null; 321 migrationBranch.Successor = generationsComparator; 322 resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter; 323 migrationsCounter.Successor = uniformSubScopesProcessor5; 350 islandAnalyzer2.Successor = islandGenerationsCounter; 351 islandGenerationsCounter.Successor = checkIslandGenerationsReachedMaximum; 352 checkIslandGenerationsReachedMaximum.Successor = checkContinueEvolution; 324 353 uniformSubScopesProcessor5.Operator = emigrantsSelector; 354 emigrantsSelector.Successor = null; 325 355 uniformSubScopesProcessor5.Successor = migrator; 326 356 migrator.Successor = uniformSubScopesProcessor6; 327 357 uniformSubScopesProcessor6.Operator = immigrationReplacer; 328 uniformSubScopesProcessor6.Successor = null;358 uniformSubScopesProcessor6.Successor = generationsComparator; 329 359 generationsComparator.Successor = analyzer2; 330 360 analyzer2.Successor = generationsTerminationCondition; -
branches/HiveHiveEngine/HeuristicLab.Operators.Views/3.3/HeuristicLab.Operators.Views-3.3.csproj
r7393 r7401 141 141 <DependentUpon>OperatorView.cs</DependentUpon> 142 142 </Compile> 143 <Compile Include="Plugin.cs" /> 143 144 <Compile Include="ReductionOperationView.cs"> 144 145 <SubType>UserControl</SubType> … … 147 148 <DependentUpon>ReductionOperationView.cs</DependentUpon> 148 149 </Compile> 149 <Compile Include="Plugin.cs" />150 150 <Compile Include="ValuesCollectorView.cs"> 151 151 <SubType>UserControl</SubType> -
branches/HiveHiveEngine/HeuristicLab.Operators.Views/3.3/Plugin.cs.frame
r7259 r7401 30 30 [PluginDependency("HeuristicLab.Common", "3.3")] 31 31 [PluginDependency("HeuristicLab.Core", "3.3")] 32 [PluginDependency("HeuristicLab.Data", "3.3")] 32 33 [PluginDependency("HeuristicLab.Core.Views", "3.3")] 33 34 [PluginDependency("HeuristicLab.MainForm", "3.3")] -
branches/HiveHiveEngine/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r7394 r7401 118 118 <Compile Include="Assigner.cs" /> 119 119 <Compile Include="AlgorithmOperator.cs" /> 120 <Compile Include="DataReducer.cs" /> 120 121 <Compile Include="LocalRandomCreator.cs" /> 121 <Compile Include="DataReducer.cs" />122 <Compile Include="ReductionOperation.cs" />123 <Compile Include="ReductionOperations.cs" />124 122 <Compile Include="MultiOperator.cs" /> 125 123 <Compile Include="Operator.cs" /> … … 127 125 <Compile Include="IntCounter.cs" /> 128 126 <Compile Include="Plugin.cs" /> 127 <Compile Include="ReductionOperation.cs" /> 128 <Compile Include="ReductionOperations.cs" /> 129 129 <Compile Include="ScopeCleaner.cs" /> 130 130 <Compile Include="StochasticBranch.cs" /> -
branches/HiveHiveEngine/HeuristicLab.Optimizer/3.3/MenuItems/CloseMenuItem.cs
r7259 r7401 42 42 43 43 protected override void OnToolStripItemSet(EventArgs e) { 44 ToolStripItem.Enabled = !(MainFormManager.MainForm.ActiveView is Sidebar);44 ToolStripItem.Enabled = (MainFormManager.MainForm.ActiveView != null) && !(MainFormManager.MainForm.ActiveView is Sidebar); 45 45 } 46 46 protected override void OnActiveViewChanged(object sender, EventArgs e) { 47 ToolStripItem.Enabled = !(MainFormManager.MainForm.ActiveView is Sidebar);47 ToolStripItem.Enabled = (MainFormManager.MainForm.ActiveView != null) && !(MainFormManager.MainForm.ActiveView is Sidebar); 48 48 } 49 49 -
branches/HiveHiveEngine/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests merged: 7397
- Property svn:mergeinfo changed
-
branches/HiveHiveEngine/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r7259 r7401 502 502 ga.SetSeedRandomly.Value = false; 503 503 RunAlgorithm(ga); 504 Assert.AreEqual( 10469, GetDoubleResult(ga, "BestQuality"));505 Assert.AreEqual(1 1184.87, GetDoubleResult(ga, "CurrentAverageQuality"));506 Assert.AreEqual(1 3420, GetDoubleResult(ga, "CurrentWorstQuality"));504 Assert.AreEqual(9918, GetDoubleResult(ga, "BestQuality")); 505 Assert.AreEqual(10324.64, GetDoubleResult(ga, "CurrentAverageQuality")); 506 Assert.AreEqual(11823, GetDoubleResult(ga, "CurrentWorstQuality")); 507 507 Assert.AreEqual(495500, GetIntResult(ga, "EvaluatedSolutions")); 508 508 }
Note: See TracChangeset
for help on using the changeset viewer.