Changeset 3359


Ignore:
Timestamp:
04/15/10 19:01:30 (11 years ago)
Author:
abeham
Message:

Fixed bug in IslandGeneticAlgorithm #971
(updated TS workbench)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r3356 r3359  
    4141  [StorableClass]
    4242  public sealed class IslandGeneticAlgorithm : EngineAlgorithm {
    43     #region Fields
    44     [Storable]
    45     private IslandGeneticAlgorithmMainLoop mainLoop;
    46     [Storable]
    47     private SolutionsCreator solutionsCreator;
    48     [Storable]
    49     private RandomCreator randomCreator;
    50     #endregion
    5143
    5244    #region Problem Properties
     
    183175    private List<ISelector> immigrationSelectors;
    184176    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    }
    185186    #endregion
    186187
     
    206207      Parameters.Add(new ValueParameter<BoolValue>("Parallel", "True if the islands should be run in parallel (also requires a parallel engine)", new BoolValue(false)));
    207208
    208       randomCreator = new RandomCreator();
     209      RandomCreator randomCreator = new RandomCreator();
    209210      SubScopesCreator populationCreator = new SubScopesCreator();
    210211      UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor();
    211       solutionsCreator = new SolutionsCreator();
    212       mainLoop = new IslandGeneticAlgorithmMainLoop();
     212      SolutionsCreator solutionsCreator = new SolutionsCreator();
     213      IslandGeneticAlgorithmMainLoop mainLoop = new IslandGeneticAlgorithmMainLoop();
    213214      OperatorGraph.InitialOperator = randomCreator;
    214215
     
    351352    }
    352353    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;
    355356    }
    356357    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;
    362363      if (Problem.Visualizer != null)
    363         mainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;
     364        MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;
    364365    }
    365366    private void ParameterizeStochasticOperator(IOperator op) {
    366367      if (op is IStochasticOperator)
    367         ((IStochasticOperator)op).RandomParameter.ActualName = randomCreator.RandomParameter.ActualName;
     368        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    368369    }
    369370    private void InitializeSelectors() {
Note: See TracChangeset for help on using the changeset viewer.