Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/06/15 16:39:55 (9 years ago)
Author:
bburlacu
Message:

#1772: Added storable attributes to the before/after evolution tracking operators in HeuristicLab.Problems.DataAnalysis.Symbolic. Very small changes to the trace calculator (updated license header, removed old sample count code).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs

    r12155 r12287  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Data;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
     
    2931  [StorableClass]
    3032  public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : PopulationSimilarityAnalyzer {
     33    private const string MatchConstantValuesParameterName = "MatchConstantValues";
     34    private const string MatchVariableWeightsParameterName = "MatchVariableWeights";
     35
     36    public IFixedValueParameter<BoolValue> MatchConstantValuesParameter {
     37      get { return (IFixedValueParameter<BoolValue>)Parameters[MatchConstantValuesParameterName]; }
     38    }
     39
     40    public IFixedValueParameter<BoolValue> MatchVariableWeightsParameter {
     41      get { return (IFixedValueParameter<BoolValue>)Parameters[MatchVariableWeightsParameterName]; }
     42    }
     43
     44    public bool MatchConstantValues {
     45      get { return MatchConstantValuesParameter.Value.Value; }
     46      set {
     47        MatchConstantValuesParameter.Value.Value = value;
     48
     49      }
     50    }
     51
     52    public bool MatchVariableWeights {
     53      get { return MatchVariableWeightsParameter.Value.Value; }
     54      set {
     55        MatchVariableWeightsParameter.Value.Value = value;
     56      }
     57    }
     58
    3159    [StorableConstructor]
    3260    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { }
     
    4472      DiversityResultName = "Genotypic Diversity";
    4573      UpdateCounterParameter.ActualName = "GenotypicDiversityAnalyzerUpdateCounter";
     74
     75      Parameters.Add(new FixedValueParameter<BoolValue>(MatchConstantValuesParameterName, new BoolValue(true)));
     76      Parameters.Add(new FixedValueParameter<BoolValue>(MatchVariableWeightsParameterName, new BoolValue(true)));
     77    }
     78
     79    public override IOperation Apply() {
     80      var bus = (SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculatorParameter.Value;
     81      bus.MatchConstantValues = MatchConstantValues;
     82      bus.MatchVariableWeights = MatchVariableWeights;
     83      return base.Apply();
    4684    }
    4785  }
Note: See TracChangeset for help on using the changeset viewer.