Changeset 11482 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs
- Timestamp:
- 10/21/14 01:31:20 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs
r11291 r11482 22 22 using HeuristicLab.Analysis; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Parameters; 24 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 … … 28 30 [StorableClass] 29 31 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 30 59 [StorableConstructor] 31 60 protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { } 32 61 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 33 70 public SymbolicDataAnalysisBottomUpDiversityAnalyzer() { 34 71 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))); 35 74 } 36 75 }
Note: See TracChangeset
for help on using the changeset viewer.