1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2011 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 | using HeuristicLab.Common;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
26 | using HeuristicLab.Parameters;
|
---|
27 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
28 |
|
---|
29 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
|
---|
30 | /// <summary>
|
---|
31 | /// An operator that analyzes the validation best symbolic regression solution for multi objective symbolic regression problems.
|
---|
32 | /// </summary>
|
---|
33 | [Item("SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for multi objective symbolic regression problems.")]
|
---|
34 | [StorableClass]
|
---|
35 | public sealed class SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionMultiObjectiveEvaluator, IRegressionProblemData>,
|
---|
36 | ISymbolicDataAnalysisBoundedOperator {
|
---|
37 | private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
|
---|
38 | private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
|
---|
39 | private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
|
---|
40 |
|
---|
41 | #region parameter properties
|
---|
42 | public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
|
---|
43 | get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
|
---|
44 | }
|
---|
45 |
|
---|
46 | public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
|
---|
47 | get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
|
---|
48 | }
|
---|
49 | public IValueParameter<BoolValue> ApplyLinearScalingParameter {
|
---|
50 | get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
|
---|
51 | }
|
---|
52 | #endregion
|
---|
53 |
|
---|
54 | #region properties
|
---|
55 | public BoolValue ApplyLinearScaling {
|
---|
56 | get { return ApplyLinearScalingParameter.Value; }
|
---|
57 | }
|
---|
58 | #endregion
|
---|
59 | [StorableConstructor]
|
---|
60 | private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
|
---|
61 | private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
|
---|
62 | public SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer()
|
---|
63 | : base() {
|
---|
64 | Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model."));
|
---|
65 | Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model."));
|
---|
66 | Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true)));
|
---|
67 | }
|
---|
68 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
69 | return new SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(this, cloner);
|
---|
70 | }
|
---|
71 |
|
---|
72 | protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
|
---|
73 | var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value);
|
---|
74 | var solution = new SymbolicRegressionSolution(model, ProblemDataParameter.ActualValue);
|
---|
75 | if (ApplyLinearScaling.Value)
|
---|
76 | solution.ScaleModel();
|
---|
77 | return solution;
|
---|
78 | }
|
---|
79 | }
|
---|
80 | }
|
---|