Changeset 9039 for trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm
- Timestamp:
- 12/12/12 13:46:18 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r8255 r9039 181 181 } 182 182 private UniformSubScopesProcessor IslandProcessor { 183 get { return ((RandomCreator.Successor as SubScopesCreator).Successor as UniformSubScopesProcessor); }183 get { return OperatorGraph.Iterate().OfType<UniformSubScopesProcessor>().First(x => x.Operator is SolutionsCreator); } 184 184 } 185 185 private SolutionsCreator SolutionsCreator { … … 232 232 233 233 RandomCreator randomCreator = new RandomCreator(); 234 UniformSubScopesProcessor ussp0 = new UniformSubScopesProcessor(); 235 LocalRandomCreator localRandomCreator = new LocalRandomCreator(); 236 RandomCreator globalRandomResetter = new RandomCreator(); 234 237 SubScopesCreator populationCreator = new SubScopesCreator(); 235 238 UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor(); … … 250 253 251 254 populationCreator.NumberOfSubScopesParameter.ActualName = NumberOfIslandsParameter.Name; 252 populationCreator.Successor = ussp1; 255 populationCreator.Successor = ussp0; 256 257 ussp0.Operator = localRandomCreator; 258 ussp0.Successor = globalRandomResetter; 259 260 // BackwardsCompatibility3.3 261 // the global random is resetted to ensure the same algorithm results 262 #region Backwards compatible code, remove with 3.4 263 globalRandomResetter.RandomParameter.ActualName = "GlobalRandom"; 264 globalRandomResetter.SeedParameter.ActualName = SeedParameter.Name; 265 globalRandomResetter.SeedParameter.Value = null; 266 globalRandomResetter.SetSeedRandomlyParameter.Value = new BoolValue(false); 267 globalRandomResetter.Successor = ussp1; 268 #endregion 253 269 254 270 ussp1.Operator = solutionsCreator; … … 325 341 protected override void OnProblemChanged() { 326 342 ParameterizeStochasticOperator(Problem.SolutionCreator); 327 ParameterizeStochasticOperator (Problem.Evaluator);343 ParameterizeStochasticOperatorForIsland(Problem.Evaluator); 328 344 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 329 345 ParameterizeSolutionsCreator(); … … 345 361 } 346 362 protected override void Problem_EvaluatorChanged(object sender, EventArgs e) { 347 ParameterizeStochasticOperator (Problem.Evaluator);363 ParameterizeStochasticOperatorForIsland(Problem.Evaluator); 348 364 ParameterizeSolutionsCreator(); 349 365 ParameterizeMainLoop(); -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r7395 r9039 313 313 uniformSubScopesProcessor0.Successor = analyzer1; 314 314 islandVariableCreator.Successor = islandAnalyzer1; 315 // BackwardsCompatibility3.3 316 //the local randoms are created by the island GA itself and are only here to ensure same algorithm results 317 #region Backwards compatible code, remove with 3.4 315 318 islandAnalyzer1.Successor = localRandomCreator; 316 319 localRandomCreator.Successor = null; 320 #endregion 317 321 analyzer1.Successor = resultsCollector1; 318 322 resultsCollector1.Successor = uniformSubScopesProcessor1;
Note: See TracChangeset
for help on using the changeset viewer.