Index: branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj	(revision 8954)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj	(revision 8955)
@@ -263,4 +263,10 @@
       <DependentUpon>RunCollectionDataTableView.cs</DependentUpon>
     </Compile>
+    <Compile Include="TimeLimitRunView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="TimeLimitRunView.Designer.cs">
+      <DependentUpon>TimeLimitRunView.cs</DependentUpon>
+    </Compile>
     <Compile Include="UserDefinedAlgorithmView.cs">
       <SubType>UserControl</SubType>
@@ -391,4 +397,9 @@
       <Private>False</Private>
     </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="TimeLimitRunView.resx">
+      <DependentUpon>TimeLimitRunView.cs</DependentUpon>
+    </EmbeddedResource>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.Designer.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.Designer.cs	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.Designer.cs	(revision 8955)
@@ -0,0 +1,323 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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
+
+namespace HeuristicLab.Optimization.Views {
+  partial class TimeLimitRunView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TimeLimitRunView));
+      this.timeLimitLabel = new System.Windows.Forms.Label();
+      this.timeLimitTextBox = new System.Windows.Forms.TextBox();
+      this.label1 = new System.Windows.Forms.Label();
+      this.snapShotsTextBox = new System.Windows.Forms.TextBox();
+      this.storeAlgorithmInEachSnapshotCheckBox = new System.Windows.Forms.CheckBox();
+      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
+      this.algorithmTabPage = new System.Windows.Forms.TabPage();
+      this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+      this.openAlgorithmButton = new System.Windows.Forms.Button();
+      this.newAlgorithmButton = new System.Windows.Forms.Button();
+      this.snapshotsTabPage = new System.Windows.Forms.TabPage();
+      this.snapshotsView = new HeuristicLab.Optimization.Views.RunCollectionView();
+      this.runsTabPage = new System.Windows.Forms.TabPage();
+      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
+      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+      this.tabControl.SuspendLayout();
+      this.algorithmTabPage.SuspendLayout();
+      this.snapshotsTabPage.SuspendLayout();
+      this.runsTabPage.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // startButton
+      // 
+      this.startButton.Location = new System.Drawing.Point(0, 440);
+      this.toolTip.SetToolTip(this.startButton, "Start/Resume Optimizer");
+      // 
+      // executionTimeTextBox
+      // 
+      this.executionTimeTextBox.Location = new System.Drawing.Point(295, 444);
+      // 
+      // executionTimeLabel
+      // 
+      this.executionTimeLabel.Location = new System.Drawing.Point(206, 447);
+      // 
+      // pauseButton
+      // 
+      this.pauseButton.Location = new System.Drawing.Point(30, 440);
+      this.toolTip.SetToolTip(this.pauseButton, "Pause Optimizer");
+      // 
+      // stopButton
+      // 
+      this.stopButton.Location = new System.Drawing.Point(60, 440);
+      this.toolTip.SetToolTip(this.stopButton, "Stop Optimizer");
+      // 
+      // resetButton
+      // 
+      this.resetButton.Location = new System.Drawing.Point(90, 440);
+      this.toolTip.SetToolTip(this.resetButton, "Reset Optimizer");
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Location = new System.Drawing.Point(69, 0);
+      this.nameTextBox.Size = new System.Drawing.Size(338, 20);
+      // 
+      // timeLimitLabel
+      // 
+      this.timeLimitLabel.AutoSize = true;
+      this.timeLimitLabel.Location = new System.Drawing.Point(3, 29);
+      this.timeLimitLabel.Name = "timeLimitLabel";
+      this.timeLimitLabel.Size = new System.Drawing.Size(53, 13);
+      this.timeLimitLabel.TabIndex = 16;
+      this.timeLimitLabel.Text = "Time limit:";
+      // 
+      // timeLimitTextBox
+      // 
+      this.timeLimitTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.timeLimitTextBox.Location = new System.Drawing.Point(69, 26);
+      this.timeLimitTextBox.Name = "timeLimitTextBox";
+      this.timeLimitTextBox.Size = new System.Drawing.Size(338, 20);
+      this.timeLimitTextBox.TabIndex = 17;
+      this.timeLimitTextBox.Leave += new System.EventHandler(this.timeLimitTextBox_Leave);
+      this.timeLimitTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeLimitTextBox_Validating);
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(3, 55);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(60, 13);
+      this.label1.TabIndex = 16;
+      this.label1.Text = "Snapshots:";
+      // 
+      // snapShotsTextBox
+      // 
+      this.snapShotsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.snapShotsTextBox.Location = new System.Drawing.Point(69, 52);
+      this.snapShotsTextBox.Name = "snapShotsTextBox";
+      this.snapShotsTextBox.Size = new System.Drawing.Size(148, 20);
+      this.snapShotsTextBox.TabIndex = 17;
+      // 
+      // storeAlgorithmInEachSnapshotCheckBox
+      // 
+      this.storeAlgorithmInEachSnapshotCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+      this.storeAlgorithmInEachSnapshotCheckBox.AutoSize = true;
+      this.storeAlgorithmInEachSnapshotCheckBox.Location = new System.Drawing.Point(223, 54);
+      this.storeAlgorithmInEachSnapshotCheckBox.Name = "storeAlgorithmInEachSnapshotCheckBox";
+      this.storeAlgorithmInEachSnapshotCheckBox.Size = new System.Drawing.Size(184, 17);
+      this.storeAlgorithmInEachSnapshotCheckBox.TabIndex = 18;
+      this.storeAlgorithmInEachSnapshotCheckBox.Text = "Store Algorithm in Each Snapshot";
+      this.storeAlgorithmInEachSnapshotCheckBox.UseVisualStyleBackColor = true;
+      this.storeAlgorithmInEachSnapshotCheckBox.CheckedChanged += new System.EventHandler(this.storeAlgorithmInEachSnapshotCheckBox_CheckedChanged);
+      // 
+      // tabControl
+      // 
+      this.tabControl.AllowDrop = true;
+      this.tabControl.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.tabControl.Controls.Add(this.algorithmTabPage);
+      this.tabControl.Controls.Add(this.snapshotsTabPage);
+      this.tabControl.Controls.Add(this.runsTabPage);
+      this.tabControl.Location = new System.Drawing.Point(0, 78);
+      this.tabControl.Name = "tabControl";
+      this.tabControl.SelectedIndex = 0;
+      this.tabControl.Size = new System.Drawing.Size(429, 356);
+      this.tabControl.TabIndex = 19;
+      // 
+      // algorithmTabPage
+      // 
+      this.algorithmTabPage.AllowDrop = true;
+      this.algorithmTabPage.Controls.Add(this.algorithmViewHost);
+      this.algorithmTabPage.Controls.Add(this.openAlgorithmButton);
+      this.algorithmTabPage.Controls.Add(this.newAlgorithmButton);
+      this.algorithmTabPage.Location = new System.Drawing.Point(4, 22);
+      this.algorithmTabPage.Name = "algorithmTabPage";
+      this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.algorithmTabPage.Size = new System.Drawing.Size(421, 330);
+      this.algorithmTabPage.TabIndex = 1;
+      this.algorithmTabPage.Text = "Algorithm";
+      this.algorithmTabPage.UseVisualStyleBackColor = true;
+      this.algorithmTabPage.DragDrop += new System.Windows.Forms.DragEventHandler(this.algorithmTabPage_DragDrop);
+      this.algorithmTabPage.DragEnter += new System.Windows.Forms.DragEventHandler(this.algorithmTabPage_DragEnterOver);
+      this.algorithmTabPage.DragOver += new System.Windows.Forms.DragEventHandler(this.algorithmTabPage_DragEnterOver);
+      // 
+      // algorithmViewHost
+      // 
+      this.algorithmViewHost.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.algorithmViewHost.Caption = "View";
+      this.algorithmViewHost.Content = null;
+      this.algorithmViewHost.Enabled = false;
+      this.algorithmViewHost.Location = new System.Drawing.Point(6, 36);
+      this.algorithmViewHost.Name = "algorithmViewHost";
+      this.algorithmViewHost.ReadOnly = false;
+      this.algorithmViewHost.Size = new System.Drawing.Size(409, 288);
+      this.algorithmViewHost.TabIndex = 3;
+      this.algorithmViewHost.ViewsLabelVisible = true;
+      this.algorithmViewHost.ViewType = null;
+      // 
+      // openAlgorithmButton
+      // 
+      this.openAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("openAlgorithmButton.Image")));
+      this.openAlgorithmButton.Location = new System.Drawing.Point(36, 6);
+      this.openAlgorithmButton.Name = "openAlgorithmButton";
+      this.openAlgorithmButton.Size = new System.Drawing.Size(24, 24);
+      this.openAlgorithmButton.TabIndex = 1;
+      this.toolTip.SetToolTip(this.openAlgorithmButton, "Open Optimizer");
+      this.openAlgorithmButton.UseVisualStyleBackColor = true;
+      this.openAlgorithmButton.Click += new System.EventHandler(this.openAlgorithmButton_Click);
+      // 
+      // newAlgorithmButton
+      // 
+      this.newAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("newAlgorithmButton.Image")));
+      this.newAlgorithmButton.Location = new System.Drawing.Point(6, 6);
+      this.newAlgorithmButton.Name = "newAlgorithmButton";
+      this.newAlgorithmButton.Size = new System.Drawing.Size(24, 24);
+      this.newAlgorithmButton.TabIndex = 0;
+      this.toolTip.SetToolTip(this.newAlgorithmButton, "New Optimizer");
+      this.newAlgorithmButton.UseVisualStyleBackColor = true;
+      this.newAlgorithmButton.Click += new System.EventHandler(this.newAlgorithmButton_Click);
+      // 
+      // snapshotsTabPage
+      // 
+      this.snapshotsTabPage.Controls.Add(this.snapshotsView);
+      this.snapshotsTabPage.Location = new System.Drawing.Point(4, 22);
+      this.snapshotsTabPage.Name = "snapshotsTabPage";
+      this.snapshotsTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.snapshotsTabPage.Size = new System.Drawing.Size(421, 330);
+      this.snapshotsTabPage.TabIndex = 2;
+      this.snapshotsTabPage.Text = "Snapshots";
+      this.snapshotsTabPage.UseVisualStyleBackColor = true;
+      // 
+      // snapshotsView
+      // 
+      this.snapshotsView.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.snapshotsView.Caption = "RunCollection View";
+      this.snapshotsView.Content = null;
+      this.snapshotsView.Location = new System.Drawing.Point(6, 6);
+      this.snapshotsView.Name = "snapshotsView";
+      this.snapshotsView.ReadOnly = false;
+      this.snapshotsView.Size = new System.Drawing.Size(409, 317);
+      this.snapshotsView.TabIndex = 0;
+      // 
+      // runsTabPage
+      // 
+      this.runsTabPage.Controls.Add(this.runsView);
+      this.runsTabPage.Location = new System.Drawing.Point(4, 22);
+      this.runsTabPage.Name = "runsTabPage";
+      this.runsTabPage.Size = new System.Drawing.Size(421, 330);
+      this.runsTabPage.TabIndex = 3;
+      this.runsTabPage.Text = "Runs";
+      this.runsTabPage.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(6, 6);
+      this.runsView.Name = "runsView";
+      this.runsView.ReadOnly = false;
+      this.runsView.Size = new System.Drawing.Size(409, 317);
+      this.runsView.TabIndex = 1;
+      // 
+      // openFileDialog
+      // 
+      this.openFileDialog.DefaultExt = "hl";
+      this.openFileDialog.FileName = "Optimizer";
+      this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
+      this.openFileDialog.Title = "Open Optimizer";
+      // 
+      // TimeLimitRunView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.tabControl);
+      this.Controls.Add(this.timeLimitTextBox);
+      this.Controls.Add(this.timeLimitLabel);
+      this.Controls.Add(this.label1);
+      this.Controls.Add(this.snapShotsTextBox);
+      this.Controls.Add(this.storeAlgorithmInEachSnapshotCheckBox);
+      this.Name = "TimeLimitRunView";
+      this.Size = new System.Drawing.Size(432, 464);
+      this.Controls.SetChildIndex(this.storeAlgorithmInEachSnapshotCheckBox, 0);
+      this.Controls.SetChildIndex(this.snapShotsTextBox, 0);
+      this.Controls.SetChildIndex(this.label1, 0);
+      this.Controls.SetChildIndex(this.timeLimitLabel, 0);
+      this.Controls.SetChildIndex(this.timeLimitTextBox, 0);
+      this.Controls.SetChildIndex(this.nameLabel, 0);
+      this.Controls.SetChildIndex(this.nameTextBox, 0);
+      this.Controls.SetChildIndex(this.infoLabel, 0);
+      this.Controls.SetChildIndex(this.resetButton, 0);
+      this.Controls.SetChildIndex(this.stopButton, 0);
+      this.Controls.SetChildIndex(this.pauseButton, 0);
+      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
+      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
+      this.Controls.SetChildIndex(this.startButton, 0);
+      this.Controls.SetChildIndex(this.tabControl, 0);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+      this.tabControl.ResumeLayout(false);
+      this.algorithmTabPage.ResumeLayout(false);
+      this.snapshotsTabPage.ResumeLayout(false);
+      this.runsTabPage.ResumeLayout(false);
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Label timeLimitLabel;
+    private System.Windows.Forms.TextBox timeLimitTextBox;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.TextBox snapShotsTextBox;
+    private System.Windows.Forms.CheckBox storeAlgorithmInEachSnapshotCheckBox;
+    private MainForm.WindowsForms.DragOverTabControl tabControl;
+    private System.Windows.Forms.TabPage algorithmTabPage;
+    private MainForm.WindowsForms.ViewHost algorithmViewHost;
+    private System.Windows.Forms.Button openAlgorithmButton;
+    private System.Windows.Forms.Button newAlgorithmButton;
+    private System.Windows.Forms.TabPage snapshotsTabPage;
+    private RunCollectionView snapshotsView;
+    private System.Windows.Forms.TabPage runsTabPage;
+    private RunCollectionView runsView;
+    private System.Windows.Forms.OpenFileDialog openFileDialog;
+  }
+}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.cs	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.cs	(revision 8955)
@@ -0,0 +1,279 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.ComponentModel;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Core.Views;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Optimization.Views {
+  [View("TimeLimit Run View")]
+  [Content(typeof(TimeLimitRun), IsDefaultView = true)]
+  public partial class TimeLimitRunView : IOptimizerView {
+    protected TypeSelectorDialog algorithmTypeSelectorDialog;
+    protected virtual bool SuppressEvents { get; set; }
+
+    public new TimeLimitRun Content {
+      get { return (TimeLimitRun)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public TimeLimitRunView() {
+      InitializeComponent();
+    }
+
+    protected override void Dispose(bool disposing) {
+      if (disposing) {
+        if (algorithmTypeSelectorDialog != null) algorithmTypeSelectorDialog.Dispose();
+        if (components != null) components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    protected override void DeregisterContentEvents() {
+      Content.PropertyChanged -= Content_PropertyChanged;
+      base.DeregisterContentEvents();
+    }
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.PropertyChanged += Content_PropertyChanged;
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      SuppressEvents = true;
+      try {
+        if (Content == null) {
+          timeLimitTextBox.Tag = TimeSpan.FromSeconds(60);
+          timeLimitTextBox.Text = FormatTimeSpan((TimeSpan)timeLimitTextBox.Tag);
+          snapShotsTextBox.Text = String.Empty;
+          storeAlgorithmInEachSnapshotCheckBox.Checked = false;
+          algorithmViewHost.Content = null;
+          snapshotsView.Content = null;
+          runsView.Content = null;
+        } else {
+          timeLimitTextBox.Tag = Content.MaximumExecutionTime;
+          timeLimitTextBox.Text = FormatTimeSpan(Content.MaximumExecutionTime);
+          snapShotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes);
+          storeAlgorithmInEachSnapshotCheckBox.Checked = Content.StoreAlgorithmInEachSnapshot;
+          algorithmViewHost.Content = Content.Algorithm;
+          snapshotsView.Content = Content.Snapshots;
+          runsView.Content = Content.Runs;
+        }
+      } finally { SuppressEvents = false; }
+    }
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      timeLimitTextBox.Enabled = Content != null && !ReadOnly;
+      snapShotsTextBox.Enabled = Content != null && !ReadOnly;
+      storeAlgorithmInEachSnapshotCheckBox.Enabled = Content != null && !ReadOnly;
+      newAlgorithmButton.Enabled = Content != null && !ReadOnly;
+      openAlgorithmButton.Enabled = Content != null && !ReadOnly;
+      algorithmViewHost.Enabled = Content != null;
+      snapshotsView.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<IAlgorithm>();
+        if (!optimizers.Contains(Content.Algorithm)) {
+          var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers);
+          if (!nestedOptimizers.Contains(Content)) Content.Stop();
+        }
+      }
+      base.OnClosed(e);
+    }
+
+    #region Event Handlers
+    #region Content events
+    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
+      switch (e.PropertyName) {
+        case "MaximumExecutionTime":
+          SuppressEvents = true;
+          try {
+            timeLimitTextBox.Text = FormatTimeSpan(Content.MaximumExecutionTime);
+          } finally { SuppressEvents = false; }
+          break;
+        case "SnapshotTimes": break;
+        case "StoreAlgorithmInEachSnapshot":
+          SuppressEvents = true;
+          try {
+            storeAlgorithmInEachSnapshotCheckBox.Checked = Content.StoreAlgorithmInEachSnapshot;
+          } finally { SuppressEvents = false; }
+          break;
+        case "Algorithm":
+          SuppressEvents = true;
+          try {
+            algorithmViewHost.Content = Content.Algorithm;
+          } finally { SuppressEvents = false; }
+          break;
+        case "Snapshots":
+          SuppressEvents = true;
+          try {
+            snapshotsView.Content = Content.Snapshots;
+          } finally { SuppressEvents = false; }
+          break;
+        case "Runs":
+          SuppressEvents = true;
+          try {
+            runsView.Content = Content.Runs;
+          } finally { SuppressEvents = false; }
+          break;
+      }
+    }
+    #endregion
+
+    #region Control events
+    private void timeLimitTextBox_Leave(object sender, EventArgs e) {
+      if (SuppressEvents) return;
+      SuppressEvents = true;
+      try {
+        timeLimitTextBox.Text = FormatTimeSpan((TimeSpan)timeLimitTextBox.Tag);
+      } finally { SuppressEvents = false; }
+    }
+
+    private void timeLimitTextBox_Validating(object sender, CancelEventArgs e) {
+      if (SuppressEvents) return;
+      double value;
+      var text = timeLimitTextBox.Text.Trim();
+      var length = text.Length;
+      while (!double.TryParse(text.Substring(0, length), out value)) {
+        length--;
+        if (length <= 0) {
+          value = double.NaN;
+          break;
+        }
+      }
+      if (double.IsNaN(value)) {
+        e.Cancel = true;
+        errorProvider.SetError(timeLimitTextBox, "Please enter a valid time span, e.g. 60, 20s, 45 seconds, 3h, 1 hour, 4 d, 2 days");
+      } else {
+        TimeSpan ts;
+        if (length < text.Length) {
+          ts = GetTimeSpanFromFormat(value, text.Substring(length - 1, text.Length - (length - 1)).TrimStart());
+        } else ts = TimeSpan.FromSeconds(value);
+        timeLimitTextBox.Tag = ts;
+        e.Cancel = false;
+        errorProvider.SetError(timeLimitTextBox, String.Empty);
+      }
+    }
+
+    private void storeAlgorithmInEachSnapshotCheckBox_CheckedChanged(object sender, EventArgs e) {
+      if (SuppressEvents) return;
+      SuppressEvents = true;
+      try {
+        Content.StoreAlgorithmInEachSnapshot = storeAlgorithmInEachSnapshotCheckBox.Checked;
+      } finally { SuppressEvents = false; }
+    }
+
+    private void newAlgorithmButton_Click(object sender, EventArgs e) {
+      if (algorithmTypeSelectorDialog == null) {
+        algorithmTypeSelectorDialog = new TypeSelectorDialog { Caption = "Select Algorithm" };
+        algorithmTypeSelectorDialog.TypeSelector.Caption = "Available Algorithms";
+        algorithmTypeSelectorDialog.TypeSelector.Configure(typeof(IAlgorithm), false, true);
+      }
+      if (algorithmTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
+        try {
+          Content.Algorithm = (IAlgorithm)algorithmTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
+        } catch (Exception ex) {
+          ErrorHandling.ShowErrorDialog(this, ex);
+        }
+      }
+    }
+
+    private void openAlgorithmButton_Click(object sender, EventArgs e) {
+      openFileDialog.Title = "Open Algorithm";
+      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
+        newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = false;
+        algorithmViewHost.Enabled = false;
+
+        ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) {
+          try {
+            if (error != null) throw error;
+            var algorithm = content as IAlgorithm;
+            if (algorithm == null)
+              MessageBox.Show(this, "The selected file does not contain an algorithm.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
+            else
+              Content.Algorithm = algorithm;
+          } catch (Exception ex) {
+            ErrorHandling.ShowErrorDialog(this, ex);
+          } finally {
+            Invoke(new Action(delegate() {
+              algorithmViewHost.Enabled = true;
+              newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = true;
+            }));
+          }
+        });
+      }
+    }
+
+    private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) {
+      e.Effect = DragDropEffects.None;
+      if (!ReadOnly && (e.Data.GetData(Constants.DragDropDataFormat) is IAlgorithm)) {
+        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;
+      }
+    }
+
+    private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) {
+      if (e.Effect != DragDropEffects.None) {
+        var algorithm = e.Data.GetData(Constants.DragDropDataFormat) as IAlgorithm;
+        if (e.Effect.HasFlag(DragDropEffects.Copy)) algorithm = (IAlgorithm)algorithm.Clone();
+        Content.Algorithm = algorithm;
+      }
+    }
+    #endregion
+    #endregion
+
+    private string FormatTimeSpan(TimeSpan ts) {
+      if (ts.TotalSeconds < 180) return ts.TotalSeconds + " seconds";
+      if (ts.TotalMinutes < 180) return ts.TotalMinutes + " minutes";
+      if (ts.TotalHours < 96) return ts.TotalHours + " hours";
+      return ts.TotalDays + " days";
+    }
+
+    private TimeSpan GetTimeSpanFromFormat(double value, string text) {
+      switch (text) {
+        case "d":
+        case "day":
+        case "days": return TimeSpan.FromDays(value);
+        case "h":
+        case "hour":
+        case "hours": return TimeSpan.FromHours(value);
+        case "min":
+        case "minute":
+        case "minutes": return TimeSpan.FromMinutes(value);
+        default: return TimeSpan.FromSeconds(value);
+      }
+    }
+  }
+}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.resx
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.resx	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.resx	(revision 8955)
@@ -0,0 +1,162 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>107, 17</value>
+  </metadata>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="openAlgorithmButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDAAA
+        CwwBP0AiyAAAAn9JREFUOE+lk2tI01EYxhf0oU8WqVEIRpaIBWJgSPUhROmippS3QkkTylsXDMW8ts3b
+        1G06daVibuqaOq0sxbBCKBSJ0PJCialZUFSKqaGSt1//TbIsww8deOBwznl+5zkv71kHiP5rGAFrKb1Q
+        5ypR6bmaVU6m2kCiXJv007Om2XgwJEaNT4QiyDi/GF9mKRVgsWkav+CYQkR1utwAQfypphqZ4l/JIhOL
+        jvtGKfCOyDMB6O/WMjNea9L3MT1zIxoM5QrqdWnS1SA+kUq8w1V4hhUgqq1QMj1WtcK88KmIud5oqsqy
+        qCzOQFMopSQvhRvyBApkcQLzV91E1docpr9ol29eFMz0J0Bv2Kr6C3CrVMa3jyWm2EZzc12OSQ8M2TTo
+        ZdytzMCgSUVfIqFcfY2bqiSKlQmoc+JNaUSVJRlMvsvHGHuoVUx9lZKFIQkMp63UW2FtMBH6YuBVFF01
+        /lwO9aoQadSpTAxkwXs596oVtD+ULx36/Qkvg6HDl/k2D2YeufCmwoELZ45MCIA9olKVmK+vJQy3JVOv
+        l7M4KIae8CVAV6hgPMV8uxczLYeZbDrIaN1eJBG2nHazyDN1cZEymdHueG7rcuh8KiTpixYA56AziMVn
+        J5h9coyp5kOM1TvxudqejvRNBHrY4GRnZmcCqLMT6GlJ4Y4uGwZS4IUQ97kfs62eTD12YbzBmRGDAx+0
+        u+iVmyMO24njbqvG5VbOz4yjtjyL3vuRdOSKltUuX0+LbAON0o3UJFmiibPi+pXtBLrvWHR2tHZfBuSm
+        xZIrPk9mfAiJlwKMleWsvxsnj+7H9YAD+xxssbexwnqbBVs2m7HV3GxlI631E9fa/wGRpaRpa3TTbQAA
+        AABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="newAlgorithmButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDAAA
+        CwwBP0AiyAAAAaJJREFUOE+Nkk1LAkEYx5egU9Sla9AX6NKhLlH3IujSoXtBn0EI+gB5qVBIKyIMtEDo
+        BUIhK6qDSUj4gqYloilmvqa5rrr/Zlx3dkU0B/48z87O/zfzPDMcAE7SOg8sB2AkqYdIXIoAK4LyX17X
+        HiVzYPhC0NBUB1yR6Jfy5lx59rQXRAKEhl6Y4YhMnXOSmUDywRlYHV5YbG6YLp1UW2pgEyBoSdARbdNP
+        OszSSQxEZnkO2D+7w/TCWhtEOoGfqyE5KmKnVf/HIHBLcn4SiI21oGQPkw32J68M0VKvBKgvulgJdEey
+        O+sJNhlg9/i6aZalAEpz98xwQADhAaWJ2GOAWr0BCpFBCoCeIjOxgdCIHlYCiI8DGQ1QMjKzKIooVwSk
+        MuUmYGp+lf5rlcDeArhD6wMzqZOqUEe2UEE0WegNMFgcHYB6Q0SxXEUiXcJbNNsboD+xdwAqfA3p3C8i
+        n3l4QuneAFqfetDG5X94xFJFBCIZuHzJ/gHqxoVjObwGv/DojvcPUDfO9/4NpyeBm+dofwD5vrvFrtco
+        3zFd8J/oO/gDpYIVhUFyWDsAAAAASUVORK5CYII=
+</value>
+  </data>
+  <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>230, 17</value>
+  </metadata>
+</root>
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/BatchRun.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/BatchRun.cs	(revision 8954)
+++ 	(revision )
@@ -1,454 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2012 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.Drawing;
-using HeuristicLab.Collections;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Optimization {
-  internal enum BatchRunAction { None, Prepare, Start, Pause, Stop };
-
-  /// <summary>
-  /// A run in which an optimizer is executed a given number of times.
-  /// </summary>
-  [Item("Batch Run", "A run in which an optimizer is executed a given number of times.")]
-  [Creatable("Testing & Analysis")]
-  [StorableClass]
-  public sealed class BatchRun : NamedItem, IOptimizer, IStorableContent {
-    public string Filename { get; set; }
-
-    public static new 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;
-      }
-    }
-
-    [Storable]
-    private ExecutionState executionState;
-    public ExecutionState ExecutionState {
-      get { return executionState; }
-      private set {
-        if (executionState != value) {
-          executionState = value;
-          OnExecutionStateChanged();
-          OnItemImageChanged();
-        }
-      }
-    }
-
-    [Storable]
-    private TimeSpan executionTime;
-    public TimeSpan ExecutionTime {
-      get {
-        if ((Optimizer != null) && (Optimizer.ExecutionState != ExecutionState.Stopped))
-          return executionTime + Optimizer.ExecutionTime;
-        else
-          return executionTime;
-      }
-      private set {
-        executionTime = value;
-        OnExecutionTimeChanged();
-      }
-    }
-
-    [Storable]
-    private TimeSpan runsExecutionTime;
-
-    [Storable]
-    private IOptimizer optimizer;
-    public IOptimizer Optimizer {
-      get { return optimizer; }
-      set {
-        if (optimizer != value) {
-          if (optimizer != null) {
-            DeregisterOptimizerEvents();
-            IEnumerable<IRun> runs = optimizer.Runs;
-            optimizer = null; //necessary to avoid removing the runs from the old optimizer
-            Runs.RemoveRange(runs);
-          }
-          optimizer = value;
-          if (optimizer != null) {
-            RegisterOptimizerEvents();
-            Runs.AddRange(optimizer.Runs);
-          }
-          OnOptimizerChanged();
-          Prepare();
-        }
-      }
-    }
-    // BackwardsCompatibility3.3
-    #region Backwards compatible code (remove with 3.4)
-    [Storable(AllowOneWay = true)]
-    private IAlgorithm algorithm {
-      set { optimizer = value; }
-    }
-    #endregion
-
-    [Storable]
-    private int repetitions;
-    public int Repetitions {
-      get { return repetitions; }
-      set {
-        if (repetitions != value) {
-          repetitions = value;
-          OnRepetitionsChanged();
-          if ((Optimizer != null) && (Optimizer.ExecutionState == ExecutionState.Stopped))
-            Prepare();
-        }
-      }
-    }
-    [Storable]
-    private int repetitionsCounter;
-    public int RepetitionsCounter {
-      get { return repetitionsCounter; }
-      private set {
-        if (value != repetitionsCounter) {
-          repetitionsCounter = value;
-          OnRepetitionsCounterChanged();
-        }
-      }
-    }
-
-    [Storable]
-    private RunCollection runs;
-    public RunCollection Runs {
-      get { return runs; }
-      private set {
-        if (value == null) throw new ArgumentNullException();
-        if (runs != value) {
-          if (runs != null) DeregisterRunsEvents();
-          runs = value;
-          if (runs != null) RegisterRunsEvents();
-        }
-      }
-    }
-
-    public IEnumerable<IOptimizer> NestedOptimizers {
-      get {
-        if (Optimizer == null) yield break;
-
-        yield return Optimizer;
-        foreach (IOptimizer opt in Optimizer.NestedOptimizers)
-          yield return opt;
-      }
-    }
-
-    private BatchRunAction batchRunAction = BatchRunAction.None;
-
-    public BatchRun()
-      : base() {
-      name = ItemName;
-      description = ItemDescription;
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      runsExecutionTime = TimeSpan.Zero;
-      repetitions = 10;
-      repetitionsCounter = 0;
-      Runs = new RunCollection { AlgorithmName = Name };
-    }
-    public BatchRun(string name)
-      : base(name) {
-      description = ItemDescription;
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      runsExecutionTime = TimeSpan.Zero;
-      repetitions = 10;
-      repetitionsCounter = 0;
-      Runs = new RunCollection { AlgorithmName = Name };
-    }
-    public BatchRun(string name, string description)
-      : base(name, description) {
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      runsExecutionTime = TimeSpan.Zero;
-      repetitions = 10;
-      repetitionsCounter = 0;
-      Runs = new RunCollection { AlgorithmName = Name };
-    }
-    [StorableConstructor]
-    private BatchRun(bool deserializing) : base(deserializing) { }
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      Initialize();
-    }
-
-    private BatchRun(BatchRun original, Cloner cloner)
-      : base(original, cloner) {
-      executionState = original.executionState;
-      executionTime = original.executionTime;
-      runsExecutionTime = original.runsExecutionTime;
-      optimizer = cloner.Clone(original.optimizer);
-      repetitions = original.repetitions;
-      repetitionsCounter = original.repetitionsCounter;
-      runs = cloner.Clone(original.runs);
-      batchRunAction = original.batchRunAction;
-      Initialize();
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
-      return new BatchRun(this, cloner);
-    }
-
-    private void Initialize() {
-      if (optimizer != null) RegisterOptimizerEvents();
-      if (runs != null) RegisterRunsEvents();
-    }
-
-    public void Prepare() {
-      Prepare(false);
-    }
-    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));
-      if (Optimizer != null) {
-        ExecutionTime = TimeSpan.Zero;
-        RepetitionsCounter = 0;
-        if (clearRuns) runs.Clear();
-        batchRunAction = BatchRunAction.Prepare;
-        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-        try { Optimizer.Prepare(clearRuns); }
-        catch (InvalidOperationException) { }
-      } else {
-        ExecutionState = ExecutionState.Stopped;
-      }
-    }
-    public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizer == null) return;
-      batchRunAction = BatchRunAction.Start;
-      if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare();
-      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-      try { Optimizer.Start(); }
-      catch (InvalidOperationException) { }
-    }
-    public void Pause() {
-      if (ExecutionState != ExecutionState.Started)
-        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizer == null) return;
-      batchRunAction = BatchRunAction.Pause;
-      if (Optimizer.ExecutionState != ExecutionState.Started) return;
-      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-      try { Optimizer.Pause(); }
-      catch (InvalidOperationException) { }
-    }
-    public void Stop() {
-      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizer == null) return;
-      batchRunAction = BatchRunAction.Stop;
-      if (Optimizer.ExecutionState != ExecutionState.Started && Optimizer.ExecutionState != ExecutionState.Paused) {
-        OnStopped();
-        return;
-      }
-      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-      try { Optimizer.Stop(); }
-      catch (InvalidOperationException) { }
-    }
-
-    #region Events
-    protected override void OnNameChanged() {
-      base.OnNameChanged();
-      runs.AlgorithmName = Name;
-    }
-
-    public event EventHandler ExecutionStateChanged;
-    private void OnExecutionStateChanged() {
-      EventHandler handler = ExecutionStateChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler ExecutionTimeChanged;
-    private void OnExecutionTimeChanged() {
-      EventHandler handler = ExecutionTimeChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler OptimizerChanged;
-    private void OnOptimizerChanged() {
-      EventHandler handler = OptimizerChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler RepetitionsChanged;
-    private void OnRepetitionsChanged() {
-      EventHandler handler = RepetitionsChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler RepetetionsCounterChanged;
-    private void OnRepetitionsCounterChanged() {
-      EventHandler handler = RepetetionsCounterChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Prepared;
-    private void OnPrepared() {
-      batchRunAction = BatchRunAction.None;
-      ExecutionState = ExecutionState.Prepared;
-      EventHandler handler = Prepared;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Started;
-    private void OnStarted() {
-      // no reset of BatchRunAction.Started, because we need to differ which of the two was started by the user
-      ExecutionState = ExecutionState.Started;
-      EventHandler handler = Started;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Paused;
-    private void OnPaused() {
-      batchRunAction = BatchRunAction.None;
-      ExecutionState = ExecutionState.Paused;
-      EventHandler handler = Paused;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Stopped;
-    private void OnStopped() {
-      batchRunAction = BatchRunAction.None;
-      ExecutionState = ExecutionState.Stopped;
-      EventHandler handler = Stopped;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
-    private void OnExceptionOccurred(Exception exception) {
-      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
-      if (handler != null) handler(this, new EventArgs<Exception>(exception));
-    }
-
-    private void RegisterOptimizerEvents() {
-      optimizer.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Optimizer_ExceptionOccurred);
-      optimizer.ExecutionTimeChanged += new EventHandler(Optimizer_ExecutionTimeChanged);
-      optimizer.Paused += new EventHandler(Optimizer_Paused);
-      optimizer.Prepared += new EventHandler(Optimizer_Prepared);
-      optimizer.Started += new EventHandler(Optimizer_Started);
-      optimizer.Stopped += new EventHandler(Optimizer_Stopped);
-      optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_CollectionReset);
-      optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsAdded);
-      optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsRemoved);
-    }
-    private void DeregisterOptimizerEvents() {
-      optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Optimizer_ExceptionOccurred);
-      optimizer.ExecutionTimeChanged -= new EventHandler(Optimizer_ExecutionTimeChanged);
-      optimizer.Paused -= new EventHandler(Optimizer_Paused);
-      optimizer.Prepared -= new EventHandler(Optimizer_Prepared);
-      optimizer.Started -= new EventHandler(Optimizer_Started);
-      optimizer.Stopped -= new EventHandler(Optimizer_Stopped);
-      optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_CollectionReset);
-      optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsAdded);
-      optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsRemoved);
-    }
-    private void Optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) {
-      OnExceptionOccurred(e.Value);
-    }
-    private void Optimizer_ExecutionTimeChanged(object sender, EventArgs e) {
-      OnExecutionTimeChanged();
-    }
-    private void Optimizer_Paused(object sender, EventArgs e) {
-      if (ExecutionState == ExecutionState.Started) {
-        OnPaused();
-      }
-    }
-    private void Optimizer_Prepared(object sender, EventArgs e) {
-      if (batchRunAction == BatchRunAction.Prepare || ExecutionState == ExecutionState.Stopped) {
-        ExecutionTime = TimeSpan.Zero;
-        runsExecutionTime = TimeSpan.Zero;
-        RepetitionsCounter = 0;
-        OnPrepared();
-      }
-    }
-    private void Optimizer_Started(object sender, EventArgs e) {
-      if (ExecutionState != ExecutionState.Started)
-        OnStarted();
-    }
-    private void Optimizer_Stopped(object sender, EventArgs e) {
-      RepetitionsCounter++;
-      ExecutionTime += runsExecutionTime;
-      runsExecutionTime = TimeSpan.Zero;
-
-      if (batchRunAction == BatchRunAction.Stop) OnStopped();
-      else if (repetitionsCounter >= repetitions) OnStopped();
-      else if (batchRunAction == BatchRunAction.Pause) OnPaused();
-      else if (batchRunAction == BatchRunAction.Start) {
-        Optimizer.Prepare();
-        Optimizer.Start();
-      } else if (executionState == ExecutionState.Started) {
-        // if the batch run hasn't been started but the inner optimizer was run then pause
-        OnPaused();
-      } else OnStopped();
-    }
-    private void Optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      Runs.RemoveRange(e.OldItems);
-      Runs.AddRange(e.Items);
-    }
-    private void Optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      Runs.AddRange(e.Items);
-    }
-    private void Optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      Runs.RemoveRange(e.Items);
-    }
-
-    private void RegisterRunsEvents() {
-      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
-      runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
-      runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
-    }
-
-    private void DeregisterRunsEvents() {
-      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
-      runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
-      runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
-    }
-    private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      if (Optimizer != null) Optimizer.Runs.RemoveRange(e.OldItems);
-      foreach (IRun run in e.Items) {
-        IItem item;
-        run.Results.TryGetValue("Execution Time", out item);
-        TimeSpanValue executionTime = item as TimeSpanValue;
-        if (executionTime != null) ExecutionTime += executionTime.Value;
-      }
-    }
-    private void Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      foreach (IRun run in e.Items) {
-        IItem item;
-        run.Results.TryGetValue("Execution Time", out item);
-        TimeSpanValue executionTime = item as TimeSpanValue;
-        if (executionTime != null) {
-          if (Optimizer.ExecutionState == ExecutionState.Started)
-            runsExecutionTime += executionTime.Value;
-          else
-            ExecutionTime += executionTime.Value;
-        }
-      }
-    }
-    private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      if (Optimizer != null) Optimizer.Runs.RemoveRange(e.Items);
-    }
-    #endregion
-  }
-}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/Experiment.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/Experiment.cs	(revision 8954)
+++ 	(revision )
@@ -1,412 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2012 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.Drawing;
-using System.Linq;
-using HeuristicLab.Collections;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Optimization {
-  /// <summary>
-  /// An experiment which contains multiple algorithms, batch runs or other experiments.
-  /// </summary>
-  [Item("Experiment", "An experiment which contains multiple algorithms, batch runs or other experiments.")]
-  [Creatable("Testing & Analysis")]
-  [StorableClass]
-  public sealed class Experiment : NamedItem, IOptimizer, IStorableContent {
-    public string Filename { get; set; }
-
-    public static new Image StaticItemImage {
-      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
-    }
-    public override Image ItemImage {
-      get {
-        if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPrepared;
-        else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStarted;
-        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPaused;
-        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStopped;
-        else return base.ItemImage;
-      }
-    }
-
-    [Storable]
-    private ExecutionState executionState;
-    public ExecutionState ExecutionState {
-      get { return executionState; }
-      private set {
-        if (executionState != value) {
-          executionState = value;
-          OnExecutionStateChanged();
-          OnItemImageChanged();
-        }
-      }
-    }
-
-    [Storable]
-    private TimeSpan executionTime;
-    public TimeSpan ExecutionTime {
-      get { return executionTime; }
-      private set {
-        executionTime = value;
-        OnExecutionTimeChanged();
-      }
-    }
-
-    [Storable]
-    private OptimizerList optimizers;
-    public OptimizerList Optimizers {
-      get { return optimizers; }
-    }
-
-    [Storable]
-    private RunCollection runs;
-    public RunCollection Runs {
-      get { return runs; }
-      private set {
-        if (value == null) throw new ArgumentNullException();
-        if (runs != value) {
-          if (runs != null) DeregisterRunsEvents();
-          runs = value;
-          if (runs != null) RegisterRunsEvents();
-        }
-      }
-    }
-
-    public IEnumerable<IOptimizer> NestedOptimizers {
-      get {
-        if (Optimizers == null) yield break;
-
-        foreach (IOptimizer opt in Optimizers) {
-          yield return opt;
-          foreach (IOptimizer nestedOpt in opt.NestedOptimizers)
-            yield return nestedOpt;
-        }
-      }
-    }
-
-    private bool experimentStarted = false;
-    private bool experimentStopped = false;
-
-    public Experiment()
-      : base() {
-      name = ItemName;
-      description = ItemDescription;
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      optimizers = new OptimizerList();
-      Runs = new RunCollection { AlgorithmName = Name };
-      Initialize();
-    }
-    public Experiment(string name)
-      : base(name) {
-      description = ItemDescription;
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      optimizers = new OptimizerList();
-      Runs = new RunCollection { AlgorithmName = Name };
-      Initialize();
-    }
-    public Experiment(string name, string description)
-      : base(name, description) {
-      executionState = ExecutionState.Stopped;
-      executionTime = TimeSpan.Zero;
-      optimizers = new OptimizerList();
-      Runs = new RunCollection { AlgorithmName = Name };
-      Initialize();
-    }
-    [StorableConstructor]
-    private Experiment(bool deserializing) : base(deserializing) { }
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      Initialize();
-    }
-    private Experiment(Experiment original, Cloner cloner)
-      : base(original, cloner) {
-      executionState = original.executionState;
-      executionTime = original.executionTime;
-      optimizers = cloner.Clone(original.optimizers);
-      runs = cloner.Clone(original.runs);
-
-      experimentStarted = original.experimentStarted;
-      experimentStopped = original.experimentStopped;
-      Initialize();
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
-      return new Experiment(this, cloner);
-    }
-
-    private void Initialize() {
-      RegisterOptimizersEvents();
-      foreach (IOptimizer optimizer in optimizers)
-        RegisterOptimizerEvents(optimizer);
-      if (runs != null) RegisterRunsEvents();
-    }
-
-    public void Prepare() {
-      Prepare(false);
-    }
-    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));
-      if (Optimizers.Count == 0) return;
-
-      if (clearRuns) runs.Clear();
-
-      experimentStarted = false;
-      experimentStopped = false;
-      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) {
-        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-        try { optimizer.Prepare(clearRuns); }
-        catch (InvalidOperationException) { }
-      }
-    }
-    public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizers.Count == 0) return;
-
-      experimentStarted = true;
-      experimentStopped = false;
-      IOptimizer optimizer = Optimizers.FirstOrDefault(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused));
-      if (optimizer != null) {
-        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-        try { optimizer.Start(); }
-        catch (InvalidOperationException) { }
-      }
-    }
-    public void Pause() {
-      if (ExecutionState != ExecutionState.Started)
-        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizers.Count == 0) return;
-
-      experimentStarted = false;
-      experimentStopped = false;
-      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) {
-        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-        try { optimizer.Pause(); }
-        catch (InvalidOperationException) { }
-      }
-    }
-    public void Stop() {
-      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizers.Count == 0) return;
-
-      experimentStarted = false;
-      experimentStopped = true;
-      if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
-        foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
-          // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-          try { optimizer.Stop(); }
-          catch (InvalidOperationException) { }
-        }
-      } else {
-        OnStopped();
-      }
-    }
-
-    #region Events
-    protected override void OnNameChanged() {
-      base.OnNameChanged();
-      Runs.AlgorithmName = Name;
-    }
-
-    public event EventHandler ExecutionStateChanged;
-    private void OnExecutionStateChanged() {
-      EventHandler handler = ExecutionStateChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler ExecutionTimeChanged;
-    private void OnExecutionTimeChanged() {
-      EventHandler handler = ExecutionTimeChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Prepared;
-    private void OnPrepared() {
-      ExecutionState = ExecutionState.Prepared;
-      EventHandler handler = Prepared;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Started;
-    private void OnStarted() {
-      ExecutionState = ExecutionState.Started;
-      EventHandler handler = Started;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Paused;
-    private void OnPaused() {
-      ExecutionState = ExecutionState.Paused;
-      EventHandler handler = Paused;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler Stopped;
-    private void OnStopped() {
-      ExecutionState = ExecutionState.Stopped;
-      EventHandler handler = Stopped;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
-    private void OnExceptionOccurred(Exception exception) {
-      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
-      if (handler != null) handler(this, new EventArgs<Exception>(exception));
-    }
-
-    private void RegisterOptimizersEvents() {
-      Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
-      Optimizers.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
-      Optimizers.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
-      Optimizers.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
-    }
-    private void DeregisterOptimizersEvents() {
-      Optimizers.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
-      Optimizers.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
-      Optimizers.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
-      Optimizers.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
-    }
-    private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
-      foreach (IndexedItem<IOptimizer> item in e.OldItems)
-        RemoveOptimizer(item.Value);
-      foreach (IndexedItem<IOptimizer> item in e.Items)
-        AddOptimizer(item.Value);
-    }
-    private void Optimizers_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
-      foreach (IndexedItem<IOptimizer> item in e.Items)
-        AddOptimizer(item.Value);
-    }
-    private void Optimizers_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
-      foreach (IndexedItem<IOptimizer> item in e.Items)
-        RemoveOptimizer(item.Value);
-    }
-    private void Optimizers_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
-      foreach (IndexedItem<IOptimizer> item in e.OldItems)
-        RemoveOptimizer(item.Value);
-      foreach (IndexedItem<IOptimizer> item in e.Items)
-        AddOptimizer(item.Value);
-    }
-    private void AddOptimizer(IOptimizer optimizer) {
-      RegisterOptimizerEvents(optimizer);
-      Runs.AddRange(optimizer.Runs);
-      optimizer.Prepare();
-      if (ExecutionState == ExecutionState.Stopped && optimizer.ExecutionState == ExecutionState.Prepared)
-        OnPrepared();
-    }
-    private void RemoveOptimizer(IOptimizer optimizer) {
-      DeregisterOptimizerEvents(optimizer);
-      Runs.RemoveRange(optimizer.Runs);
-      if (ExecutionState == ExecutionState.Prepared && !optimizers.Any(opt => opt.ExecutionState == ExecutionState.Prepared))
-        OnStopped();
-    }
-
-    private void RegisterOptimizerEvents(IOptimizer optimizer) {
-      optimizer.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
-      optimizer.ExecutionTimeChanged += new EventHandler(optimizer_ExecutionTimeChanged);
-      optimizer.Paused += new EventHandler(optimizer_Paused);
-      optimizer.Prepared += new EventHandler(optimizer_Prepared);
-      optimizer.Started += new EventHandler(optimizer_Started);
-      optimizer.Stopped += new EventHandler(optimizer_Stopped);
-      optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
-      optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
-      optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
-    }
-    private void DeregisterOptimizerEvents(IOptimizer optimizer) {
-      optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
-      optimizer.ExecutionTimeChanged -= new EventHandler(optimizer_ExecutionTimeChanged);
-      optimizer.Paused -= new EventHandler(optimizer_Paused);
-      optimizer.Prepared -= new EventHandler(optimizer_Prepared);
-      optimizer.Started -= new EventHandler(optimizer_Started);
-      optimizer.Stopped -= new EventHandler(optimizer_Stopped);
-      optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
-      optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
-      optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
-    }
-
-    private readonly object locker = new object();
-    private void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) {
-      lock (locker)
-        OnExceptionOccurred(e.Value);
-    }
-    private void optimizer_ExecutionTimeChanged(object sender, EventArgs e) {
-      lock (locker)
-        ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime);
-    }
-    private void optimizer_Paused(object sender, EventArgs e) {
-      lock (locker)
-        if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused();
-    }
-    private void optimizer_Prepared(object sender, EventArgs e) {
-      lock (locker)
-        if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared();
-    }
-    private void optimizer_Started(object sender, EventArgs e) {
-      lock (locker)
-        if (ExecutionState != ExecutionState.Started) OnStarted();
-    }
-    private void optimizer_Stopped(object sender, EventArgs e) {
-      lock (locker) {
-        if (experimentStopped) {
-          if (Optimizers.All(x => (x.ExecutionState == ExecutionState.Stopped) || (x.ExecutionState == ExecutionState.Prepared))) OnStopped();
-        } else {
-          if (experimentStarted && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
-            Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
-          } else if (Optimizers.All(x => x.ExecutionState == ExecutionState.Stopped)) OnStopped();
-          else if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused();
-        }
-      }
-    }
-    private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      lock (locker) {
-        Runs.RemoveRange(e.OldItems);
-        Runs.AddRange(e.Items);
-      }
-    }
-    private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      lock (locker)
-        Runs.AddRange(e.Items);
-    }
-    private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      lock (locker)
-        Runs.RemoveRange(e.Items);
-    }
-
-    private void RegisterRunsEvents() {
-      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
-      runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
-    }
-    private void DeregisterRunsEvents() {
-      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
-      runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
-    }
-    private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      foreach (IOptimizer optimizer in Optimizers)
-        optimizer.Runs.RemoveRange(e.OldItems);
-    }
-    private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
-      foreach (IOptimizer optimizer in Optimizers)
-        optimizer.Runs.RemoveRange(e.Items);
-    }
-    #endregion
-  }
-}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 8954)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 8955)
@@ -121,4 +121,7 @@
     <Compile Include="Interfaces\ISimilarityBasedOperator.cs" />
     <Compile Include="Interfaces\ISolutionSimilarityCalculator.cs" />
+    <Compile Include="MetaOptimizers\BatchRun.cs" />
+    <Compile Include="MetaOptimizers\Experiment.cs" />
+    <Compile Include="MetaOptimizers\TimeLimitRun.cs" />
     <Compile Include="RunCollectionModification\RunCollectionRunRemover.cs" />
     <Compile Include="Plugin.cs" />
@@ -130,5 +133,4 @@
     <None Include="Plugin.cs.frame" />
     <Compile Include="Algorithms\Algorithm.cs" />
-    <Compile Include="BatchRun.cs" />
     <Compile Include="RunCollectionModification\Calculator.cs" />
     <Compile Include="Interfaces\IDiscreteDoubleMatrixModifier.cs" />
@@ -173,5 +175,4 @@
     <Compile Include="RunCollectionConstraints\IRunCollectionConstraint.cs" />
     <Compile Include="OptimizerList.cs" />
-    <Compile Include="Experiment.cs" />
     <Compile Include="Interfaces\IOptimizer.cs" />
     <Compile Include="RunCollection.cs" />
@@ -281,5 +282,5 @@
   -->
   <PropertyGroup>
-   <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
 set ProjectDir=$(ProjectDir)
 set SolutionDir=$(SolutionDir)
@@ -288,5 +289,5 @@
 call PreBuildEvent.cmd
 </PreBuildEvent>
-<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
 export ProjectDir=$(ProjectDir)
 export SolutionDir=$(SolutionDir)
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs	(revision 8955)
@@ -0,0 +1,454 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Drawing;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization {
+  internal enum BatchRunAction { None, Prepare, Start, Pause, Stop };
+
+  /// <summary>
+  /// A run in which an optimizer is executed a given number of times.
+  /// </summary>
+  [Item("Batch Run", "A run in which an optimizer is executed a given number of times.")]
+  [Creatable("Testing & Analysis")]
+  [StorableClass]
+  public sealed class BatchRun : NamedItem, IOptimizer, IStorableContent {
+    public string Filename { get; set; }
+
+    public static new 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;
+      }
+    }
+
+    [Storable]
+    private ExecutionState executionState;
+    public ExecutionState ExecutionState {
+      get { return executionState; }
+      private set {
+        if (executionState != value) {
+          executionState = value;
+          OnExecutionStateChanged();
+          OnItemImageChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private TimeSpan executionTime;
+    public TimeSpan ExecutionTime {
+      get {
+        if ((Optimizer != null) && (Optimizer.ExecutionState != ExecutionState.Stopped))
+          return executionTime + Optimizer.ExecutionTime;
+        else
+          return executionTime;
+      }
+      private set {
+        executionTime = value;
+        OnExecutionTimeChanged();
+      }
+    }
+
+    [Storable]
+    private TimeSpan runsExecutionTime;
+
+    [Storable]
+    private IOptimizer optimizer;
+    public IOptimizer Optimizer {
+      get { return optimizer; }
+      set {
+        if (optimizer != value) {
+          if (optimizer != null) {
+            DeregisterOptimizerEvents();
+            IEnumerable<IRun> runs = optimizer.Runs;
+            optimizer = null; //necessary to avoid removing the runs from the old optimizer
+            Runs.RemoveRange(runs);
+          }
+          optimizer = value;
+          if (optimizer != null) {
+            RegisterOptimizerEvents();
+            Runs.AddRange(optimizer.Runs);
+          }
+          OnOptimizerChanged();
+          Prepare();
+        }
+      }
+    }
+    // BackwardsCompatibility3.3
+    #region Backwards compatible code (remove with 3.4)
+    [Storable(AllowOneWay = true)]
+    private IAlgorithm algorithm {
+      set { optimizer = value; }
+    }
+    #endregion
+
+    [Storable]
+    private int repetitions;
+    public int Repetitions {
+      get { return repetitions; }
+      set {
+        if (repetitions != value) {
+          repetitions = value;
+          OnRepetitionsChanged();
+          if ((Optimizer != null) && (Optimizer.ExecutionState == ExecutionState.Stopped))
+            Prepare();
+        }
+      }
+    }
+    [Storable]
+    private int repetitionsCounter;
+    public int RepetitionsCounter {
+      get { return repetitionsCounter; }
+      private set {
+        if (value != repetitionsCounter) {
+          repetitionsCounter = value;
+          OnRepetitionsCounterChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private RunCollection runs;
+    public RunCollection Runs {
+      get { return runs; }
+      private set {
+        if (value == null) throw new ArgumentNullException();
+        if (runs != value) {
+          if (runs != null) DeregisterRunsEvents();
+          runs = value;
+          if (runs != null) RegisterRunsEvents();
+        }
+      }
+    }
+
+    public IEnumerable<IOptimizer> NestedOptimizers {
+      get {
+        if (Optimizer == null) yield break;
+
+        yield return Optimizer;
+        foreach (IOptimizer opt in Optimizer.NestedOptimizers)
+          yield return opt;
+      }
+    }
+
+    private BatchRunAction batchRunAction = BatchRunAction.None;
+
+    public BatchRun()
+      : base() {
+      name = ItemName;
+      description = ItemDescription;
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      runsExecutionTime = TimeSpan.Zero;
+      repetitions = 10;
+      repetitionsCounter = 0;
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+    public BatchRun(string name)
+      : base(name) {
+      description = ItemDescription;
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      runsExecutionTime = TimeSpan.Zero;
+      repetitions = 10;
+      repetitionsCounter = 0;
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+    public BatchRun(string name, string description)
+      : base(name, description) {
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      runsExecutionTime = TimeSpan.Zero;
+      repetitions = 10;
+      repetitionsCounter = 0;
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+    [StorableConstructor]
+    private BatchRun(bool deserializing) : base(deserializing) { }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+
+    private BatchRun(BatchRun original, Cloner cloner)
+      : base(original, cloner) {
+      executionState = original.executionState;
+      executionTime = original.executionTime;
+      runsExecutionTime = original.runsExecutionTime;
+      optimizer = cloner.Clone(original.optimizer);
+      repetitions = original.repetitions;
+      repetitionsCounter = original.repetitionsCounter;
+      runs = cloner.Clone(original.runs);
+      batchRunAction = original.batchRunAction;
+      Initialize();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
+      return new BatchRun(this, cloner);
+    }
+
+    private void Initialize() {
+      if (optimizer != null) RegisterOptimizerEvents();
+      if (runs != null) RegisterRunsEvents();
+    }
+
+    public void Prepare() {
+      Prepare(false);
+    }
+    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));
+      if (Optimizer != null) {
+        ExecutionTime = TimeSpan.Zero;
+        RepetitionsCounter = 0;
+        if (clearRuns) runs.Clear();
+        batchRunAction = BatchRunAction.Prepare;
+        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+        try { Optimizer.Prepare(clearRuns); }
+        catch (InvalidOperationException) { }
+      } else {
+        ExecutionState = ExecutionState.Stopped;
+      }
+    }
+    public void Start() {
+      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
+        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizer == null) return;
+      batchRunAction = BatchRunAction.Start;
+      if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare();
+      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+      try { Optimizer.Start(); }
+      catch (InvalidOperationException) { }
+    }
+    public void Pause() {
+      if (ExecutionState != ExecutionState.Started)
+        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizer == null) return;
+      batchRunAction = BatchRunAction.Pause;
+      if (Optimizer.ExecutionState != ExecutionState.Started) return;
+      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+      try { Optimizer.Pause(); }
+      catch (InvalidOperationException) { }
+    }
+    public void Stop() {
+      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
+        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizer == null) return;
+      batchRunAction = BatchRunAction.Stop;
+      if (Optimizer.ExecutionState != ExecutionState.Started && Optimizer.ExecutionState != ExecutionState.Paused) {
+        OnStopped();
+        return;
+      }
+      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+      try { Optimizer.Stop(); }
+      catch (InvalidOperationException) { }
+    }
+
+    #region Events
+    protected override void OnNameChanged() {
+      base.OnNameChanged();
+      runs.AlgorithmName = Name;
+    }
+
+    public event EventHandler ExecutionStateChanged;
+    private void OnExecutionStateChanged() {
+      EventHandler handler = ExecutionStateChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler ExecutionTimeChanged;
+    private void OnExecutionTimeChanged() {
+      EventHandler handler = ExecutionTimeChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler OptimizerChanged;
+    private void OnOptimizerChanged() {
+      EventHandler handler = OptimizerChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler RepetitionsChanged;
+    private void OnRepetitionsChanged() {
+      EventHandler handler = RepetitionsChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler RepetetionsCounterChanged;
+    private void OnRepetitionsCounterChanged() {
+      EventHandler handler = RepetetionsCounterChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Prepared;
+    private void OnPrepared() {
+      batchRunAction = BatchRunAction.None;
+      ExecutionState = ExecutionState.Prepared;
+      EventHandler handler = Prepared;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Started;
+    private void OnStarted() {
+      // no reset of BatchRunAction.Started, because we need to differ which of the two was started by the user
+      ExecutionState = ExecutionState.Started;
+      EventHandler handler = Started;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Paused;
+    private void OnPaused() {
+      batchRunAction = BatchRunAction.None;
+      ExecutionState = ExecutionState.Paused;
+      EventHandler handler = Paused;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Stopped;
+    private void OnStopped() {
+      batchRunAction = BatchRunAction.None;
+      ExecutionState = ExecutionState.Stopped;
+      EventHandler handler = Stopped;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
+    private void OnExceptionOccurred(Exception exception) {
+      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
+      if (handler != null) handler(this, new EventArgs<Exception>(exception));
+    }
+
+    private void RegisterOptimizerEvents() {
+      optimizer.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Optimizer_ExceptionOccurred);
+      optimizer.ExecutionTimeChanged += new EventHandler(Optimizer_ExecutionTimeChanged);
+      optimizer.Paused += new EventHandler(Optimizer_Paused);
+      optimizer.Prepared += new EventHandler(Optimizer_Prepared);
+      optimizer.Started += new EventHandler(Optimizer_Started);
+      optimizer.Stopped += new EventHandler(Optimizer_Stopped);
+      optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_CollectionReset);
+      optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsAdded);
+      optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsRemoved);
+    }
+    private void DeregisterOptimizerEvents() {
+      optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Optimizer_ExceptionOccurred);
+      optimizer.ExecutionTimeChanged -= new EventHandler(Optimizer_ExecutionTimeChanged);
+      optimizer.Paused -= new EventHandler(Optimizer_Paused);
+      optimizer.Prepared -= new EventHandler(Optimizer_Prepared);
+      optimizer.Started -= new EventHandler(Optimizer_Started);
+      optimizer.Stopped -= new EventHandler(Optimizer_Stopped);
+      optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_CollectionReset);
+      optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsAdded);
+      optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Optimizer_Runs_ItemsRemoved);
+    }
+    private void Optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) {
+      OnExceptionOccurred(e.Value);
+    }
+    private void Optimizer_ExecutionTimeChanged(object sender, EventArgs e) {
+      OnExecutionTimeChanged();
+    }
+    private void Optimizer_Paused(object sender, EventArgs e) {
+      if (ExecutionState == ExecutionState.Started) {
+        OnPaused();
+      }
+    }
+    private void Optimizer_Prepared(object sender, EventArgs e) {
+      if (batchRunAction == BatchRunAction.Prepare || ExecutionState == ExecutionState.Stopped) {
+        ExecutionTime = TimeSpan.Zero;
+        runsExecutionTime = TimeSpan.Zero;
+        RepetitionsCounter = 0;
+        OnPrepared();
+      }
+    }
+    private void Optimizer_Started(object sender, EventArgs e) {
+      if (ExecutionState != ExecutionState.Started)
+        OnStarted();
+    }
+    private void Optimizer_Stopped(object sender, EventArgs e) {
+      RepetitionsCounter++;
+      ExecutionTime += runsExecutionTime;
+      runsExecutionTime = TimeSpan.Zero;
+
+      if (batchRunAction == BatchRunAction.Stop) OnStopped();
+      else if (repetitionsCounter >= repetitions) OnStopped();
+      else if (batchRunAction == BatchRunAction.Pause) OnPaused();
+      else if (batchRunAction == BatchRunAction.Start) {
+        Optimizer.Prepare();
+        Optimizer.Start();
+      } else if (executionState == ExecutionState.Started) {
+        // if the batch run hasn't been started but the inner optimizer was run then pause
+        OnPaused();
+      } else OnStopped();
+    }
+    private void Optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      Runs.RemoveRange(e.OldItems);
+      Runs.AddRange(e.Items);
+    }
+    private void Optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      Runs.AddRange(e.Items);
+    }
+    private void Optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      Runs.RemoveRange(e.Items);
+    }
+
+    private void RegisterRunsEvents() {
+      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+      runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
+      runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
+    }
+
+    private void DeregisterRunsEvents() {
+      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+      runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
+      runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
+    }
+    private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      if (Optimizer != null) Optimizer.Runs.RemoveRange(e.OldItems);
+      foreach (IRun run in e.Items) {
+        IItem item;
+        run.Results.TryGetValue("Execution Time", out item);
+        TimeSpanValue executionTime = item as TimeSpanValue;
+        if (executionTime != null) ExecutionTime += executionTime.Value;
+      }
+    }
+    private void Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      foreach (IRun run in e.Items) {
+        IItem item;
+        run.Results.TryGetValue("Execution Time", out item);
+        TimeSpanValue executionTime = item as TimeSpanValue;
+        if (executionTime != null) {
+          if (Optimizer.ExecutionState == ExecutionState.Started)
+            runsExecutionTime += executionTime.Value;
+          else
+            ExecutionTime += executionTime.Value;
+        }
+      }
+    }
+    private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      if (Optimizer != null) Optimizer.Runs.RemoveRange(e.Items);
+    }
+    #endregion
+  }
+}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs	(revision 8955)
@@ -0,0 +1,412 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Drawing;
+using System.Linq;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization {
+  /// <summary>
+  /// An experiment which contains multiple algorithms, batch runs or other experiments.
+  /// </summary>
+  [Item("Experiment", "An experiment which contains multiple algorithms, batch runs or other experiments.")]
+  [Creatable("Testing & Analysis")]
+  [StorableClass]
+  public sealed class Experiment : NamedItem, IOptimizer, IStorableContent {
+    public string Filename { get; set; }
+
+    public static new Image StaticItemImage {
+      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
+    }
+    public override Image ItemImage {
+      get {
+        if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPrepared;
+        else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStarted;
+        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPaused;
+        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStopped;
+        else return base.ItemImage;
+      }
+    }
+
+    [Storable]
+    private ExecutionState executionState;
+    public ExecutionState ExecutionState {
+      get { return executionState; }
+      private set {
+        if (executionState != value) {
+          executionState = value;
+          OnExecutionStateChanged();
+          OnItemImageChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private TimeSpan executionTime;
+    public TimeSpan ExecutionTime {
+      get { return executionTime; }
+      private set {
+        executionTime = value;
+        OnExecutionTimeChanged();
+      }
+    }
+
+    [Storable]
+    private OptimizerList optimizers;
+    public OptimizerList Optimizers {
+      get { return optimizers; }
+    }
+
+    [Storable]
+    private RunCollection runs;
+    public RunCollection Runs {
+      get { return runs; }
+      private set {
+        if (value == null) throw new ArgumentNullException();
+        if (runs != value) {
+          if (runs != null) DeregisterRunsEvents();
+          runs = value;
+          if (runs != null) RegisterRunsEvents();
+        }
+      }
+    }
+
+    public IEnumerable<IOptimizer> NestedOptimizers {
+      get {
+        if (Optimizers == null) yield break;
+
+        foreach (IOptimizer opt in Optimizers) {
+          yield return opt;
+          foreach (IOptimizer nestedOpt in opt.NestedOptimizers)
+            yield return nestedOpt;
+        }
+      }
+    }
+
+    private bool experimentStarted = false;
+    private bool experimentStopped = false;
+
+    public Experiment()
+      : base() {
+      name = ItemName;
+      description = ItemDescription;
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      optimizers = new OptimizerList();
+      Runs = new RunCollection { AlgorithmName = Name };
+      Initialize();
+    }
+    public Experiment(string name)
+      : base(name) {
+      description = ItemDescription;
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      optimizers = new OptimizerList();
+      Runs = new RunCollection { AlgorithmName = Name };
+      Initialize();
+    }
+    public Experiment(string name, string description)
+      : base(name, description) {
+      executionState = ExecutionState.Stopped;
+      executionTime = TimeSpan.Zero;
+      optimizers = new OptimizerList();
+      Runs = new RunCollection { AlgorithmName = Name };
+      Initialize();
+    }
+    [StorableConstructor]
+    private Experiment(bool deserializing) : base(deserializing) { }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+    private Experiment(Experiment original, Cloner cloner)
+      : base(original, cloner) {
+      executionState = original.executionState;
+      executionTime = original.executionTime;
+      optimizers = cloner.Clone(original.optimizers);
+      runs = cloner.Clone(original.runs);
+
+      experimentStarted = original.experimentStarted;
+      experimentStopped = original.experimentStopped;
+      Initialize();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
+      return new Experiment(this, cloner);
+    }
+
+    private void Initialize() {
+      RegisterOptimizersEvents();
+      foreach (IOptimizer optimizer in optimizers)
+        RegisterOptimizerEvents(optimizer);
+      if (runs != null) RegisterRunsEvents();
+    }
+
+    public void Prepare() {
+      Prepare(false);
+    }
+    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));
+      if (Optimizers.Count == 0) return;
+
+      if (clearRuns) runs.Clear();
+
+      experimentStarted = false;
+      experimentStopped = false;
+      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) {
+        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+        try { optimizer.Prepare(clearRuns); }
+        catch (InvalidOperationException) { }
+      }
+    }
+    public void Start() {
+      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
+        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizers.Count == 0) return;
+
+      experimentStarted = true;
+      experimentStopped = false;
+      IOptimizer optimizer = Optimizers.FirstOrDefault(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused));
+      if (optimizer != null) {
+        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+        try { optimizer.Start(); }
+        catch (InvalidOperationException) { }
+      }
+    }
+    public void Pause() {
+      if (ExecutionState != ExecutionState.Started)
+        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizers.Count == 0) return;
+
+      experimentStarted = false;
+      experimentStopped = false;
+      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) {
+        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+        try { optimizer.Pause(); }
+        catch (InvalidOperationException) { }
+      }
+    }
+    public void Stop() {
+      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
+        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
+      if (Optimizers.Count == 0) return;
+
+      experimentStarted = false;
+      experimentStopped = true;
+      if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
+        foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
+          // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+          try { optimizer.Stop(); }
+          catch (InvalidOperationException) { }
+        }
+      } else {
+        OnStopped();
+      }
+    }
+
+    #region Events
+    protected override void OnNameChanged() {
+      base.OnNameChanged();
+      Runs.AlgorithmName = Name;
+    }
+
+    public event EventHandler ExecutionStateChanged;
+    private void OnExecutionStateChanged() {
+      EventHandler handler = ExecutionStateChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler ExecutionTimeChanged;
+    private void OnExecutionTimeChanged() {
+      EventHandler handler = ExecutionTimeChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Prepared;
+    private void OnPrepared() {
+      ExecutionState = ExecutionState.Prepared;
+      EventHandler handler = Prepared;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Started;
+    private void OnStarted() {
+      ExecutionState = ExecutionState.Started;
+      EventHandler handler = Started;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Paused;
+    private void OnPaused() {
+      ExecutionState = ExecutionState.Paused;
+      EventHandler handler = Paused;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Stopped;
+    private void OnStopped() {
+      ExecutionState = ExecutionState.Stopped;
+      EventHandler handler = Stopped;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
+    private void OnExceptionOccurred(Exception exception) {
+      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
+      if (handler != null) handler(this, new EventArgs<Exception>(exception));
+    }
+
+    private void RegisterOptimizersEvents() {
+      Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
+      Optimizers.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
+      Optimizers.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
+      Optimizers.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
+    }
+    private void DeregisterOptimizersEvents() {
+      Optimizers.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
+      Optimizers.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
+      Optimizers.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
+      Optimizers.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
+    }
+    private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
+      foreach (IndexedItem<IOptimizer> item in e.OldItems)
+        RemoveOptimizer(item.Value);
+      foreach (IndexedItem<IOptimizer> item in e.Items)
+        AddOptimizer(item.Value);
+    }
+    private void Optimizers_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
+      foreach (IndexedItem<IOptimizer> item in e.Items)
+        AddOptimizer(item.Value);
+    }
+    private void Optimizers_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
+      foreach (IndexedItem<IOptimizer> item in e.Items)
+        RemoveOptimizer(item.Value);
+    }
+    private void Optimizers_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
+      foreach (IndexedItem<IOptimizer> item in e.OldItems)
+        RemoveOptimizer(item.Value);
+      foreach (IndexedItem<IOptimizer> item in e.Items)
+        AddOptimizer(item.Value);
+    }
+    private void AddOptimizer(IOptimizer optimizer) {
+      RegisterOptimizerEvents(optimizer);
+      Runs.AddRange(optimizer.Runs);
+      optimizer.Prepare();
+      if (ExecutionState == ExecutionState.Stopped && optimizer.ExecutionState == ExecutionState.Prepared)
+        OnPrepared();
+    }
+    private void RemoveOptimizer(IOptimizer optimizer) {
+      DeregisterOptimizerEvents(optimizer);
+      Runs.RemoveRange(optimizer.Runs);
+      if (ExecutionState == ExecutionState.Prepared && !optimizers.Any(opt => opt.ExecutionState == ExecutionState.Prepared))
+        OnStopped();
+    }
+
+    private void RegisterOptimizerEvents(IOptimizer optimizer) {
+      optimizer.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
+      optimizer.ExecutionTimeChanged += new EventHandler(optimizer_ExecutionTimeChanged);
+      optimizer.Paused += new EventHandler(optimizer_Paused);
+      optimizer.Prepared += new EventHandler(optimizer_Prepared);
+      optimizer.Started += new EventHandler(optimizer_Started);
+      optimizer.Stopped += new EventHandler(optimizer_Stopped);
+      optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
+      optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
+      optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
+    }
+    private void DeregisterOptimizerEvents(IOptimizer optimizer) {
+      optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
+      optimizer.ExecutionTimeChanged -= new EventHandler(optimizer_ExecutionTimeChanged);
+      optimizer.Paused -= new EventHandler(optimizer_Paused);
+      optimizer.Prepared -= new EventHandler(optimizer_Prepared);
+      optimizer.Started -= new EventHandler(optimizer_Started);
+      optimizer.Stopped -= new EventHandler(optimizer_Stopped);
+      optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
+      optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
+      optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
+    }
+
+    private readonly object locker = new object();
+    private void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) {
+      lock (locker)
+        OnExceptionOccurred(e.Value);
+    }
+    private void optimizer_ExecutionTimeChanged(object sender, EventArgs e) {
+      lock (locker)
+        ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime);
+    }
+    private void optimizer_Paused(object sender, EventArgs e) {
+      lock (locker)
+        if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused();
+    }
+    private void optimizer_Prepared(object sender, EventArgs e) {
+      lock (locker)
+        if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared();
+    }
+    private void optimizer_Started(object sender, EventArgs e) {
+      lock (locker)
+        if (ExecutionState != ExecutionState.Started) OnStarted();
+    }
+    private void optimizer_Stopped(object sender, EventArgs e) {
+      lock (locker) {
+        if (experimentStopped) {
+          if (Optimizers.All(x => (x.ExecutionState == ExecutionState.Stopped) || (x.ExecutionState == ExecutionState.Prepared))) OnStopped();
+        } else {
+          if (experimentStarted && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
+            Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
+          } else if (Optimizers.All(x => x.ExecutionState == ExecutionState.Stopped)) OnStopped();
+          else if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused();
+        }
+      }
+    }
+    private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      lock (locker) {
+        Runs.RemoveRange(e.OldItems);
+        Runs.AddRange(e.Items);
+      }
+    }
+    private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      lock (locker)
+        Runs.AddRange(e.Items);
+    }
+    private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      lock (locker)
+        Runs.RemoveRange(e.Items);
+    }
+
+    private void RegisterRunsEvents() {
+      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+      runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
+    }
+    private void DeregisterRunsEvents() {
+      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
+      runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
+    }
+    private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      foreach (IOptimizer optimizer in Optimizers)
+        optimizer.Runs.RemoveRange(e.OldItems);
+    }
+    private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
+      foreach (IOptimizer optimizer in Optimizers)
+        optimizer.Runs.RemoveRange(e.Items);
+    }
+    #endregion
+  }
+}
Index: branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs
===================================================================
--- branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs	(revision 8955)
+++ branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs	(revision 8955)
@@ -0,0 +1,477 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.ComponentModel;
+using System.Drawing;
+using System.Linq;
+using System.Threading;
+using System.Timers;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Common.Resources;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using Timer = System.Timers.Timer;
+
+namespace HeuristicLab.Optimization {
+  internal enum TimeLimitedRunAction { None, Prepare, Start, Pause, Stop };
+
+  /// <summary>
+  /// A run in which an algorithm is executed for a certain maximum time only.
+  /// </summary>
+  [Item("TimeLimitRun", "A run in which an optimizer is executed a certain maximum time.")]
+  [Creatable("Testing & Analysis")]
+  [StorableClass]
+  public sealed class TimeLimitRun : NamedItem, IOptimizer, IStorableContent, INotifyPropertyChanged {
+    public string Filename { get; set; }
+
+    #region ItemImage
+    public static new Image StaticItemImage {
+      get { return VSImageLibrary.Event; }
+    }
+    public override Image ItemImage {
+      get { return (Algorithm != null) ? Algorithm.ItemImage : VSImageLibrary.ExecutableStopped; }
+    }
+    #endregion
+
+    private readonly Timer snapTimer;
+    private readonly Timer runTimer;
+    private readonly ManualResetEvent algorithmPaused = new ManualResetEvent(false);
+    private readonly ManualResetEvent algorithmStopped = new ManualResetEvent(false);
+
+    [Storable]
+    private TimeSpan maximumExecutionTime;
+    public TimeSpan MaximumExecutionTime {
+      get { return maximumExecutionTime; }
+      set {
+        if (maximumExecutionTime == value) return;
+        maximumExecutionTime = value;
+        runTimer.Interval = (maximumExecutionTime - ExecutionTime).TotalMilliseconds;
+        OnPropertyChanged("MaximumExecutionTime");
+      }
+    }
+
+    [Storable]
+    private int snapshotTimesIndex;
+    [Storable]
+    private ObservableList<double> snapshotTimes;
+    public ObservableList<double> SnapshotTimes {
+      get { return snapshotTimes; }
+      set {
+        if (snapshotTimes == value) return;
+        snapshotTimes = value;
+        snapshotTimesIndex = 0;
+        OnPropertyChanged("SnapshotTimes");
+      }
+    }
+
+    [Storable]
+    private bool storeAlgorithmInEachSnapshot;
+    [Storable]
+    public bool StoreAlgorithmInEachSnapshot {
+      get { return storeAlgorithmInEachSnapshot; }
+      set {
+        if (storeAlgorithmInEachSnapshot == value) return;
+        storeAlgorithmInEachSnapshot = value;
+        OnPropertyChanged("StoreAlgorithmInEachSnapshot");
+      }
+    }
+
+    [Storable]
+    private RunCollection snapshots;
+    public RunCollection Snapshots {
+      get { return snapshots; }
+      set {
+        if (snapshots == value) return;
+        snapshots = value;
+        OnPropertyChanged("Snapshots");
+      }
+    }
+
+    #region Inherited Properties
+    public ExecutionState ExecutionState {
+      get { return (Algorithm != null) ? Algorithm.ExecutionState : ExecutionState.Stopped; }
+    }
+
+    public TimeSpan ExecutionTime {
+      get { return (Algorithm != null) ? Algorithm.ExecutionTime : TimeSpan.FromSeconds(0); }
+    }
+
+    [Storable]
+    private IAlgorithm algorithm;
+    public IAlgorithm Algorithm {
+      get { return algorithm; }
+      set {
+        if (algorithm == value) return;
+        if (algorithm != null) {
+          DeregisterAlgorithmEvents();
+          var runs = algorithm.Runs;
+          algorithm = null; //necessary to avoid removing the runs from the old algorithm
+          Runs.RemoveRange(runs);
+        }
+        algorithm = value;
+        if (algorithm != null) {
+          RegisterAlgorithmEvents();
+          Runs.AddRange(algorithm.Runs);
+          if (algorithm.ExecutionState == ExecutionState.Paused) algorithmPaused.Set();
+          else algorithmPaused.Reset();
+          if (algorithm.ExecutionState == ExecutionState.Stopped) algorithmStopped.Set();
+          else algorithmStopped.Reset();
+        }
+        OnPropertyChanged("Algorithm");
+        Prepare();
+      }
+    }
+
+    [Storable]
+    private RunCollection runs;
+    public RunCollection Runs {
+      get { return runs; }
+      private set {
+        if (value == null) throw new ArgumentNullException();
+        if (runs == value) return;
+        runs = value;
+        OnPropertyChanged("Runs");
+      }
+    }
+
+    public IEnumerable<IOptimizer> NestedOptimizers {
+      get {
+        if (Algorithm == null) yield break;
+        yield return Algorithm;
+        foreach (var opt in Algorithm.NestedOptimizers)
+          yield return opt;
+      }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private TimeLimitRun(bool deserializing)
+      : base(deserializing) {
+      // the timer will not be serialized
+      snapTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = double.MaxValue
+      };
+      runTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = double.MaxValue
+      };
+    }
+    private TimeLimitRun(TimeLimitRun original, Cloner cloner)
+      : base(original, cloner) {
+      maximumExecutionTime = original.maximumExecutionTime;
+      snapshotTimes = new ObservableList<double>(original.snapshotTimes);
+      snapshotTimesIndex = original.snapshotTimesIndex;
+      snapTimer = new Timer() {
+        AutoReset = original.snapTimer.AutoReset,
+        Enabled = original.snapTimer.Enabled,
+        Interval = original.snapTimer.Interval
+      };
+      runTimer = new Timer() {
+        AutoReset = original.runTimer.AutoReset,
+        Enabled = original.runTimer.Enabled,
+        Interval = original.runTimer.Interval
+      };
+      snapshots = cloner.Clone(original.snapshots);
+      storeAlgorithmInEachSnapshot = original.storeAlgorithmInEachSnapshot;
+      algorithm = cloner.Clone(original.algorithm);
+      runs = cloner.Clone(original.runs);
+      Initialize();
+    }
+    public TimeLimitRun()
+      : base() {
+      name = ItemName;
+      description = ItemDescription;
+      maximumExecutionTime = TimeSpan.FromMinutes(1);
+      snapshotTimes = new ObservableList<double>(new[] {
+          TimeSpan.FromSeconds(5).TotalMilliseconds,
+          TimeSpan.FromSeconds(10).TotalMilliseconds,
+          TimeSpan.FromSeconds(30).TotalMilliseconds });
+      snapshotTimesIndex = 0;
+      snapTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = snapshotTimes[snapshotTimesIndex]
+      };
+      runTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = MaximumExecutionTime.TotalMilliseconds
+      };
+      snapshots = new RunCollection();
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+    public TimeLimitRun(string name)
+      : base(name) {
+      description = ItemDescription;
+      maximumExecutionTime = TimeSpan.FromMinutes(1);
+      snapshotTimes = new ObservableList<double>(new[] {
+          TimeSpan.FromSeconds(5).TotalMilliseconds,
+          TimeSpan.FromSeconds(10).TotalMilliseconds,
+          TimeSpan.FromSeconds(30).TotalMilliseconds });
+      snapshotTimesIndex = 0;
+      snapTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = snapshotTimes[snapshotTimesIndex]
+      };
+      snapshots = new RunCollection();
+      runTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = MaximumExecutionTime.TotalMilliseconds
+      };
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+    public TimeLimitRun(string name, string description)
+      : base(name, description) {
+      maximumExecutionTime = TimeSpan.FromMinutes(1);
+      snapshotTimes = new ObservableList<double>(new[] {
+          TimeSpan.FromSeconds(5).TotalMilliseconds,
+          TimeSpan.FromSeconds(10).TotalMilliseconds,
+          TimeSpan.FromSeconds(30).TotalMilliseconds });
+      snapshotTimesIndex = 0;
+      snapTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = snapshotTimes[snapshotTimesIndex]
+      };
+      snapshots = new RunCollection();
+      runTimer = new Timer() {
+        AutoReset = false,
+        Enabled = false,
+        Interval = MaximumExecutionTime.TotalMilliseconds
+      };
+      Runs = new RunCollection { AlgorithmName = Name };
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
+      return new TimeLimitRun(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+
+    private void Initialize() {
+      if (algorithm != null) RegisterAlgorithmEvents();
+      snapTimer.Elapsed += snapshotTimer_Elapsed;
+      runTimer.Elapsed += runTimer_Elapsed;
+    }
+
+    private readonly object timerLock = new object();
+    private void snapshotTimer_Elapsed(object sender, ElapsedEventArgs e) {
+      lock (timerLock) {
+        runTimer.Stop();
+        if (Algorithm == null) return;
+        if (ExecutionState != ExecutionState.Started) return;
+        var error = false;
+        try { Algorithm.Pause(); } catch (InvalidOperationException) { error = true; }
+        if (error && ExecutionState != ExecutionState.Paused) return; // Algorithm is either stopped or prepared
+
+        algorithmPaused.WaitOne();
+        MakeSnapshot();
+        try { Algorithm.Start(); } catch (InvalidOperationException) { }
+      }
+    }
+
+    private void runTimer_Elapsed(object sender, ElapsedEventArgs e) {
+      lock (timerLock) {
+        runTimer.Stop();
+        snapTimer.Stop();
+        try { Algorithm.Stop(); } catch (InvalidOperationException) { }
+      }
+    }
+
+    private double? GetNextInterval(TimeSpan reference) {
+      double interval;
+      while ((interval = snapshotTimes[snapshotTimesIndex] - reference.TotalMilliseconds) <= 0) {
+        snapshotTimesIndex++;
+        if (snapshotTimesIndex >= snapshotTimes.Count) return null;
+      };
+      return interval;
+    }
+
+    private void MakeSnapshot() {
+      string runName = ExecutionTime.ToString() + " " + algorithm.Name + " Snapshot";
+      Run run;
+      if (StoreAlgorithmInEachSnapshot) {
+        run = new Run(runName, algorithm);
+      } else {
+        // duplicate code of Run.Initialize - necessary, because Algorithm property doesn't have a setter
+        run = new Run() { Name = runName };
+        var parameters = new Dictionary<string, IItem>();
+        var results = new Dictionary<string, IItem>();
+        algorithm.CollectParameterValues(parameters);
+        algorithm.CollectResultValues(results);
+        var cloner = new Cloner();
+        foreach (var kvp in parameters.Select(x => new KeyValuePair<string, IItem>(x.Key, cloner.Clone(x.Value))).ToDictionary(x => x.Key, x => x.Value))
+          run.Parameters.Add(kvp);
+        foreach (var kvp in results.Select(x => new KeyValuePair<string, IItem>(x.Key, cloner.Clone(x.Value))).ToDictionary(x => x.Key, x => x.Value))
+          run.Results.Add(kvp);
+      }
+      snapshots.Add(run);
+    }
+
+    public void Prepare() {
+      Prepare(false);
+    }
+    public void Prepare(bool clearRuns) {
+      Algorithm.Prepare(clearRuns);
+    }
+    public void Start() {
+      Algorithm.Start();
+    }
+    public void Pause() {
+      Algorithm.Pause();
+    }
+    public void Stop() {
+      Algorithm.Stop();
+    }
+
+    #region Events
+    protected override void OnNameChanged() {
+      base.OnNameChanged();
+      runs.AlgorithmName = Name;
+    }
+
+    public event PropertyChangedEventHandler PropertyChanged;
+    private void OnPropertyChanged(string property) {
+      var handler = PropertyChanged;
+      if (handler != null) handler(this, new PropertyChangedEventArgs(property));
+    }
+
+    #region IExecutable Events
+    public event EventHandler ExecutionStateChanged;
+    private void OnExecutionStateChanged() {
+      var handler = ExecutionStateChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler ExecutionTimeChanged;
+    private void OnExecutionTimeChanged() {
+      var handler = ExecutionTimeChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Prepared;
+    private void OnPrepared() {
+      var handler = Prepared;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Started;
+    private void OnStarted() {
+      var handler = Started;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Paused;
+    private void OnPaused() {
+      var handler = Paused;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler Stopped;
+    private void OnStopped() {
+      var handler = Stopped;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
+    private void OnExceptionOccurred(Exception exception) {
+      var handler = ExceptionOccurred;
+      if (handler != null) handler(this, new EventArgs<Exception>(exception));
+    }
+    #endregion
+
+    #region Algorithm Events
+    private void RegisterAlgorithmEvents() {
+      algorithm.ExceptionOccurred += Algorithm_ExceptionOccurred;
+      algorithm.ExecutionTimeChanged += Algorithm_ExecutionTimeChanged;
+      algorithm.ExecutionStateChanged += Algorithm_ExecutionStateChanged;
+      algorithm.Paused += Algorithm_Paused;
+      algorithm.Prepared += Algorithm_Prepared;
+      algorithm.Started += Algorithm_Started;
+      algorithm.Stopped += Algorithm_Stopped;
+    }
+    private void DeregisterAlgorithmEvents() {
+      algorithm.ExceptionOccurred -= Algorithm_ExceptionOccurred;
+      algorithm.ExecutionTimeChanged -= Algorithm_ExecutionTimeChanged;
+      algorithm.ExecutionStateChanged -= Algorithm_ExecutionStateChanged;
+      algorithm.Paused -= Algorithm_Paused;
+      algorithm.Prepared -= Algorithm_Prepared;
+      algorithm.Started -= Algorithm_Started;
+      algorithm.Stopped -= Algorithm_Stopped;
+    }
+    private void Algorithm_ExceptionOccurred(object sender, EventArgs<Exception> e) {
+      OnExceptionOccurred(e.Value);
+    }
+    private void Algorithm_ExecutionTimeChanged(object sender, EventArgs e) {
+      OnExecutionTimeChanged();
+    }
+    private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) {
+      OnExecutionStateChanged();
+    }
+    private void Algorithm_Paused(object sender, EventArgs e) {
+      algorithmPaused.Set();
+      algorithmStopped.Reset();
+      OnPaused();
+    }
+    private void Algorithm_Prepared(object sender, EventArgs e) {
+      algorithmPaused.Reset();
+      algorithmStopped.Reset();
+      snapTimer.Stop();
+      runTimer.Stop();
+      snapshotTimesIndex = 0;
+      snapshots.Clear();
+      OnPrepared();
+    }
+    private void Algorithm_Started(object sender, EventArgs e) {
+      algorithmPaused.Reset();
+      algorithmStopped.Reset();
+      var execTime = ExecutionTime;
+      var interval = GetNextInterval(execTime);
+      if (interval.HasValue) {
+        snapTimer.Interval = interval.Value;
+        snapTimer.Start();
+      }
+      runTimer.Interval = (MaximumExecutionTime - execTime).TotalMilliseconds;
+      runTimer.Start();
+      OnStarted();
+    }
+    private void Algorithm_Stopped(object sender, EventArgs e) {
+      algorithmPaused.Reset();
+      algorithmStopped.Set();
+      snapTimer.Stop();
+      runTimer.Stop();
+      MakeSnapshot();
+      var snapshotsRun = new Run() { Name = algorithm.Runs.Last().Name };
+      foreach (var s in snapshots)
+        snapshotsRun.Parameters.Add(s.Name, s);
+      Runs.Add(snapshotsRun);
+      OnStopped();
+    }
+    #endregion
+    #endregion
+  }
+}
