Changeset 3359 for trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm
- Timestamp:
- 04/15/10 19:01:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r3356 r3359 41 41 [StorableClass] 42 42 public sealed class IslandGeneticAlgorithm : EngineAlgorithm { 43 #region Fields44 [Storable]45 private IslandGeneticAlgorithmMainLoop mainLoop;46 [Storable]47 private SolutionsCreator solutionsCreator;48 [Storable]49 private RandomCreator randomCreator;50 #endregion51 43 52 44 #region Problem Properties … … 183 175 private List<ISelector> immigrationSelectors; 184 176 private List<IMigrator> migrators; 177 private RandomCreator RandomCreator { 178 get { return (RandomCreator)OperatorGraph.InitialOperator; } 179 } 180 private SolutionsCreator SolutionsCreator { 181 get { return (SolutionsCreator)((RandomCreator.Successor as SubScopesCreator).Successor as UniformSubScopesProcessor).Operator; } 182 } 183 private IslandGeneticAlgorithmMainLoop MainLoop { 184 get { return (IslandGeneticAlgorithmMainLoop)((RandomCreator.Successor as SubScopesCreator).Successor as UniformSubScopesProcessor).Successor; } 185 } 185 186 #endregion 186 187 … … 206 207 Parameters.Add(new ValueParameter<BoolValue>("Parallel", "True if the islands should be run in parallel (also requires a parallel engine)", new BoolValue(false))); 207 208 208 randomCreator = new RandomCreator();209 RandomCreator randomCreator = new RandomCreator(); 209 210 SubScopesCreator populationCreator = new SubScopesCreator(); 210 211 UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor(); 211 solutionsCreator = new SolutionsCreator();212 mainLoop = new IslandGeneticAlgorithmMainLoop();212 SolutionsCreator solutionsCreator = new SolutionsCreator(); 213 IslandGeneticAlgorithmMainLoop mainLoop = new IslandGeneticAlgorithmMainLoop(); 213 214 OperatorGraph.InitialOperator = randomCreator; 214 215 … … 351 352 } 352 353 private void ParameterizeSolutionsCreator() { 353 solutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;354 solutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;354 SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 355 SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 355 356 } 356 357 private void ParameterizeMainLoop() { 357 mainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;358 mainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;359 mainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;360 mainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;361 mainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;358 MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 359 MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 360 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 361 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 362 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name; 362 363 if (Problem.Visualizer != null) 363 mainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;364 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName; 364 365 } 365 366 private void ParameterizeStochasticOperator(IOperator op) { 366 367 if (op is IStochasticOperator) 367 ((IStochasticOperator)op).RandomParameter.ActualName = randomCreator.RandomParameter.ActualName;368 ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 368 369 } 369 370 private void InitializeSelectors() {
Note: See TracChangeset
for help on using the changeset viewer.