Free cookie consent management tool by TermsFeed Policy Generator

source: branches/sluengo/HeuristicLab.Problems.TradeRules/TradeRulesSingleObjectiveValidationBestSolutionAnalyzer.cs @ 14604

Last change on this file since 14604 was 9262, checked in by sluengo, 12 years ago
File size: 3.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7using HeuristicLab.Problems.DataAnalysis.Symbolic;
8using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
9using HeuristicLab.Problems.DataAnalysis;
10using HeuristicLab.Common;
11using HeuristicLab.Data;
12using HeuristicLab.Parameters;
13using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
14
15namespace HeuristicLab.Problems.TradeRules
16{
17    [Item("TradeRulesSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for single objective symbolic regression problems.")]
18    [StorableClass]
19    public sealed class TradeRulesSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData>,
20    ISymbolicDataAnalysisBoundedOperator
21    {
22         private const string EstimationLimitsParameterName = "EstimationLimits";
23    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
24
25    #region parameter properties
26    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
27      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
28    }
29    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
30      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
31    }
32    #endregion
33
34    #region properties
35    public BoolValue ApplyLinearScaling {
36      get { return ApplyLinearScalingParameter.Value; }
37    }
38    #endregion
39
40    [StorableConstructor]
41    private TradeRulesSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
42    private TradeRulesSingleObjectiveValidationBestSolutionAnalyzer(TradeRulesSingleObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
43    public TradeRulesSingleObjectiveValidationBestSolutionAnalyzer()
44      : base() {
45      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
46      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false)));
47    }
48
49    public override IDeepCloneable Clone(Cloner cloner) {
50        return new TradeRulesSingleObjectiveValidationBestSolutionAnalyzer(this, cloner);
51    }
52
53    protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
54      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
55      if (ApplyLinearScaling.Value)
56        SymbolicRegressionModel.Scale(model, ProblemDataParameter.ActualValue);
57      return new TradingRulesSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
58    }
59
60    }
61}
Note: See TracBrowser for help on using the repository browser.