Index: branches/3040_VectorBasedGP/HeuristicLab.Common/3.3/Statistics/EnumerableStatisticExtensions.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Common/3.3/Statistics/EnumerableStatisticExtensions.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Common/3.3/Statistics/EnumerableStatisticExtensions.cs	(revision 17741)
@@ -230,7 +230,6 @@
       if (min > max) throw new ArgumentException(string.Format("Minimum {0} is larger than maximum {1}.", min, max));
       foreach (var x in values) {
-        /*if (double.IsNaN(x)) yield return (max + min) / 2.0;
-        else */
-        if (x < min) yield return min;
+        if (double.IsNaN(x)) yield return (max + min) / 2.0;
+        else if (x < min) yield return min;
         else if (x > max) yield return max;
         else yield return x;
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 17741)
@@ -118,5 +118,5 @@
 
     private void UpdateEstimationLimits() {
-      if (ProblemData.TrainingIndices.Any()) {
+      if (ProblemData.TrainingIndices.Any() && ProblemData.Dataset.VariableHasType<double>(ProblemData.TargetVariable)) {
         var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList();
         var mean = targetValues.Average();
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs	(revision 17741)
@@ -141,5 +141,6 @@
       if (values.Count != variableValues[variableName].Count)
         throw new ArgumentException("The number of values must coincide with the number of dataset rows.");
-      if (GetVariableType(variableName) != values[0].GetType())
+      //if (GetVariableType(variableName) != values[0].GetType())
+      if (!GetVariableType(variableName).IsInstanceOfType(values[0]))
         throw new ArgumentException("The type of the provided value does not match the variable type.");
       variableValues[variableName] = values;
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj	(revision 17741)
@@ -262,4 +262,5 @@
     <Compile Include="Regression\VectorData\RandomExtensions.cs" />
     <Compile Include="Regression\VectorData\VectorDataInstanceProvider.cs" />
+    <Compile Include="Regression\VectorData\VectorDataTestFour.cs" />
     <Compile Include="Regression\VectorData\VectorDataTestThree.cs" />
     <Compile Include="Regression\VectorData\VectorDataTestTwo.cs" />
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs	(revision 17741)
@@ -28,5 +28,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Random;
-
+using MathNet.Numerics.Statistics;
 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
 
@@ -38,5 +38,5 @@
     protected override string TargetVariable { get { return "B3"; } }
     protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } }
-    protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } }
+    protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4", "X5" }; } }
     protected override int TrainingPartitionStart { get { return 0; } }
     protected override int TrainingPartitionEnd { get { return 70; } }
@@ -85,4 +85,5 @@
         x3Column.Add(x3);
         x4Column.Add(x4);
+        x5Column.Add(x5);
         b3Column.Add(b3);
       }
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliKorns5.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliKorns5.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliKorns5.cs	(revision 17741)
@@ -28,5 +28,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Random;
-
+using MathNet.Numerics.Statistics;
 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
 
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs	(revision 17740)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs	(revision 17741)
@@ -62,4 +62,8 @@
         new VectorDataTestThreeC(rand.Next()),
         new VectorDataTestThreeD(rand.Next()),
+        new VectorDataTestFourA(rand.Next()),
+        new VectorDataTestFourB(rand.Next()),
+        new VectorDataTestFourC(rand.Next()),
+        new VectorDataTestFourD(rand.Next()),
         new AzzaliBenchmark1(rand.Next()),
         new AzzaliBenchmark2(rand.Next()),
Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestFour.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestFour.cs	(revision 17741)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestFour.cs	(revision 17741)
@@ -0,0 +1,199 @@
+﻿#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;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+using MathNet.Numerics.Statistics;
+using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
+
+namespace HeuristicLab.Problems.Instances.DataAnalysis {
+  public abstract class VectorDataTestFour : ArtificialRegressionDataDescriptor {
+
+    protected const int Rows = 10000;
+
+    public override string Description { get { return ""; } }
+
+    protected override string TargetVariable { get { return "Y"; } }
+    protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4", "X5", "V1", "V2", "V3", "V4", "V5", "Y" }; } }
+    protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4", "X5", "V1", "V2", "V3", "V4", "V5" }; } }
+    protected override int TrainingPartitionStart { get { return 0; } }
+    protected override int TrainingPartitionEnd { get { return Rows * 3 / 4; } }
+    protected override int TestPartitionStart { get { return TrainingPartitionEnd; } }
+    protected override int TestPartitionEnd { get { return Rows; } }
+
+    public int Seed { get; private set; }
+
+    protected VectorDataTestFour()
+      : this((int)DateTime.Now.Ticks) { }
+    protected VectorDataTestFour(int seed)
+      : base() {
+      Seed = seed;
+    }
+
+
+    protected override List<List<double>> GenerateValues() { return null; }
+    protected override List<IList> GenerateValuesExtended() {
+      var rand = new MersenneTwister((uint)Seed);
+
+      double x1, x2, x3, x4, x5;
+      DoubleVector v1, v2, v3, v4, v5;
+      double y;
+
+      var x1Column = new List<double>(Rows);
+      var x2Column = new List<double>(Rows);
+      var x3Column = new List<double>(Rows);
+      var x4Column = new List<double>(Rows);
+      var x5Column = new List<double>(Rows);
+      var v1Column = new List<DoubleVector>(Rows);
+      var v2Column = new List<DoubleVector>(Rows);
+      var v3Column = new List<DoubleVector>(Rows);
+      var v4Column = new List<DoubleVector>(Rows);
+      var v5Column = new List<DoubleVector>(Rows);
+      var yColumn = new List<double>(Rows);
+
+      var vectorLengths = GetVectorLengths(rand);
+      for (int i = 0; i < Rows; i++) {
+        x1 = rand.NextDouble(-2, 2);
+        x2 = rand.NextDouble(2, 6);
+        x3 = rand.NextDouble(0, 1);
+        x4 = rand.NextDouble(30, 100);
+        x5 = rand.NextDouble(150, 200);
+        v1 = rand.NextDoubleVector(2, 6, vectorLengths[0][i]);
+        v2 = rand.NextDoubleVector(3, 5, vectorLengths[1][i]);
+        v3 = rand.NextDoubleVector(-10, 50, vectorLengths[2][i]);
+        v4 = rand.NextDoubleVector(0, 200, vectorLengths[3][i]);
+        v5 = rand.NextDoubleVector(200, 220, vectorLengths[4][i]);
+
+        var t1 = ((v1 + Math.Log(10 * x5)) * (v4 - 50 * v2.PointwiseSin()).Mean() * x1).Mean() / 10;  // mean 50
+        var t2 = (v5.StandardDeviation() + v2.PointwisePower(2.0)).Mean();  // mean 18 + 6 = 24
+        var t3 = Math.Exp(3 * x3) + v2.PointwiseMultiply(v3).Mean() / 10;     // mean 7 + 8 = 15
+        y = t1 - 0.1 * t2 * t3;
+
+        x1Column.Add(x1);
+        x2Column.Add(x2);
+        x3Column.Add(x3);
+        x4Column.Add(x4);
+        x5Column.Add(x5);
+        v1Column.Add(v1);
+        v2Column.Add(v2);
+        v3Column.Add(v3);
+        v4Column.Add(v4);
+        v5Column.Add(v5);
+        yColumn.Add(y);
+      }
+
+      return new List<IList> {
+        x1Column, x2Column, x3Column, x4Column, x5Column,
+        v1Column, v2Column, v3Column, v4Column, v5Column,
+        yColumn
+      };
+    }
+
+    protected abstract List<int>[] GetVectorLengths(IRandom rand);
+  }
+
+  public class VectorDataTestFourA : VectorDataTestFour {
+    public override string Name {
+      get { return "Vector Data Test - IV [fully-constrained]: Y = X1 * sum(V1) + X2 * mean(V2)"; }
+    }
+
+    public VectorDataTestFourA() : base() { }
+    public VectorDataTestFourA(int seed) : base(seed) { }
+
+    protected override List<int>[] GetVectorLengths(IRandom rand) {
+      // always same length
+      const int length = 40;
+      return new List<int>[5] {
+        Enumerable.Repeat(length, Rows).ToList(),
+        Enumerable.Repeat(length, Rows).ToList(),
+        Enumerable.Repeat(length, Rows).ToList(),
+        Enumerable.Repeat(length, Rows).ToList(),
+        Enumerable.Repeat(length, Rows).ToList()
+      };
+    }
+  }
+
+  public class VectorDataTestFourB : VectorDataTestFour {
+    public override string Name { get { return "Vector Data Test - IV [row-constrained]: Y = X1 * sum(V1) + X2 * mean(V2)"; } }
+
+    public VectorDataTestFourB() : base() { }
+    public VectorDataTestFourB(int seed) : base(seed) { }
+
+    protected override List<int>[] GetVectorLengths(IRandom rand) {
+      // length between length 40 and 80, same row always the same length
+      var lengths = Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList();
+      return new List<int>[5] {
+        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(),
+        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(),
+        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(),
+        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList(),
+        Enumerable.Range(0, Rows).Select(i => lengths[i]).ToList()
+      };
+    }
+  }
+
+  public class VectorDataTestFourC : VectorDataTestFour {
+    public override string Name { get { return "Vector Data Test - IV [column-constrained]: Y = X1 * sum(V1) + X2 * mean(V2)"; } }
+
+    public VectorDataTestFourC() : base() { }
+    public VectorDataTestFourC(int seed) : base(seed) { }
+
+    protected override List<int>[] GetVectorLengths(IRandom rand) {
+      // length between length 40 and 80; each feature is same length
+      int v1Length = rand.Next(40, 80);
+      int v2Length;
+      do { v2Length = rand.Next(40, 80); } while (v1Length != v2Length);
+      int v3Length = rand.Next(40, 80);
+      int v4Length;
+      do { v4Length = rand.Next(40, 80); } while (v3Length != v4Length);
+      int v5Length = rand.Next(40, 80);
+      return new List<int>[5] {
+        Enumerable.Repeat(v1Length, Rows).ToList(),
+        Enumerable.Repeat(v2Length, Rows).ToList(),
+        Enumerable.Repeat(v3Length, Rows).ToList(),
+        Enumerable.Repeat(v4Length, Rows).ToList(),
+        Enumerable.Repeat(v5Length, Rows).ToList()
+      };
+    }
+  }
+
+  public class VectorDataTestFourD : VectorDataTestFour {
+    public override string Name { get { return "Vector Data Test - IV [unconstrained]: Y = X1 * sum(V1) + X2 * mean(V2)"; } }
+
+    public VectorDataTestFourD() : base() { }
+    public VectorDataTestFourD(int seed) : base(seed) { }
+
+    protected override List<int>[] GetVectorLengths(IRandom rand) {
+      // always random between 40 and 80
+      return new List<int>[5] {
+        Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList(),
+        Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList(),
+        Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList(),
+        Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList(),
+        Enumerable.Range(0, Rows).Select(i => rand.Next(40, 80)).ToList()
+      };
+    }
+  }
+}
