Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs	(revision 17409)
@@ -24,7 +24,7 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HEAL.Attic;
 using HeuristicLab.Problems.DataAnalysis;
 
@@ -38,4 +38,5 @@
     // don't store the actual model!
     // the actual model is only recalculated when necessary
+    private IGradientBoostedTreesModel fullModel;
     private readonly Lazy<IGradientBoostedTreesModel> actualModel;
     private IGradientBoostedTreesModel ActualModel {
@@ -48,15 +49,15 @@
     private readonly uint seed;
     [Storable]
-    private ILossFunction lossFunction;
+    private readonly ILossFunction lossFunction;
     [Storable]
-    private double r;
+    private readonly double r;
     [Storable]
-    private double m;
+    private readonly double m;
     [Storable]
-    private double nu;
+    private readonly double nu;
     [Storable]
-    private int iterations;
+    private readonly int iterations;
     [Storable]
-    private int maxSize;
+    private readonly int maxSize;
 
 
@@ -69,13 +70,10 @@
     [StorableConstructor]
     private GradientBoostedTreesModelSurrogate(StorableConstructorFlag _) : base(_) {
-      actualModel = new Lazy<IGradientBoostedTreesModel>(() => RecalculateModel());
+      actualModel = CreateLazyInitFunc();
     }
 
     private GradientBoostedTreesModelSurrogate(GradientBoostedTreesModelSurrogate original, Cloner cloner)
       : base(original, cloner) {
-      IGradientBoostedTreesModel clonedModel = null;
-      if (original.actualModel.IsValueCreated) clonedModel = cloner.Clone(original.ActualModel);
-      actualModel = new Lazy<IGradientBoostedTreesModel>(CreateLazyInitFunc(clonedModel)); // only capture clonedModel in the closure
-
+      // clone data which is necessary to rebuild the model
       this.trainingProblemData = cloner.Clone(original.trainingProblemData);
       this.lossFunction = cloner.Clone(original.lossFunction);
@@ -86,10 +84,15 @@
       this.m = original.m;
       this.nu = original.nu;
+
+      // clone full model if it has already been created
+      if (original.fullModel != null) this.fullModel = cloner.Clone(original.fullModel);
+      actualModel = CreateLazyInitFunc();
     }
 
-    private Func<IGradientBoostedTreesModel> CreateLazyInitFunc(IGradientBoostedTreesModel clonedModel) {
-      return () => {
-        return clonedModel ?? RecalculateModel();
-      };
+    private Lazy<IGradientBoostedTreesModel> CreateLazyInitFunc() {
+      return new Lazy<IGradientBoostedTreesModel>(() => {
+        if (fullModel == null) fullModel = RecalculateModel();
+        return fullModel;
+      });
     }
 
@@ -107,12 +110,12 @@
       this.nu = nu;
 
-      actualModel = new Lazy<IGradientBoostedTreesModel>(() => RecalculateModel());
+      actualModel = CreateLazyInitFunc();
     }
 
-    // wrap an actual model in a surrograte
+    // wrap an actual model in a surrogate
     public GradientBoostedTreesModelSurrogate(IGradientBoostedTreesModel model, IRegressionProblemData trainingProblemData, uint seed,
       ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu)
       : this(trainingProblemData, seed, lossFunction, iterations, maxSize, r, m, nu) {
-      actualModel = new Lazy<IGradientBoostedTreesModel>(() => model);
+      fullModel = model;
     }
 
@@ -135,13 +138,9 @@
 
     public IEnumerable<IRegressionModel> Models {
-      get {
-        return ActualModel.Models;
-      }
+      get { return ActualModel.Models; }
     }
 
     public IEnumerable<double> Weights {
-      get {
-        return ActualModel.Weights;
-      }
+      get { return ActualModel.Weights; }
     }
   }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelSurrogate.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelSurrogate.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelSurrogate.cs	(revision 17409)
@@ -35,20 +35,23 @@
     #region parameters for recalculation of the model
     [Storable]
-    private int seed;
+    private readonly int seed;
     [Storable]
-    private IDataAnalysisProblemData originalTrainingData;
+    private readonly IDataAnalysisProblemData originalTrainingData;
     [Storable]
-    private double[] classValues;
+    private readonly double[] classValues;
     [Storable]
-    private int nTrees;
+    private readonly int nTrees;
     [Storable]
-    private double r;
+    private readonly double r;
     [Storable]
-    private double m;
+    private readonly double m;
     #endregion
+
 
     // don't store the actual model!
     // the actual model is only recalculated when necessary
+    private IRandomForestModel fullModel = null;
     private readonly Lazy<IRandomForestModel> actualModel;
+
     private IRandomForestModel ActualModel {
       get { return actualModel.Value; }
@@ -74,23 +77,20 @@
       this.m = m;
 
-      actualModel = new Lazy<IRandomForestModel>(() => RecalculateModel());
+      actualModel = CreateLazyInitFunc();
     }
 
-    // wrap an actual model in a surrograte
+    // wrap an actual model in a surrogate
     public RandomForestModelSurrogate(IRandomForestModel model, string targetVariable, IDataAnalysisProblemData originalTrainingData,
-      int seed, int nTrees, double r, double m, double[] classValues = null) : this(targetVariable, originalTrainingData, seed, nTrees, r, m, classValues) {
-      actualModel = new Lazy<IRandomForestModel>(() => model);
+      int seed, int nTrees, double r, double m, double[] classValues = null)
+      : this(targetVariable, originalTrainingData, seed, nTrees, r, m, classValues) {
+      fullModel = model;
     }
 
     [StorableConstructor]
     private RandomForestModelSurrogate(StorableConstructorFlag _) : base(_) {
-      actualModel = new Lazy<IRandomForestModel>(() => RecalculateModel());
+      actualModel = CreateLazyInitFunc();
     }
 
     private RandomForestModelSurrogate(RandomForestModelSurrogate original, Cloner cloner) : base(original, cloner) {
-      IRandomForestModel clonedModel = null;
-      if (original.actualModel.IsValueCreated) clonedModel = cloner.Clone(original.ActualModel);
-      actualModel = new Lazy<IRandomForestModel>(CreateLazyInitFunc(clonedModel)); // only capture clonedModel in the closure
-
       // clone data which is necessary to rebuild the model
       this.originalTrainingData = cloner.Clone(original.originalTrainingData);
@@ -100,14 +100,19 @@
       this.r = original.r;
       this.m = original.m;
-    }
 
-    private Func<IRandomForestModel> CreateLazyInitFunc(IRandomForestModel clonedModel) {
-      return () => {
-        return clonedModel ?? RecalculateModel();
-      };
+      // clone full model if it has already been created
+      if (original.fullModel != null) this.fullModel = cloner.Clone(original.fullModel);
+      actualModel = CreateLazyInitFunc();
     }
 
     public override IDeepCloneable Clone(Cloner cloner) {
       return new RandomForestModelSurrogate(this, cloner);
+    }
+
+    private Lazy<IRandomForestModel> CreateLazyInitFunc() {
+      return new Lazy<IRandomForestModel>(() => {
+        if (fullModel == null) fullModel = RecalculateModel();
+        return fullModel;
+      });
     }
 
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.Designer.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.Designer.cs	(revision 17409)
@@ -39,6 +39,7 @@
       this.endLabel = new System.Windows.Forms.Label();
       this.indefiniteCheckBox = new System.Windows.Forms.CheckBox();
-      this.createdTextBox = new System.Windows.Forms.TextBox();      
+      this.createdTextBox = new System.Windows.Forms.TextBox();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+      this.refreshButton = new System.Windows.Forms.Button();
       this.SuspendLayout();
       // 
@@ -68,5 +69,5 @@
       this.nameLabel.Name = "nameLabel";
       this.nameLabel.Size = new System.Drawing.Size(38, 13);
-      this.nameLabel.TabIndex = 0;
+      this.nameLabel.TabIndex = 2;
       this.nameLabel.Text = "Name:";
       // 
@@ -78,5 +79,5 @@
       this.nameTextBox.Name = "nameTextBox";
       this.nameTextBox.Size = new System.Drawing.Size(464, 20);
-      this.nameTextBox.TabIndex = 2;
+      this.nameTextBox.TabIndex = 3;
       this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged);
       this.nameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.nameTextBox_Validating);
@@ -88,5 +89,5 @@
       this.descriptionLabel.Name = "descriptionLabel";
       this.descriptionLabel.Size = new System.Drawing.Size(63, 13);
-      this.descriptionLabel.TabIndex = 0;
+      this.descriptionLabel.TabIndex = 4;
       this.descriptionLabel.Text = "Description:";
       // 
@@ -99,20 +100,9 @@
       this.descriptionTextBox.Name = "descriptionTextBox";
       this.descriptionTextBox.Size = new System.Drawing.Size(464, 98);
-      this.descriptionTextBox.TabIndex = 3;
+      this.descriptionTextBox.TabIndex = 5;
       this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged);
       // 
-      // ownerLabel
-      // 
-      this.ownerLabel.AutoSize = true;
-      this.ownerLabel.Location = new System.Drawing.Point(3, 167);
-      this.ownerLabel.Name = "ownerLabel";
-      this.ownerLabel.Size = new System.Drawing.Size(41, 13);
-      this.ownerLabel.TabIndex = 0;
-      this.ownerLabel.Text = "Owner:";
-      // 
       // ownerComboBox
       // 
-      //this.ownerComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-      //      | System.Windows.Forms.AnchorStyles.Right)));
       this.ownerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.ownerComboBox.FormattingEnabled = true;
@@ -120,6 +110,15 @@
       this.ownerComboBox.Name = "ownerComboBox";
       this.ownerComboBox.Size = new System.Drawing.Size(200, 21);
-      this.ownerComboBox.TabIndex = 4;
+      this.ownerComboBox.TabIndex = 7;
       this.ownerComboBox.SelectedIndexChanged += new System.EventHandler(this.ownerComboBox_SelectedIndexChanged);
+      // 
+      // ownerLabel
+      // 
+      this.ownerLabel.AutoSize = true;
+      this.ownerLabel.Location = new System.Drawing.Point(3, 167);
+      this.ownerLabel.Name = "ownerLabel";
+      this.ownerLabel.Size = new System.Drawing.Size(41, 13);
+      this.ownerLabel.TabIndex = 6;
+      this.ownerLabel.Text = "Owner:";
       // 
       // createdLabel
@@ -129,5 +128,5 @@
       this.createdLabel.Name = "createdLabel";
       this.createdLabel.Size = new System.Drawing.Size(47, 13);
-      this.createdLabel.TabIndex = 8;
+      this.createdLabel.TabIndex = 9;
       this.createdLabel.Text = "Created:";
       // 
@@ -135,11 +134,10 @@
       // 
       this.startDateTimePicker.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
-      this.startDateTimePicker.Enabled = false;
       this.startDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
       this.startDateTimePicker.Location = new System.Drawing.Point(72, 216);
       this.startDateTimePicker.Name = "startDateTimePicker";
       this.startDateTimePicker.Size = new System.Drawing.Size(200, 20);
-      this.startDateTimePicker.TabIndex = 9;
-      this.startDateTimePicker.ValueChanged += new System.EventHandler(this.startDateTimePicker_ValueChanged);      
+      this.startDateTimePicker.TabIndex = 12;
+      this.startDateTimePicker.ValueChanged += new System.EventHandler(this.startDateTimePicker_ValueChanged);
       // 
       // startLabel
@@ -149,5 +147,5 @@
       this.startLabel.Name = "startLabel";
       this.startLabel.Size = new System.Drawing.Size(32, 13);
-      this.startLabel.TabIndex = 10;
+      this.startLabel.TabIndex = 11;
       this.startLabel.Text = "Start:";
       // 
@@ -155,10 +153,9 @@
       // 
       this.endDateTimePicker.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
-      this.endDateTimePicker.Enabled = false;
       this.endDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
       this.endDateTimePicker.Location = new System.Drawing.Point(72, 243);
       this.endDateTimePicker.Name = "endDateTimePicker";
       this.endDateTimePicker.Size = new System.Drawing.Size(200, 20);
-      this.endDateTimePicker.TabIndex = 11;
+      this.endDateTimePicker.TabIndex = 14;
       this.endDateTimePicker.ValueChanged += new System.EventHandler(this.endDateTimePicker_ValueChanged);
       // 
@@ -169,5 +166,5 @@
       this.endLabel.Name = "endLabel";
       this.endLabel.Size = new System.Drawing.Size(29, 13);
-      this.endLabel.TabIndex = 10;
+      this.endLabel.TabIndex = 13;
       this.endLabel.Text = "End:";
       // 
@@ -178,5 +175,5 @@
       this.indefiniteCheckBox.Name = "indefiniteCheckBox";
       this.indefiniteCheckBox.Size = new System.Drawing.Size(69, 17);
-      this.indefiniteCheckBox.TabIndex = 13;
+      this.indefiniteCheckBox.TabIndex = 15;
       this.indefiniteCheckBox.Text = "Indefinite";
       this.indefiniteCheckBox.UseVisualStyleBackColor = true;
@@ -189,5 +186,15 @@
       this.createdTextBox.ReadOnly = true;
       this.createdTextBox.Size = new System.Drawing.Size(200, 20);
-      this.createdTextBox.TabIndex = 14;
+      this.createdTextBox.TabIndex = 10;
+      // 
+      // refreshButton
+      // 
+      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
+      this.refreshButton.Location = new System.Drawing.Point(278, 162);
+      this.refreshButton.Name = "refreshButton";
+      this.refreshButton.Size = new System.Drawing.Size(24, 24);
+      this.refreshButton.TabIndex = 8;
+      this.refreshButton.UseVisualStyleBackColor = true;
+      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
       // 
       // ProjectView
@@ -195,4 +202,5 @@
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.refreshButton);
       this.Controls.Add(this.createdTextBox);
       this.Controls.Add(this.indefiniteCheckBox);
@@ -213,5 +221,4 @@
       this.Size = new System.Drawing.Size(539, 271);
       this.Load += new System.EventHandler(this.ProjectView_Load);
-      this.Disposed += new System.EventHandler(this.ProjectView_Disposed);
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -235,6 +242,7 @@
     private System.Windows.Forms.Label endLabel;
     private System.Windows.Forms.CheckBox indefiniteCheckBox;
-    private System.Windows.Forms.TextBox createdTextBox;    
+    private System.Windows.Forms.TextBox createdTextBox;
     private System.Windows.Forms.ToolTip toolTip;
+    private System.Windows.Forms.Button refreshButton;
   }
 }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs	(revision 17409)
@@ -28,4 +28,5 @@
 using HeuristicLab.Core.Views;
 using HeuristicLab.MainForm;
+using Tpl = System.Threading.Tasks;
 
 namespace HeuristicLab.Clients.Hive.Administrator.Views {
@@ -33,6 +34,4 @@
   [Content(typeof(Project), IsDefaultView = true)]
   public partial class ProjectView : ItemView {
-    private readonly object locker = new object();
-
     public new Project Content {
       get { return (Project)base.Content; }
@@ -58,27 +57,10 @@
     }
 
-    protected void RegisterControlEvents() {
-      nameTextBox.TextChanged += nameTextBox_TextChanged;
-      nameTextBox.Validating += nameTextBox_Validating;
-      descriptionTextBox.TextChanged += descriptionTextBox_TextChanged;
-      ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
-      startDateTimePicker.ValueChanged += startDateTimePicker_ValueChanged;
-      endDateTimePicker.ValueChanged += endDateTimePicker_ValueChanged;
-      indefiniteCheckBox.CheckedChanged += indefiniteCheckBox_CheckedChanged;
-    }
-
-    protected void DeregisterControlEvents() {
-      nameTextBox.TextChanged -= nameTextBox_TextChanged;
-      nameTextBox.Validating -= nameTextBox_Validating;
-      descriptionTextBox.TextChanged -= descriptionTextBox_TextChanged;
-      ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
-      startDateTimePicker.ValueChanged -= startDateTimePicker_ValueChanged;
-      endDateTimePicker.ValueChanged -= endDateTimePicker_ValueChanged;
-      indefiniteCheckBox.CheckedChanged -= indefiniteCheckBox_CheckedChanged;
-    }
-
     protected override void OnContentChanged() {
       base.OnContentChanged();
-      DeregisterControlEvents();
+      UpdateView();
+    }
+
+    private void UpdateView() {
       if (Content == null) {
         idTextBox.Clear();
@@ -94,207 +76,28 @@
         nameTextBox.Text = Content.Name;
         descriptionTextBox.Text = Content.Description;
-
-        if (AccessClient.Instance.UsersAndGroups != null) {
-          var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>();
-          if (!Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator));
-          var projectOwnerId = Content.OwnerUserId;
-          ownerComboBox.DataSource = users.OrderBy(x => x.UserName).ToList();
-          ownerComboBox.SelectedItem = users.FirstOrDefault(x => x.Id == projectOwnerId);
-        }
-
+        ownerComboBox.SelectedItem = AccessClient.Instance.UsersAndGroups?.OfType<LightweightUser>().SingleOrDefault(x => x.Id == Content.OwnerUserId);
         createdTextBox.Text = Content.DateCreated.ToString("ddd, dd.MM.yyyy, HH:mm:ss");
         startDateTimePicker.Value = Content.StartDate;
-
+        endDateTimePicker.Value = Content.EndDate.GetValueOrDefault(Content.StartDate);
         indefiniteCheckBox.Checked = !Content.EndDate.HasValue;
-        if (!indefiniteCheckBox.Checked) endDateTimePicker.Value = Content.EndDate.Value;
-        else endDateTimePicker.Value = Content.StartDate;
-        endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
-      }
-      SetEnabledStateOfControls();
-      RegisterControlEvents();
-    }
-
-    protected override void SetEnabledStateOfControls() {
-      base.SetEnabledStateOfControls();
-      bool enabled = Content != null && !Locked && !ReadOnly;
-      nameTextBox.Enabled = enabled;
-      descriptionTextBox.Enabled = enabled;
-      ownerComboBox.Enabled = enabled;
-      createdTextBox.Enabled = enabled;
-      startDateTimePicker.Enabled = enabled;
-      endDateTimePicker.Enabled = enabled && Content.EndDate.HasValue;
-      indefiniteCheckBox.Enabled = enabled;
-
-      if (Content != null) {
-        //var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault();
-        var parentProject = HiveAdminClient.Instance.Projects.FirstOrDefault(x => x.Id == Content.ParentProjectId);
-        if ((!IsAdmin() && (parentProject == null || parentProject.EndDate.HasValue))
-           || (IsAdmin() && parentProject != null && parentProject.EndDate.HasValue)) {
-          indefiniteCheckBox.Enabled = false;
-        }
-
-        if (Content.Id != Guid.Empty && !IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id)) {
-          ownerComboBox.Enabled = false;
-          startDateTimePicker.Enabled = false;
-          endDateTimePicker.Enabled = false;
-          indefiniteCheckBox.Enabled = false;
-        }
-      }
-    }
-    #endregion
-
-    #region Event Handlers
-    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
-      if (InvokeRequired) Invoke((Action<object, PropertyChangedEventArgs>)Content_PropertyChanged, sender, e);
-      else OnContentChanged();
-    }
-
-    private void AccessClient_Instance_Refreshing(object sender, EventArgs e) {
-      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
-      else {
-        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
-        SetEnabledStateOfControls();
-      }
-    }
-
-    private void AccessClient_Instance_Refreshed(object sender, EventArgs e) {
-      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
-      else {
-        Progress.Hide(this);
-        SetEnabledStateOfControls();
-      }
-    }
-
-    private async void ProjectView_Load(object sender, EventArgs e) {
-      await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
-        action: () => UpdateUsers(),
-        finallyCallback: () => {
-          ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
-          var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>();
-          if (Content != null && !Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator));
-          var projectOwnerId = Content != null ? Content.OwnerUserId : (Guid?)null;
-          ownerComboBox.DataSource = users.OrderBy(x => x.UserName).ToList();
-          ownerComboBox.SelectedItem = projectOwnerId.HasValue ? users.FirstOrDefault(x => x.Id == projectOwnerId) : null;
-          ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
-        });
-    }
-
-    private void ProjectView_Disposed(object sender, EventArgs e) {
-      AccessClient.Instance.Refreshed -= AccessClient_Instance_Refreshed;
-      AccessClient.Instance.Refreshing -= AccessClient_Instance_Refreshing;
-    }
-
-    private void nameTextBox_Validating(object sender, CancelEventArgs e) {
-      if (string.IsNullOrEmpty(nameTextBox.Text)) {
-        MessageBox.Show(
-          "Project must have a name.",
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Error);
-        e.Cancel = true;
-      }
-    }
-
-    private void nameTextBox_TextChanged(object sender, EventArgs e) {
-      if (Content != null && Content.Name != nameTextBox.Text) {
-        DeregisterContentEvents();
-        Content.Name = nameTextBox.Text;
-        RegisterContentEvents();
-      }
-    }
-
-    private void descriptionTextBox_TextChanged(object sender, EventArgs e) {
-      if (Content != null && Content.Description != descriptionTextBox.Text) {
-        DeregisterContentEvents();
-        Content.Description = descriptionTextBox.Text;
-        RegisterContentEvents();
-      }
-    }
-
-    private void ownerComboBox_SelectedIndexChanged(object sender, EventArgs e) {
-      var selectedItem = (LightweightUser)ownerComboBox.SelectedItem;
-      var selectedOwnerUserId = selectedItem != null ? selectedItem.Id : Guid.Empty;
-      if (Content != null && Content.OwnerUserId != selectedOwnerUserId) {
-        DeregisterContentEvents();
-        Content.OwnerUserId = selectedOwnerUserId;
-        RegisterContentEvents();
-      }
-    }
-
-    private void startDateTimePicker_ValueChanged(object sender, EventArgs e) {
-      if (Content == null) return;
-      startDateTimePicker.ValueChanged -= startDateTimePicker_ValueChanged;
-
-      if (!IsAdmin()) {
-        var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault();
-        if (parentProject != null) {
-          if (startDateTimePicker.Value < parentProject.StartDate)
-            startDateTimePicker.Value = parentProject.StartDate;
-        } else {
-          startDateTimePicker.Value = Content.StartDate;
-        }
-      }
-
-      if (!Content.EndDate.HasValue || startDateTimePicker.Value > Content.EndDate)
-        endDateTimePicker.Value = startDateTimePicker.Value;
-      if (Content.StartDate != startDateTimePicker.Value) {
-        DeregisterContentEvents();
-        Content.StartDate = startDateTimePicker.Value;
-        RegisterContentEvents();
-      }
-
-      startDateTimePicker.ValueChanged += startDateTimePicker_ValueChanged;
-    }
-
-    private void endDateTimePicker_ValueChanged(object sender, EventArgs e) {
-      if (Content == null) return;
-      endDateTimePicker.ValueChanged -= endDateTimePicker_ValueChanged;
-
-      if (!IsAdmin()) {
-        var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault();
-        if (parentProject != null) {
-          if (parentProject.EndDate.HasValue && endDateTimePicker.Value > parentProject.EndDate.Value) {
-            endDateTimePicker.Value = parentProject.EndDate.Value;
-          }
-        } else if (Content.EndDate.HasValue) {
-          endDateTimePicker.Value = Content.EndDate.Value;
-        }
-      }
-
-      if (endDateTimePicker.Value < startDateTimePicker.Value)
-        endDateTimePicker.Value = startDateTimePicker.Value;
-      if (Content.EndDate != endDateTimePicker.Value) {
-        DeregisterContentEvents();
-        Content.EndDate = endDateTimePicker.Value;
-        RegisterContentEvents();
-      }
-
-      endDateTimePicker.ValueChanged += endDateTimePicker_ValueChanged;
-    }
-
-    private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) {
-      if (Content == null) return;
-
-      var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value;
-      endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
-      if (Content.EndDate != newEndDate) {
-        DeregisterContentEvents();
-        Content.EndDate = newEndDate;
-        RegisterContentEvents();
-      }
-    }
-    #endregion
-
-    #region Helpers
+      }
+    }
+
+    private async Tpl.Task UpdateUsersAsync() {
+      await Tpl.Task.Run(() => UpdateUsers());
+    }
+
     private void UpdateUsers() {
+      // deregister handler to avoid change of content's owner when data source is updated
+      ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
       try {
-        AccessClient.Instance.Refresh();
+        ownerComboBox.DataSource = null;
+        SecurityExceptionUtil.TryAndReportSecurityExceptions(AccessClient.Instance.Refresh);
+        ownerComboBox.DataSource = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>().OrderBy(x => x.UserName).ToList();
       } catch (AnonymousUserException) {
         ShowHiveInformationDialog();
-      }
-    }
-
-    private bool IsAdmin() {
-      return HiveRoles.CheckAdminUserPermissions();
+      } finally {
+        ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
+      }
     }
 
@@ -307,4 +110,171 @@
       }
     }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+
+      bool enabled = Content != null && !Locked && !ReadOnly;
+
+      nameTextBox.Enabled = enabled;
+      descriptionTextBox.Enabled = enabled;
+      ownerComboBox.Enabled = enabled;
+      refreshButton.Enabled = enabled;
+      createdTextBox.Enabled = enabled;
+      startDateTimePicker.Enabled = enabled;
+      endDateTimePicker.Enabled = enabled && Content.EndDate.HasValue && Content.EndDate > Content.StartDate;
+      indefiniteCheckBox.Enabled = enabled;
+
+      if (Content == null) return;
+
+      var parentProject = HiveAdminClient.Instance.Projects.SingleOrDefault(x => x.Id == Content.ParentProjectId);
+      if (parentProject != null && parentProject.EndDate.HasValue)
+        indefiniteCheckBox.Enabled = false;
+
+      if (Content.Id == Guid.Empty) return; // newly created project
+      if (HiveRoles.CheckAdminUserPermissions()) return; // admins can edit any project
+      if (HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id)) return; // owner can edit project
+
+      // project was already created and user is neither admin nor owner
+      ownerComboBox.Enabled = false;
+      startDateTimePicker.Enabled = false;
+      endDateTimePicker.Enabled = false;
+      indefiniteCheckBox.Enabled = false;
+    }
+    #endregion
+
+    #region Event Handlers
+    private void ProjectView_Load(object sender, EventArgs e) {
+      Locked = true;
+      try {
+        UpdateUsers();
+        UpdateView();
+      } finally {
+        Locked = false;
+      }
+    }
+
+    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
+      UpdateView();
+    }
+
+    private void nameTextBox_TextChanged(object sender, EventArgs e) {
+      if (Content == null || Content.Name == nameTextBox.Text) return;
+      Content.Name = nameTextBox.Text;
+    }
+
+    private void nameTextBox_Validating(object sender, CancelEventArgs e) {
+      if (!string.IsNullOrEmpty(nameTextBox.Text)) return;
+
+      MessageBox.Show("Project must have a name.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
+      e.Cancel = true;
+    }
+
+    private void descriptionTextBox_TextChanged(object sender, EventArgs e) {
+      if (Content == null || Content.Description == descriptionTextBox.Text) return;
+      Content.Description = descriptionTextBox.Text;
+    }
+
+    private void ownerComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      if (Content == null) return;
+
+      var selectedItem = (LightweightUser)ownerComboBox.SelectedItem;
+      var selectedOwnerUserId = selectedItem != null ? selectedItem.Id : Guid.Empty;
+      if (Content.OwnerUserId == selectedOwnerUserId) return;
+
+      Content.OwnerUserId = selectedOwnerUserId;
+    }
+
+    private async void refreshButton_Click(object sender, EventArgs e) {
+      Locked = true;
+      try {
+        await UpdateUsersAsync();
+        UpdateView();
+      } finally {
+        Locked = false;
+      }
+    }
+
+    private void startDateTimePicker_ValueChanged(object sender, EventArgs e) {
+      if (Content == null || Content.StartDate == startDateTimePicker.Value) return;
+
+      string errorMessage = string.Empty;
+
+      var parentProject = HiveAdminClient.Instance.Projects.SingleOrDefault(x => x.Id == Content.ParentProjectId);
+      if (parentProject != null) {
+        if (startDateTimePicker.Value < parentProject.StartDate) {
+          errorMessage = "Project cannot start before its parent project has started.";
+        } else if (startDateTimePicker.Value > parentProject.EndDate) {
+          errorMessage = "Project cannot start after its parent project has ended.";
+        }
+      }
+
+      if (startDateTimePicker.Value > endDateTimePicker.Value) {
+        errorMessage = "Project cannot start after it ends.";
+      }
+
+      if (!string.IsNullOrEmpty(errorMessage)) {
+        MessageBox.Show(errorMessage, "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
+        startDateTimePicker.Value = Content.StartDate;
+      }
+
+      Content.StartDate = startDateTimePicker.Value;
+    }
+
+    private void endDateTimePicker_ValueChanged(object sender, EventArgs e) {
+      if (Content == null || Content.EndDate == endDateTimePicker.Value || Content.StartDate == endDateTimePicker.Value) return;
+
+      string errorMessage = string.Empty;
+
+      var parentProject = HiveAdminClient.Instance.Projects.SingleOrDefault(x => x.Id == Content.ParentProjectId);
+      if (parentProject != null) {
+        if (endDateTimePicker.Value > parentProject.EndDate) {
+          errorMessage = "Project cannot end after its parent project has ended.";
+        } else if (endDateTimePicker.Value < parentProject.StartDate) {
+          errorMessage = "Project cannot end before its parent project has started.";
+        }
+      }
+
+      if (endDateTimePicker.Value < startDateTimePicker.Value) {
+        errorMessage = "Project cannot end after it starts.";
+      }
+
+      if (!string.IsNullOrEmpty(errorMessage)) {
+        MessageBox.Show(errorMessage, "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
+        endDateTimePicker.Value = Content.EndDate.GetValueOrDefault(Content.StartDate);
+      }
+
+      Content.EndDate = endDateTimePicker.Value;
+    }
+
+    private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) {
+      if (Content == null) return;
+
+      var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value;
+
+      if (Content.EndDate == newEndDate) return;
+      Content.EndDate = newEndDate;
+
+      endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
+    }
+
+    private void AccessClient_Instance_Refreshing(object sender, EventArgs e) {
+      if (InvokeRequired) {
+        Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
+        return;
+      }
+
+      Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
+      SetEnabledStateOfControls();
+    }
+
+    private void AccessClient_Instance_Refreshed(object sender, EventArgs e) {
+      if (InvokeRequired) {
+        Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
+        return;
+      }
+
+      Progress.Hide(this);
+      SetEnabledStateOfControls();
+    }
     #endregion
   }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs	(revision 17409)
@@ -144,6 +144,7 @@
       if (Content != null && Content.Jobs != null) {
         // clear hive client only if it is not displayed by any other content view (i.e. job manager)
-        var contentViews = MainFormManager.MainForm.Views.OfType<IContentView>();
-        if (contentViews.All(x => x.Content != Content || x == this))
+        var contentViews = MainFormManager.MainForm.Views.OfType<IContentView>()
+          .Where(v => v.Content == Content && v != this);
+        if (!contentViews.Any())
           Content.ClearHiveClient();
 
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs	(revision 17409)
@@ -25,5 +25,4 @@
 using System.Linq;
 using System.Management;
-using System.Net.NetworkInformation;
 using HeuristicLab.Clients.Hive.SlaveCore.Properties;
 
@@ -133,6 +132,5 @@
       try {
         prog = jobManager.GetExecutionTimes();
-      }
-      catch (Exception ex) {
+      } catch (Exception ex) {
         SlaveClientCom.Instance.LogMessage(string.Format("Exception was thrown while trying to get execution times: {0}", ex.Message));
       }
@@ -140,14 +138,18 @@
     }
 
+    /// <summary>
+    /// Returns the unique machine id of the slave
+    /// </summary>
+    /// <returns><see cref="Guid"/></returns>
     public static Guid GetUniqueMachineId() {
-      Guid id;
-      try {
-        id = GetUniqueMachineIdFromMac();
-      }
-      catch {
-        // fallback if something goes wrong...        
-        id = new Guid(Environment.MachineName.GetHashCode(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-      }
-      return id;
+      // Due to the fact that repeated calculation of the machine ID can lead to a client registering at 
+      // the Hive server multiple times with different IDs it's better to set the unique machine id only 
+      // once, at first startup, and store it in core settings. 
+      if (Settings.Default.MachineId == Guid.Empty) {
+        Settings.Default.MachineId = Guid.NewGuid();
+        Settings.Default.Save();
+      }
+
+      return Settings.Default.MachineId;
     }
 
@@ -170,48 +172,4 @@
     }
 
-    /// <summary>
-    /// Generate a guid based on mac address of the first found nic (yes, mac addresses are not unique...)
-    /// and the machine name.
-    /// Format:
-    /// 
-    ///  D1      D2  D3  Res.   D4
-    /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-    /// |n a m e|0 0|0 0|0 0 mac address|
-    /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-    /// 
-    /// The mac address is saved in the last 48 bits of the Data 4 segment 
-    /// of the guid (first 2 bytes of Data 4 are reserved).
-    /// D1 contains the hash of the machinename. 
-    /// </summary>    
-    private static Guid GetUniqueMachineIdFromMac() {
-      //try to get a real network interface, not a virtual one 
-      NetworkInterface validNic = NetworkInterface.GetAllNetworkInterfaces()
-                      .FirstOrDefault(x =>
-                                  !x.Name.Contains(vmwareNameString) &&
-                                  !x.Name.Contains(virtualboxNameString) &&
-                                  (x.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
-                                   x.NetworkInterfaceType == NetworkInterfaceType.GigabitEthernet));
-
-      if (validNic == default(NetworkInterface)) {
-        validNic = NetworkInterface.GetAllNetworkInterfaces().First();
-      }
-
-      byte[] addr = validNic.GetPhysicalAddress().GetAddressBytes();
-      if (addr.Length < macLength || addr.Length > macLongLength) {
-        throw new ArgumentException(string.Format("Error generating slave UID: MAC address has to have a length between {0} and {1} bytes. Actual MAC address is: {2}",
-              macLength, macLongLength, addr));
-      }
-
-      if (addr.Length < macLongLength) {
-        byte[] b = new byte[8];
-        Array.Copy(addr, 0, b, 2, addr.Length);
-        addr = b;
-      }
-
-      // also get machine name and save it to the first 4 bytes                
-      Guid guid = new Guid(Environment.MachineName.GetHashCode(), 0, 0, addr);
-      return guid;
-    }
-
     private static long? GetWMIValue(string clazz, string property) {
       ManagementClass mgtClass = new ManagementClass(clazz);
@@ -223,6 +181,5 @@
             try {
               return long.Parse(prop.Value.ToString());
-            }
-            catch {
+            } catch {
               return null;
             }
@@ -241,6 +198,5 @@
       try {
         mb = (int)(memCounter.NextValue() / 1024 / 1024);
-      }
-      catch { }
+      } catch { }
       return mb;
     }
@@ -251,6 +207,5 @@
       try {
         return cpuCounter.NextValue();
-      }
-      catch { }
+      } catch { }
       return cpuVal;
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs	(revision 17409)
@@ -1,9 +1,9 @@
 ﻿//------------------------------------------------------------------------------
 // <auto-generated>
-//     Dieser Code wurde von einem Tool generiert.
-//     Laufzeitversion:4.0.30319.42000
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
 //
-//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
-//     der Code erneut generiert wird.
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
 // </auto-generated>
 //------------------------------------------------------------------------------
@@ -13,5 +13,5 @@
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")]
     public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
@@ -323,4 +323,16 @@
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("00000000-0000-0000-0000-000000000000")]
+        public global::System.Guid MachineId {
+            get {
+                return ((global::System.Guid)(this["MachineId"]));
+            }
+            set {
+                this["MachineId"] = value;
+            }
+        }
     }
 }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings	(revision 17409)
@@ -78,4 +78,7 @@
       <Value Profile="(Default)">00:05:00</Value>
     </Setting>
+    <Setting Name="MachineId" Type="System.Guid" Scope="User">
+      <Value Profile="(Default)">00000000-0000-0000-0000-000000000000</Value>
+    </Setting>
   </Settings>
 </SettingsFile>
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/app.config
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/app.config	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive.Slave/3.3/app.config	(revision 17409)
@@ -84,4 +84,7 @@
       <setting name="CheckpointCheckInterval" serializeAs="String">
         <value>00:05:00</value>
+      </setting>
+      <setting name="MachineId" serializeAs="String">
+        <value>00000000-0000-0000-0000-000000000000</value>
       </setting>
     </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings>
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.CodeEditor/3.4/CodeEditor.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.CodeEditor/3.4/CodeEditor.cs	(revision 17409)
@@ -282,5 +282,5 @@
     public override void ScrollToPosition(int line, int column) {
       var segment = GetSegmentAtLocation(line, column);
-      TextEditor.CaretOffset = segment.Offset + segment.Length;
+      TextEditor.CaretOffset = segment.Offset;
       TextEditor.ScrollToLine(line);
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Common/3.3/DoubleExtensions.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Common/3.3/DoubleExtensions.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Common/3.3/DoubleExtensions.cs	(revision 17409)
@@ -23,10 +23,28 @@
 namespace HeuristicLab.Common {
   public static class DoubleExtensions {
+    /// <summary>
+    /// Compares the similarity of value x and value y with a precision of 1.0E-12.
+    /// </summary>
+    /// <param name="x">First double value to be checked</param>
+    /// <param name="y">Second double value to compare with</param>
+    /// <returns>true if the difference is <= 1.0E-12</returns>
     public static bool IsAlmost(this double x, double y) {
+      var epsilon = 1.0E-12;
+      return IsAlmost(x, y, epsilon);
+    }
+
+    /// <summary> 
+    /// Compares the similarity of value x and value y with a given precision (epsilon).
+    /// </summary>
+    /// <param name="x">First double value to be checked</param>
+    /// <param name="y">Second double value to compare with</param>
+    /// <param name="epsilon">Error term to specify the precision</param>
+    /// <returns>true if the difference is <= epsilon</returns>
+    public static bool IsAlmost(this double x, double y, double epsilon) {
       if (double.IsInfinity(x)) {
         if (x > 0) return double.IsPositiveInfinity(y);
         else return double.IsNegativeInfinity(y);
       } else {
-        return Math.Abs(x - y) < 1.0E-12;
+        return Math.Abs(x - y) < epsilon;
       }
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Data/3.3/Interfaces/ITextValue.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Data/3.3/Interfaces/ITextValue.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Data/3.3/Interfaces/ITextValue.cs	(revision 17409)
@@ -20,9 +20,8 @@
 #endregion
 
-using System;
-using HeuristicLab.Common;
+using HEAL.Attic;
 
 namespace HeuristicLab.Data {
-  public interface ITextValue : IStringConvertibleValue {
-  }
+  [StorableType("6fe7970b-66de-4dcf-aa2b-c1aa9d7da29f")]
+  public interface ITextValue : IStringConvertibleValue { }
 }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/BalancedTreeCreator.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/BalancedTreeCreator.cs	(revision 17409)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/BalancedTreeCreator.cs	(revision 17409)
@@ -0,0 +1,248 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [NonDiscoverableType]
+  [StorableType("AA3649C4-18CF-480B-AA41-F5D6F148B494")]
+  [Item("BalancedTreeCreator", "An operator that produces trees with a specified distribution")]
+  public class BalancedTreeCreator : SymbolicExpressionTreeCreator {
+    private const string IrregularityBiasParameterName = "IrregularityBias";
+
+    public IFixedValueParameter<PercentValue> IrregularityBiasParameter {
+      get { return (IFixedValueParameter<PercentValue>)Parameters[IrregularityBiasParameterName]; }
+    }
+
+    public double IrregularityBias {
+      get { return IrregularityBiasParameter.Value.Value; }
+      set { IrregularityBiasParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected BalancedTreeCreator(StorableConstructorFlag _) : base(_) { }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(IrregularityBiasParameterName)) {
+        Parameters.Add(new FixedValueParameter<PercentValue>(IrregularityBiasParameterName, new PercentValue(0.0)));
+      }
+    }
+
+    protected BalancedTreeCreator(BalancedTreeCreator original, Cloner cloner) : base(original, cloner) { }
+
+    public BalancedTreeCreator() {
+      Parameters.Add(new FixedValueParameter<PercentValue>(IrregularityBiasParameterName, new PercentValue(0.0)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BalancedTreeCreator(this, cloner);
+    }
+
+    public override ISymbolicExpressionTree CreateTree(IRandom random, ISymbolicExpressionGrammar grammar, int maxLength, int maxDepth) {
+      return Create(random, grammar, maxLength, maxDepth, IrregularityBias);
+    }
+
+    public static ISymbolicExpressionTree Create(IRandom random, ISymbolicExpressionGrammar grammar, int maxLength, int maxDepth, double irregularityBias = 0) {
+      int targetLength = random.Next(3, maxLength); // because we have 2 extra nodes for the root and start symbols, and the end is exclusive
+      return CreateExpressionTree(random, grammar, targetLength, maxDepth, irregularityBias);
+    }
+
+    private class SymbolCacheEntry {
+      public int MinSubtreeCount;
+      public int MaxSubtreeCount;
+      public int[] MaxChildArity;
+    }
+
+    private class SymbolCache {
+      public SymbolCache(ISymbolicExpressionGrammarBase grammar) {
+        Grammar = grammar;
+      }
+
+      public ISymbolicExpressionTreeNode SampleNode(IRandom random, ISymbol parent, int childIndex, int minArity, int maxArity) {
+        var symbols = new List<ISymbol>();
+        var weights = new List<double>();
+        foreach (var child in AllowedSymbols.Where(x => !(x is StartSymbol || x is Defun))) {
+          var t = Tuple.Create(parent, child);
+          if (!allowedCache.TryGetValue(t, out bool[] allowed)) { continue; }
+          if (!allowed[childIndex]) { continue; }
+
+          if (symbolCache.TryGetValue(child, out SymbolCacheEntry cacheItem)) {
+            if (cacheItem.MinSubtreeCount < minArity) { continue; }
+            if (cacheItem.MaxSubtreeCount > maxArity) { continue; }
+          }
+
+          symbols.Add(child);
+          weights.Add(child.InitialFrequency);
+        }
+        if (symbols.Count == 0) {
+          throw new ArgumentException("SampleNode: parent symbol " + parent.Name
+            + " does not have any allowed child symbols with min arity " + minArity
+            + " and max arity " + maxArity + ". Please ensure the grammar is properly configured.");
+        }
+        var symbol = symbols.SampleProportional(random, 1, weights).First();
+        var node = symbol.CreateTreeNode();
+        if (node.HasLocalParameters) {
+          node.ResetLocalParameters(random);
+        }
+        return node;
+      }
+
+      public ISymbolicExpressionGrammarBase Grammar {
+        get { return grammar; }
+        set {
+          grammar = value;
+          RebuildCache();
+        }
+      }
+
+      public IList<ISymbol> AllowedSymbols { get; private set; }
+
+      public SymbolCacheEntry this[ISymbol symbol] {
+        get { return symbolCache[symbol]; }
+      }
+
+      public bool[] this[ISymbol parent, ISymbol child] {
+        get { return allowedCache[Tuple.Create(parent, child)]; }
+      }
+
+      public bool HasUnarySymbols { get; private set; }
+
+      private void RebuildCache() {
+        AllowedSymbols = Grammar.AllowedSymbols.Where(x => x.InitialFrequency > 0 && !(x is ProgramRootSymbol)).ToList();
+
+        allowedCache = new Dictionary<Tuple<ISymbol, ISymbol>, bool[]>();
+        symbolCache = new Dictionary<ISymbol, SymbolCacheEntry>();
+
+        SymbolCacheEntry TryAddItem(ISymbol symbol) {
+          if (!symbolCache.TryGetValue(symbol, out SymbolCacheEntry cacheItem)) {
+            cacheItem = new SymbolCacheEntry {
+              MinSubtreeCount = Grammar.GetMinimumSubtreeCount(symbol),
+              MaxSubtreeCount = Grammar.GetMaximumSubtreeCount(symbol)
+            };
+            symbolCache[symbol] = cacheItem;
+          }
+          return cacheItem;
+        }
+
+        foreach (var parent in AllowedSymbols) {
+          var parentCacheEntry = TryAddItem(parent);
+          var maxChildArity = new int[parentCacheEntry.MaxSubtreeCount];
+
+          if (!(parent is StartSymbol || parent is Defun)) {
+            HasUnarySymbols |= parentCacheEntry.MaxSubtreeCount == 1;
+          }
+
+          foreach (var child in AllowedSymbols) {
+            var childCacheEntry = TryAddItem(child);
+            var allowed = new bool[parentCacheEntry.MaxSubtreeCount];
+
+            for (int childIndex = 0; childIndex < parentCacheEntry.MaxSubtreeCount; ++childIndex) {
+              allowed[childIndex] = Grammar.IsAllowedChildSymbol(parent, child, childIndex);
+              maxChildArity[childIndex] = Math.Max(maxChildArity[childIndex], allowed[childIndex] ? childCacheEntry.MaxSubtreeCount : 0);
+            }
+            allowedCache[Tuple.Create(parent, child)] = allowed;
+          }
+          parentCacheEntry.MaxChildArity = maxChildArity;
+        }
+      }
+
+      private ISymbolicExpressionGrammarBase grammar;
+      private Dictionary<Tuple<ISymbol, ISymbol>, bool[]> allowedCache;
+      private Dictionary<ISymbol, SymbolCacheEntry> symbolCache;
+    }
+
+    public static ISymbolicExpressionTree CreateExpressionTree(IRandom random, ISymbolicExpressionGrammar grammar, int targetLength, int maxDepth, double irregularityBias = 1) {
+      // even lengths cannot be achieved without symbols of odd arity
+      // therefore we randomly pick a neighbouring odd length value
+      var tree = MakeStump(random, grammar); // create a stump consisting of just a ProgramRootSymbol and a StartSymbol
+      CreateExpression(random, tree.Root.GetSubtree(0), targetLength - 2, maxDepth - 2, irregularityBias); // -2 because the stump has length 2 and depth 2
+      return tree;
+    }
+
+    public static void CreateExpression(IRandom random, ISymbolicExpressionTreeNode root, int targetLength, int maxDepth, double irregularityBias = 1) {
+      var grammar = root.Grammar;
+      var symbolCache = new SymbolCache(grammar);
+      var entry = symbolCache[root.Symbol];
+      var arity = random.Next(entry.MinSubtreeCount, entry.MaxSubtreeCount + 1);
+      var tuples = new List<NodeInfo>(targetLength) { new NodeInfo { Node = root, Depth = 0, Arity = arity } };
+      int openSlots = arity;
+
+      for (int i = 0; i < tuples.Count; ++i) {
+        var t = tuples[i];
+        var node = t.Node;
+        var parentEntry = symbolCache[node.Symbol];
+
+        for (int childIndex = 0; childIndex < t.Arity; ++childIndex) {
+          // min and max arity here refer to the required arity limits for the child node
+          int maxChildArity = t.Depth == maxDepth - 1 ? 0 : Math.Min(parentEntry.MaxChildArity[childIndex], targetLength - openSlots);
+          int minChildArity = Math.Min((openSlots - tuples.Count > 1 && random.NextDouble() < irregularityBias) ? 0 : 1, maxChildArity);
+          var child = symbolCache.SampleNode(random, node.Symbol, childIndex, minChildArity, maxChildArity);
+          var childEntry = symbolCache[child.Symbol];
+          var childArity = random.Next(childEntry.MinSubtreeCount, childEntry.MaxSubtreeCount + 1);
+          var childDepth = t.Depth + 1;
+          node.AddSubtree(child);
+          tuples.Add(new NodeInfo { Node = child, Depth = childDepth, Arity = childArity });
+          openSlots += childArity;
+        }
+      }
+    }
+
+    protected override ISymbolicExpressionTree Create(IRandom random) {
+      var maxLength = MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value;
+      var maxDepth = MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value;
+      var grammar = ClonedSymbolicExpressionTreeGrammarParameter.ActualValue;
+      return Create(random, grammar, maxLength, maxDepth);
+    }
+
+    #region helpers
+    private class NodeInfo {
+      public ISymbolicExpressionTreeNode Node;
+      public int Depth;
+      public int Arity;
+    }
+
+    private static ISymbolicExpressionTree MakeStump(IRandom random, ISymbolicExpressionGrammar grammar) {
+      SymbolicExpressionTree tree = new SymbolicExpressionTree();
+      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
+      if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
+      rootNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
+
+      var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
+      if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
+      startNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
+
+      rootNode.AddSubtree(startNode);
+      tree.Root = rootNode;
+      return tree;
+    }
+    #endregion
+  }
+}
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 17409)
@@ -129,4 +129,5 @@
     <Compile Include="ArchitectureManipulators\SubroutineDuplicater.cs" />
     <Compile Include="ArchitectureManipulators\SymbolicExpressionTreeArchitectureManipulator.cs" />
+    <Compile Include="Creators\BalancedTreeCreator.cs" />
     <Compile Include="Grammars\GrammarUtils.cs" />
     <Compile Include="SymbolicExpressionTreeProblem.cs" />
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 17409)
@@ -38,4 +38,11 @@
     }
 
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+
+      var tree = Content?.Model?.SymbolicExpressionTree;
+      btnOptimizeConstants.Enabled = tree != null && SymbolicRegressionConstantOptimizationEvaluator.CanOptimizeConstants(tree);
+    }
+
     protected override void UpdateModel(ISymbolicExpressionTree tree) {
       var model = new SymbolicRegressionModel(Content.ProblemData.TargetVariable, tree, Content.Model.Interpreter, Content.Model.LowerEstimationLimit, Content.Model.UpperEstimationLimit);
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 17409)
@@ -168,4 +168,5 @@
     private void Content_Changed(object sender, EventArgs e) {
       UpdateView();
+      SetEnabledStateOfControls();
     }
 
@@ -313,8 +314,12 @@
     private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
       progress.Start("Optimizing Constants ...");
-      var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
-      var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
-      await Task.Delay(500); // wait for progressbar to finish animation
-      UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed)
+      try {
+        var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
+        var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
+        await Task.Delay(500); // wait for progressbar to finish animation
+        UpdateModel(newTree);
+      } finally {
+        progress.Finish();
+      }
     }
   }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs	(revision 17409)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs	(revision 17409)
@@ -0,0 +1,38 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("BalancedTreeCreator", "An operator that creates new symbolic expression trees using the 'Balanced' method")]
+  [StorableType("E268BE19-BBEB-46EF-9632-1799A43D01F9")]
+  public class SymbolicDataAnalysisExpressionBalancedTreeCreator : BalancedTreeCreator, ISymbolicDataAnalysisSolutionCreator {
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionBalancedTreeCreator(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicDataAnalysisExpressionBalancedTreeCreator(SymbolicDataAnalysisExpressionBalancedTreeCreator original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionBalancedTreeCreator(this, cloner); }
+
+    public SymbolicDataAnalysisExpressionBalancedTreeCreator() : base() { }
+  }
+}
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17409)
@@ -150,4 +150,5 @@
     <Compile Include="Converters\DerivativeCalculator.cs" />
     <Compile Include="Converters\TreeToAutoDiffTermConverter.cs" />
+    <Compile Include="Creators\SymbolicDataAnalysisExpressionBalancedTreeCreator.cs" />
     <Compile Include="Crossovers\SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs" />
     <Compile Include="Formatters\InfixExpressionFormatter.cs" />
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs	(revision 17409)
@@ -52,5 +52,5 @@
     private static readonly MethodInfo Log = typeof(Math).GetMethod("Log", new[] { typeof(double) });
     private static readonly MethodInfo IsNaN = typeof(double).GetMethod("IsNaN");
-    private static readonly MethodInfo IsAlmost = typeof(DoubleExtensions).GetMethod("IsAlmost");
+    private static readonly MethodInfo IsAlmost = typeof(DoubleExtensions).GetMethod("IsAlmost", new Type[] { typeof(double), typeof(double)});
     private static readonly MethodInfo Gamma = typeof(alglib).GetMethod("gammafunction", new[] { typeof(double) });
     private static readonly MethodInfo Psi = typeof(alglib).GetMethod("psi", new[] { typeof(double) });
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17409)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -181,11 +202,11 @@
 
     [ThreadStatic]
-    private Dictionary<string, double[]> cachedData;
+    private static Dictionary<string, double[]> cachedData;
 
     [ThreadStatic]
-    private IDataset dataset;
+    private static IDataset cachedDataset;
 
     private void InitCache(IDataset dataset) {
-      this.dataset = dataset;
+      cachedDataset = dataset;
       cachedData = new Dictionary<string, double[]>();
       foreach (var v in dataset.DoubleVariables) {
@@ -196,10 +217,10 @@
     public void InitializeState() {
       cachedData = null;
-      dataset = null;
+      cachedDataset = null;
       EvaluatedSolutions = 0;
     }
 
     private double[] GetValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
-      if (cachedData == null || this.dataset != dataset) {
+      if (cachedData == null || cachedDataset != dataset) {
         InitCache(dataset);
       }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17409)
@@ -99,5 +99,5 @@
 
     [ThreadStatic]
-    private IDataset dataset;
+    private static IDataset cachedDataset;
 
     private static readonly HashSet<byte> supportedOpCodes = new HashSet<byte>() {
@@ -127,5 +127,5 @@
       if (!rows.Any()) return Enumerable.Empty<double>();
 
-      if (cachedData == null || this.dataset != dataset) {
+      if (cachedData == null || cachedDataset != dataset) {
         InitCache(dataset);
       }
@@ -152,5 +152,5 @@
 
     private void InitCache(IDataset dataset) {
-      this.dataset = dataset;
+      cachedDataset = dataset;
 
       // free handles to old data
@@ -178,5 +178,5 @@
         cachedData = null;
       }
-      dataset = null;
+      cachedDataset = null;
       EvaluatedSolutions = 0;
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs	(revision 17409)
@@ -192,5 +192,4 @@
       this.Name = "ClassificationSolutionVariableImpactsView";
       this.Size = new System.Drawing.Size(712, 365);
-      this.VisibleChanged += new System.EventHandler(this.ClassificationSolutionVariableImpactsView_VisibleChanged);
       this.ResumeLayout(false);
       this.PerformLayout();
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 17409)
@@ -40,4 +40,5 @@
     private CancellationTokenSource cancellationToken = new CancellationTokenSource();
     private List<Tuple<string, double>> rawVariableImpacts = new List<Tuple<string, double>>();
+    private bool attachedToProgress = false;
 
     public new IClassificationSolution Content {
@@ -86,6 +87,12 @@
       }
     }
-    private void ClassificationSolutionVariableImpactsView_VisibleChanged(object sender, EventArgs e) {
+    protected override void OnHidden(EventArgs e) {
+      base.OnHidden(e);
       cancellationToken.Cancel();
+
+      if (attachedToProgress) {
+        Progress.Hide(this);
+        attachedToProgress = false;
+      }
     }
 
@@ -126,4 +133,5 @@
       variableImpactsArrayView.Caption = Content.Name + " Variable Impacts";
       progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
+      attachedToProgress = true;
       cancellationToken = new CancellationTokenSource();
 
@@ -144,5 +152,8 @@
         UpdateOrdering();
       } finally {
-        Progress.Hide(this);
+        if (attachedToProgress) {
+          Progress.Hide(this);
+          attachedToProgress = false;
+        }
       }
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs	(revision 17409)
@@ -93,25 +93,26 @@
       var dateTimeVars = ds.DateTimeVariables.Where(vn => ds.GetDateTimeValues(vn).Distinct().Skip(1).Any()).ToArray();
 
-      // produce training and test values separately as they might overlap (e.g. for ensembles)
-      var predictedValuesTrain = Content.EstimatedTrainingValues.ToArray();
-      int j = 0; // idx for predictedValues array
-      foreach (var i in problemData.TrainingIndices) {
+      var predictedValues = Content.EstimatedValues.ToArray();
+      foreach (var i in problemData.AllIndices) {
         var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars);
         var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i);
-        AddErrors(run, predictedValuesTrain[j++], targetValue);
-        run.Results.Add(PartitionLabel, new StringValue("Training"));
-        run.Color = Color.Gold;
+        AddErrors(run, predictedValues[i], targetValue);
+
+        if (problemData.IsTrainingSample(i) && problemData.IsTestSample(i)) {
+          run.Results.Add(PartitionLabel, new StringValue("Training + Test"));
+          run.Color = Color.Orange;
+        } else if (problemData.IsTrainingSample(i)) {
+          run.Results.Add(PartitionLabel, new StringValue("Training"));
+          run.Color = Color.Gold;
+        } else if (problemData.IsTestSample(i)) {
+          run.Results.Add(PartitionLabel, new StringValue("Test"));
+          run.Color = Color.Red;
+        } else {
+          run.Results.Add(PartitionLabel, new StringValue("Additional Data"));
+          run.Color = Color.Black;
+        }
         runs.Add(run);
       }
-      var predictedValuesTest = Content.EstimatedTestValues.ToArray();
-      j = 0;
-      foreach (var i in problemData.TestIndices) {
-        var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars);
-        var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i);
-        AddErrors(run, predictedValuesTest[j++], targetValue);
-        run.Results.Add(PartitionLabel, new StringValue("Test"));
-        run.Color = Color.Red;
-        runs.Add(run);
-      }
+
       if (string.IsNullOrEmpty(selectedXAxis))
         selectedXAxis = "Index";
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.Designer.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.Designer.cs	(revision 17409)
@@ -192,5 +192,4 @@
       this.Name = "RegressionSolutionVariableImpactsView";
       this.Size = new System.Drawing.Size(712, 365);
-      this.VisibleChanged += new System.EventHandler(this.RegressionSolutionVariableImpactsView_VisibleChanged);
       this.ResumeLayout(false);
       this.PerformLayout();
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 17409)
@@ -40,4 +40,5 @@
     private CancellationTokenSource cancellationToken = new CancellationTokenSource();
     private List<Tuple<string, double>> rawVariableImpacts = new List<Tuple<string, double>>();
+    private bool attachedToProgress = false;
 
     public new IRegressionSolution Content {
@@ -86,6 +87,13 @@
       }
     }
-    private void RegressionSolutionVariableImpactsView_VisibleChanged(object sender, EventArgs e) {
+
+    protected override void OnHidden(EventArgs e) {
+      base.OnHidden(e);
       cancellationToken.Cancel();
+
+      if (attachedToProgress) {
+        Progress.Hide(this);
+        attachedToProgress = false;
+      }
     }
 
@@ -124,4 +132,5 @@
       variableImpactsArrayView.Caption = Content.Name + " Variable Impacts";
       var progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
+      attachedToProgress = true;
       cancellationToken = new CancellationTokenSource();
 
@@ -141,7 +150,9 @@
         rawVariableImpacts.AddRange(impacts);
         UpdateOrdering();
-      }
-      finally {
-        Progress.Hide(this);
+      } finally {
+        if (attachedToProgress) {
+          Progress.Hide(this);
+          attachedToProgress = false;
+        }
       }
     }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs	(revision 17409)
@@ -37,5 +37,27 @@
     protected Interval(StorableConstructorFlag _) { }
 
+    /// <summary>
+    /// Creates an interval with given bounds, where lower bound must be smaller than
+    /// the upper bound. Floating point precision errors trough calculations are fixed by,
+    /// checking if the intervals are almost the same (E-12). If this is the case, the bounds 
+    /// will be set to the bound closer to zero.
+    /// </summary>
+    /// <param name="lowerBound">Lower bound of the interval</param>
+    /// <param name="upperBound">Upper bound of the interval</param>
     public Interval(double lowerBound, double upperBound) {
+      if (lowerBound.IsAlmost(upperBound)) {
+        //If the bounds go over zero
+        if (lowerBound <= 0 && upperBound >= 0) {
+          lowerBound = 0.0;
+          upperBound = 0.0;
+          //Interval is negative
+        } else if (upperBound < 0) {
+          lowerBound = upperBound;
+          //Interval is positive
+        } else {
+          upperBound = lowerBound;
+        }
+      }
+
       if (lowerBound > upperBound)
         throw new ArgumentException("LowerBound must be smaller than UpperBound.");
@@ -58,4 +80,18 @@
                 double.IsNaN(LowerBound) || double.IsNaN(UpperBound);
       }
+    }
+
+    /// <summary>
+    /// True if the interval is positive without zero
+    /// </summary>
+    public bool IsPositive {
+      get => LowerBound > 0.0; 
+    }
+
+    /// <summary>
+    /// True if the interval is negative without zero
+    /// </summary>
+    public bool IsNegative {
+      get => UpperBound < 0.0;
     }
 
@@ -128,5 +164,5 @@
     }
 
-    //mkommend: Division by intervals containing 0 is implemented as defined in
+    //Division by intervals containing 0 is implemented as defined in
     //http://en.wikipedia.org/wiki/Interval_arithmetic
     public static Interval Divide(Interval a, Interval b) {
@@ -171,5 +207,5 @@
     public static Interval Tangens(Interval a) {
       return Interval.Divide(Interval.Sine(a), Interval.Cosine(a));
-    }  
+    }
     public static Interval HyperbolicTangent(Interval a) {
       return new Interval(Math.Tanh(a.LowerBound), Math.Tanh(a.UpperBound));
@@ -226,6 +262,30 @@
 
     public static Interval CubicRoot(Interval a) {
-      if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN);
-      return new Interval(Math.Pow(a.LowerBound, 1.0 / 3), Math.Pow(a.UpperBound, 1.0 / 3));
+      var lower = (a.LowerBound < 0) ? -Math.Pow(-a.LowerBound, 1d / 3d) : Math.Pow(a.LowerBound, 1d / 3d);
+      var upper = (a.UpperBound < 0) ? -Math.Pow(-a.UpperBound, 1d / 3d) : Math.Pow(a.UpperBound, 1d / 3d);
+
+      return new Interval(lower, upper);
+    }
+
+    public static Interval Absolute(Interval a) {
+      var absLower = Math.Abs(a.LowerBound);
+      var absUpper = Math.Abs(a.UpperBound);
+      var min = Math.Min(absLower, absUpper);
+      var max = Math.Max(absLower, absUpper);
+
+      if (a.Contains(0.0)) {
+        min = 0.0;
+      }
+
+      return new Interval(min, max);
+    }
+
+    public static Interval AnalyticalQuotient(Interval a, Interval b) {
+      var dividend = a;
+      var divisor = Add(Square(b), new Interval(1.0, 1.0));
+      divisor = SquareRoot(divisor);
+
+      var quotient = Divide(dividend, divisor);
+      return quotient;
     }
     #endregion
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.Designer.cs	(revision 17409)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.Designer.cs	(revision 17409)
@@ -0,0 +1,212 @@
+﻿namespace HeuristicLab.Scripting.Views {
+  partial class CompilerErrorDialog {
+    /// <summary>
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary>
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Windows Form 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() {
+      this.iconLabel = new System.Windows.Forms.Label();
+      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
+      this.codeValueLinkLabel = new System.Windows.Forms.LinkLabel();
+      this.messageLabel = new System.Windows.Forms.Label();
+      this.codeLabel = new System.Windows.Forms.Label();
+      this.columnValueLabel = new System.Windows.Forms.Label();
+      this.columnLabel = new System.Windows.Forms.Label();
+      this.lineValueLabel = new System.Windows.Forms.Label();
+      this.lineLabel = new System.Windows.Forms.Label();
+      this.messageValueTextBox = new System.Windows.Forms.TextBox();
+      this.infoTextBox = new System.Windows.Forms.TextBox();
+      this.okButton = new System.Windows.Forms.Button();
+      this.detailsGroupBox.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // iconLabel
+      // 
+      this.iconLabel.Location = new System.Drawing.Point(12, 9);
+      this.iconLabel.Name = "iconLabel";
+      this.iconLabel.Size = new System.Drawing.Size(30, 30);
+      this.iconLabel.TabIndex = 1;
+      // 
+      // detailsGroupBox
+      // 
+      this.detailsGroupBox.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.detailsGroupBox.Controls.Add(this.codeValueLinkLabel);
+      this.detailsGroupBox.Controls.Add(this.messageLabel);
+      this.detailsGroupBox.Controls.Add(this.codeLabel);
+      this.detailsGroupBox.Controls.Add(this.columnValueLabel);
+      this.detailsGroupBox.Controls.Add(this.columnLabel);
+      this.detailsGroupBox.Controls.Add(this.lineValueLabel);
+      this.detailsGroupBox.Controls.Add(this.lineLabel);
+      this.detailsGroupBox.Controls.Add(this.messageValueTextBox);
+      this.detailsGroupBox.Location = new System.Drawing.Point(12, 42);
+      this.detailsGroupBox.Name = "detailsGroupBox";
+      this.detailsGroupBox.Size = new System.Drawing.Size(560, 212);
+      this.detailsGroupBox.TabIndex = 3;
+      this.detailsGroupBox.TabStop = false;
+      this.detailsGroupBox.Text = "Details";
+      // 
+      // codeValueLinkLabel
+      // 
+      this.codeValueLinkLabel.AutoSize = true;
+      this.codeValueLinkLabel.Location = new System.Drawing.Point(65, 65);
+      this.codeValueLinkLabel.Name = "codeValueLinkLabel";
+      this.codeValueLinkLabel.Size = new System.Drawing.Size(21, 13);
+      this.codeValueLinkLabel.TabIndex = 5;
+      this.codeValueLinkLabel.TabStop = true;
+      this.codeValueLinkLabel.Text = "{0}";
+      this.codeValueLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.codeLinkLabel_LinkClicked);
+      // 
+      // messageLabel
+      // 
+      this.messageLabel.AutoSize = true;
+      this.messageLabel.Location = new System.Drawing.Point(6, 88);
+      this.messageLabel.Name = "messageLabel";
+      this.messageLabel.Size = new System.Drawing.Size(53, 13);
+      this.messageLabel.TabIndex = 6;
+      this.messageLabel.Text = "Message:";
+      // 
+      // codeLabel
+      // 
+      this.codeLabel.AutoSize = true;
+      this.codeLabel.Location = new System.Drawing.Point(6, 65);
+      this.codeLabel.Name = "codeLabel";
+      this.codeLabel.Size = new System.Drawing.Size(35, 13);
+      this.codeLabel.TabIndex = 4;
+      this.codeLabel.Text = "Code:";
+      // 
+      // columnValueLabel
+      // 
+      this.columnValueLabel.AutoSize = true;
+      this.columnValueLabel.Location = new System.Drawing.Point(65, 42);
+      this.columnValueLabel.Name = "columnValueLabel";
+      this.columnValueLabel.Size = new System.Drawing.Size(21, 13);
+      this.columnValueLabel.TabIndex = 3;
+      this.columnValueLabel.Text = "{0}";
+      // 
+      // columnLabel
+      // 
+      this.columnLabel.AutoSize = true;
+      this.columnLabel.Location = new System.Drawing.Point(6, 42);
+      this.columnLabel.Name = "columnLabel";
+      this.columnLabel.Size = new System.Drawing.Size(45, 13);
+      this.columnLabel.TabIndex = 2;
+      this.columnLabel.Text = "Column:";
+      // 
+      // lineValueLabel
+      // 
+      this.lineValueLabel.AutoSize = true;
+      this.lineValueLabel.Location = new System.Drawing.Point(65, 19);
+      this.lineValueLabel.Name = "lineValueLabel";
+      this.lineValueLabel.Size = new System.Drawing.Size(21, 13);
+      this.lineValueLabel.TabIndex = 1;
+      this.lineValueLabel.Text = "{0}";
+      // 
+      // lineLabel
+      // 
+      this.lineLabel.AutoSize = true;
+      this.lineLabel.Location = new System.Drawing.Point(6, 19);
+      this.lineLabel.Name = "lineLabel";
+      this.lineLabel.Size = new System.Drawing.Size(30, 13);
+      this.lineLabel.TabIndex = 0;
+      this.lineLabel.Text = "Line:";
+      // 
+      // messageValueTextBox
+      // 
+      this.messageValueTextBox.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.messageValueTextBox.BackColor = System.Drawing.SystemColors.Control;
+      this.messageValueTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+      this.messageValueTextBox.Location = new System.Drawing.Point(68, 88);
+      this.messageValueTextBox.Multiline = true;
+      this.messageValueTextBox.Name = "messageValueTextBox";
+      this.messageValueTextBox.ReadOnly = true;
+      this.messageValueTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+      this.messageValueTextBox.Size = new System.Drawing.Size(486, 118);
+      this.messageValueTextBox.TabIndex = 7;
+      this.messageValueTextBox.Text = "{0}";
+      // 
+      // infoTextBox
+      // 
+      this.infoTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.infoTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+      this.infoTextBox.Cursor = System.Windows.Forms.Cursors.Default;
+      this.infoTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.infoTextBox.Location = new System.Drawing.Point(48, 17);
+      this.infoTextBox.Name = "infoTextBox";
+      this.infoTextBox.ReadOnly = true;
+      this.infoTextBox.Size = new System.Drawing.Size(524, 13);
+      this.infoTextBox.TabIndex = 2;
+      this.infoTextBox.Text = "{0} was generated during compilation.";
+      // 
+      // okButton
+      // 
+      this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
+      this.okButton.Location = new System.Drawing.Point(497, 260);
+      this.okButton.Name = "okButton";
+      this.okButton.Size = new System.Drawing.Size(75, 23);
+      this.okButton.TabIndex = 0;
+      this.okButton.Text = "&OK";
+      this.okButton.UseVisualStyleBackColor = true;
+      // 
+      // CompilerErrorDialog
+      // 
+      this.AcceptButton = this.okButton;
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+      this.CancelButton = this.okButton;
+      this.ClientSize = new System.Drawing.Size(584, 295);
+      this.Controls.Add(this.okButton);
+      this.Controls.Add(this.infoTextBox);
+      this.Controls.Add(this.detailsGroupBox);
+      this.Controls.Add(this.iconLabel);
+      this.MaximizeBox = false;
+      this.MinimizeBox = false;
+      this.Name = "CompilerErrorDialog";
+      this.ShowInTaskbar = false;
+      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+      this.Text = "{0}";
+      this.detailsGroupBox.ResumeLayout(false);
+      this.detailsGroupBox.PerformLayout();
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Label iconLabel;
+    private System.Windows.Forms.GroupBox detailsGroupBox;
+    private System.Windows.Forms.TextBox messageValueTextBox;
+    private System.Windows.Forms.Label lineLabel;
+    private System.Windows.Forms.Label columnLabel;
+    private System.Windows.Forms.Label lineValueLabel;
+    private System.Windows.Forms.Label codeLabel;
+    private System.Windows.Forms.Label columnValueLabel;
+    private System.Windows.Forms.LinkLabel codeValueLinkLabel;
+    private System.Windows.Forms.Label messageLabel;
+    private System.Windows.Forms.TextBox infoTextBox;
+    private System.Windows.Forms.Button okButton;
+  }
+}
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.cs	(revision 17409)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.cs	(revision 17409)
@@ -0,0 +1,34 @@
+﻿using System.CodeDom.Compiler;
+using System.Diagnostics;
+using System.Drawing;
+using System.Windows.Forms;
+using HeuristicLab.Common.Resources;
+
+namespace HeuristicLab.Scripting.Views {
+  public partial class CompilerErrorDialog : Form {
+    private const string ErrorLinkFormatString = "https://docs.microsoft.com/en-us/search/?search={0}&scope=.NET";
+
+    private static readonly Bitmap WarningImage = VSImageLibrary.Warning;
+    private static readonly Bitmap ErrorImage = VSImageLibrary.Error;
+
+    public CompilerErrorDialog(CompilerError error) {
+      InitializeComponent();
+
+      var image = error.IsWarning ? WarningImage : ErrorImage;
+
+      Icon = Icon.FromHandle(image.GetHicon());
+      Text = error.IsWarning ? "Warning" : "Error";
+      iconLabel.Image = image;
+      infoTextBox.Text = string.Format(infoTextBox.Text, error.IsWarning ? "A warning" : "An error");
+      lineValueLabel.Text = error.Line.ToString();
+      columnValueLabel.Text = error.Column.ToString();
+      codeValueLinkLabel.Text = error.ErrorNumber;
+      codeValueLinkLabel.Links.Add(new LinkLabel.Link(0, error.ErrorNumber.Length, string.Format(ErrorLinkFormatString, error.ErrorNumber)));
+      messageValueTextBox.Text = error.ErrorText;
+    }
+
+    private void codeLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
+      Process.Start((string)e.Link.LinkData);
+    }
+  }
+}
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj	(revision 17409)
@@ -97,4 +97,10 @@
     <Compile Include="CSharpScriptView.Designer.cs">
       <DependentUpon>CSharpScriptView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="CompilerErrorDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="CompilerErrorDialog.Designer.cs">
+      <DependentUpon>CompilerErrorDialog.cs</DependentUpon>
     </Compile>
     <Compile Include="ExecutableScriptView.cs">
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs	(revision 17409)
@@ -184,4 +184,5 @@
       this.errorListView.UseCompatibleStateImageBehavior = false;
       this.errorListView.View = System.Windows.Forms.View.Details;
+      this.errorListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.errorListView_MouseClick);
       this.errorListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.errorListView_MouseDoubleClick);
       // 
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting.Views/3.3/ScriptView.cs	(revision 17409)
@@ -209,11 +209,23 @@
     }
 
+    private void errorListView_MouseClick(object sender, MouseEventArgs e) {
+      if (e.Button != MouseButtons.Left) return;
+
+      var item = errorListView.SelectedItems[0];
+      var message = (CompilerError)item.Tag;
+
+      codeEditor.ScrollToPosition(message.Line, message.Column);
+      codeEditor.Focus();
+    }
+
     private void errorListView_MouseDoubleClick(object sender, MouseEventArgs e) {
-      if (e.Button == MouseButtons.Left) {
-        var item = errorListView.SelectedItems[0];
-        var message = (CompilerError)item.Tag;
-        codeEditor.ScrollToPosition(message.Line, message.Column);
-        codeEditor.Focus();
-      }
+      if (e.Button != MouseButtons.Left) return;
+
+      var item = errorListView.SelectedItems[0];
+      var message = (CompilerError)item.Tag;
+
+      using (var dialog = new CompilerErrorDialog(message)) {
+        dialog.ShowDialog(this);
+      };
     }
     #endregion
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting/3.3/Script.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting/3.3/Script.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Scripting/3.3/Script.cs	(revision 17409)
@@ -40,4 +40,5 @@
   public abstract class Script : NamedItem, IProgrammableItem {
     #region Fields & Properties
+    public static readonly HashSet<string> ExcludedAssemblyFileNames = new HashSet<string> { "IKVM.OpenJDK.ClassLibrary.dll" };
     public static new Image StaticItemImage {
       get { return VSImageLibrary.Script; }
@@ -124,5 +125,6 @@
     public virtual IEnumerable<Assembly> GetAssemblies() {
       var assemblies = AppDomain.CurrentDomain.GetAssemblies()
-        .Where(a => !a.IsDynamic && File.Exists(a.Location))
+        .Where(a => !a.IsDynamic && File.Exists(a.Location)
+                 && !ExcludedAssemblyFileNames.Contains(Path.GetFileName(a.Location)))
         .GroupBy(x => Regex.Replace(Path.GetFileName(x.Location), @"-[\d.]+\.dll$", ""))
         .Select(x => x.OrderByDescending(y => y.GetName().Version).First())
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Services.Hive/3.3/HiveService.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 17409)
@@ -665,7 +665,9 @@
             bool oldIsAllowedToCalculate = slave.IsAllowedToCalculate;
             Guid? oldParentResourceId = slave.ParentResourceId;
+            bool? oldIsDisposable = slave.IsDisposable;
             slaveInfo.CopyToEntity(slave);
             slave.IsAllowedToCalculate = oldIsAllowedToCalculate;
             slave.ParentResourceId = oldParentResourceId;
+            slave.IsDisposable = oldIsDisposable;
             slave.LastHeartbeat = DateTime.Now;
             slave.SlaveState = DA.SlaveState.Idle;
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs	(revision 17408)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs	(revision 17409)
@@ -14,5 +14,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalAddOperation() {
+    public void AddIntervalTest() {
       //add        [x1,x2] + [y1,y2] = [x1 + y1,x2 + y2]
 
@@ -28,5 +28,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalSubOperation() {
+    public void SubtractIntervalTest() {
       //subtract   [x1,x2] − [y1,y2] = [x1 − y2,x2 − y1]
 
@@ -42,5 +42,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalMutlipyOperation() {
+    public void MultiplyIntervalTest() {
       //multiply   [x1,x2] * [y1,y2] = [min(x1*y1,x1*y2,x2*y1,x2*y2),max(x1*y1,x1*y2,x2*y1,x2*y2)]
 
@@ -59,5 +59,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalDivideOperation() {
+    public void DivideIntervalTest() {
       //divide  [x1, x2] / [y1, y2] = [x1, x2] * (1/[y1, y2]), where 1 / [y1,y2] = [1 / y2,1 / y1] if 0 not in [y_1, y_2].
 
@@ -80,5 +80,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalSineOperator() {
+    public void SineIntervalTest() {
       //sine depends on interval
       //sin([0, 2*pi]) = [-1, 1]
@@ -98,5 +98,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalCosineOperator() {
+    public void CosineIntervalTest() {
       //Cosine uses sine Interval.Sine(Interval.Subtract(a, new Interval(Math.PI / 2, Math.PI / 2)));
       Assert.AreEqual<Interval>(Interval.Cosine(new Interval(0, 2 * Math.PI)), new Interval(-1, 1));
@@ -107,5 +107,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalLogOperator() {
+    public void LogIntervalTest() {
       //Log([3, 5]) = [log(3), log(5)]
       Assert.AreEqual<Interval>(new Interval(Math.Log(3), Math.Log(5)), Interval.Logarithm(new Interval(3, 5)));
@@ -122,5 +122,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalExpOperator() {
+    public void ExponentialIntervalTest() {
       //Exp([0, 1]) = [exp(0), exp(1)]
       Assert.AreEqual<Interval>(new Interval(1, Math.Exp(1)), Interval.Exponential(new Interval(0, 1)));
@@ -131,5 +131,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalSqrOperator() {
+    public void SquareIntervalTest() {
       Assert.AreEqual<Interval>(new Interval(1, 4), Interval.Square(new Interval(1, 2)));
       Assert.AreEqual<Interval>(new Interval(1, 4), Interval.Square(new Interval(-2, -1)));
@@ -140,5 +140,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalSqrtOperator() {
+    public void SquarerootIntervalTest() {
       Assert.AreEqual<Interval>(new Interval(1, 2), Interval.SquareRoot(new Interval(1, 4)));
       Assert.AreEqual<Interval>(new Interval(double.NaN, double.NaN), Interval.SquareRoot(new Interval(-4, -1)));
@@ -148,5 +148,5 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalCubeOperator() {
+    public void CubeIntervalTest() {
       Assert.AreEqual<Interval>(new Interval(1, 8), Interval.Cube(new Interval(1, 2)));
       Assert.AreEqual<Interval>(new Interval(-8, -1), Interval.Cube(new Interval(-2, -1)));
@@ -157,7 +157,95 @@
     [TestCategory("Problems.DataAnalysis")]
     [TestProperty("Time", "short")]
-    public void TestIntervalCbrtOperator() {
+    public void CubeRootIntervalTest() {
       Assert.AreEqual<Interval>(new Interval(1, 2), Interval.CubicRoot(new Interval(1, 8)));
-      Assert.AreEqual<Interval>(new Interval(double.NaN, double.NaN), Interval.CubicRoot(new Interval(-8, -1)));
+      Assert.AreEqual<Interval>(new Interval(-2, -2), Interval.CubicRoot(new Interval(-8, -8)));
+      Assert.AreEqual<Interval>(new Interval(-2, 2), Interval.CubicRoot(new Interval(-8, 8)));
+      Assert.AreEqual(new Interval(2, 2), Interval.CubicRoot(new Interval(8, 8)));
+      Assert.AreEqual(new Interval(-Math.Pow(6, 1.0 / 3), 2), Interval.CubicRoot(new Interval(-6, 8)));
+      Assert.AreEqual(new Interval(2, 2), Interval.CubicRoot(new Interval(8, 8)));
+      Assert.AreEqual(new Interval(-2, 0), Interval.CubicRoot(new Interval(-8, 0)));
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void AbsoluteIntervalTest() {
+      Assert.AreEqual(new Interval(2, 5), Interval.Absolute(new Interval(-5, -2)));
+      Assert.AreEqual(new Interval(2, 5), Interval.Absolute(new Interval(2, 5)));
+      Assert.AreEqual(new Interval(0, 3), Interval.Absolute(new Interval(-3, 0)));
+      Assert.AreEqual(new Interval(0, 5), Interval.Absolute(new Interval(0, 5)));
+      Assert.AreEqual(new Interval(0, 5), Interval.Absolute(new Interval(-2, 5)));
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void AnalyticalQuotientIntervalTest() {
+      //Analytical Quotient ==> a / sqrt(b^2 + 1)
+      var aPos = new Interval(3, 5);
+      var aZero = new Interval(-3, 5);
+      var aNeg = new Interval(-5, -3);
+
+      var bPos = new Interval(2, 4);
+      var bZero = new Interval(-2, 4);
+      var bNeg = new Interval(-4, -2);
+
+      //Second interval goes over zero
+      Assert.AreEqual(new Interval(aPos.LowerBound/Math.Sqrt(17), aPos.UpperBound), Interval.AnalyticalQuotient(aPos, bZero));
+      Assert.AreEqual(new Interval(aZero.LowerBound, aZero.UpperBound), Interval.AnalyticalQuotient(aZero, bZero));
+      Assert.AreEqual(new Interval(aNeg.LowerBound, aNeg.UpperBound/Math.Sqrt(17)), Interval.AnalyticalQuotient(aNeg, bZero));
+      //Second interval is positive
+      Assert.AreEqual(new Interval(aPos.LowerBound/Math.Sqrt(17), aPos.UpperBound/Math.Sqrt(5)), Interval.AnalyticalQuotient(aPos, bPos));
+      Assert.AreEqual(new Interval(aZero.LowerBound/Math.Sqrt(5), aZero.UpperBound/Math.Sqrt(5)), Interval.AnalyticalQuotient(aZero, bPos));
+      Assert.AreEqual(new Interval(aNeg.LowerBound/Math.Sqrt(5), aNeg.UpperBound/Math.Sqrt(17)), Interval.AnalyticalQuotient(aNeg, bPos));
+      //Second interval is negative
+      Assert.AreEqual(new Interval(aPos.LowerBound/Math.Sqrt(17), aPos.UpperBound/Math.Sqrt(5)), Interval.AnalyticalQuotient(aPos, bNeg));
+      Assert.AreEqual(new Interval(aZero.LowerBound/Math.Sqrt(5), aZero.UpperBound/Math.Sqrt(5)), Interval.AnalyticalQuotient(aZero, bNeg));
+      Assert.AreEqual(new Interval(aNeg.LowerBound/Math.Sqrt(5), aNeg.UpperBound/Math.Sqrt(17)), Interval.AnalyticalQuotient(aNeg, bNeg));
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void IsNegativeIntervalTest() {
+      Assert.IsTrue(new Interval(-2, -1).IsNegative);
+      Assert.IsFalse(new Interval(-2, 0).IsNegative);
+      Assert.IsFalse(new Interval(-2, 2).IsNegative);
+      Assert.IsFalse(new Interval(2, 4).IsNegative);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void IsPositiveIntervalTest() {
+      Assert.IsTrue(new Interval(3, 5).IsPositive);
+      Assert.IsFalse(new Interval(0, 5).IsPositive);
+      Assert.IsFalse(new Interval(-1, 5).IsPositive);
+      Assert.IsFalse(new Interval(-5, -2).IsPositive);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void IsAlmostIntervalTest() {
+      var negativeLowerBound = -2E-13;
+      var negativeUpperBound = -1E-13;
+      var positiveLowerBound = 3E-13;
+      var positiveUpperBound = 5E-13;
+
+      var negativeInterval = new Interval(negativeLowerBound, negativeUpperBound);
+      var positiveInterval = new Interval(positiveLowerBound, positiveUpperBound);
+      var zeroInterval = new Interval(negativeUpperBound, positiveLowerBound);
+
+      //Check for right-shift of negative interval
+      Assert.AreEqual(negativeUpperBound, negativeInterval.LowerBound);
+      Assert.AreEqual(negativeUpperBound, negativeInterval.UpperBound);
+      //Check for left-shift of positive interval
+      Assert.AreEqual(positiveLowerBound, positiveInterval.LowerBound);
+      Assert.AreEqual(positiveLowerBound, positiveInterval.UpperBound);
+      //Check for setting interval to zero
+      Assert.AreEqual(0, zeroInterval.LowerBound);
+      Assert.AreEqual(0, zeroInterval.UpperBound);
+
     }
   }
