Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 15427)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 15447)
@@ -168,5 +168,5 @@
       TreeToAutoDiffTermConverter.ParametricFunction func;
       TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad;
-      if (!TreeToAutoDiffTermConverter.TryConvertToAutoDiff(tree, updateVariableWeights, out parameters, out initialConstants, out func, out func_grad))
+      if (!TreeToAutoDiffTermConverter.TryConvertToAutoDiff(tree, updateVariableWeights, applyLinearScaling, out parameters, out initialConstants, out func, out func_grad))
         throw new NotSupportedException("Could not optimize constants of symbolic expression tree due to not supported symbols used in the tree.");
       if (parameters.Count == 0) return 0.0; // gkronber: constant expressions always have a R² of 0.0 
@@ -175,11 +175,16 @@
 
       //extract inital constants
-      double[] c = new double[initialConstants.Length + 2];
-      {
-        c[0] = 0.0;
-        c[1] = 1.0;
-        Array.Copy(initialConstants, 0, c, 2, initialConstants.Length);
-      }
-      double[] originalConstants = (double[])c.Clone();
+      double[] c;
+      if (applyLinearScaling) {
+        c = new double[initialConstants.Length + 2];
+        {
+          c[0] = 0.0;
+          c[1] = 1.0;
+          Array.Copy(initialConstants, 0, c, 2, initialConstants.Length);
+        }
+      } else {
+        c = (double[])initialConstants.Clone();
+      }
+
       double originalQuality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
 
@@ -219,19 +224,21 @@
         alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, xrep, null);
         alglib.lsfitresults(state, out retVal, out c, out rep);
-      }
-      catch (ArithmeticException) {
+      } catch (ArithmeticException) {
         return originalQuality;
-      }
-      catch (alglib.alglibexception) {
+      } catch (alglib.alglibexception) {
         return originalQuality;
       }
 
       //retVal == -7  => constant optimization failed due to wrong gradient
-      if (retVal != -7) UpdateConstants(tree, c.Skip(2).ToArray(), updateVariableWeights);
+      if (retVal != -7) {
+        if (applyLinearScaling) UpdateConstants(tree, c.Skip(2).ToArray(), updateVariableWeights);
+        else UpdateConstants(tree, c.ToArray(), updateVariableWeights);
+      }
       var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
 
-      if (!updateConstantsInTree) UpdateConstants(tree, originalConstants.Skip(2).ToArray(), updateVariableWeights);
+      if (!updateConstantsInTree) UpdateConstants(tree, initialConstants.ToArray(), updateVariableWeights);
+
       if (originalQuality - quality > 0.001 || double.IsNaN(quality)) {
-        UpdateConstants(tree, originalConstants.Skip(2).ToArray(), updateVariableWeights);
+        UpdateConstants(tree, initialConstants.ToArray(), updateVariableWeights);
         return originalQuality;
       }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs	(revision 15427)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs	(revision 15447)
@@ -87,5 +87,5 @@
     #endregion
 
-    public static bool TryConvertToAutoDiff(ISymbolicExpressionTree tree, bool makeVariableWeightsVariable,
+    public static bool TryConvertToAutoDiff(ISymbolicExpressionTree tree, bool makeVariableWeightsVariable, bool addLinearScalingTerms,
       out List<DataForVariable> parameters, out double[] initialConstants,
       out ParametricFunction func,
@@ -93,5 +93,5 @@
 
       // use a transformator object which holds the state (variable list, parameter list, ...) for recursive transformation of the tree
-      var transformator = new TreeToAutoDiffTermConverter(makeVariableWeightsVariable);
+      var transformator = new TreeToAutoDiffTermConverter(makeVariableWeightsVariable, addLinearScalingTerms);
       AutoDiff.Term term;
       try {
@@ -120,7 +120,9 @@
     private readonly List<AutoDiff.Variable> variables;
     private readonly bool makeVariableWeightsVariable;
-
-    private TreeToAutoDiffTermConverter(bool makeVariableWeightsVariable) {
+    private readonly bool addLinearScalingTerms;
+
+    private TreeToAutoDiffTermConverter(bool makeVariableWeightsVariable, bool addLinearScalingTerms) {
       this.makeVariableWeightsVariable = makeVariableWeightsVariable;
+      this.addLinearScalingTerms = addLinearScalingTerms;
       this.initialConstants = new List<double>();
       this.parameters = new Dictionary<DataForVariable, AutoDiff.Variable>();
@@ -248,9 +250,11 @@
       }
       if (node.Symbol is StartSymbol) {
-        var alpha = new AutoDiff.Variable();
-        var beta = new AutoDiff.Variable();
-        variables.Add(beta);
-        variables.Add(alpha);
-        return ConvertToAutoDiff(node.GetSubtree(0)) * alpha + beta;
+        if (addLinearScalingTerms) {
+          var alpha = new AutoDiff.Variable();
+          var beta = new AutoDiff.Variable();
+          variables.Add(beta);
+          variables.Add(alpha);
+          return ConvertToAutoDiff(node.GetSubtree(0)) * alpha + beta;
+        } else return ConvertToAutoDiff(node.GetSubtree(0));
       }
       throw new ConversionException();
