Index: branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
===================================================================
--- branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 14232)
+++ branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 14237)
@@ -205,8 +205,11 @@
           ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
           VariableTreeNode variableTreeNode = node as VariableTreeNode;
+          FactorVariableTreeNode factorVariableTreeNode = node as FactorVariableTreeNode;
           if (constantTreeNode != null)
             c[i++] = constantTreeNode.Value;
           else if (updateVariableWeights && variableTreeNode != null)
             c[i++] = variableTreeNode.Weight;
+          else if (updateVariableWeights && factorVariableTreeNode != null)
+            c[i++] = factorVariableTreeNode.Weight;
         }
       }
@@ -270,8 +273,11 @@
         ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
         VariableTreeNode variableTreeNode = node as VariableTreeNode;
+        FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode;
         if (constantTreeNode != null)
           constantTreeNode.Value = constants[i++];
         else if (updateVariableWeights && variableTreeNode != null)
           variableTreeNode.Weight = constants[i++];
+        else if (updateVariableWeights && factorVarTreeNode != null)
+          factorVarTreeNode.Weight = constants[i++];
       }
     }
@@ -299,10 +305,12 @@
         return true;
       }
-      if (node.Symbol is Variable) {
-        var varNode = node as VariableTreeNode;
+      if (node.Symbol is Variable || node.Symbol is FactorVariable) {
+        var varNode = node as VariableTreeNodeBase;
+        var factorVarNode = node as FactorVariableTreeNode;
+        // factor variable values are only 0 or 1 and set in x accordingly
         var par = new AutoDiff.Variable();
         parameters.Add(par);
         variableNames.Add(varNode.VariableName);
-        categoricalVariableValues.Add(string.Empty);   // as a value as placeholder (variableNames.Length == catVariableValues.Length)
+        categoricalVariableValues.Add(factorVarNode != null ? factorVarNode.VariableValue : string.Empty);
 
         if (updateVariableWeights) {
@@ -313,15 +321,4 @@
           term = par;
         }
-        return true;
-      }
-      if (node.Symbol is FactorVariable) {
-        // nothing to update in this case (like a variable without a weight)
-        // values are only 0 or 1 and set in x accordingly
-        var factorNode = node as FactorVariableTreeNode;
-        var par = new AutoDiff.Variable();
-        parameters.Add(par);
-        variableNames.Add(factorNode.VariableName);
-        categoricalVariableValues.Add(factorNode.VariableValue);
-        term = par;
         return true;
       }
Index: branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs
===================================================================
--- branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs	(revision 14232)
+++ branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs	(revision 14237)
@@ -62,5 +62,5 @@
 
       double bestReplacementValue = 0.0;
-      double bestImpactValue = double.NegativeInfinity;
+      double bestImpactValue = double.PositiveInfinity;
       newQualityForImpactsCalculation = qualityForImpactsCalculation; // initialize
       // try the potentially reasonable replacement values and use the best one
@@ -80,5 +80,5 @@
 
         impactValue = qualityForImpactsCalculation - newQualityForImpactsCalculation;
-        if (impactValue > bestImpactValue) {
+        if (impactValue < bestImpactValue) {
           bestImpactValue = impactValue;
           bestReplacementValue = repValue;
