Index: branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
===================================================================
--- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 10684)
+++ branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 10686)
@@ -217,4 +217,10 @@
     </Compile>
     <Compile Include="Plugin.cs" />
+    <Compile Include="SlidingWindowBestSolutionsCollectionHeatMapView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SlidingWindowBestSolutionsCollectionHeatMapView.Designer.cs">
+      <DependentUpon>SlidingWindowBestSolutionsCollectionHeatMapView.cs</DependentUpon>
+    </Compile>
     <Compile Include="SlidingWindowBestSolutionsCollectionView.cs">
       <SubType>UserControl</SubType>
Index: branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionHeatMapView.cs
===================================================================
--- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionHeatMapView.cs	(revision 10686)
+++ branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionHeatMapView.cs	(revision 10686)
@@ -0,0 +1,173 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Analysis;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Views;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  [View("Sliding Window Best Solutions HeatMap View")]
+  [Content(typeof(SlidingWindowBestSolutionsCollection), false)]
+  public partial class SlidingWindowBestSolutionsCollectionHeatMapView : ItemView {
+    public new SlidingWindowBestSolutionsCollection Content {
+      get { return (SlidingWindowBestSolutionsCollection)base.Content; }
+      set { base.Content = value; }
+    }
+    public SlidingWindowBestSolutionsCollectionHeatMapView() {
+      InitializeComponent();
+
+      qualityMeasure = (int)QualityMeasures.PEARSON;
+    }
+
+    enum QualityMeasures { PEARSON, MSE };
+
+    private int qualityMeasure;
+
+    protected override void DeregisterContentEvents() {
+      // TODO: Deregister your event handlers here
+      base.DeregisterContentEvents();
+    }
+
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      // TODO: Register your event handlers here
+    }
+
+    public void heatMapView_cellDoubleClick(object sender, DataGridViewCellEventArgs e) {
+      var dataGridView = (DataGridView)sender;
+      var cell = dataGridView.SelectedCells[0];
+      var bestSolutions = Content.BestSolutions.Values.ToList();
+      var tree = bestSolutions[cell.RowIndex];
+      var model = Content.CreateModel(tree, Content.Interpreter);
+      var solution = Content.CreateSolution(model, Content.ProblemData);
+      var result = new Result("Sliding Window Solution", solution);
+      var view = MainFormManager.MainForm.ShowContent(result, typeof(ResultView));
+      if (view != null) {
+        view.ReadOnly = ReadOnly;
+        view.Locked = Locked;
+      }
+    }
+
+    #region Event Handlers (Content)
+    // TODO: Put event handlers of the content here
+    #endregion
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null) {
+        // TODO: Add code when content has been changed and is null
+      } else {
+        // TODO: Add code when content has been changed and is not null
+        UpdateQualitiesMap();
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
+    }
+
+    #region Event Handlers (child controls)
+    // TODO: Put event handlers of child controls here.
+    #endregion
+
+    private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) {
+      var combobox = (ComboBox)sender;
+      switch ((string)combobox.SelectedItem) {
+        case "Pearson R2": {
+            qualityMeasure = (int)QualityMeasures.PEARSON;
+            break;
+          }
+        case "Mean Squared Error": {
+            qualityMeasure = (int)QualityMeasures.MSE;
+            break;
+          }
+      }
+      UpdateQualitiesMap();
+    }
+
+    private void UpdateQualitiesMap() {
+      var bestSolutions = Content.BestSolutions.Values.ToList();
+      var swPositions = Content.BestSolutions.Keys.ToList();
+
+      var nRows = bestSolutions.Count;
+      var nCols = swPositions.Count + 1;
+      var qualitiesMap = new double[nRows, nCols];
+      double min = 0, max = 0;
+
+      for (int i = 0; i < nCols - 1; ++i) {
+        var pos = swPositions[i];
+        var rows = Enumerable.Range(pos.Item1, pos.Item2 - pos.Item1).ToList();
+
+        for (int j = nRows - 1; j >= 0; --j) {
+          var tree = bestSolutions[j];
+          var q = CalculateQuality(tree, rows);
+          if (min > q) min = q;
+          if (max < q) max = q;
+          qualitiesMap[j, i] = q;
+        }
+      }
+      // deal separately with the last column which represents the whole training partition interval
+      for (int j = nRows - 1; j >= 0; --j) {
+        var tree = bestSolutions[j];
+        var q = CalculateQuality(tree, Content.ProblemData.TrainingIndices);
+        if (min > q) min = q;
+        if (max < q) max = q;
+        qualitiesMap[j, nCols - 1] = q;
+      }
+
+      heatMapView.Content = new HeatMap(qualitiesMap);
+      heatMapView.Content.Minimum = min;
+      heatMapView.Content.Maximum = max;
+    }
+
+    private string GetTargetVariable(IDataAnalysisProblemData problemData) {
+      var regressionProblemData = problemData as IRegressionProblemData;
+      var classificationProblemData = problemData as IClassificationProblemData;
+      if (regressionProblemData != null) return regressionProblemData.TargetVariable;
+      if (classificationProblemData != null) return classificationProblemData.TargetVariable;
+      throw new NotSupportedException();
+    }
+
+    private double CalculateQuality(ISymbolicExpressionTree tree, IEnumerable<int> rows) {
+      var estimatedValues = Content.Interpreter.GetSymbolicExpressionTreeValues(tree, Content.ProblemData.Dataset, rows);
+      var originalValues = Content.ProblemData.Dataset.GetDoubleValues(GetTargetVariable(Content.ProblemData), rows);
+      double quality = 0;
+      var errorState = new OnlineCalculatorError();
+      switch ((QualityMeasures)qualityMeasure) {
+        case QualityMeasures.PEARSON:
+          quality = OnlinePearsonsRSquaredCalculator.Calculate(estimatedValues, originalValues, out errorState);
+          break;
+        case QualityMeasures.MSE:
+          quality = OnlineMeanSquaredErrorCalculator.Calculate(estimatedValues, originalValues, out errorState);
+          break;
+      }
+      return errorState == OnlineCalculatorError.None ? quality : double.NaN;
+    }
+  }
+}
