Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowBestSolutionsCollection.cs @ 10396

Last change on this file since 10396 was 10396, checked in by bburlacu, 11 years ago

#1837: Introduced the SlidingWindowBestSolutionsCollectionView which shows how well each individual sliding window solution performs on the other portions of the training data.

File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 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.Data;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
30  [StorableClass]
31  [Item("", "")]
32  public abstract class SlidingWindowBestSolutionsCollection : Item {
33    [Storable]
34    private List<ISymbolicExpressionTree> bestSolutions;
35    public List<ISymbolicExpressionTree> BestSolutions {
36      get { return bestSolutions; }
37    }
38
39    [Storable]
40    private List<IntRange> slidingWindowPositions;
41    public List<IntRange> SlidingWindowPositions {
42      get { return slidingWindowPositions; }
43    }
44    public IDataAnalysisProblemData ProblemData { get; set; }
45    public ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get; set; }
46
47    protected SlidingWindowBestSolutionsCollection(SlidingWindowBestSolutionsCollection original, Cloner cloner)
48      : base(original, cloner) {
49    }
50    protected SlidingWindowBestSolutionsCollection() {
51      bestSolutions = new List<ISymbolicExpressionTree>();
52      slidingWindowPositions = new List<IntRange>();
53    }
54
55    public void Add(ISymbolicExpressionTree solution, IntRange range) {
56      if (bestSolutions == null) bestSolutions = new List<ISymbolicExpressionTree>();
57      bestSolutions.Add(solution);
58      if (slidingWindowPositions == null) slidingWindowPositions = new List<IntRange>();
59      slidingWindowPositions.Add(range);
60    }
61
62    public void Clear() {
63      if (bestSolutions != null) bestSolutions.Clear();
64      if (slidingWindowPositions != null) slidingWindowPositions.Clear();
65    }
66
67    public abstract ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
68     double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue);
69
70    public abstract ISymbolicDataAnalysisSolution CreateSolution(ISymbolicDataAnalysisModel model,
71      IDataAnalysisProblemData problemData);
72  }
73}
Note: See TracBrowser for help on using the repository browser.