Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs @ 16628

Last change on this file since 16628 was 16628, checked in by gkronber, 5 years ago

#2971: made branch compile with current version of trunk

File size: 5.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Parameters;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HEAL.Attic;
29
30namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
31  [StorableType("3CE012DD-41E9-4C6E-9BAE-EB3AD8AC9F32")]
32  public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator {
33    private const string DecimalPlacesParameterName = "Decimal Places";
34    private const string UseConstantOptimizationParameterName = "Use constant optimization";
35    private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
36
37    private const string ConstantOptimizationUpdateVariableWeightsParameterName =
38      "Constant optimization update variable weights";
39
40    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
41      get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
42    }
43    public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {
44      get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; }
45    }
46
47    public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
48      get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
49    }
50
51    public IFixedValueParameter<BoolValue> ConstantOptimizationUpdateVariableWeightsParameter {
52      get { return (IFixedValueParameter<BoolValue>)Parameters[ConstantOptimizationUpdateVariableWeightsParameterName]; }
53    }
54
55    public int DecimalPlaces {
56      get { return DecimalPlacesParameter.Value.Value; }
57      set { DecimalPlacesParameter.Value.Value = value; }
58    }
59    public bool UseConstantOptimization {
60      get { return UseConstantOptimizationParameter.Value.Value; }
61      set { UseConstantOptimizationParameter.Value.Value = value; }
62    }
63    public int ConstantOptimizationIterations {
64      get { return ConstantOptimizationIterationsParameter.Value.Value; }
65      set { ConstantOptimizationIterationsParameter.Value.Value = value; }
66    }
67    public bool ConstantOptimizationUpdateVariableWeights {
68      get { return ConstantOptimizationUpdateVariableWeightsParameter.Value.Value; }
69      set { ConstantOptimizationUpdateVariableWeightsParameter.Value.Value = value; }
70    }
71
72    [StorableConstructor]
73    protected SymbolicRegressionMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
74    protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
75      : base(original, cloner) {
76    }
77
78    protected SymbolicRegressionMultiObjectiveEvaluator()
79      : base() {
80      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
81      Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
82      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
83      Parameters.Add(new FixedValueParameter<BoolValue>(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)) { Hidden = true });
84    }
85
86    [StorableHook(HookType.AfterDeserialization)]
87    private void AfterDeserialization() {
88      if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
89        Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
90      }
91      if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
92        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
93      }
94      if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
95        Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
96      }
97      if (!Parameters.ContainsKey(ConstantOptimizationUpdateVariableWeightsParameterName)) {
98        Parameters.Add(new FixedValueParameter<BoolValue>(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)));
99      }
100    }
101  }
102}
Note: See TracBrowser for help on using the repository browser.