Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveSplittingEvaluator.cs @ 17627

Last change on this file since 17627 was 17627, checked in by chaider, 4 years ago

#3076

  • Added abstract class for splitting parameters
  • Fixed formatting
File size: 3.2 KB
Line 
1using HEAL.Attic;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Data;
5using HeuristicLab.Parameters;
6
7namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
8  [StorableType("4CFC2616-9B32-40EE-BAE7-25E8BFBAF5BC")]
9  public abstract class
10    SymbolicRegressionMultiObjectiveSplittingEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
11    private const string MinSplittingWidthParameterName    = "Minimum splitting width";
12    private const string MaxSplittingDepthParameterName    = "Maximum splitting depth";
13    private const string UseIntervalSplittingParameterName = "Use interval splitting";
14
15    public IFixedValueParameter<IntValue> MinSplittingWidthParameter =>
16      (IFixedValueParameter<IntValue>) Parameters[MinSplittingWidthParameterName];
17
18    public IFixedValueParameter<IntValue> MaxSplittingDepthParameter =>
19      (IFixedValueParameter<IntValue>) Parameters[MaxSplittingDepthParameterName];
20
21    public IFixedValueParameter<BoolValue> UseIntervalSplittingParameter =>
22      (IFixedValueParameter<BoolValue>) Parameters[UseIntervalSplittingParameterName];
23
24    public int MinSplittingWidth {
25      get => MinSplittingWidthParameter.Value.Value;
26      set => MinSplittingWidthParameter.Value.Value = value;
27    }
28
29    public int MaxSplittingDepth {
30      get => MaxSplittingDepthParameter.Value.Value;
31      set => MaxSplittingDepthParameter.Value.Value = value;
32    }
33
34    public bool UseIntervalSplitting {
35      get => UseIntervalSplittingParameter.Value.Value;
36      set => UseIntervalSplittingParameter.Value.Value = value;
37    }
38
39    [StorableConstructor]
40    protected SymbolicRegressionMultiObjectiveSplittingEvaluator(StorableConstructorFlag _) : base(_) { }
41
42    protected SymbolicRegressionMultiObjectiveSplittingEvaluator(
43      SymbolicRegressionMultiObjectiveSplittingEvaluator original, Cloner cloner) : base(original, cloner) { }
44
45    protected SymbolicRegressionMultiObjectiveSplittingEvaluator() {
46      Parameters.Add(new FixedValueParameter<IntValue>(MinSplittingWidthParameterName,
47        "The minimum interval width before the splitting ends.", new IntValue(0)));
48      Parameters.Add(new FixedValueParameter<IntValue>(MaxSplittingDepthParameterName,
49        "The maximum recursion depth before the splitting ends.", new IntValue(5)));
50      Parameters.Add(new FixedValueParameter<BoolValue>(UseIntervalSplittingParameterName, "", new BoolValue(false)));
51    }
52
53    [StorableHook(HookType.AfterDeserialization)]
54    private void AfterDeserialization() {
55      if (!Parameters.ContainsKey(MinSplittingWidthParameterName)) {
56        Parameters.Add(new FixedValueParameter<IntValue>(MinSplittingWidthParameterName,
57          "The minimum interval width before the splitting ends.", new IntValue(0)));
58      }
59
60      if (!Parameters.ContainsKey(MaxSplittingDepthParameterName)) {
61        Parameters.Add(new FixedValueParameter<IntValue>(MaxSplittingDepthParameterName,
62          "The maximum recursion depth before the splitting ends.", new IntValue(5)));
63      }
64
65      if (!Parameters.ContainsKey(UseIntervalSplittingParameterName)) {
66        Parameters.Add(new FixedValueParameter<BoolValue>(UseIntervalSplittingParameterName, "", new BoolValue(false)));
67      }
68    }
69  }
70}
Note: See TracBrowser for help on using the repository browser.