[5500] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[14186] | 3 | * Copyright (C) 2002-2016 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 |
|
---|
| 23 | using HeuristicLab.Common;
|
---|
[13310] | 24 | using HeuristicLab.Core;
|
---|
| 25 | using HeuristicLab.Data;
|
---|
| 26 | using HeuristicLab.Parameters;
|
---|
[5500] | 27 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[13310] | 28 |
|
---|
[5500] | 29 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
|
---|
[13310] | 30 | [StorableClass]
|
---|
[5509] | 31 | public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator {
|
---|
[13310] | 32 | private const string DecimalPlacesParameterName = "Decimal Places";
|
---|
| 33 | private const string UseConstantOptimizationParameterName = "Use constant optimization";
|
---|
| 34 | private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
|
---|
| 35 |
|
---|
[14004] | 36 | private const string ConstantOptimizationUpdateVariableWeightsParameterName =
|
---|
| 37 | "Constant optimization update variable weights";
|
---|
| 38 |
|
---|
[13310] | 39 | public IFixedValueParameter<IntValue> DecimalPlacesParameter {
|
---|
| 40 | get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
|
---|
| 41 | }
|
---|
| 42 | public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {
|
---|
| 43 | get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; }
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
|
---|
| 47 | get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
[14004] | 50 | public IFixedValueParameter<BoolValue> ConstantOptimizationUpdateVariableWeightsParameter {
|
---|
| 51 | get { return (IFixedValueParameter<BoolValue>)Parameters[ConstantOptimizationUpdateVariableWeightsParameterName]; }
|
---|
| 52 | }
|
---|
[13310] | 53 |
|
---|
| 54 | public int DecimalPlaces {
|
---|
| 55 | get { return DecimalPlacesParameter.Value.Value; }
|
---|
| 56 | set { DecimalPlacesParameter.Value.Value = value; }
|
---|
| 57 | }
|
---|
| 58 | public bool UseConstantOptimization {
|
---|
| 59 | get { return UseConstantOptimizationParameter.Value.Value; }
|
---|
| 60 | set { UseConstantOptimizationParameter.Value.Value = value; }
|
---|
| 61 | }
|
---|
| 62 | public int ConstantOptimizationIterations {
|
---|
| 63 | get { return ConstantOptimizationIterationsParameter.Value.Value; }
|
---|
| 64 | set { ConstantOptimizationIterationsParameter.Value.Value = value; }
|
---|
| 65 | }
|
---|
[14004] | 66 | public bool ConstantOptimizationUpdateVariableWeights {
|
---|
| 67 | get { return ConstantOptimizationUpdateVariableWeightsParameter.Value.Value; }
|
---|
| 68 | set { ConstantOptimizationUpdateVariableWeightsParameter.Value.Value = value; }
|
---|
| 69 | }
|
---|
[13310] | 70 |
|
---|
[5500] | 71 | [StorableConstructor]
|
---|
| 72 | protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
|
---|
| 73 | protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
|
---|
| 74 | : base(original, cloner) {
|
---|
| 75 | }
|
---|
| 76 |
|
---|
[13310] | 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 });
|
---|
| 80 | Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
|
---|
| 81 | Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
|
---|
[14004] | 82 | 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 });
|
---|
[13310] | 83 | }
|
---|
| 84 |
|
---|
| 85 | [StorableHook(HookType.AfterDeserialization)]
|
---|
| 86 | private void AfterDeserialization() {
|
---|
| 87 | if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
|
---|
| 88 | Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
|
---|
| 89 | }
|
---|
| 90 | if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
|
---|
| 91 | Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
|
---|
| 92 | }
|
---|
| 93 | if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
|
---|
| 94 | Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
|
---|
| 95 | }
|
---|
[14004] | 96 | if (!Parameters.ContainsKey(ConstantOptimizationUpdateVariableWeightsParameterName)) {
|
---|
| 97 | Parameters.Add(new FixedValueParameter<BoolValue>(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)));
|
---|
| 98 | }
|
---|
[13310] | 99 | }
|
---|
[5500] | 100 | }
|
---|
| 101 | }
|
---|