Index: branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs
===================================================================
--- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs	(revision 16713)
+++ branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs	(revision 16747)
@@ -24,4 +24,5 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using HEAL.Attic;
 using HeuristicLab.Analysis;
@@ -84,7 +85,57 @@
     }
 
+    static Dictionary<IntervalConstraint, bool> CheckConstraints(ISymbolicExpressionTree model,
+      IRegressionProblemData problemData) {
+      var constraints = IntervalConstraintsParser.Parse(((RegressionProblemData)problemData).IntervalConstraints.Value);
+      var constraintViolations = new Dictionary<IntervalConstraint, bool>();
+      var variableRanges = ((RegressionProblemData)problemData).VariableRanges.VariableIntervals;
+
+      foreach (var constraint in constraints) {
+        if (!constraintViolations.ContainsKey(constraint)) {
+          constraintViolations.Add(constraint, CheckConstraint(model, variableRanges, constraint));
+        }
+      }
+
+      return constraintViolations;
+    }
+
+    static Dictionary<IntervalConstraint, bool> CheckConstraints(ISymbolicRegressionModel model,
+      IRegressionProblemData problemData) {
+      return CheckConstraints(model.SymbolicExpressionTree, problemData);
+    }
+
+    static bool CheckConstraint(ISymbolicExpressionTree model, Dictionary<string, Interval> variableRanges,
+      IntervalConstraint constraint) {
+      var intervalInterpreter = new IntervalInterpreter();
+      if (constraint.Variable != null) {
+        if (!constraint.IsDerivation) {
+          var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(model,
+            variableRanges);
+          if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound,
+            constraint.InclusiveUpperBound)) {
+            return false;
+          }
+        } else {
+          var dTree = model;
+          for (var i = 0; i < constraint.NumberOfDerivation; ++i) {
+            dTree = DerivativeCalculator.Derive(dTree, constraint.Variable);
+          }
+          var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(dTree,
+            variableRanges);
+          if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound,
+            constraint.InclusiveUpperBound)) {
+            return false;
+          }
+        }
+      }
+      return true;
+    }
+
+    static bool CheckConstraint(ISymbolicRegressionModel model, Dictionary<string, Interval> variableRanges, IntervalConstraint constraint) {
+      return CheckConstraint(model.SymbolicExpressionTree, variableRanges, constraint);
+    }
+
     public override IOperation Apply() {
       var results = ResultCollectionParameter.ActualValue;
-      var intervalInterpreter = new IntervalInterpreter();
       if (!results.ContainsKey(ConstraintViolationsResultName)) {
         var newDataTable = new DataTable(ConstraintViolationsResultName);
@@ -92,12 +143,9 @@
           newDataTable));
       }
-
       var dataTable = (DataTable)results[ConstraintViolationsResultName].Value;
       var problemData = RegressionProblemData;
-
       var constraintViolations = new Dictionary<string, int>();
 
       var constraints = IntervalConstraintsParser.Parse(problemData.IntervalConstraints.Value);
-      var variableRanges = problemData.VariableRanges.VariableIntervals;
 
       if (dataTable.Rows.Count == 0) {
@@ -114,29 +162,9 @@
 
       foreach (var tree in this.SymbolicExpressionTree) {
-        foreach (var constraint in constraints) {
-          if (constraint.Variable != null && !variableRanges.ContainsKey(constraint.Variable))
-            throw new ArgumentException(
-              $"The given variable {constraint.Variable} in the constraint does not exists in the model.",
-              nameof(IntervalConstraintsParser));
-          if (!constraint.IsDerivation) {
-            var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree,
-              variableRanges);
-            if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound,
-              constraint.InclusiveUpperBound)) {
-              constraintViolations[constraint.Expression]++;
-            }
-          } else {
-            var dTree = tree;
-            for (var i = 0; i < constraint.NumberOfDerivation; ++i) {
-              dTree = DerivativeCalculator.Derive(dTree, constraint.Variable);
-            }
+        var checkedConstraints = CheckConstraints(tree, problemData);
 
-            var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(dTree,
-              variableRanges);
-            if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound,
-              constraint.InclusiveUpperBound)) {
-              constraintViolations[constraint.Expression]++;
-            }
-          }
+        foreach (var kvp in checkedConstraints) {
+          if (!kvp.Value)
+            constraintViolations[kvp.Key.Expression]++;
         }
       }
