Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10402


Ignore:
Timestamp:
01/27/14 14:14:42 (10 years ago)
Author:
bburlacu
Message:

#1837: Added missing license information headers. Added storable constructors and changed properties in SlidingWindowBestSolutionsCollection to return IEnumerables instead of Lists.

Location:
branches/Sliding Window GP
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs

    r10396 r10402  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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 HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Optimization;
     
    2142    }
    2243    #endregion
    23 
    2444    [StorableConstructor]
    2545    protected GenerationalClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     46    [StorableHook(HookType.AfterDeserialization)]
     47    private void AfterDeserialization() { }
    2648    protected GenerationalClassificationSlidingWindowAnalyzer(GenerationalClassificationSlidingWindowAnalyzer original, Cloner cloner)
    2749      : base(original, cloner) {
     
    3052      return new GenerationalClassificationSlidingWindowAnalyzer(this, cloner);
    3153    }
    32     [StorableHook(HookType.AfterDeserialization)]
    33     private void AfterDeserialization() {
    34     }
    35 
    3654    public GenerationalClassificationSlidingWindowAnalyzer() {
    3755      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
    3856    }
    39 
    4057    public override IOperation Apply() {
    4158      if (!ResultCollection.ContainsKey("Best Solutions")) {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs

    r10396 r10402  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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 HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Optimization;
     
    728namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    829  [StorableClass]
    9   [Item("OffspringSelectionClassificationSlidingWindowAnalyzer", "")]
     30  [Item("Offspring Selection Classification Sliding Window Analyzer", "")]
    1031  public class OffspringSelectionClassificationSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer {
    1132    private const string ModelCreatorParameterName = "ModelCreator";
     
    2142    }
    2243    #endregion
    23 
     44    [StorableConstructor]
     45    protected OffspringSelectionClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     46    [StorableHook(HookType.AfterDeserialization)]
     47    private void AfterDeserialization() { }
    2448    protected OffspringSelectionClassificationSlidingWindowAnalyzer(OffspringSelectionClassificationSlidingWindowAnalyzer original, Cloner cloner)
    2549      : base(original, cloner) {
     
    2852      return new OffspringSelectionClassificationSlidingWindowAnalyzer(this, cloner);
    2953    }
    30     [StorableConstructor]
    31     protected OffspringSelectionClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
    32 
    3354    public OffspringSelectionClassificationSlidingWindowAnalyzer() {
    3455      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
    3556    }
    36 
    37     [StorableHook(HookType.AfterDeserialization)]
    38     private void AfterDeserialization() {
    39     }
    40 
    4157    public override IOperation Apply() {
    4258      if (!ResultCollection.ContainsKey("Best Solutions")) {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs

    r10396 r10402  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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
    222using HeuristicLab.Common;
    323using HeuristicLab.Core;
     
    727namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    828  [StorableClass]
    9   [Item("", "")]
     29  [Item("Sliding Window Best Classification Solutions Collection", "A collection of best sliding window solutions for symbolic classification.")]
    1030  public class SlidingWindowBestClassificationSolutionsCollection : SlidingWindowBestSolutionsCollection {
     31    public new IClassificationProblemData ProblemData {
     32      get { return (IClassificationProblemData)base.ProblemData; }
     33      set { base.ProblemData = value; }
     34    }
     35    public ISymbolicClassificationModelCreator ModelCreator { get; set; }
     36    [StorableConstructor]
     37    protected SlidingWindowBestClassificationSolutionsCollection(bool deserializing) : base(deserializing) { }
     38    [StorableHook(HookType.AfterDeserialization)]
     39    private void AfterDeserialization() { }
    1140    public SlidingWindowBestClassificationSolutionsCollection(SlidingWindowBestClassificationSolutionsCollection original, Cloner cloner)
    1241      : base(original, cloner) {
     
    1544      return new SlidingWindowBestClassificationSolutionsCollection(this, cloner);
    1645    }
    17 
    18     public new IClassificationProblemData ProblemData {
    19       get { return (IClassificationProblemData)base.ProblemData; }
    20       set { base.ProblemData = value; }
    21     }
    22 
    23     public ISymbolicClassificationModelCreator ModelCreator { get; set; }
    24 
    25     public SlidingWindowBestClassificationSolutionsCollection() {
    26 
    27     }
    28 
     46    public SlidingWindowBestClassificationSolutionsCollection() { }
    2947    public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
    3048      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     
    3351      return model;
    3452    }
    35 
    3653    public override ISymbolicDataAnalysisSolution CreateSolution(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData) {
    3754      return new SymbolicClassificationSolution((ISymbolicClassificationModel)model, (IClassificationProblemData)problemData);
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/GenerationalRegressionSlidingWindowAnalyzer.cs

    r10396 r10402  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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 HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Optimization;
     
    1031    [StorableConstructor]
    1132    protected GenerationalRegressionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     33    [StorableHook(HookType.AfterDeserialization)]
     34    private void AfterDeserialization() { }
    1235    protected GenerationalRegressionSlidingWindowAnalyzer(GenerationalRegressionSlidingWindowAnalyzer original, Cloner cloner)
    1336      : base(original, cloner) {
     
    1639      return new GenerationalRegressionSlidingWindowAnalyzer(this, cloner);
    1740    }
    18     [StorableHook(HookType.AfterDeserialization)]
    19     private void AfterDeserialization() {
    20     }
     41    public GenerationalRegressionSlidingWindowAnalyzer() { }
    2142    public override IOperation Apply() {
    2243      if (!ResultCollection.ContainsKey("Best Solutions")) {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/OffspringSelectionRegressionSlidingWindowAnalyzer.cs

    r10396 r10402  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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 HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Optimization;
     
    829  [Item("OffspringSelectionRegressionSlidingWindowAnalyzer", "")]
    930  public class OffspringSelectionRegressionSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer {
     31    [StorableConstructor]
     32    protected OffspringSelectionRegressionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     33    [StorableHook(HookType.AfterDeserialization)]
     34    private void AfterDeserialization() { }
    1035    protected OffspringSelectionRegressionSlidingWindowAnalyzer(OffspringSelectionRegressionSlidingWindowAnalyzer original, Cloner cloner)
    1136      : base(original, cloner) {
     
    1439      return new OffspringSelectionRegressionSlidingWindowAnalyzer(this, cloner);
    1540    }
    16     [StorableConstructor]
    17     protected OffspringSelectionRegressionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
    1841    public OffspringSelectionRegressionSlidingWindowAnalyzer() { }
    19 
    20     [StorableHook(HookType.AfterDeserialization)]
    21     private void AfterDeserialization() {
    22     }
    23 
    2442    public override IOperation Apply() {
    2543      if (!ResultCollection.ContainsKey("Best Solutions")) {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/SlidingWindowBestRegressionSolutionsCollection.cs

    r10396 r10402  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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
    222using HeuristicLab.Common;
    323using HeuristicLab.Core;
     
    727namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
    828  [StorableClass]
    9   [Item("", "")]
     29  [Item("SlidingWindowBestRegressionSolutionsCollection", "A collection of best sliding window solutions for symbolic regression.")]
    1030  public class SlidingWindowBestRegressionSolutionsCollection : SlidingWindowBestSolutionsCollection {
     31    public new IRegressionProblemData ProblemData {
     32      get { return (IRegressionProblemData)base.ProblemData; }
     33      set { base.ProblemData = value; }
     34    }
     35    [StorableConstructor]
     36    protected SlidingWindowBestRegressionSolutionsCollection(bool deserializing) : base(deserializing) { }
     37    [StorableHook(HookType.AfterDeserialization)]
     38    private void AfterDeserialization() { }
    1139    public SlidingWindowBestRegressionSolutionsCollection(SlidingWindowBestRegressionSolutionsCollection original, Cloner cloner)
    1240      : base(original, cloner) {
     
    1543      return new SlidingWindowBestRegressionSolutionsCollection(this, cloner);
    1644    }
    17 
    18     public new IRegressionProblemData ProblemData {
    19       get { return (IRegressionProblemData)base.ProblemData; }
    20       set { base.ProblemData = value; }
    21     }
    22 
    23     public SlidingWindowBestRegressionSolutionsCollection() {
    24 
    25     }
    26 
     45    public SlidingWindowBestRegressionSolutionsCollection() { }
    2746    public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
    2847      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    2948      return new SymbolicRegressionModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
    3049    }
    31 
    3250    public override ISymbolicDataAnalysisSolution CreateSolution(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData) {
    3351      return new SymbolicRegressionSolution((ISymbolicRegressionModel)model, (IRegressionProblemData)problemData);
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionView.cs

    r10396 r10402  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    4364      var dataGridView = (DataGridView)sender;
    4465      var cell = dataGridView.SelectedCells[0];
    45       var tree = Content.BestSolutions[cell.RowIndex];
     66      var bestSolutions = Content.BestSolutions.ToList();
     67      var tree = bestSolutions[cell.RowIndex];
    4668      var model = Content.CreateModel(tree, Content.Interpreter);
    4769      var solution = Content.CreateSolution(model, Content.ProblemData);
     
    93115
    94116    private void UpdateQualitiesMap() {
    95       var qualitiesMap = new DoubleMatrix(Content.BestSolutions.Count, Content.SlidingWindowPositions.Count + 1);
     117      var bestSolutions = Content.BestSolutions.ToList();
     118      var swPositions = Content.SlidingWindowPositions.ToList();
     119      var qualitiesMap = new DoubleMatrix(bestSolutions.Count, swPositions.Count + 1);
    96120      qualitiesMap.ColumnNames = Content.SlidingWindowPositions.Select(x => x.Start + "-" + x.End).Concat(new List<string> { "Training" });
    97       qualitiesMap.RowNames = Enumerable.Range(1, Content.BestSolutions.Count).Select(x => "M" + x);
     121      qualitiesMap.RowNames = Enumerable.Range(1, bestSolutions.Count).Select(x => "M" + x);
    98122      double min = 0, max = 0;
    99123
    100124      for (int i = 0; i < qualitiesMap.Columns - 1; ++i) {
    101         var pos = Content.SlidingWindowPositions[i];
     125        var pos = swPositions[i];
    102126        var rows = Enumerable.Range(pos.Start, pos.End - pos.Start).ToList();
    103127
    104128        for (int j = 0; j < qualitiesMap.Rows; ++j) {
    105           var tree = Content.BestSolutions[j];
     129          var tree = bestSolutions[j];
    106130          var q = CalculateQuality(tree, rows);
    107131          if (min > q) min = q;
     
    112136      // deal separately with the last column which represents the whole training partition interval
    113137      for (int j = 0; j < qualitiesMap.Rows; ++j) {
    114         var tree = Content.BestSolutions[j];
     138        var tree = bestSolutions[j];
    115139        var q = CalculateQuality(tree, Content.ProblemData.TrainingIndices);
    116140        if (min > q) min = q;
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowBestSolutionsCollection.cs

    r10398 r10402  
    3131  [Item("SlidingWindowBestSolutionsCollection", "An object holding a collection of the best sliding window solutions.")]
    3232  public abstract class SlidingWindowBestSolutionsCollection : Item {
     33
     34    private List<ISymbolicExpressionTree> bestSolutions;
    3335    [Storable]
    34     private List<ISymbolicExpressionTree> bestSolutions;
    35     public List<ISymbolicExpressionTree> BestSolutions {
     36    public IEnumerable<ISymbolicExpressionTree> BestSolutions {
    3637      get { return bestSolutions; }
     38      set { bestSolutions = new List<ISymbolicExpressionTree>(value); }
    3739    }
    3840
     41    private List<IntRange> slidingWindowPositions;
    3942    [Storable]
    40     private List<IntRange> slidingWindowPositions;
    41     public List<IntRange> SlidingWindowPositions {
     43    public IEnumerable<IntRange> SlidingWindowPositions {
    4244      get { return slidingWindowPositions; }
     45      set { slidingWindowPositions = new List<IntRange>(value); }
    4346    }
    4447
     
    5659      set { interpreter = value; }
    5760    }
     61    [StorableHook(HookType.AfterDeserialization)]
     62    private void AfterDeserialization() {
     63    }
    5864
     65    [StorableConstructor]
     66    protected SlidingWindowBestSolutionsCollection(bool deserializing) : base(deserializing) { }
    5967    protected SlidingWindowBestSolutionsCollection(SlidingWindowBestSolutionsCollection original, Cloner cloner)
    6068      : base(original, cloner) {
    61       this.bestSolutions = original.BestSolutions;
    62       this.slidingWindowPositions = original.SlidingWindowPositions;
    63       this.ProblemData = original.ProblemData;
    64       this.Interpreter = original.Interpreter;
     69      this.bestSolutions = original.bestSolutions;
     70      this.slidingWindowPositions = original.slidingWindowPositions;
     71      this.problemData = original.problemData;
     72      this.interpreter = original.interpreter;
    6573    }
    6674    protected SlidingWindowBestSolutionsCollection() {
Note: See TracChangeset for help on using the changeset viewer.