Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RemoveBackwardsCompatibility/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs @ 16755

Last change on this file since 16755 was 13241, checked in by gkronber, 9 years ago

#2175: merged all changes from branch to trunk (preserving the original .csproj-files so that I don't have to change reference and output paths)

File size: 4.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 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;
28
29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
30  [StorableClass]
31  public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator {
32    private const string DecimalPlacesParameterName = "Decimal Places";
33    private const string UseConstantOptimizationParameterName = "Use constant optimization";
34    private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
35
36    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
37      get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
38    }
39    public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {
40      get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; }
41    }
42
43    public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
44      get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
45    }
46
47
48    public int DecimalPlaces {
49      get { return DecimalPlacesParameter.Value.Value; }
50      set { DecimalPlacesParameter.Value.Value = value; }
51    }
52    public bool UseConstantOptimization {
53      get { return UseConstantOptimizationParameter.Value.Value; }
54      set { UseConstantOptimizationParameter.Value.Value = value; }
55    }
56    public int ConstantOptimizationIterations {
57      get { return ConstantOptimizationIterationsParameter.Value.Value; }
58      set { ConstantOptimizationIterationsParameter.Value.Value = value; }
59    }
60
61    [StorableConstructor]
62    protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
63    protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
64      : base(original, cloner) {
65    }
66
67    protected SymbolicRegressionMultiObjectiveEvaluator()
68      : base() {
69      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
70      Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
71      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
72    }
73
74    [StorableHook(HookType.AfterDeserialization)]
75    private void AfterDeserialization() {
76      if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
77        Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
78      }
79      if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
80        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
81      }
82      if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
83        Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
84      }
85    }
86  }
87}
Note: See TracBrowser for help on using the repository browser.