Index: /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator.cs
===================================================================
--- /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator.cs	(revision 17704)
+++ /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator.cs	(revision 17705)
@@ -62,10 +62,41 @@
       var minIntervalWidth      = MinSplittingWidth;
       var maxIntervalSplitDepth = MaxSplittingDepth;
-      //var applyLinearScaling  = ApplyLinearScalingParameter.ActualValue.Value;
-      var applyLinearScaling = false;
+      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,
-          applyLinearScaling,
+          false,
           ConstantOptimizationIterations,
           ConstantOptimizationUpdateVariableWeights,
@@ -74,5 +105,5 @@
 
       var qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData,
-        rows, applyLinearScaling, DecimalPlaces, minIntervalWidth, maxIntervalSplitDepth);
+        rows, DecimalPlaces, minIntervalWidth, maxIntervalSplitDepth);
       QualitiesParameter.ActualValue = new DoubleArray(qualities);
       return base.InstrumentedApply();
@@ -88,6 +119,5 @@
       var quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree,
         EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper,
-        problemData, rows,
-        ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces, MinSplittingWidth,
+        problemData, rows, DecimalPlaces, MinSplittingWidth,
         MaxSplittingDepth);
 
@@ -103,5 +133,5 @@
                                      ISymbolicExpressionTree solution, double lowerEstimationLimit,
                                      double upperEstimationLimit,
-                                     IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling,
+                                     IRegressionProblemData problemData, IEnumerable<int> rows,
                                      int decimalPlaces, double minIntervalSplitWidth, int maxIntervalSplitDepth) {
       OnlineCalculatorError errorState;
@@ -114,8 +144,8 @@
       var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
       nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
-      if (errorState != OnlineCalculatorError.None) nmse = double.NaN;
+      if (errorState != OnlineCalculatorError.None) nmse = 1.0;
 
       if (nmse > 1)
-        nmse = 1;
+        nmse = 1.0;
 
       var constraints    = problemData.IntervalConstraints.Constraints.Where(c => c.Enabled);
@@ -190,5 +220,5 @@
         var objectives = new List<bool> {false};          //First NMSE ==> min
         objectives.AddRange(Enumerable.Repeat(false, 2)); //Constraints ==> min
-
+        
         return objectives;
       }
Index: /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator.cs
===================================================================
--- /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator.cs	(revision 17704)
+++ /branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator.cs	(revision 17705)
@@ -1,4 +1,3 @@
-﻿using System;
-using System.Collections.Generic;
+﻿using System.Collections.Generic;
 using HEAL.Attic;
 using HeuristicLab.Common;
@@ -6,5 +5,4 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Parameters;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.SingleObjective.Evaluators {
@@ -13,7 +11,6 @@
   public class SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator
     : SymbolicRegressionSingleObjectiveEvaluator {
-
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator(StorableConstructorFlag _) : base(_) {}
+    protected SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator(StorableConstructorFlag _) : base(_) { }
 
     protected SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator(
@@ -31,47 +28,46 @@
 
     public override IOperation InstrumentedApply() {
-      var rows                                      = GenerateRowsToEvaluate();
-      var solution                                  = SymbolicExpressionTreeParameter.ActualValue;
-      var problemData                               = ProblemDataParameter.ActualValue;
-      var interpreter                               = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
-      var estimationLimits                          = EstimationLimitsParameter.ActualValue;
-      var applyLinearScaling                        = false; 
-      
-     //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);
-     var a = alpha;
-     var b = beta;
-     //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 rows               = GenerateRowsToEvaluate();
+      var solution           = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData        = ProblemDataParameter.ActualValue;
+      var interpreter        = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits   = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = true;
+
+      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,
-        applyLinearScaling);
+        false);
       QualityParameter.ActualValue = new DoubleValue(quality);
       return base.InstrumentedApply();
@@ -85,6 +81,6 @@
       var estimatedValues =
         interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
-      var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-      var constraints = problemData.IntervalConstraints.EnabledConstraints;
+      var targetValues   = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      var constraints    = problemData.IntervalConstraints.EnabledConstraints;
       var variableRanges = problemData.VariableRanges.GetReadonlyDictionary();
 
@@ -93,10 +89,11 @@
 
       var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-      var nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out var errorState);
+      var nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues,
+        out var errorState);
       if (errorState != OnlineCalculatorError.None) nmse = 1.0;
 
       return nmse;
     }
-    
+
     public override double Evaluate(
       IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData,
@@ -108,6 +105,5 @@
       var nmse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree,
         EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper,
-        problemData, rows,
-        ApplyLinearScalingParameter.ActualValue.Value);
+        problemData, rows, false);
 
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
