Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs

Last change on this file was 18132, checked in by gkronber, 3 years ago

#3140: merged r18091:18131 from branch to trunk

File size: 6.8 KB
RevLine 
[5500]1#region License Information
2/* HeuristicLab
[17180]3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[5500]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;
[13241]24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Parameters;
[16565]27using HEAL.Attic;
[13241]28
[5500]29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
[16565]30  [StorableType("1BEEE472-95E7-45C3-BD47-883B5E3A672D")]
[5509]31  public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator {
[13241]32    private const string DecimalPlacesParameterName = "Decimal Places";
[18132]33    private const string UseParameterOptimizationParameterName = "Use parameter optimization";
34    private const string ParameterOptimizationIterationsParameterName = "Parameter optimization iterations";
[13241]35
[18132]36    private const string ParameterOptimizationUpdateVariableWeightsParameterName =
37      "Parameter optimization update variable weights";
[13670]38
[13241]39    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
40      get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
41    }
[18132]42    public IFixedValueParameter<BoolValue> UseParameterOptimizationParameter {
43      get { return (IFixedValueParameter<BoolValue>)Parameters[UseParameterOptimizationParameterName]; }
[13241]44    }
45
[18132]46    public IFixedValueParameter<IntValue> ParameterOptimizationIterationsParameter {
47      get { return (IFixedValueParameter<IntValue>)Parameters[ParameterOptimizationIterationsParameterName]; }
[13241]48    }
49
[18132]50    public IFixedValueParameter<BoolValue> ParameterOptimizationUpdateVariableWeightsParameter {
51      get { return (IFixedValueParameter<BoolValue>)Parameters[ParameterOptimizationUpdateVariableWeightsParameterName]; }
[13670]52    }
[13241]53
54    public int DecimalPlaces {
55      get { return DecimalPlacesParameter.Value.Value; }
56      set { DecimalPlacesParameter.Value.Value = value; }
57    }
[18132]58    public bool UseParameterOptimization {
59      get { return UseParameterOptimizationParameter.Value.Value; }
60      set { UseParameterOptimizationParameter.Value.Value = value; }
[13241]61    }
[18132]62    public int ParameterOptimizationIterations {
63      get { return ParameterOptimizationIterationsParameter.Value.Value; }
64      set { ParameterOptimizationIterationsParameter.Value.Value = value; }
[13241]65    }
[18132]66    public bool ParameterOptimizationUpdateVariableWeights {
67      get { return ParameterOptimizationUpdateVariableWeightsParameter.Value.Value; }
68      set { ParameterOptimizationUpdateVariableWeightsParameter.Value.Value = value; }
[13670]69    }
[13241]70
[5500]71    [StorableConstructor]
[16565]72    protected SymbolicRegressionMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
[5500]73    protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
74      : base(original, cloner) {
75    }
76
[13241]77    protected SymbolicRegressionMultiObjectiveEvaluator()
78      : base() {
79      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
[18132]80      Parameters.Add(new FixedValueParameter<BoolValue>(UseParameterOptimizationParameterName, "", new BoolValue(false)));
81      Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptimizationIterationsParameterName, "The number of iterations parameter optimization should be applied.", new IntValue(5)));
82      Parameters.Add(new FixedValueParameter<BoolValue>(ParameterOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during parameter optimization.", new BoolValue(true)) { Hidden = true });
[13241]83    }
84
85    [StorableHook(HookType.AfterDeserialization)]
86    private void AfterDeserialization() {
[18132]87      if (!Parameters.ContainsKey(UseParameterOptimizationParameterName)) {
88        if (Parameters.ContainsKey("Use constant optimization")) {
89          Parameters.Add(new FixedValueParameter<BoolValue>(UseParameterOptimizationParameterName, "", (BoolValue)Parameters["Use constant optimization"].ActualValue));
90          Parameters.Remove("Use constant optimization");
91        } else {
92          Parameters.Add(new FixedValueParameter<BoolValue>(UseParameterOptimizationParameterName, "", new BoolValue(false)));
93        }
[13241]94      }
[18132]95
[13241]96      if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
97        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
98      }
[18132]99      if (!Parameters.ContainsKey(ParameterOptimizationIterationsParameterName)) {
100        if (Parameters.ContainsKey("Constant optimization iterations")) {
101          Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptimizationIterationsParameterName, "The number of iterations parameter optimization should be applied.", (IntValue)Parameters["Constant optimization iterations"].ActualValue));
102          Parameters.Remove("Constant optimization iterations");
103        } else {
104          Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptimizationIterationsParameterName, "The number of iterations parameter optimization should be applied.", new IntValue(5)));
105        }
[13241]106      }
[18132]107      if (!Parameters.ContainsKey(ParameterOptimizationUpdateVariableWeightsParameterName)) {
108        if (Parameters.ContainsKey("Constant optimization update variable weights")) {
109          Parameters.Add(new FixedValueParameter<BoolValue>(ParameterOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during parameter optimization.",
110            (BoolValue)Parameters["Constant optimization update variable weights"].ActualValue));
111          Parameters.Remove("Constant optimization update variable weights");
112        } else {
113          Parameters.Add(new FixedValueParameter<BoolValue>(ParameterOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during parameter optimization.", new BoolValue(true)));
114        }
[13670]115      }
[13241]116    }
[5500]117  }
118}
Note: See TracBrowser for help on using the repository browser.