Index: branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintEvaluator.cs
===================================================================
--- branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintEvaluator.cs	(revision 17749)
+++ branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintEvaluator.cs	(revision 17750)
@@ -119,43 +119,44 @@
       var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
 
-      if (applyLinearScaling) {
-        //Check for interval arithmetic grammar
-        //remove scaling nodes for linear scaling evaluation
-        var                    rootNode  = new ProgramRootSymbol().CreateTreeNode();
-        var                    startNode = new StartSymbol().CreateTreeNode();
-        SymbolicExpressionTree newTree   = null;
-        foreach (var node in solution.IterateNodesPrefix())
-          if (node.Symbol.Name == "Scaling") {
-            for (var i = 0; i < node.SubtreeCount; ++i) startNode.AddSubtree(node.GetSubtree(i));
-            rootNode.AddSubtree(startNode);
-            newTree = new SymbolicExpressionTree(rootNode);
-            break;
-          }
-
-        //calculate alpha and beta for scaling
-        var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(newTree, problemData.Dataset, rows);
-        var targetValues    = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-        OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out var alpha, out var beta,
-          out var errorState);
-        //Set alpha and beta to the scaling nodes from ia grammar
-        foreach (var node in solution.IterateNodesPrefix())
-          if (node.Symbol.Name == "Offset") {
-            node.RemoveSubtree(1);
-            var alphaNode = new ConstantTreeNode(new Constant()) {Value = alpha};
-            node.AddSubtree(alphaNode);
-          } else if (node.Symbol.Name == "Scaling") {
-            node.RemoveSubtree(1);
-            var betaNode = new ConstantTreeNode(new Constant()) {Value = beta};
-            node.AddSubtree(betaNode);
-          }
-      }
-
       if (UseConstantOptimization) {
         SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows,
           false, ConstantOptimizationIterations, true,
           estimationLimits.Lower, estimationLimits.Upper);
-      }
-
-      var quality = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, UseSoftConstraints,
+      } else {
+        if (applyLinearScaling) {
+          //Check for interval arithmetic grammar
+          //remove scaling nodes for linear scaling evaluation
+          var                    rootNode  = new ProgramRootSymbol().CreateTreeNode();
+          var                    startNode = new StartSymbol().CreateTreeNode();
+          SymbolicExpressionTree newTree   = null;
+          foreach (var node in solution.IterateNodesPrefix())
+            if (node.Symbol.Name == "Scaling") {
+              for (var i = 0; i < node.SubtreeCount; ++i) startNode.AddSubtree(node.GetSubtree(i));
+              rootNode.AddSubtree(startNode);
+              newTree = new SymbolicExpressionTree(rootNode);
+              break;
+            }
+
+          //calculate alpha and beta for scaling
+          var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(newTree, problemData.Dataset, rows);
+          var targetValues    = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+          OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out var alpha, out var beta,
+            out var errorState);
+          //Set alpha and beta to the scaling nodes from ia grammar
+          foreach (var node in solution.IterateNodesPrefix())
+            if (node.Symbol.Name == "Offset") {
+              node.RemoveSubtree(1);
+              var alphaNode = new ConstantTreeNode(new Constant()) {Value = alpha};
+              node.AddSubtree(alphaNode);
+            } else if (node.Symbol.Name == "Scaling") {
+              node.RemoveSubtree(1);
+              var betaNode = new ConstantTreeNode(new Constant()) {Value = beta};
+              node.AddSubtree(betaNode);
+            }
+        }
+      }
+
+      var quality = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows,
+        UseSoftConstraints,
         PenaltyMultiplier);
       QualityParameter.ActualValue = new DoubleValue(quality);
@@ -171,13 +172,14 @@
       double penaltyMultiplier) {
       var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
-      var targetValues   = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-      var constraints    = problemData.IntervalConstraints.EnabledConstraints;
-      var variableRanges = problemData.VariableRanges.GetReadonlyDictionary();
-
+      var targetValues    = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      var constraints     = problemData.IntervalConstraints.EnabledConstraints;
+      var variableRanges  = problemData.VariableRanges.GetReadonlyDictionary();
+      
       var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
       var nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues,
         out var errorState);
 
-      if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, out var error)) {
+      if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution,
+        out var error)) {
         if (useSoftConstraints) {
           if (double.IsNaN(error) || double.IsInfinity(error)) {
@@ -186,5 +188,5 @@
             nmse += penaltyMultiplier * error;
           }
-
+          
           nmse = Math.Min(1.0, nmse);
         } else {
@@ -205,5 +207,5 @@
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
       EstimationLimitsParameter.ExecutionContext                    = context;
-      ApplyLinearScalingParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext                  = context;
 
       var nmse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree,
