Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/13 10:52:38 (10 years ago)
Author:
mkommend
Message:

#1997: Worked on symbolic data analysis island algorithms:

  • Refactored and removed unnecessary code in symbolic island GA and symbolic island GA evaluator.
  • Added EnumerableItem to ease the passing of rows to the actual evaluator.
  • Added prototype of island offspring selection GA.
  • Corrected build configuration (plugin classes, project settings, ...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r9756 r10142  
    4141  [Creatable("Algorithms")]
    4242  [StorableClass]
    43   public sealed class IslandGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
     43  public class IslandGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
    4444    public string Filename { get; set; }
    4545
     
    5555
    5656    #region Parameter Properties
    57     private ValueParameter<IntValue> SeedParameter {
     57    protected ValueParameter<IntValue> SeedParameter {
    5858      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
    5959    }
    60     private ValueParameter<BoolValue> SetSeedRandomlyParameter {
     60    protected ValueParameter<BoolValue> SetSeedRandomlyParameter {
    6161      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
    6262    }
    63     private ValueParameter<IntValue> NumberOfIslandsParameter {
     63    protected ValueParameter<IntValue> NumberOfIslandsParameter {
    6464      get { return (ValueParameter<IntValue>)Parameters["NumberOfIslands"]; }
    6565    }
    66     private ValueParameter<IntValue> MigrationIntervalParameter {
     66    protected ValueParameter<IntValue> MigrationIntervalParameter {
    6767      get { return (ValueParameter<IntValue>)Parameters["MigrationInterval"]; }
    6868    }
    69     private ValueParameter<PercentValue> MigrationRateParameter {
     69    protected ValueParameter<PercentValue> MigrationRateParameter {
    7070      get { return (ValueParameter<PercentValue>)Parameters["MigrationRate"]; }
    7171    }
     
    7979      get { return (IConstrainedValueParameter<IReplacer>)Parameters["ImmigrationReplacer"]; }
    8080    }
    81     private ValueParameter<IntValue> PopulationSizeParameter {
     81    protected ValueParameter<IntValue> PopulationSizeParameter {
    8282      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    8383    }
    84     private ValueParameter<IntValue> MaximumGenerationsParameter {
     84    protected ValueParameter<IntValue> MaximumGenerationsParameter {
    8585      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
    8686    }
     
    9191      get { return (IConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
    9292    }
    93     private ValueParameter<PercentValue> MutationProbabilityParameter {
     93    protected ValueParameter<PercentValue> MutationProbabilityParameter {
    9494      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
    9595    }
     
    9797      get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    9898    }
    99     private ValueParameter<IntValue> ElitesParameter {
     99    protected ValueParameter<IntValue> ElitesParameter {
    100100      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    101101    }
    102     private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     102    protected IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
    103103      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
    104104    }
    105     private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     105    protected ValueParameter<MultiAnalyzer> AnalyzerParameter {
    106106      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    107107    }
    108     private ValueParameter<MultiAnalyzer> IslandAnalyzerParameter {
     108    protected ValueParameter<MultiAnalyzer> IslandAnalyzerParameter {
    109109      get { return (ValueParameter<MultiAnalyzer>)Parameters["IslandAnalyzer"]; }
    110110    }
     
    184184      set { IslandAnalyzerParameter.Value = value; }
    185185    }
    186     private RandomCreator RandomCreator {
     186    protected RandomCreator RandomCreator {
    187187      get { return (RandomCreator)OperatorGraph.InitialOperator; }
    188188    }
    189     private UniformSubScopesProcessor IslandProcessor {
     189    protected UniformSubScopesProcessor IslandProcessor {
    190190      get { return OperatorGraph.Iterate().OfType<UniformSubScopesProcessor>().First(x => x.Operator is SolutionsCreator); }
    191191    }
    192     private SolutionsCreator SolutionsCreator {
     192    protected SolutionsCreator SolutionsCreator {
    193193      get { return (SolutionsCreator)IslandProcessor.Operator; }
    194194    }
    195     private IslandGeneticAlgorithmMainLoop MainLoop {
     195    protected IslandGeneticAlgorithmMainLoop MainLoop {
    196196      get { return FindMainLoop(IslandProcessor.Successor); }
    197197    }
    198198    [Storable]
    199     private BestAverageWorstQualityAnalyzer islandQualityAnalyzer;
     199    protected BestAverageWorstQualityAnalyzer islandQualityAnalyzer;
    200200    [Storable]
    201     private BestAverageWorstQualityAnalyzer qualityAnalyzer;
     201    protected BestAverageWorstQualityAnalyzer qualityAnalyzer;
    202202    #endregion
    203203
    204204    [StorableConstructor]
    205     private IslandGeneticAlgorithm(bool deserializing) : base(deserializing) { }
     205    protected IslandGeneticAlgorithm(bool deserializing) : base(deserializing) { }
    206206    [StorableHook(HookType.AfterDeserialization)]
    207207    private void AfterDeserialization() {
     
    215215      Initialize();
    216216    }
    217     private IslandGeneticAlgorithm(IslandGeneticAlgorithm original, Cloner cloner)
     217    protected IslandGeneticAlgorithm(IslandGeneticAlgorithm original, Cloner cloner)
    218218      : base(original, cloner) {
    219219      islandQualityAnalyzer = cloner.Clone(original.islandQualityAnalyzer);
     
    422422
    423423    #region Helpers
    424     private void Initialize() {
     424    protected virtual void Initialize() {
    425425      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
    426426      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
     
    433433      }
    434434    }
    435     private void ParameterizeSolutionsCreator() {
     435    protected virtual void ParameterizeSolutionsCreator() {
    436436      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    437437      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
    438438    }
    439     private void ParameterizeMainLoop() {
     439    protected virtual void ParameterizeMainLoop() {
    440440      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
    441441      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
     
    443443      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    444444    }
    445     private void ParameterizeStochasticOperator(IOperator op) {
     445    protected virtual void ParameterizeStochasticOperator(IOperator op) {
    446446      IStochasticOperator stochasticOp = op as IStochasticOperator;
    447447      if (stochasticOp != null) {
     
    450450      }
    451451    }
    452     private void ParameterizeStochasticOperatorForIsland(IOperator op) {
     452    protected virtual void ParameterizeStochasticOperatorForIsland(IOperator op) {
    453453      IStochasticOperator stochasticOp = op as IStochasticOperator;
    454454      if (stochasticOp != null) {
     
    457457      }
    458458    }
    459     private void ParameterizeSelectors() {
     459    protected virtual void ParameterizeSelectors() {
    460460      foreach (ISelector selector in SelectorParameter.ValidValues) {
    461461        selector.CopySelected = new BoolValue(true);
     
    494494      }
    495495    }
    496     private void ParameterizeAnalyzers() {
     496    protected virtual void ParameterizeAnalyzers() {
    497497      islandQualityAnalyzer.ResultsParameter.ActualName = "Results";
    498498      islandQualityAnalyzer.ResultsParameter.Hidden = true;
     
    517517      }
    518518    }
    519     private void ParameterizeIterationBasedOperators() {
     519    protected virtual void ParameterizeIterationBasedOperators() {
    520520      if (Problem != null) {
    521521        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
     
    527527      }
    528528    }
    529     private void UpdateCrossovers() {
     529    protected virtual void UpdateCrossovers() {
    530530      ICrossover oldCrossover = CrossoverParameter.Value;
    531531      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
     
    543543        CrossoverParameter.Value = defaultCrossover;
    544544    }
    545     private void UpdateMutators() {
     545    protected virtual void UpdateMutators() {
    546546      IManipulator oldMutator = MutatorParameter.Value;
    547547      MutatorParameter.ValidValues.Clear();
     
    555555      }
    556556    }
    557     private void UpdateAnalyzers() {
     557    protected virtual void UpdateAnalyzers() {
    558558      IslandAnalyzer.Operators.Clear();
    559559      Analyzer.Operators.Clear();
     
    568568      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
    569569    }
    570     private IslandGeneticAlgorithmMainLoop FindMainLoop(IOperator start) {
     570    protected virtual IslandGeneticAlgorithmMainLoop FindMainLoop(IOperator start) {
    571571      IOperator mainLoop = start;
    572572      while (mainLoop != null && !(mainLoop is IslandGeneticAlgorithmMainLoop))
Note: See TracChangeset for help on using the changeset viewer.