Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 18185)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 18186)
@@ -176,4 +176,5 @@
     <Compile Include="Mutators\MultiSymbolicDataAnalysisExpressionManipulator.cs" />
     <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionManipulator.cs" />
+    <Compile Include="Mutators\SegmentOptimization\SamplingSegmentOptimizationManipulator.cs" />
     <Compile Include="Mutators\SymbolicDataAnalysisExpressionManipulator.cs" />
     <Compile Include="Crossovers\SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs" />
@@ -205,4 +206,5 @@
     <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs" />
     <Compile Include="Mutators\SubVectorImprovementManipulator.cs" />
+    <Compile Include="Mutators\SegmentOptimization\SegmentOptimizationMutator.cs" />
     <Compile Include="SegmentOptimization\SegmentOptimizationProblem.cs" />
     <Compile Include="Selectors\DiversitySelector.cs" />
@@ -463,5 +465,9 @@
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <PackageReference Include="OneOf">
+      <Version>3.0.205</Version>
+    </PackageReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
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 18186)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SamplingSegmentOptimizationManipulator.cs	(revision 18186)
@@ -0,0 +1,141 @@
+﻿#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.Encodings.IntegerVectorEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SamplingSegmentOptimizationManipulator", "")]
+  [StorableType("4D4D8BC9-2C2B-418E-B9AE-5FB5511C70CE")]
+  public class SamplingSegmentOptimizationManipulator : SegmentOptimizationMutator {
+
+    protected enum DimensionType {
+      All,
+      Single
+    }
+    protected enum SearchRangeType {
+      Full,
+      None,
+      Left,
+      Right
+    }
+    protected enum SamplingType {
+      Exhaustive,
+      RandomSampling,
+      LinearSelection // "generalized nth"
+    }
+
+    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"];
+
+    public SamplingSegmentOptimizationManipulator() {
+      Parameters.Add(new ValueParameter<EnumValue<DimensionType>>("Dimension", new EnumValue<DimensionType>(DimensionType.All)));
+      Parameters.Add(new ValueParameter<EnumValue<SearchRangeType>>("SearchRange", new EnumValue<SearchRangeType>(SearchRangeType.Full)));
+      Parameters.Add(new ValueParameter<EnumValue<SamplingType>>("Sampling", new EnumValue<SamplingType>(SamplingType.Exhaustive)));
+      Parameters.Add(new ValueParameter<IntValue>("SampleCount")); // only used when sampling != Exhaustive
+    }
+    public SamplingSegmentOptimizationManipulator(SamplingSegmentOptimizationManipulator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SamplingSegmentOptimizationManipulator(this, cloner);
+    }
+    [StorableConstructor]
+    public SamplingSegmentOptimizationManipulator(StorableConstructorFlag _) : base(_) { }
+   
+    protected override void ManipulateBounded(IRandom random, IntegerVector integerVector, IntMatrix bounds) {
+      var indices = CreateIndices(random, integerVector, bounds, Dimension.Value.Value, SearchRange.Value.Value);
+      var solutions = CreateCombinations(indices);
+      solutions = SampleIndices(solutions, Sampling.Value.Value, random, SampleCount.Value.Value);
+      var best = FindBest(solutions);
+      CopyTo(best.Item1, integerVector);
+    }
+    
+    private static IEnumerable<int>[] CreateIndices(IRandom random, IntegerVector integerVector, IntMatrix bounds, DimensionType dimension, SearchRangeType indexRange) {
+      var indices = new IEnumerable<int>[integerVector.Length];
+      int targetIndex = random.Next(indices.Length); // first or second index
+      for (int i = 0; i < indices.Length; i++) {
+        var searchRange = dimension == DimensionType.All || targetIndex == i ? indexRange : SearchRangeType.None;
+        indices[i] = CreateSingleIndices(bounds[i % bounds.Rows, 1], integerVector[i], searchRange);
+      }
+      return indices;
+    }
+
+    protected static IEnumerable<int> CreateSingleIndices(int length, int currentIndex, SearchRangeType searchRange) {
+      switch (searchRange) {
+        case SearchRangeType.Full:
+          return Enumerable.Range(0, length);
+        case SearchRangeType.None:
+          return new[] { currentIndex };
+        case SearchRangeType.Left:
+          return Enumerable.Range(0, currentIndex);
+        case SearchRangeType.Right:
+          return Enumerable.Range(currentIndex, length - currentIndex);
+        default:
+          throw new ArgumentOutOfRangeException(nameof(searchRange), searchRange, null);
+      }
+    }
+
+    protected static IEnumerable<IntegerVector> CreateCombinations(IEnumerable<int> startIndices, IEnumerable<int> endIndices) {
+      return CreateCombinations(new[] { startIndices, endIndices });
+    }
+    protected static IEnumerable<IntegerVector> CreateCombinations(IEnumerable<IEnumerable<int>> indices) {
+      return indices.CartesianProduct().Select(seq => new IntegerVector(seq.ToArray()));
+    }
+
+    protected static IEnumerable<T> SampleIndices<T>(IEnumerable<T> indices, SamplingType sampling, IRandom random, int count) {
+      switch (sampling) {
+        case SamplingType.Exhaustive:
+          return indices;
+        case SamplingType.RandomSampling:
+          return indices.SampleRandom(random, count);
+        case SamplingType.LinearSelection:
+          var indicesList = indices.ToList();
+          var selected = MathNet.Numerics.Generate.LinearSpaced(count, 0, indicesList.Count)
+            .Select(i => (int)Math.Round(i))
+            .Distinct();
+          return selected.Select(i => indicesList[i]);
+        default:
+          throw new ArgumentOutOfRangeException(nameof(sampling), sampling, null);
+      }
+    }
+
+    protected Tuple<IntegerVector, double> FindBest(IEnumerable<IntegerVector> solutions) {
+      var evaluatedSolutions = solutions.Select(s => Tuple.Create(s, Evaluate(s)));
+      var best = evaluatedSolutions.OrderBy(t => t.Item2).First();
+      return best;
+    }
+
+    private static void CopyTo(IntegerVector source, IntegerVector target) {
+      for (int i = 0; i < target.Length; i++)
+        target[i] = source[i];
+    }
+  }
+}
Index: /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SegmentOptimizationMutator.cs
===================================================================
--- /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SegmentOptimizationMutator.cs	(revision 18186)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Mutators/SegmentOptimization/SegmentOptimizationMutator.cs	(revision 18186)
@@ -0,0 +1,56 @@
+﻿#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.Data;
+using HeuristicLab.Encodings.IntegerVectorEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.SegmentOptimization;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SegmentOptimizationMutator", "")]
+  [StorableType("254B8A32-CC55-4979-A792-E54001CF4C8B")]
+  public abstract class SegmentOptimizationMutator : BoundedIntegerVectorManipulator {
+    protected ILookupParameter<DoubleMatrix> DataParameter => (ILookupParameter<DoubleMatrix>)Parameters["Data"];
+    protected ILookupParameter<IntRange> KnownBoundsParameter => (ILookupParameter<IntRange>)Parameters["Known Bounds"];
+    protected ILookupParameter<EnumValue<SegmentOptimizationProblem.Aggregation>> AggregationParameter => (ILookupParameter<EnumValue<SegmentOptimizationProblem.Aggregation>>)Parameters["Aggregation Function"];
+    
+    protected SegmentOptimizationMutator() {
+      Parameters.Add(new LookupParameter<DoubleMatrix>("Data"));
+      Parameters.Add(new LookupParameter<IntRange>("Known Bounds"));
+      Parameters.Add(new LookupParameter<EnumValue<SegmentOptimizationProblem.Aggregation>>("Aggregation Function"));
+    }
+
+    protected SegmentOptimizationMutator(SegmentOptimizationMutator original, Cloner cloner)
+      : base(original, cloner) { }
+    [StorableConstructor]
+    protected SegmentOptimizationMutator(StorableConstructorFlag _) : base(_) { }
+
+    protected double Evaluate(IntegerVector solution) {
+      var data = DataParameter.ActualValue;
+      var knownBounds = KnownBoundsParameter.ActualValue;
+      var aggregation = AggregationParameter.ActualValue.Value;
+      return SegmentOptimizationProblem.Evaluate(solution, data, knownBounds, aggregation);
+    }
+  }
+}
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 18185)
+++ /branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs	(revision 18186)
@@ -29,4 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.Problems.Instances;
 using HeuristicLab.Problems.Instances.Types;
@@ -81,4 +82,8 @@
       });
       #endregion
+
+      var optMutators = ApplicationManager.Manager.GetInstances<SegmentOptimizationMutator>();
+      Encoding.ConfigureOperators(optMutators);
+      Operators.AddRange(optMutators);
     }
     private SegmentOptimizationProblem(SegmentOptimizationProblem original, Cloner cloner)
@@ -126,11 +131,12 @@
       var knownBounds = KnownBoundsParameter.Value;
       var aggregation = aggregationParameter.Value.Value;
-
       var solution = individual.IntegerVector(Encoding.Name);
+      return Evaluate(solution, data, knownBounds, aggregation);
+    }
+
+    public static double Evaluate(IntegerVector solution, DoubleMatrix data, IntRange knownBounds, Aggregation aggregation) {
       var bounds = new IntRange(solution.Min(), solution.Max());
-
       double target = BoundedAggregation(data, knownBounds, aggregation);
       double prediction = BoundedAggregation(data, bounds, aggregation);
-
       return Math.Pow(target - prediction, 2);
     }
