Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs @ 12848

Last change on this file since 12848 was 12848, checked in by mkommend, 9 years ago

#2175: Merged trunk changes and extracted parameters of evaluators to their base class.

File size: 3.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
35    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
36      get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
37    }
38    public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {
39      get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; }
40    }
41
42    public int DecimalPlaces {
43      get { return DecimalPlacesParameter.Value.Value; }
44      set { DecimalPlacesParameter.Value.Value = value; }
45    }
46    public bool UseConstantOptimization {
47      get { return UseConstantOptimizationParameter.Value.Value; }
48      set { UseConstantOptimizationParameter.Value.Value = value; }
49    }
50
51    [StorableConstructor]
52    protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
53    protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
54      : base(original, cloner) {
55    }
56
57    protected SymbolicRegressionMultiObjectiveEvaluator()
58      : base() {
59      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
60      Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
61    }
62
63    [StorableHook(HookType.AfterDeserialization)]
64    private void AfterDeserialization() {
65      if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
66        Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
67      }
68      if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
69        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
70      }
71    }
72  }
73}
Note: See TracBrowser for help on using the repository browser.