Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SamplingSegmentOptimizationManipulator.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SamplingSegmentOptimizationManipulator.cs	(revision 18202)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SamplingSegmentOptimizationManipulator.cs	(revision 18204)
@@ -37,10 +37,10 @@
 
     [StorableType("65B2E870-7EED-4DD0-918E-94A346671784")]
-    protected enum DimensionType {
+    public enum DimensionType {
       All,
       Single
     }
     [StorableType("C73064F2-4E2F-473F-8DBA-DD47881726D4")]
-    protected enum SearchRangeType {
+    public enum SearchRangeType {
       None, // Fixed on current value
       Full,
@@ -49,5 +49,5 @@
     }
     [StorableType("A9EBE01E-53DE-4EB7-94B3-26C624034A08")]
-    protected enum SamplingType {
+    public enum SamplingType {
       Exhaustive,
       RandomSampling,
@@ -57,5 +57,5 @@
     [StorableType("4EBF0DFE-90A1-4DFE-8CC7-D358EF8AF96B")]
     [Flags]
-    protected enum SamplingPointsType {
+    public enum SamplingPointsType {
       None = 0,
       BeforeCombinations = 1,
@@ -63,10 +63,19 @@
     }
 
-    protected ValueParameter<EnumValue<DimensionType>> Dimension => (ValueParameter<EnumValue<DimensionType>>)Parameters["Dimension"];
-    protected ValueParameter<EnumValue<SearchRangeType>> SearchRange => (ValueParameter<EnumValue<SearchRangeType>>)Parameters["SearchRange"];
-    protected ValueParameter<EnumValue<SamplingType>> Sampling => (ValueParameter<EnumValue<SamplingType>>)Parameters["Sampling"];
-    protected ValueParameter<IntValue> SampleCount => (ValueParameter<IntValue>)Parameters["SampleCount"];
-    protected ValueParameter<EnumValue<SamplingPointsType>> SamplingPoints => (ValueParameter<EnumValue<SamplingPointsType>>)Parameters["SamplingPoints"];
-    
+    #region Properties
+    public DimensionType Dimension { get { return DimensionParameter.Value.Value; } set { DimensionParameter.Value.Value = value; } }
+    public SearchRangeType SearchRange { get { return SearchRangeParameter.Value.Value; } set { SearchRangeParameter.Value.Value = value; } }
+    public SamplingType Sampling { get { return SamplingParameter.Value.Value; } set { SamplingParameter.Value.Value = value; } }
+    public int SampleCount { get { return SampleCountParameter.Value.Value; } set { SampleCountParameter.Value.Value = value; } }
+    public SamplingPointsType SamplingPoints { get { return SamplingPointsParameter.Value.Value; } set { SamplingPointsParameter.Value.Value = value; } }
+    #endregion
+
+    #region Parameter Properties
+    public ValueParameter<EnumValue<DimensionType>> DimensionParameter => (ValueParameter<EnumValue<DimensionType>>)Parameters["Dimension"];
+    public ValueParameter<EnumValue<SearchRangeType>> SearchRangeParameter => (ValueParameter<EnumValue<SearchRangeType>>)Parameters["SearchRange"];
+    public ValueParameter<EnumValue<SamplingType>> SamplingParameter => (ValueParameter<EnumValue<SamplingType>>)Parameters["Sampling"];
+    public ValueParameter<IntValue> SampleCountParameter => (ValueParameter<IntValue>)Parameters["SampleCount"];
+    public ValueParameter<EnumValue<SamplingPointsType>> SamplingPointsParameter => (ValueParameter<EnumValue<SamplingPointsType>>)Parameters["SamplingPoints"];
+    #endregion
 
     public SamplingSegmentOptimizationManipulator() {
@@ -86,13 +95,18 @@
    
     protected override void ManipulateBounded(IRandom random, IntegerVector integerVector, IntMatrix bounds) {
-      var indices = CreateIndices(random, integerVector, bounds, Dimension.Value.Value, SearchRange.Value.Value);
-
-      if (SamplingPoints.Value.Value.HasFlag(SamplingPointsType.BeforeCombinations))
-        indices = indices.Select(i => SampleIndices(i, Sampling.Value.Value, random, SampleCount.Value.Value).ToList()).ToArray();
+      var indices = CreateIndices(random, new IntegerVector(new [] { integerVector.Min(), integerVector.Max() }), bounds, Dimension, SearchRange);
+      
+      if (SamplingPoints.HasFlag(SamplingPointsType.BeforeCombinations))
+        indices = indices.Select(i => SampleIndices(i, Sampling, random, SampleCount).ToList()).ToArray();
 
       var solutions = CreateCombinations(indices[0], indices[1]);
+      if (!solutions.Any()) { 
+        if (SamplingPoints.HasFlag(SamplingPointsType.BeforeCombinations))
+          return; // no valid combinations -> no mutation
+        throw new InvalidOperationException("no indices!");
+      }
 
-      if (SamplingPoints.Value.Value.HasFlag(SamplingPointsType.AfterCombinations))
-        solutions = SampleIndices(solutions, Sampling.Value.Value, random, SampleCount.Value.Value);
+      if (SamplingPoints.HasFlag(SamplingPointsType.AfterCombinations))
+        solutions = SampleIndices(solutions, Sampling, random, SampleCount);
 
       var best = FindBest(solutions);
@@ -105,4 +119,5 @@
       var indices = new IEnumerable<int>[integerVector.Length];
       int targetIndex = random.Next(indices.Length); // first or second index
+      integerVector = new IntegerVector(new[] { integerVector.Min(), integerVector.Max() });
       for (int i = 0; i < indices.Length; i++) {
         var searchRange = dimension == DimensionType.All || targetIndex == i ? indexRange : SearchRangeType.None;
@@ -122,9 +137,11 @@
         case SearchRangeType.None:
           return new[] { currentIndex };
-        case SearchRangeType.RandomDirection:
-          return random.Next(2) == 0 ? Enumerable.Range(0, currentIndex) : Enumerable.Range(currentIndex, length - currentIndex);
-        case SearchRangeType.RandomRange:
-          int start = random.Next(0, length - 1), end = random.Next(start + 1, length);
-          return Enumerable.Range(start, end - start);
+        case SearchRangeType.RandomDirection: // including currentIndex
+          return random.Next(2) == 0 
+            ? Enumerable.Range(0, currentIndex + 1) // left
+            : Enumerable.Range(currentIndex, length - currentIndex); // right
+        case SearchRangeType.RandomRange: // random range around current index, not completely random range
+          int start = random.Next(0, currentIndex + 1), end = random.Next(currentIndex, length);
+          return Enumerable.Range(start, end - start + 1);
         default:
           throw new ArgumentOutOfRangeException(nameof(searchRange), searchRange, null);
@@ -148,6 +165,6 @@
         case SamplingType.LinearSelection:
           var indicesList = indices.ToList();
-          var selected = MathNet.Numerics.Generate.LinearSpaced(count, 0, indicesList.Count)
-            .Select(i => (int)Math.Round(i))
+          var selected = MathNet.Numerics.Generate.LinearSpaced(count, 0, indicesList.Count - 1) // LinearSpaced stop is inclusive
+            .Select(i => (int)Math.Floor(i))
             .Distinct();
           return selected.Select(i => indicesList[i]);
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 18202)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs	(revision 18204)
@@ -183,13 +183,7 @@
 
       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);
-        var segment = DoubleVector.Build.DenseOfEnumerable(array.Skip(bounds.Start).Take(bounds.Size));
-
+        var vector = data.GetRow(row);
+        var segment = vector.Skip(bounds.Start).Take(bounds.Size);
         switch (aggregation) {
           case Aggregation.Sum:
