#region License Information
/* HeuristicLab
* Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
[StorableClass]
public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator, ISymbolicRegressionMultiObjectiveEvaluator {
private const string DecimalPlacesParameterName = "Decimal Places";
private const string UseConstantOptimizationParameterName = "Use constant optimization";
private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
private const string ConstantOptimizationUpdateVariableWeightsParameterName =
"Constant optimization update variable weights";
public IFixedValueParameter DecimalPlacesParameter {
get { return (IFixedValueParameter)Parameters[DecimalPlacesParameterName]; }
}
public IFixedValueParameter UseConstantOptimizationParameter {
get { return (IFixedValueParameter)Parameters[UseConstantOptimizationParameterName]; }
}
public IFixedValueParameter ConstantOptimizationIterationsParameter {
get { return (IFixedValueParameter)Parameters[ConstantOptimizationIterationsParameterName]; }
}
public IFixedValueParameter ConstantOptimizationUpdateVariableWeightsParameter {
get { return (IFixedValueParameter)Parameters[ConstantOptimizationUpdateVariableWeightsParameterName]; }
}
public int DecimalPlaces {
get { return DecimalPlacesParameter.Value.Value; }
set { DecimalPlacesParameter.Value.Value = value; }
}
public bool UseConstantOptimization {
get { return UseConstantOptimizationParameter.Value.Value; }
set { UseConstantOptimizationParameter.Value.Value = value; }
}
public int ConstantOptimizationIterations {
get { return ConstantOptimizationIterationsParameter.Value.Value; }
set { ConstantOptimizationIterationsParameter.Value.Value = value; }
}
public bool ConstantOptimizationUpdateVariableWeights {
get { return ConstantOptimizationUpdateVariableWeightsParameter.Value.Value; }
set { ConstantOptimizationUpdateVariableWeightsParameter.Value.Value = value; }
}
[StorableConstructor]
protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
: base(original, cloner) {
}
protected SymbolicRegressionMultiObjectiveEvaluator()
: base() {
Parameters.Add(new FixedValueParameter(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
Parameters.Add(new FixedValueParameter(UseConstantOptimizationParameterName, "", new BoolValue(false)));
Parameters.Add(new FixedValueParameter(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
Parameters.Add(new FixedValueParameter(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)));
}
[StorableHook(HookType.AfterDeserialization)]
private void AfterDeserialization() {
if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
Parameters.Add(new FixedValueParameter(UseConstantOptimizationParameterName, "", new BoolValue(false)));
}
if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
Parameters.Add(new FixedValueParameter(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
}
if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
Parameters.Add(new FixedValueParameter(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
}
if (!Parameters.ContainsKey(ConstantOptimizationUpdateVariableWeightsParameterName)) {
Parameters.Add(new FixedValueParameter(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)));
}
}
}
}