Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SymbolicTimeSeriesPrognosisModel.cs @ 4463

Last change on this file since 4463 was 4463, checked in by gkronber, 14 years ago

Added support for automatic symbolic simplification and manual impact-guided pruning for symbolic time series prognosis solutions. #1142

File size: 3.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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.Collections.Generic;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Symbols;
29using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
30using System.Linq;
31using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Interfaces;
32
33namespace HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic {
34  [StorableClass]
35  [Item("SymbolicTimeSeriesPrognosisModel", "Represents a model for time series prognosis.")]
36  public class SymbolicTimeSeriesPrognosisModel : NamedItem, IMultiVariateDataAnalysisModel {
37    [Storable]
38    private ISymbolicTimeSeriesExpressionInterpreter interpreter;
39    public ISymbolicTimeSeriesExpressionInterpreter Interpreter {
40      get { return interpreter; }
41    }
42    [Storable]
43    private SymbolicExpressionTree tree;
44    public SymbolicExpressionTree SymbolicExpressionTree {
45      get { return tree; }
46    }
47    [StorableConstructor]
48    protected SymbolicTimeSeriesPrognosisModel(bool deserializing) : base(deserializing) { }
49
50    public SymbolicTimeSeriesPrognosisModel() { }
51
52    public SymbolicTimeSeriesPrognosisModel(ISymbolicTimeSeriesExpressionInterpreter interpreter, SymbolicExpressionTree tree) {
53      this.tree = tree;
54      this.interpreter = interpreter;
55
56    }
57
58    public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end, int horizon) {
59      IEnumerable<int> rows = Enumerable.Range(start, end - start);
60      IEnumerable<string> targetVariables = from item in problemData.TargetVariables.CheckedItems
61                                            select item.Value.Value;
62      return interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, targetVariables, rows, horizon);
63    }
64
65    #region IMultiVariateDataAnalysisModel Members
66
67    public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end) {
68      return GetEstimatedValues(problemData, start, end, 1);
69    }
70    #endregion
71
72    public override IDeepCloneable Clone(Cloner cloner) {
73      SymbolicTimeSeriesPrognosisModel clone = (SymbolicTimeSeriesPrognosisModel)base.Clone(cloner);
74      clone.tree = (SymbolicExpressionTree)cloner.Clone(tree);
75      clone.interpreter = (ISymbolicTimeSeriesExpressionInterpreter)cloner.Clone(interpreter);
76      return clone;
77    }
78  }
79}
Note: See TracBrowser for help on using the repository browser.