Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs	(revision 18097)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs	(revision 18098)
@@ -50,7 +50,7 @@
 
     [Storable]
-    private IValueParameter<DoubleArray> dataVectorParameter;
-    public IValueParameter<DoubleArray> DataVectorParameter {
-      get { return dataVectorParameter; }
+    private IValueParameter<DoubleMatrix> dataParameter;
+    public IValueParameter<DoubleMatrix> DataParameter {
+      get { return dataParameter; }
     }
     [Storable]
@@ -68,5 +68,5 @@
       Encoding = new IntegerVectorEncoding("bounds");
 
-      Parameters.Add(dataVectorParameter = new ValueParameter<DoubleArray>("Data Vector", ""));
+      Parameters.Add(dataParameter = new ValueParameter<DoubleMatrix>("Data", ""));
       Parameters.Add(knownBoundsParameter = new ValueParameter<IntRange>("Known Bounds", ""));
       Parameters.Add(aggregationParameter = new ValueParameter<EnumValue<Aggregation>>("Aggregation Function", ""));
@@ -76,5 +76,5 @@
       #region Default Instance
       Load(new SOPData() {
-        Values = Enumerable.Range(1, 50).Select(x => (double)x * x).ToArray(),
+        Data = ToNdimArray(Enumerable.Range(1, 50).Select(x => (double)x * x).ToArray()),
         Lower = 20, Upper = 30,
         Aggregation = "mean"
@@ -84,5 +84,5 @@
     private SegmentOptimizationProblem(SegmentOptimizationProblem original, Cloner cloner)
       : base(original, cloner) {
-      dataVectorParameter = cloner.Clone(original.dataVectorParameter);
+      dataParameter = cloner.Clone(original.dataParameter);
       knownBoundsParameter = cloner.Clone(original.knownBoundsParameter);
       aggregationParameter = cloner.Clone(original.aggregationParameter);
@@ -98,14 +98,22 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
+      if (Parameters.ContainsKey("Data Vector") && Parameters["Data Vector"] is ValueParameter<DoubleArray> arrayParameter) {
+        Parameters.Remove(arrayParameter);
+        var array = arrayParameter.Value;
+        var matrix = new DoubleMatrix(1, array.Length);
+        for (int i = 0; i < array.Length; i++) matrix[0, i] = array[i];
+        Parameters.Add(dataParameter = new ValueParameter<DoubleMatrix>("Data", "", matrix));
+      }
+
       RegisterEventHandlers();
     }
     
     private void RegisterEventHandlers() {
-      dataVectorParameter.ValueChanged += DataVectorChanged;
+      dataParameter.ValueChanged += DataChanged;
       knownBoundsParameter.ValueChanged += KnownBoundsChanged;
       aggregationParameter.Value.ValueChanged += AggregationFunctionChanged;
     }
-    private void DataVectorChanged(object sender, EventArgs eventArgs) {
-      Encoding.Bounds = new IntMatrix(new[,] { { 0, DataVectorParameter.Value.Length } });
+    private void DataChanged(object sender, EventArgs eventArgs) {
+      Encoding.Bounds = new IntMatrix(new[,] { { 0, DataParameter.Value.Columns } });
     }
     private void KnownBoundsChanged(object sender, EventArgs e) {
@@ -115,5 +123,5 @@
 
     public override double Evaluate(Individual individual, IRandom random) {
-      var data = DataVectorParameter.Value;
+      var data = DataParameter.Value;
       var knownBounds = KnownBoundsParameter.Value;
       var aggregation = aggregationParameter.Value.Value;
@@ -134,5 +142,5 @@
       var bounds = new IntRange(best.Min(), best.Max());
 
-      var data = DataVectorParameter.Value;
+      var data = DataParameter.Value;
       var knownBounds = KnownBoundsParameter.Value;
       var aggregation = aggregationParameter.Value.Value;
@@ -153,25 +161,42 @@
 
     private static double BoundedAggregation(DoubleArray data, IntRange bounds, Aggregation aggregation) {
+      var matrix = new DoubleMatrix(1, data.Length);
+      for (int i = 0; i < data.Length; i++) matrix[0, i] = data[i];
+      return BoundedAggregation(matrix, bounds, aggregation);
+    }
+
+    private static double BoundedAggregation(DoubleMatrix data, IntRange bounds, Aggregation aggregation) {
       if (bounds.Size == 0) {
         return 0;
       }
 
-      var vector = DoubleVector.Build.DenseOfEnumerable(data);
-      var segment = vector.SubVector(bounds.Start, bounds.Size);
-
-      switch (aggregation) {
-        case Aggregation.Sum:
-          return segment.Sum();
-        case Aggregation.Mean:
-         return segment.Average();
+      var resultValues = new double[data.Rows];
+      var array = new double[data.Columns];
+      for (int row = 0; row < data.Rows; row++) {
+        for (int i = 0; i < array.Length; i++) array[i] = data[row, i];
+
+        var vector = DoubleVector.Build.DenseOfArray(array);
+        var segment = vector.SubVector(bounds.Start, bounds.Size);
+
+        switch (aggregation) {
+          case Aggregation.Sum:
+            resultValues[row] = segment.Sum();
+            break;
+          case Aggregation.Mean:
+            resultValues[row] = segment.Average();
+            break;
           case Aggregation.StandardDeviation:
-          return segment.StandardDeviationPop();
-        default:
-          throw new NotImplementedException();
-      }
+            resultValues[row] = segment.StandardDeviationPop();
+            break;
+          default:
+            throw new NotImplementedException();
+        }
+      }
+
+      return resultValues.Average();
     }
 
     public void Load(SOPData data) {
-      DataVectorParameter.Value = new DoubleArray(data.Values);
+      DataParameter.Value = new DoubleMatrix(data.Data);
       KnownBoundsParameter.Value = new IntRange(data.Lower, data.Upper);
       switch (data.Aggregation.ToLower()) {
@@ -193,5 +218,5 @@
                                             
       Encoding.Length = 2;
-      Encoding.Bounds = new IntMatrix(new[,] { { 0, DataVectorParameter.Value.Length } });
+      Encoding.Bounds = new IntMatrix(new[,] { { 0, DataParameter.Value.Columns } });
 
       BestKnownQuality = 0;
@@ -200,4 +225,11 @@
       Description = data.Description;
     }
+
+    public static T[,] ToNdimArray<T>(T[] array) {
+      var matrix = new T[1, array.Length];
+      for (int i = 0; i < array.Length; i++)
+        matrix[0, i] = array[i];
+      return matrix;
+    }
   }
 }
Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SOPDataDescriptor.cs
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SOPDataDescriptor.cs	(revision 18097)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SOPDataDescriptor.cs	(revision 18098)
@@ -40,14 +40,12 @@
 
     internal string VariableName { get; set; }
-    internal int Row { get; set; }
     internal int  Lower { get; set; }
     internal int Upper { get; set; }
     internal string Aggregation { get; set; }
-    internal SOPDataDescriptor(string name, string description, string variableName, int row, int lower, int upper, string aggregation) {
+    internal SOPDataDescriptor(string name, string description, string variableName, int lower, int upper, string aggregation) {
       Name = name;
       Description = description;
 
       VariableName = variableName;
-      Row = row;
       Lower = lower;
       Upper = upper;
Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SegmentOptimizationInstanceProvider.cs
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SegmentOptimizationInstanceProvider.cs	(revision 18097)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/SegmentOptimization/SegmentOptimizationInstanceProvider.cs	(revision 18098)
@@ -47,17 +47,17 @@
       return new[] {
         new SOPDataDescriptor("[1:100]: i sum", "", new SOPData {
-          Values = Enumerable.Range(1, 100).Select(i => (double)i).ToArray(),
+          Data = ToNdimArray(Enumerable.Range(1, 100).Select(i => (double)i).ToArray()),
           Lower = 30, Upper = 50, Aggregation = "sum"
         }),
         new SOPDataDescriptor("[1:1000]: i sum", "", new SOPData {
-          Values = Enumerable.Range(1, 1000).Select(i => (double)i).ToArray(),
+          Data = ToNdimArray(Enumerable.Range(1, 1000).Select(i => (double)i).ToArray()),
           Lower = 350, Upper = 500, Aggregation = "sum"
         }),
         new SOPDataDescriptor("[1:100]: i^2 sum", "", new SOPData {
-          Values = Enumerable.Range(1, 100).Select(i => (double)i * i).ToArray(),
+          Data = ToNdimArray(Enumerable.Range(1, 100).Select(i => (double)i * i).ToArray()),
           Lower = 30, Upper = 50, Aggregation = "sum"
         }),
         new SOPDataDescriptor("[1:1000]: i^2 sum", "", new SOPData {
-          Values = Enumerable.Range(1, 1000).Select(i => (double)i * i).ToArray(),
+          Data = ToNdimArray(Enumerable.Range(1, 1000).Select(i => (double)i * i).ToArray()),
           Lower = 350, Upper = 500, Aggregation = "sum"
         }),
@@ -68,4 +68,11 @@
       var descriptor = (SOPDataDescriptor)id;
       return descriptor.Data;
+    }
+
+    public static T[,] ToNdimArray<T>(T[] array) {
+      var matrix = new T[1, array.Length];
+      for (int i = 0; i < array.Length; i++)
+        matrix[0, i] = array[i];
+      return matrix;
     }
   }
@@ -88,10 +95,10 @@
     public override IEnumerable<IDataDescriptor> GetDataDescriptors() {
       return new[] {
-        new SOPDataDescriptor("v1", "", "v1", 0, 20, 60, "mean"),
-        new SOPDataDescriptor("v2", "", "v2", 0, 20, 60, "mean"),
-        new SOPDataDescriptor("v3", "", "v3", 0, 20, 60, "mean"),
-        new SOPDataDescriptor("v4", "", "v4", 0, 20, 40, "mean"),
-        new SOPDataDescriptor("v5", "", "v5", 0, 60, 80, "mean"),
-        new SOPDataDescriptor("v6", "", "v6", 0, 40, 60, "mean"),
+        new SOPDataDescriptor("v1", "", "v1", 20, 60, "mean"),
+        new SOPDataDescriptor("v2", "", "v2", 20, 60, "mean"),
+        new SOPDataDescriptor("v3", "", "v3", 20, 60, "mean"),
+        new SOPDataDescriptor("v4", "", "v4", 20, 40, "mean"),
+        new SOPDataDescriptor("v5", "", "v5", 60, 80, "mean"),
+        new SOPDataDescriptor("v6", "", "v6", 40, 60, "mean"),
       };
     }
@@ -124,8 +131,18 @@
 
     private SOPData LoadInstance(IDataset dataset, SOPDataDescriptor descriptor) {
-      var data = dataset.GetDoubleVectorValue(descriptor.VariableName, descriptor.Row);
+      var vectors = dataset.GetDoubleVectorValues(descriptor.VariableName).ToList();
+      int length = vectors.FirstOrDefault()?.Count ?? 0;
+      if (length == 0 || vectors.Any(v => v.Count != length))
+        throw new ArgumentException("no or empty vectors or vectors with different lengths");
+      var data = new double[vectors.Count, vectors.First().Count];
+      for (int i = 0; i < vectors.Count; i++) {
+        var v = vectors[i];
+        for (int j = 0; j < v.Count; j++) {
+          data[i, j] = v[j];
+        }
+      }
 
       return new SOPData {
-        Values = data.ToArray(),
+        Data = data,
         Lower = descriptor.Lower,
         Upper = descriptor.Upper,
Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances/3.3/Types/SOPData.cs
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances/3.3/Types/SOPData.cs	(revision 18097)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances/3.3/Types/SOPData.cs	(revision 18098)
@@ -7,5 +7,5 @@
     public string Description { get; set; }
 
-    public double[] Values { get; set; } 
+    public double[,] Data { get; set; } 
     public int Upper { get; set; }
     public int Lower { get; set; }
