Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/21/14 01:31:20 (10 years ago)
Author:
bburlacu
Message:

#1772: Added the ability to ignore variable weights or constant values to the BottomUpSimilarityCalculator and added parameters to the SymbolicDataAnalysisBottomUpDiversityAnalyzer. Added separate methods in the MaxCommonSubtreeSimilarityCalculator for performing matching with full subtrees (including all leaves) or without (like the old - and better - behavior).

File:
1 edited

Legend:

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

    r11291 r11482  
    2222using HeuristicLab.Analysis;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Parameters;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
     
    2830  [StorableClass]
    2931  public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : SingleObjectivePopulationDiversityAnalyzer {
     32    private const string MatchConstantValuesParameterName = "MatchConstantValues";
     33    private const string MatchVariableWeightsParameterName = "MatchVariableWeights";
     34
     35    public IValueParameter<BoolValue> MatchVariableWeightsParameter {
     36      get { return (IValueParameter<BoolValue>)Parameters[MatchVariableWeightsParameterName]; }
     37    }
     38
     39    public IValueParameter<BoolValue> MatchConstantValuesParameter {
     40      get { return (IValueParameter<BoolValue>)Parameters[MatchConstantValuesParameterName]; }
     41    }
     42
     43    public bool MatchConstantValues {
     44      get { return MatchConstantValuesParameter.Value.Value; }
     45      set {
     46        MatchConstantValuesParameter.Value.Value = value;
     47        ((BottomUpSimilarityCalculator)SimilarityCalculator).MatchConstantValues = value;
     48      }
     49    }
     50
     51    public bool MatchVariableWeights {
     52      get { return MatchVariableWeightsParameter.Value.Value; }
     53      set {
     54        MatchVariableWeightsParameter.Value.Value = value;
     55        ((BottomUpSimilarityCalculator)SimilarityCalculator).MatchVariableWeights = value;
     56      }
     57    }
     58
    3059    [StorableConstructor]
    3160    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { }
    3261
     62    [StorableHook(HookType.AfterDeserialization)]
     63    private void AfterDeserialization() {
     64      if (!Parameters.ContainsKey(MatchConstantValuesParameterName))
     65        Parameters.Add(new ValueParameter<BoolValue>(MatchConstantValuesParameterName, "Specifies if the similarity calculator should match constant values.", new BoolValue(true)));
     66      if (!Parameters.ContainsKey(MatchVariableWeightsParameterName))
     67        Parameters.Add(new ValueParameter<BoolValue>(MatchVariableWeightsParameterName, "Specifies if the similarity calculator should match variable weights", new BoolValue(true)));
     68    }
     69
    3370    public SymbolicDataAnalysisBottomUpDiversityAnalyzer() {
    3471      SimilarityCalculator = new BottomUpSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" };
     72      Parameters.Add(new ValueParameter<BoolValue>(MatchConstantValuesParameterName, "Specifies if the similarity calculator should match constant values.", new BoolValue(true)));
     73      Parameters.Add(new ValueParameter<BoolValue>(MatchVariableWeightsParameterName, "Specifies if the similarity calculator should match variable weights", new BoolValue(true)));
    3574    }
    3675  }
Note: See TracChangeset for help on using the changeset viewer.