Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.DataAnalysis.Trading/3.4/SingleObjective/SymbolicTradingSingleObjectiveProblem.cs @ 6123

Last change on this file since 6123 was 6123, checked in by gkronber, 13 years ago

#1508 added classes for optimization of trading rules

File size: 2.9 KB
Line 
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
22using System.Linq;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Parameters;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
29  [Item("Symbolic Trading Problem (single objective)", "Represents a single objective symbolic trading problem.")]
30  [StorableClass]
31  [Creatable("Problems")]
32  public class SymbolicTradingSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<ITradingProblemData, ISymbolicTradingSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, ITradingProblem {
33    private const int InitialMaximumTreeDepth = 8;
34    private const int InitialMaximumTreeLength = 25;
35
36    [StorableConstructor]
37    protected SymbolicTradingSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
38    protected SymbolicTradingSingleObjectiveProblem(SymbolicTradingSingleObjectiveProblem original, Cloner cloner) : base(original, cloner) { }
39    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicTradingSingleObjectiveProblem(this, cloner); }
40
41    public SymbolicTradingSingleObjectiveProblem()
42      : base(new TradingProblemData(), new SymbolicTradingSingleObjectiveSharpeRatioEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
43      Maximization.Value = true;
44      MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth;
45      MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength;
46
47      InitializeOperators();
48    }
49
50    private void InitializeOperators() {
51      Operators.Add(new SymbolicTradingSingleObjectiveTrainingBestSolutionAnalyzer());
52      Operators.Add(new SymbolicTradingSingleObjectiveValidationBestSolutionAnalyzer());
53      ParameterizeOperators();
54    }
55
56    protected override void ParameterizeOperators() {
57      base.ParameterizeOperators();
58    }
59
60    public override void ImportProblemDataFromFile(string fileName) {
61      TradingProblemData problemData = TradingProblemData.ImportFromFile(fileName);
62      ProblemData = problemData;
63    }
64  }
65}
Note: See TracBrowser for help on using the repository browser.