Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.Designer.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.Designer.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.Designer.cs	(revision 14536)
@@ -30,5 +30,7 @@
       this.datastreamViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
       this.resultsTab = new System.Windows.Forms.TabPage();
-      this.resultsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+      this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
+      this.runsTab = new System.Windows.Forms.TabPage();
+      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
       this.tabControl.SuspendLayout();
@@ -36,4 +38,5 @@
       this.datastreamTab.SuspendLayout();
       this.resultsTab.SuspendLayout();
+      this.runsTab.SuspendLayout();
       this.SuspendLayout();
       // 
@@ -85,4 +88,5 @@
       this.tabControl.Controls.Add(this.datastreamTab);
       this.tabControl.Controls.Add(this.resultsTab);
+      this.tabControl.Controls.Add(this.runsTab);
       this.tabControl.Location = new System.Drawing.Point(3, 26);
       this.tabControl.Name = "tabControl";
@@ -103,5 +107,6 @@
       this.ensemblesTab.UseVisualStyleBackColor = true;
       this.ensemblesTab.DragDrop += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragDrop);
-      this.ensemblesTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnter);
+      this.ensemblesTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnterOver);
+      this.ensemblesTab.DragOver += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnterOver);
       // 
       // ensemblesViewHost
@@ -133,5 +138,6 @@
       this.datastreamTab.UseVisualStyleBackColor = true;
       this.datastreamTab.DragDrop += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragDrop);
-      this.datastreamTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnter);
+      this.datastreamTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnterOver);
+      this.datastreamTab.DragOver += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnterOver);
       // 
       // datastreamViewHost
@@ -151,5 +157,5 @@
       // resultsTab
       // 
-      this.resultsTab.Controls.Add(this.resultsViewHost);
+      this.resultsTab.Controls.Add(this.resultsView);
       this.resultsTab.Location = new System.Drawing.Point(4, 22);
       this.resultsTab.Name = "resultsTab";
@@ -161,15 +167,38 @@
       // resultsViewHost
       // 
-      this.resultsViewHost.Caption = "View";
-      this.resultsViewHost.Content = null;
-      this.resultsViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.resultsViewHost.Enabled = false;
-      this.resultsViewHost.Location = new System.Drawing.Point(0, 0);
-      this.resultsViewHost.Name = "resultsViewHost";
-      this.resultsViewHost.ReadOnly = false;
-      this.resultsViewHost.Size = new System.Drawing.Size(950, 554);
-      this.resultsViewHost.TabIndex = 0;
-      this.resultsViewHost.ViewsLabelVisible = true;
-      this.resultsViewHost.ViewType = null;
+      this.resultsView.Caption = "View";
+      this.resultsView.Content = null;
+      this.resultsView.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.resultsView.Enabled = false;
+      this.resultsView.Location = new System.Drawing.Point(0, 0);
+      this.resultsView.Name = "resultsViewHost";
+      this.resultsView.ReadOnly = false;
+      this.resultsView.Size = new System.Drawing.Size(950, 554);
+      this.resultsView.TabIndex = 0;
+      //
+      // runsTab
+      //
+      //this.runsTabPage.Controls.Add(this.storeAlgorithmInEachRunCheckBox);
+      this.runsTab.Controls.Add(this.runsView);
+      this.runsTab.Location = new System.Drawing.Point(4, 22);
+      this.runsTab.Name = "runsTabPage";
+      this.runsTab.Padding = new System.Windows.Forms.Padding(3);
+      this.runsTab.Size = new System.Drawing.Size(950, 554);
+      this.runsTab.TabIndex = 3;
+      this.runsTab.Text = "Runs";
+      this.runsTab.UseVisualStyleBackColor = true;
+      //
+      // runsView
+      //
+      this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+      | System.Windows.Forms.AnchorStyles.Left)
+      | System.Windows.Forms.AnchorStyles.Right)));
+      this.runsView.Caption = "RunCollection View";
+      this.runsView.Content = null;
+      this.runsView.Location = new System.Drawing.Point(0, 0);
+      this.runsView.Name = "runsView";
+      this.runsView.ReadOnly = false;
+      this.runsView.Size = new System.Drawing.Size(950, 554);
+      this.runsView.TabIndex = 0;
       // 
       // DatastreamAnalysisOptimizerView
@@ -206,8 +235,10 @@
     private System.Windows.Forms.TabPage ensemblesTab;
     private System.Windows.Forms.TabPage datastreamTab;
-    private System.Windows.Forms.TabPage resultsTab;
+    protected System.Windows.Forms.TabPage resultsTab;
+    protected System.Windows.Forms.TabPage runsTab;
     private MainForm.WindowsForms.ViewHost ensemblesViewHost;
     private MainForm.WindowsForms.ViewHost datastreamViewHost;
-    private MainForm.WindowsForms.ViewHost resultsViewHost;
+    protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
+    protected HeuristicLab.Optimization.Views.RunCollectionView runsView;
   }
 }
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.cs	(revision 14536)
@@ -1,3 +1,4 @@
 ﻿#region License Information
+
 /* HeuristicLab
  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
@@ -18,8 +19,12 @@
  * 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.Core;
 using HeuristicLab.MainForm;
 using HeuristicLab.Optimization;
@@ -37,14 +42,64 @@
 
     public new DatastreamAnalysisOptimizer Content {
-      get { return (DatastreamAnalysisOptimizer)base.Content; }
+      get { return (DatastreamAnalysisOptimizer) base.Content; }
       set { base.Content = value; }
+    }
+
+    //protected override void Dispose(bool disposing) {
+    //  if (disposing) {
+    //    if (components != null) components.Dispose();
+    //  }
+    //  base.Dispose(disposing);
+    //}
+
+    protected override void OnInitialized(EventArgs e) {
+      // set order of tab pages according to z order.
+      // NOTE: this is required due to a bug in the VS designer.
+      List<Control> tabPages = new List<Control>();
+      for (int i = 0; i < tabControl.Controls.Count; i++) {
+        tabPages.Add(tabControl.Controls[i]);
+      }
+      tabControl.Controls.Clear();
+      foreach(Control control in tabPages)
+        tabControl.Controls.Add(control);
+
+      base.OnInitialized(e);
     }
 
     protected override void OnContentChanged() {
       base.OnContentChanged();
-      if (Content == null)
-        return;
-
-      // TODO
+      if (Content == null) {
+        ensemblesViewHost.Content = null;
+        datastreamViewHost.Content = null;
+        resultsView.Content = null;
+        runsView.Content = null;
+      } else {
+        ensemblesViewHost.Content = Content.Ensembles;
+        datastreamViewHost.Content = Content.Datastream;
+        resultsView.Content = Content.Results.AsReadOnly();
+        runsView.Content = Content.Runs;
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      resultsView.Enabled = Content != null;
+      runsView.Enabled = Content != null;
+    }
+
+    protected override void OnClosed(FormClosedEventArgs e) {
+      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
+        //The content must be stopped if no other view showing the content is available
+        var optimizers =
+          MainFormManager.MainForm.Views.OfType<IContentView>()
+            .Where(v => v != this)
+            .Select(v => v.Content)
+            .OfType<IOptimizer>();
+        if (!optimizers.Contains(Content)) {
+          var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers);
+          if (!nestedOptimizers.Contains(Content)) Content.Stop();
+        }
+      }
+      base.OnClosed(e);
     }
 
@@ -52,17 +107,54 @@
       base.RegisterContentEvents();
 
-      // TODO
+      Content.EnsemblesChanged += new EventHandler(Content_EnsemblesChanged);
+      Content.DatastreamChanged += new EventHandler(Content_DatastreamChanged);
     }
 
     protected override void DeregisterContentEvents() {
+      Content.EnsemblesChanged -= new EventHandler(Content_EnsemblesChanged);
+      Content.DatastreamChanged -= new EventHandler(Content_DatastreamChanged);
+
       base.DeregisterContentEvents();
     }
 
+    #region
+    protected override void Content_Prepared(object sender, EventArgs e) {
+      if (InvokeRequired)
+        Invoke(new EventHandler(Content_Prepared), sender, e);
+      else {
+        base.Content_Prepared(sender,e);
+        resultsView.Content = Content.Results.AsReadOnly();
+      }
+    }
+
+    protected void Content_EnsemblesChanged(object sender, EventArgs e) {
+      if (InvokeRequired)
+        Invoke(new EventHandler(Content_EnsemblesChanged), sender, e);
+      else {
+        ensemblesViewHost.Content = Content.Ensembles;
+      }
+    }
+
+    protected void Content_DatastreamChanged(object sender, EventArgs e) {
+      if (InvokeRequired)
+        Invoke(new EventHandler(Content_DatastreamChanged), sender, e);
+      else {
+        if (datastreamViewHost.Content != null && Content.Datastream != null &&
+            datastreamViewHost.Content.GetType() != Content.Datastream.GetType())
+          datastreamViewHost.ViewType = null;
+        datastreamViewHost.Content = Content.Datastream;
+      }
+    }
+    #endregion
+
     #region event handlers
-
     private void ensemblesTab_DragDrop(object sender, DragEventArgs e) {
       if (e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat)) {
         try {
-          // TODO
+          var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
+          if (data is IRegressionEnsembleModel) {
+            data = (IRegressionEnsembleModel) data;
+            Content.Ensembles.Add((RegressionEnsembleModel) data);
+          }
         }
         catch (Exception ex) {
@@ -72,14 +164,18 @@
     }
 
-    private void ensemblesTab_DragEnter(object sender, DragEventArgs e) {
+    private void ensemblesTab_DragEnterOver(object sender, DragEventArgs e) {
       e.Effect = DragDropEffects.None;
-      if (!e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
+      if (ReadOnly || !e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
         return;
 
       var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
 
-      // TODO: check if data is taggedEnsembles-data
-      if(data is IRegressionEnsembleModel)
-        e.Effect = DragDropEffects.Copy;
+      if (data is IRegressionEnsembleModel) {
+        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key
+        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
+      }
     }
 
@@ -87,5 +183,8 @@
       if (e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat)) {
         try {
-          // TODO
+          var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
+          if (data is IValueParameter) data = ((IValueParameter) data).Value;
+          if (data is IRegressionProblemData)
+            Content.Datastream.ProblemData = (RegressionProblemData) data;
         }
         catch (Exception ex) {
@@ -95,12 +194,19 @@
     }
 
-    private void datastreamTab_DragEnter(object sender, DragEventArgs e) {
+    private void datastreamTab_DragEnterOver(object sender, DragEventArgs e) {
       e.Effect = DragDropEffects.None;
-      if (!e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
+
+      if (ReadOnly || !e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
         return;
 
       var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
-      if (data is IRegressionProblemData)
-        e.Effect = DragDropEffects.Copy;
+      if (data is IValueParameter) data = ((IValueParameter) data).Value;
+      if (data is IRegressionProblemData) {
+        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key
+        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
+        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
+      }
     }
 
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj	(revision 14536)
@@ -58,4 +58,8 @@
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.MainForm-3.3">
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
@@ -116,4 +120,9 @@
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="RegressionEnsembleModelView.resx">
+      <DependentUpon>RegressionEnsembleModelView.cs</DependentUpon>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs	(revision 14536)
@@ -23,5 +23,5 @@
 
 namespace HeuristicLab.DatastreamAnalysis.Views {
-  [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14488")]
+  [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14491")]
   [PluginFile("HeuristicLab.DatastreamAnalysis.Views-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs	(revision 14536)
@@ -54,3 +54,3 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.14.14488")]
+[assembly: AssemblyFileVersion("3.4.14.14491")]
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.Designer.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.Designer.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.Designer.cs	(revision 14536)
@@ -19,4 +19,8 @@
  */
 #endregion
+
+using HeuristicLab.Core.Views;
+using HeuristicLab.Problems.DataAnalysis;
+
 namespace HeuristicLab.DatastreamAnalysis.Views {
   partial class RegressionEnsembleModelView {
@@ -44,16 +48,51 @@
     /// </summary>
     private void InitializeComponent() {
+      this.modelsView = new HeuristicLab.DatastreamAnalysis.Views.RegressionEnsembleModelView.ModelsView();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
       this.SuspendLayout();
-
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Size = new System.Drawing.Size(468, 20);
+      // 
+      // infoLabel
+      // 
+      this.infoLabel.Location = new System.Drawing.Point(532, 3);
+      // 
+      // modelsView
+      // 
+      this.modelsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.modelsView.Caption = "Models View";
+      this.modelsView.Content = null;
+      this.modelsView.Location = new System.Drawing.Point(6, 35);
+      this.modelsView.Name = "modelsView";
+      this.modelsView.ReadOnly = false;
+      this.modelsView.ShowDetails = true;
+      this.modelsView.Size = new System.Drawing.Size(532, 383);
+      this.modelsView.TabIndex = 1;
       // 
       // RegressionEnsembleModelView
       // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+      this.Controls.Add(this.modelsView);
       this.Name = "RegressionEnsembleModelView";
+      this.Size = new System.Drawing.Size(551, 425);
+      this.Controls.SetChildIndex(this.modelsView, 0);
+      this.Controls.SetChildIndex(this.nameLabel, 0);
+      this.Controls.SetChildIndex(this.nameTextBox, 0);
+      this.Controls.SetChildIndex(this.infoLabel, 0);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
       this.ResumeLayout(false);
+      this.PerformLayout();
+
     }
 
     #endregion
+
+    private ModelsView modelsView;
   }
 }
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.cs	(revision 14536)
@@ -34,12 +34,15 @@
   [Content(typeof(RegressionEnsembleModel), true)]
   internal sealed partial class RegressionEnsembleModelView : NamedItemView {
-    private ModelsView view;
-    private ItemCollection<IRegressionModel> models;
+    //private ItemCollectionView<IRegressionModel> view;
+    private ItemCollection<IRegressionModel> models = new ItemCollection<IRegressionModel>();
 
     public RegressionEnsembleModelView() {
       InitializeComponent();
-      view = new ModelsView();
-      view.Dock = DockStyle.Fill;
-      Controls.Add(view);
+      models = new ItemCollection<IRegressionModel>();
+
+      models.ItemsAdded += Models_ItemsAdded;
+      models.ItemsRemoved += Models_ItemsRemoved;
+      models.CollectionReset += Models_CollectionReset;
+
     }
 
@@ -49,77 +52,100 @@
     }
 
-
-
+ 
     protected override void OnContentChanged() {
       base.OnContentChanged();
       if (Content != null) {
-         models = new ItemCollection<IRegressionModel>(Content.Models);
-        view.Content = models;
+        models.ItemsAdded -= Models_ItemsAdded;
+        models.ItemsRemoved -= Models_ItemsRemoved;
+        models.CollectionReset -= Models_CollectionReset;
+
+        models.Clear();
+        models.AddRange(Content.Models);
+        modelsView.Content = models;
+
+        models.ItemsAdded += Models_ItemsAdded;
+        models.ItemsRemoved += Models_ItemsRemoved;
+        models.CollectionReset += Models_CollectionReset;
       } else {
-        view.Content = null;
+        modelsView.Content = null;
       }
     }
 
+    private void Models_CollectionReset(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
+      Content = null;
+    }
+
+    private void Models_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
+      Content.AddRange(e.Items);
+    }
+
+    private void Models_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
+      Content.RemoveRange(e.Items);
+    }
+
     private class ModelsView : ItemCollectionView<IRegressionModel> {
-      protected override void SetEnabledStateOfControls() {
-        base.SetEnabledStateOfControls();
-        addButton.Enabled = false;
-        removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && !ReadOnly && itemsListView.SelectedItems.Count > 0;
-        itemsListView.Enabled = Content != null && !Locked;
-        detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
-        sortAscendingButton.Enabled = false;
-        sortDescendingButton.Enabled = false;
+      public ModelsView() : base() {
       }
+    }
 
-      protected override void SortItemsListView(SortOrder sortOrder) { }
+    //private class ModelsView : ItemCollectionView<IRegressionModel> {
+    //  protected override void SetEnabledStateOfControls() {
+    //    base.SetEnabledStateOfControls();
+    //    addButton.Enabled = false;
+    //    removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && !ReadOnly && itemsListView.SelectedItems.Count > 0;
+    //    itemsListView.Enabled = Content != null && !Locked;
+    //    detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
+    //    sortAscendingButton.Enabled = false;
+    //    sortDescendingButton.Enabled = false;
+    //  }
+
+    //  protected override void SortItemsListView(SortOrder sortOrder) { }
 
 
-      protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
-        validDragOperation = false;
-        if (ReadOnly || Locked) return;
-        if (Content.IsReadOnly) return;
+    //  protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
+    //    validDragOperation = false;
+    //    if (ReadOnly || Locked) return;
+    //    if (Content.IsReadOnly) return;
 
-        var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
-        validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionModel>().Any();
-      }
-      protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
-        if (e.Effect != DragDropEffects.None) {
-          var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
-          var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionModel>();
-          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
-            Cloner cloner = new Cloner();
-            solutions = solutions.Select(s => cloner.Clone(s));
-          }
-          var solutionCollection = Content as ItemCollection<IRegressionModel>;
-          if (solutionCollection != null) {
-            solutionCollection.AddRange(solutions);
-          } else {
-            foreach (var solution in solutions)
-              Content.Add(solution);
-          }
-        }
-      }
-      protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
-        var solutionCollection = Content as ItemCollection<IRegressionModel>;
-        if (e.KeyCode == Keys.Delete && solutionCollection != null) {
-          if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
-            solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
-          }
-        } else {
-          base.itemsListView_KeyDown(sender, e);
-        }
-      }
-      protected override void removeButton_Click(object sender, EventArgs e) {
-        var solutionCollection = Content as ItemCollection<IRegressionModel>;
-        if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
-          solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
-          itemsListView.SelectedItems.Clear();
-        } else {
-          base.removeButton_Click(sender, e);
-        }
-      }
-
-
-    }
+    //    var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
+    //    validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionModel>().Any();
+    //  }
+    //  protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
+    //    if (e.Effect != DragDropEffects.None) {
+    //      var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
+    //      var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionModel>();
+    //      if (e.Effect.HasFlag(DragDropEffects.Copy)) {
+    //        Cloner cloner = new Cloner();
+    //        solutions = solutions.Select(s => cloner.Clone(s));
+    //      }
+    //      var solutionCollection = Content as ItemCollection<IRegressionModel>;
+    //      if (solutionCollection != null) {
+    //        solutionCollection.AddRange(solutions);
+    //      } else {
+    //        foreach (var solution in solutions)
+    //          Content.Add(solution);
+    //      }
+    //    }
+    //  }
+    //  protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
+    //    var solutionCollection = Content as ItemCollection<IRegressionModel>;
+    //    if (e.KeyCode == Keys.Delete && solutionCollection != null) {
+    //      if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
+    //        solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
+    //      }
+    //    } else {
+    //      base.itemsListView_KeyDown(sender, e);
+    //    }
+    //  }
+    //  protected override void removeButton_Click(object sender, EventArgs e) {
+    //    var solutionCollection = Content as ItemCollection<IRegressionModel>;
+    //    if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
+    //      solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
+    //      itemsListView.SelectedItems.Clear();
+    //    } else {
+    //      base.removeButton_Click(sender, e);
+    //    }
+    //  }
+    //}
 
   }
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/AnalysisBase.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/AnalysisBase.cs	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/AnalysisBase.cs	(revision 14536)
@@ -0,0 +1,19 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.DatastreamAnalysis {
+  [StorableClass]
+  [Item("Analysis Base", "Represents trained models, grouped in ensembles and additional parameters for subsequent analysis purposes")]
+  [Creatable(CreatableAttribute.Categories.DataAnalysisEnsembles, Priority = 100)]
+  public class AnalysisBase {
+
+  }
+}
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Datastream.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Datastream.cs	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Datastream.cs	(revision 14536)
@@ -0,0 +1,191 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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.Text;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.DatastreamAnalysis {
+  [StorableClass]
+  [Item("Datastream", "Represents an item containing a data source and reading options for a certain data stream.")]
+  [Creatable(CreatableAttribute.Categories.Problems)]
+  public class Datastream : ParameterizedNamedItem, IDatastream {
+
+    protected const string ProblemDataParameterName = "ProblemData";
+    protected const string InitialSlidingWindowParameterName = "InitialSlidingWindowParameter";
+    protected const string SlidingWindowSizeParameterName = "SlidingWindowSize";
+    protected const string SlidingWindowStepWidthParameterName = "SlidingWindowStepWidth";
+    protected const string SlidingWindowMovementIntervalParameterName = "SlidingWindowMovementInterval";
+
+    #region parameter properites
+
+    public IValueParameter<RegressionProblemData> ProblemDataParameter {
+      get { return (IValueParameter<RegressionProblemData>) Parameters[ProblemDataParameterName]; }  
+    }
+
+    public IFixedValueParameter<IntRange> InitialSlidingWindowParameter {
+      get { return (IFixedValueParameter<IntRange>) Parameters[InitialSlidingWindowParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> SlidingWindowSizeParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[InitialSlidingWindowParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> SlidingWindowStepWidthParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowStepWidthParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> SlidingWindowMovementIntervalParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowMovementIntervalParameterName]; }
+    }
+
+
+    #endregion
+
+    #region properties
+
+    public RegressionProblemData ProblemData {
+      get { return ProblemDataParameter.Value; }
+      set {
+        if(value == null) throw new ArgumentNullException("problemData", "The provided value for the problemData is null.");
+        if (value == ProblemData) return;
+        ProblemDataParameter.Value = value;
+      }
+    }
+
+    public IntRange InitialSlidingWindow {
+      get { return InitialSlidingWindowParameter.Value; }
+    }
+
+    public IntValue SlidingWindowSize {
+      get { return SlidingWindowSizeParameter.Value; }
+    }
+
+    public IntValue SlidingWindowStepWidth {
+      get { return SlidingWindowStepWidthParameter.Value; }
+    }
+
+    public IntValue SlidingWindowMovementInterval {
+      get { return SlidingWindowMovementIntervalParameter.Value; }
+    }
+
+    #endregion
+
+    #region internal properties
+
+    public IntRange FitnessPartition { get; set; }
+
+    public bool SlidingWindowMovementPossible {
+      get {
+        return ProblemData != null && ProblemData.Dataset != null &&
+               FitnessPartition.End + SlidingWindowStepWidth.Value <= ProblemData.Dataset.Rows;
+        // TODO: add external datastream, hub, etc to condition
+      }
+    }
+
+    public bool SlidingWindowEvaluationPossible {
+      get {
+        return ProblemData != null && ProblemData.Dataset != null &&
+               FitnessPartition.Size > 0;
+      }
+    }
+
+    public bool MoveSlidingWindow() {
+      if (ProblemData?.Dataset == null || ProblemData.Dataset.Rows == 0) return false;
+      if (FitnessPartition.End + SlidingWindowStepWidth.Value > ProblemData.Dataset.Rows) return false;
+      
+      if (FitnessPartition.Size > SlidingWindowSize.Value) {
+        FitnessPartition.Start += SlidingWindowStepWidth.Value;
+      } else if (FitnessPartition.Size == SlidingWindowSize.Value) {
+        FitnessPartition.Start += SlidingWindowStepWidth.Value;
+        FitnessPartition.End += SlidingWindowStepWidth.Value;
+      } else {
+        FitnessPartition.End += SlidingWindowStepWidth.Value;
+      }   
+      return true;
+    }
+
+    #endregion
+
+    #region constructors
+    [StorableConstructor]
+    protected Datastream(bool deserializing) : base(deserializing) { }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterParameterEvents();
+    }
+
+    protected Datastream(Datastream original, Cloner cloner) : base(original, cloner) {
+      RegisterParameterEvents();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Datastream(this, cloner);
+    }
+
+    public Datastream() {
+      Parameters.Add(new ValueParameter<RegressionProblemData>(ProblemDataParameterName, "ProblemData for analysis with selected ensembles.", null));
+      Parameters.Add(new FixedValueParameter<IntRange>(InitialSlidingWindowParameterName, "Initial sliding window boundaries", new IntRange(0, 1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowSizeParameterName, "Sliding window size", new IntValue(1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowStepWidthParameterName, "Sliding window step width", new IntValue(1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowMovementIntervalParameterName, "Sliding window movement interval (milliseconds)", new IntValue(1000)));
+      InitializeState();
+    }
+    #endregion
+
+
+    public void InitializeState() {
+      if (ProblemData == null || ProblemData.Dataset == null || ProblemData.Dataset.Rows == 0) {
+        FitnessPartition = new IntRange(0, 0);
+      } else {
+        FitnessPartition = (IntRange)InitialSlidingWindow.Clone();
+        if (FitnessPartition.End > ProblemData.Dataset.Rows) {
+          FitnessPartition.End = ProblemData.Dataset.Rows;
+        }
+      }
+    }
+
+    public event EventHandler ProblemDataChanged;
+
+
+    private void RegisterParameterEvents() {
+      ProblemDataParameter.ValueChanged += new EventHandler(ProblemData_ValueChanged);
+    }
+
+    private void ProblemData_ValueChanged(object sender, EventArgs e) {
+      if (e == null) return;
+
+      DatastreamAnalysisUtil.RaiseEvent(this, ProblemDataChanged);
+    }
+
+    
+
+  }
+}
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs	(revision 14536)
@@ -1,3 +1,4 @@
 ﻿#region License Information
+
 /* HeuristicLab
  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
@@ -18,12 +19,19 @@
  * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
  */
+
 #endregion
 
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Drawing;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Analysis;
+using HeuristicLab.Collections;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Optimization;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -31,37 +39,121 @@
 
 namespace HeuristicLab.DatastreamAnalysis {
-  internal enum DatastreamAnalysisOptimizerAction { None, Prepare, Start, Stop, Pause }
+  internal enum DatastreamAnalysisOptimizerAction {
+    None,
+    Prepare,
+    Start,
+    Stop,
+    Pause
+  }
 
   [StorableClass]
-  [Item("DatastreamAnalysis Optimizer", "The main loop for evaluating ensemble models against a incoming datastream of time series fashion.")]
-  [Creatable("Algorithms")]
-  public class DatastreamAnalysisOptimizer : NamedItem, IOptimizer, IStorableContent {
-
-    // TODO: introduce members -> ensembles, datastream
-
-
-    // VAR 1: datastream = problem data
-    [Storable]
-    private IRegressionProblemData problemData;
-
-    public IRegressionProblemData ProblemData {
-      get { return problemData; }
+  [Item("DatastreamAnalysis Optimizer",
+     "The main loop for evaluating ensemble models against a incoming datastream of time series fashion.")]
+  [Creatable(CreatableAttribute.Categories.Algorithms)]
+  public class DatastreamAnalysisOptimizer : Executable, IOptimizer, IStorableContent {
+    #region properties
+    public string Filename { get; set; }
+
+    private DatastreamAnalysisOptimizerAction daoAction;
+
+    public IEnumerable<IOptimizer> NestedOptimizers { get; }
+
+
+    [Storable]
+    protected ILog log;
+    public ILog Log {
+      get { return log; }
+    }
+
+    [Storable]
+    private ResultCollection results;
+
+    public ResultCollection Results {
+      get { return results; }
+    }
+
+    private CancellationTokenSource cancellationTokenSource;
+    private bool stopPending;
+    private DateTime lastUpdateTime;
+
+    [Storable]
+    protected int runsCounter;
+
+    [Storable]
+    private RunCollection runs;
+
+    public RunCollection Runs
+    {
+      get { return runs; }
+      protected set
+      {
+        if (value == null) throw new ArgumentNullException();
+        if (runs != value) {
+          if (runs != null) DeregisterRunsEvents();
+          runs = value;
+          if (runs != null) RegisterRunsEvents();
+        }
+      }
+    }
+
+
+    [Storable]
+    private IItemList<RegressionEnsembleModel> ensembles;
+
+    public IItemList<RegressionEnsembleModel> Ensembles {
+      get { return ensembles; }
       set {
-        if (value == null || value == problemData)
+        if (value == null || value == ensembles)
           return;
 
-        problemData = value;
-      }
-    }
-
-    // VAR 2: datastream = external source (webservice, AMQP-Queue, etc.)
-    // TODO
+        ensembles = value;
+      }
+    }
+
+
+    // VAR 1: datastream ~= problem data, VAR 2 (TODO): datastream = external source e.g. webservice, AMQP-Queue, etc.
+    [Storable]
+    private Datastream datastream;
+
+    public Datastream Datastream {
+      get { return datastream; }
+      set {
+        if (value == null || value == datastream)
+          return;
+
+        datastream = value;
+      }
+    }
+
+    #endregion properties
+
+    #region ResultsProperties
+    private double ResultsBestQuality
+    {
+      get { return ((DoubleValue)Results["Best Quality"].Value).Value; }
+      set { ((DoubleValue)Results["Best Quality"].Value).Value = value; }
+    }
+    private DataTable ResultsQualities
+    {
+      get { return ((DataTable)Results["Qualities"].Value); }
+    }
+    #endregion
+
+    #region constructors, cloner,...
 
     public DatastreamAnalysisOptimizer() {
-      Name = "Datastream Analysis";
+      name = "Datastream Analysis";
+      log = new Log();
+      results = new ResultCollection();
+      ensembles = new ItemList<RegressionEnsembleModel>();
+      datastream = new Datastream();
+      runsCounter = 0;
+      runs = new RunCollection();
+      Initialize();
     }
 
     [StorableConstructor]
-    protected DatastreamAnalysisOptimizer(bool deserializing) : base(deserializing) { }
+    protected DatastreamAnalysisOptimizer(bool deserializing) : base(deserializing) {
+    }
 
     [StorableHook(HookType.AfterDeserialization)]
@@ -71,147 +163,321 @@
 
     protected DatastreamAnalysisOptimizer(DatastreamAnalysisOptimizer original, Cloner cloner) : base(original, cloner) {
-      // TODO: clone members (ensembles, datastream)
-      this.ProblemData = (IRegressionProblemData)original.ProblemData.Clone(cloner);
+      name = original.name;
+      log = cloner.Clone(original.log);
+      results = cloner.Clone(original.results);
+      ensembles = (ItemList<RegressionEnsembleModel>) original.Ensembles.Clone(cloner);
+      datastream = (Datastream) original.Datastream.Clone(cloner);
+      runsCounter = original.runsCounter;
+      runs = cloner.Clone(original.runs);
+      Initialize();
     }
 
     public override IDeepCloneable Clone(Cloner cloner) {
-      return  new DatastreamAnalysisOptimizer(this, cloner);
-    }
-
-
-    // TODO: introduce EventHandler for EnsemblesChanged, DatastreamChanged
-
-    public EventHandler ProblemDataChanged;
-    private void OnProblemDataChanged() {
-      var changed = ProblemDataChanged;
+      return new DatastreamAnalysisOptimizer(this, cloner);
+    }
+
+    private void Initialize() {
+      if (runs != null) RegisterRunsEvents();
+    }
+    #endregion
+
+    #region control actions
+
+    public override void Prepare() {
+      if (ensembles == null || datastream == null) return;
+      Prepare(true);
+    }
+
+    public void Prepare(bool clearRuns) {
+      if (ensembles == null || datastream == null) return;
+      base.Prepare();
+      if (clearRuns) results.Clear();
+      OnPrepared();
+    }
+
+    public override void Start() {
+      if (ensembles == null || datastream == null) return;
+      base.Start();
+      cancellationTokenSource = new CancellationTokenSource();
+      stopPending = false;
+
+      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
+      task.ContinueWith(t => {
+        try {
+          t.Wait();
+        }
+        catch (AggregateException ex) {
+          try {
+            ex.Flatten().Handle(x => x is OperationCanceledException);
+          } catch (AggregateException remaining) {
+            if(remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+            else OnExceptionOccurred(remaining);
+          }
+        }
+        cancellationTokenSource.Dispose();
+        cancellationTokenSource = null;
+
+        // handle stop/pause
+        if(stopPending) { }
+        if(!Datastream.SlidingWindowMovementPossible) OnStopped();
+        else OnPaused();
+      });
+
+    }
+
+    public override void Pause() {
+      if (ensembles == null || datastream == null) return;
+      base.Pause();
+      cancellationTokenSource.Cancel();
+    }
+
+    public override void Stop() {
+      if (ensembles == null || datastream == null) return;
+      base.Stop();
+      if (ExecutionState == ExecutionState.Paused) {
+        OnStopped();
+      } else {
+        stopPending = true;
+        cancellationTokenSource.Cancel();
+      }
+    }
+
+    protected override void OnPrepared() {
+      Log.LogMessage("Datastream analysis prepared");
+      base.OnPrepared();
+    }
+
+    protected override void OnStarted() {
+      Log.LogMessage("Datastream analysis started");
+      base.OnStarted();
+    }
+
+    protected override void OnPaused() {
+      Log.LogMessage("Datastream analysis paused");
+      base.OnPaused();
+    }
+
+    protected override void OnStopped() {
+      Log.LogMessage("Datastream analysis stopped");
+      base.OnStopped();
+    }
+
+    #endregion
+
+
+    private void Run(object state) {
+      CancellationToken cancellationToken = (CancellationToken) state;
+      OnStarted();
+      lastUpdateTime = DateTime.UtcNow;
+      System.Timers.Timer timer = new System.Timers.Timer(250);
+      timer.AutoReset = true;
+      timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
+      timer.Start();
+
+      try {
+        Run(cancellationToken);
+      }
+      finally {
+        timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
+        timer.Stop();
+        ExecutionTime += DateTime.UtcNow - lastUpdateTime;
+      }
+
+      cancellationToken.ThrowIfCancellationRequested();
+    }
+
+    protected void Run(CancellationToken cancellationToken) {
+
+      // setup results
+      var slidingWindowMovements = new IntValue(0);
+      Results.Add(new Result("Sliding Window Movements", slidingWindowMovements));
+
+      var qtable = new DataTable("Qualities");
+      qtable.Rows.Add(new DataRow("R²"));
+      qtable.Rows.Add(new DataRow("Pearson"));
+      Results.Add(new Result("Qualities", qtable));
+
+      var curLoss = new DoubleValue();
+      Results.Add(new Result("R²", curLoss));
+      Results.Add(new Result("Best Quality", curLoss));
+
+
+      // init algorithm
+      var problemData = Datastream.ProblemData;
+      var targetVarName = problemData.TargetVariable;
+      var activeVariables = problemData.AllowedInputVariables;
+      Random rnd = new Random();
+
+      try {
+        while (Datastream.SlidingWindowMovementPossible) {
+          cancellationToken.ThrowIfCancellationRequested();
+
+          Task.Delay(Datastream.SlidingWindowMovementInterval.Value);
+
+          Datastream.MoveSlidingWindow();
+
+          // TODO do the window evaluation
+
+          // TODO: collect results and display them
+
+          curLoss.Value = rnd.Next(100);
+          qtable.Rows["R²"].Values.Add(curLoss.Value);
+          qtable.Rows["Pearson"].Values.Add(curLoss.Value % 10);
+
+          slidingWindowMovements.Value++;
+        }
+
+        // TODO: collect runs (c.f. goal seeking)
+      }
+      catch (Exception ex) {
+        if (ex is ArgumentOutOfRangeException) throw ex;
+        if (ex is OperationCanceledException) throw ex;
+      }
+      finally {
+        // reset everything
+        //Prepare(true);
+      }
+    }
+
+    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
+      System.Timers.Timer timer = (System.Timers.Timer)sender;
+      timer.Enabled = false;
+      DateTime now = DateTime.UtcNow;
+      ExecutionTime += now - lastUpdateTime;
+      lastUpdateTime = now;
+      timer.Enabled = true;
+    }
+
+    public void CollectResultValues(IDictionary<string, IItem> values) {
+      values.Add("Execution Time", new TimeSpanValue(ExecutionTime));
+      Results.CollectResultValues(values);
+    }
+
+    #region events
+
+    public EventHandler EnsemblesChanged;
+    public EventHandler DatastreamChanged;
+
+    protected virtual void DeregisterRunsEvents() {
+      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+    }
+
+    protected virtual void RegisterRunsEvents() {
+      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+    }
+
+    protected virtual void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      runsCounter = runs.Count;
+    }
+
+    #region event handling
+
+    private void OnEnsemblesChanged() {
+      var changed = EnsemblesChanged;
       if (changed != null)
         changed(this, EventArgs.Empty);
     }
 
-
-    public void Prepare() {
-      Prepare(false);
-    }
-
-    public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-    }
-
-    public void Pause() {
-      if (ExecutionState != ExecutionState.Started)
-        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
-    }
-
-    public void Stop() {
-      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
-    }
-
-    public void Prepare(bool clearRuns) {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused) && (ExecutionState != ExecutionState.Stopped))
-        throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState));
-    }
-
-
-    [Storable]
-    private TimeSpan executionTime;
-    public TimeSpan ExecutionTime {
-      get { return executionTime; }
-      private set {
-        executionTime = value;
-        OnExecutionTimeChanged();
-      }
-    }
-
-    public RunCollection Runs {
-      get {
-        return new RunCollection();
-      }
-    }
-
-    public IEnumerable<IOptimizer> NestedOptimizers { get; }
-    public string Filename { get; set; }
-
-    public new static Image StaticItemImage
-    {
-      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
-    }
-
-    public override Image ItemImage {
-      get {
-        if (ExecutionState == ExecutionState.Prepared)
-          return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPrepared;
-        else if (ExecutionState == ExecutionState.Started)
-          return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStarted;
-        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPaused;
-        else if (ExecutionState == ExecutionState.Stopped)
-          return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStopped;
-        else return base.ItemImage;
-      }
-    }
-
-    #region Events
-
-    public ExecutionState ExecutionState { get; private set; }
-    public event EventHandler ExecutionStateChanged;
-    public event EventHandler ExecutionTimeChanged;
-    public event EventHandler Prepared;
-    public event EventHandler Started;
-    public event EventHandler Paused;
-    public event EventHandler Stopped;
-    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
-
-
-    #region event firing
-
-    protected override void OnNameChanged() {
-      base.OnNameChanged();
-    }
-
-    private void OnExecutionStateChanged() {
-      EventHandler handler = ExecutionStateChanged;
+    private void OnDatastreamChanged() {
+      var changed = DatastreamChanged;
+      if (changed != null)
+        changed(this, EventArgs.Empty);
+    }
+
+    #endregion
+
+    #endregion
+
+    #region nameditem
+
+    [Storable] protected string name;
+
+    /// <inheritdoc/>
+    /// <remarks>Calls <see cref="OnNameChanging"/> and also <see cref="OnNameChanged"/> 
+    /// eventually in the setter.</remarks>
+    public string Name {
+      get { return name; }
+      set {
+        if (!CanChangeName) throw new NotSupportedException("Name cannot be changed.");
+        if (!(name.Equals(value) || (value == null) && (name == string.Empty))) {
+          CancelEventArgs<string> e = value == null
+            ? new CancelEventArgs<string>(string.Empty)
+            : new CancelEventArgs<string>(value);
+          OnNameChanging(e);
+          if (!e.Cancel) {
+            name = value == null ? string.Empty : value;
+            OnNameChanged();
+          }
+        }
+      }
+    }
+
+    public virtual bool CanChangeName {
+      get { return true; }
+    }
+
+    [Storable] protected string description;
+
+    public string Description {
+      get { return description; }
+      set {
+        if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed.");
+        if (!(description.Equals(value) || (value == null) && (description == string.Empty))) {
+          description = value == null ? string.Empty : value;
+          OnDescriptionChanged();
+        }
+      }
+    }
+
+    public virtual bool CanChangeDescription {
+      get { return true; }
+    }
+
+    /// <summary>
+    /// Gets the string representation of the current instance in the format: <c>Name: [null|Value]</c>.
+    /// </summary>
+    /// <returns>The current instance as a string.</returns>
+    public override string ToString() {
+      return Name;
+    }
+
+    /// <inheritdoc/>
+    public event EventHandler<CancelEventArgs<string>> NameChanging;
+
+    /// <summary>
+    /// Fires a new <c>NameChanging</c> event.
+    /// </summary>
+    /// <param name="e">The event arguments of the changing.</param>
+    protected virtual void OnNameChanging(CancelEventArgs<string> e) {
+      var handler = NameChanging;
+      if (handler != null) handler(this, e);
+    }
+
+    /// <inheritdoc/>
+    public event EventHandler NameChanged;
+
+    /// <summary>
+    /// Fires a new <c>NameChanged</c> event.
+    /// </summary>
+    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
+    protected virtual void OnNameChanged() {
+      var handler = NameChanged;
       if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    private void OnExecutionTimeChanged() {
-      EventHandler handler = ExecutionTimeChanged;
+      OnToStringChanged();
+    }
+
+    /// <inheritdoc/>
+    public event EventHandler DescriptionChanged;
+
+    /// <summary>
+    /// Fires a new <c>DescriptionChanged</c> event.
+    /// </summary>
+    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
+    protected virtual void OnDescriptionChanged() {
+      var handler = DescriptionChanged;
       if (handler != null) handler(this, EventArgs.Empty);
     }
 
-    private void OnPrepared() {
-      ExecutionState = ExecutionState.Prepared;
-      EventHandler handler = Prepared;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    private void OnStarted() {
-      ExecutionState = ExecutionState.Started;
-      EventHandler handler = Started;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    private void OnPaused() {
-      ExecutionState = ExecutionState.Paused;
-      EventHandler handler = Paused;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    private void OnStopped() {
-      ExecutionState = ExecutionState.Stopped;
-      EventHandler handler = Stopped;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    private void OnExceptionOccurred(Exception exception) {
-      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
-      if (handler != null) handler(this, new EventArgs<Exception>(exception));
-    }
-
-    #endregion
-
-
-    #endregion
-
+    #endregion nameditem
   }
 }
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisUtil.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisUtil.cs	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisUtil.cs	(revision 14536)
@@ -0,0 +1,35 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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 HeuristicLab.Collections;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.DatastreamAnalysis {
+  internal static class DatastreamAnalysisUtil {
+
+    internal static void RaiseEvent(object sender, EventHandler handler) {
+      if (handler == null) return;
+      handler(sender, EventArgs.Empty);
+    }
+
+  }
+}
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj	(revision 14536)
@@ -102,5 +102,10 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AnalysisBase.cs" />
+    <Compile Include="Datastream.cs" />
     <Compile Include="DatastreamAnalysisOptimizer.cs" />
+    <Compile Include="DatastreamAnalysisUtil.cs" />
+    <Compile Include="IAnalysisBase.cs" />
+    <Compile Include="IDatastream.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj.user
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj.user	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj.user	(revision 14536)
@@ -4,8 +4,10 @@
     <StartAction>Program</StartAction>
     <StartProgram>C:\dev\workspaces\hl-core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
+    <StartArguments>/hidestarter /start:Optimizer</StartArguments>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
     <StartAction>Program</StartAction>
     <StartProgram>C:\dev\workspaces\hl-core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
+    <StartArguments>/hidestarter /start:Optimizer</StartArguments>
   </PropertyGroup>
 </Project>
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IAnalysisBase.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IAnalysisBase.cs	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IAnalysisBase.cs	(revision 14536)
@@ -0,0 +1,20 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.DatastreamAnalysis {
+  public interface IAnalysisBase : IParameterizedNamedItem, INamedItem, IItem, IContent, IDeepCloneable, ICloneable, IParameterizedItem {
+
+    // Ensembles
+    void AddEnsemble(IRegressionEnsembleModel ensemble);
+    void RemoveEnsemble(IRegressionEnsembleModel ensemble);
+
+    // Events
+    event EventHandler ModelsChanged;
+  }
+}
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IDatastream.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IDatastream.cs	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IDatastream.cs	(revision 14536)
@@ -0,0 +1,29 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.DatastreamAnalysis {
+  public interface IDatastream : IParameterizedNamedItem, INamedItem, IItem, IContent, IDeepCloneable, ICloneable, IParameterizedItem {
+  }
+}
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs	(revision 14536)
@@ -23,5 +23,5 @@
 
 namespace HeuristicLab.DatastreamAnalysis {
-  [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14488")]
+  [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14491")]
   [PluginFile("HeuristicLab.DatastreamAnalysis-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs	(revision 14536)
@@ -54,3 +54,3 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.14.14488")]
+[assembly: AssemblyFileVersion("3.4.14.14491")]
Index: branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs	(revision 14535)
+++ branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs	(revision 14536)
@@ -82,4 +82,9 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
+
+      foreach (var model in Models) {
+        this.models.Add(model);
+      }
+
       // BackwardsCompatibility 3.3.14
       #region Backwards compatible code, remove with 3.4
Index: branches/HeuristicLab.DatastreamAnalysis/PreBuildEvent.cmd
===================================================================
--- branches/HeuristicLab.DatastreamAnalysis/PreBuildEvent.cmd	(revision 14536)
+++ branches/HeuristicLab.DatastreamAnalysis/PreBuildEvent.cmd	(revision 14536)
@@ -0,0 +1,2 @@
+IF EXIST "%ProjectDir%\Properties\AssemblyInfo.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.cs.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
+IF EXIST "%ProjectDir%\Plugin.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
