Index: branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs
===================================================================
--- branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs	(revision 18076)
+++ branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs	(revision 18081)
@@ -21,4 +21,5 @@
 
     #region Constants
+    private const string TreeEvaluatorParameterName = "TreeEvaluator";
     private const string ProblemDataParameterName = "ProblemData";
     private const string StructureTemplateParameterName = "Structure Template";
@@ -37,4 +38,5 @@
 
     #region Parameters
+    public IConstrainedValueParameter<SymbolicRegressionSingleObjectiveEvaluator> TreeEvaluatorParameter => (IConstrainedValueParameter<SymbolicRegressionSingleObjectiveEvaluator>)Parameters[TreeEvaluatorParameterName];
     public IValueParameter<IRegressionProblemData> ProblemDataParameter => (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName];
     public IFixedValueParameter<StructureTemplate> StructureTemplateParameter => (IFixedValueParameter<StructureTemplate>)Parameters[StructureTemplateParameterName];
@@ -45,4 +47,5 @@
 
     #region Properties
+
     public IRegressionProblemData ProblemData {
       get => ProblemDataParameter.Value;
@@ -62,5 +65,5 @@
     public DoubleLimit EstimationLimits => EstimationLimitsParameter.Value;
 
-    public override bool Maximization => true;
+    public override bool Maximization => false;
     #endregion
 
@@ -79,20 +82,38 @@
       structureTemplate.Changed += OnTemplateChanged;
 
+      var evaluators = new ItemSet<SymbolicRegressionSingleObjectiveEvaluator>(
+        ApplicationManager.Manager.GetInstances<SymbolicRegressionSingleObjectiveEvaluator>()
+        .Where(x => x.Maximization == Maximization));
+
+      Parameters.Add(new ConstrainedValueParameter<SymbolicRegressionSingleObjectiveEvaluator>(
+        TreeEvaluatorParameterName, 
+        evaluators,
+        evaluators.First()));
+
       Parameters.Add(new ValueParameter<IRegressionProblemData>(
         ProblemDataParameterName,
         problemData));
+      ProblemDataParameter.ValueChanged += ProblemDataParameterValueChanged;
+
       Parameters.Add(new FixedValueParameter<StructureTemplate>(
         StructureTemplateParameterName,
         StructureTemplateDescriptionText,
         structureTemplate));
+      
       Parameters.Add(new ValueParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(
         InterpreterParameterName,
         new SymbolicDataAnalysisExpressionTreeInterpreter()) { Hidden = true });
+      
       Parameters.Add(new FixedValueParameter<DoubleLimit>(
         EstimationLimitsParameterName,
         new DoubleLimit(targetInterval.LowerBound - estimationWidth, targetInterval.UpperBound + estimationWidth)));
+      EstimationLimitsParameter.Hidden = true;
+
       Parameters.Add(new ResultParameter<ISymbolicRegressionSolution>(BestTrainingSolutionParameterName, ""));
-
-      ProblemDataParameter.ValueChanged += ProblemDataParameterValueChanged;
+      this.BestTrainingSolutionParameter.Hidden = true;
+
+      this.EvaluatorParameter.Hidden = true;
+
+     
 
       Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer());
@@ -167,9 +188,44 @@
       individual[SymbolicExpressionTreeName] = tree;
 
-      var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
+      //TreeEvaluatorParameter.Value.EstimationLimitsParameter.ActualValue = EstimationLimits;
+      //TreeEvaluatorParameter.Value.EstimationLimitsParameter.Value = EstimationLimits;
+      //var quality = TreeEvaluatorParameter.Value.Evaluate(new ExecutionContext(null, this, new Scope("Test")), tree, ProblemData, ProblemData.TrainingIndices);
+
+      var quality = double.MaxValue;
+      var evaluatorGUID = TreeEvaluatorParameter.Value.GetType().GUID;
+
+      // TODO: use Evaluate method instead of static Calculate -> a fake ExecutionContext is needed
+      if (evaluatorGUID == typeof(NMSESingleObjectiveConstraintsEvaluator).GUID) {
+        quality = NMSESingleObjectiveConstraintsEvaluator.Calculate(
+        Interpreter, tree,
+        EstimationLimits.Lower, EstimationLimits.Upper,
+        ProblemData, ProblemData.TrainingIndices, new IntervalArithBoundsEstimator());
+      } else if (evaluatorGUID == typeof(SymbolicRegressionLogResidualEvaluator).GUID) {
+        quality = SymbolicRegressionLogResidualEvaluator.Calculate(
+        Interpreter, tree,
+        EstimationLimits.Lower, EstimationLimits.Upper,
+        ProblemData, ProblemData.TrainingIndices);
+      } else if (evaluatorGUID == typeof(SymbolicRegressionMeanRelativeErrorEvaluator).GUID) {
+        quality = SymbolicRegressionMeanRelativeErrorEvaluator.Calculate(
+        Interpreter, tree,
+        EstimationLimits.Lower, EstimationLimits.Upper,
+        ProblemData, ProblemData.TrainingIndices);
+      } else if (evaluatorGUID == typeof(SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator).GUID) {
+        quality = SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.Calculate(
         Interpreter, tree,
         EstimationLimits.Lower, EstimationLimits.Upper,
         ProblemData, ProblemData.TrainingIndices, false);
-
+      } else if (evaluatorGUID == typeof(SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator).GUID) {
+        quality = SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.Calculate(
+        Interpreter, tree,
+        EstimationLimits.Lower, EstimationLimits.Upper,
+        ProblemData, ProblemData.TrainingIndices, false);
+      } else { // SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator
+        quality = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(
+        Interpreter, tree,
+        EstimationLimits.Lower, EstimationLimits.Upper,
+        ProblemData, ProblemData.TrainingIndices, false);
+      }
+    
       return quality;
     }
