Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Extensions/ConstrainedNLSInternal.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Extensions/ConstrainedNLSInternal.cs	(revision 17239)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Extensions/ConstrainedNLSInternal.cs	(revision 17240)
@@ -98,6 +98,7 @@
       var pred = interpreter.GetSymbolicExpressionTreeValues(expr, problemData.Dataset, trainingRows).ToArray();
 
+      bestError = targetVariance;
+
       if (pred.Any(pi => double.IsInfinity(pi) || double.IsNaN(pi))) {
-        bestError = targetVariance;
         invalidProblem = true;
       }
@@ -106,5 +107,4 @@
       var predStDev = pred.StandardDeviationPop();
       if (predStDev == 0) {
-        bestError = targetVariance;
         invalidProblem = true;
       }
@@ -170,6 +170,6 @@
 
 
-      var minVal = Math.Min(-100.0, thetaValues.Min());
-      var maxVal = Math.Max(100.0, thetaValues.Max());
+      var minVal = Math.Min(-1000.0, thetaValues.Min());
+      var maxVal = Math.Max(1000.0, thetaValues.Max());
       var lb = Enumerable.Repeat(minVal, thetaValues.Count).ToArray();
       var up = Enumerable.Repeat(maxVal, thetaValues.Count).ToArray();
@@ -213,10 +213,12 @@
       double minf = double.MaxValue; /* minimum objective value upon return */
       var res = NLOpt.nlopt_optimize(nlopt, x, ref minf);
-      bestSolution = x;
-      bestError = minf;
 
       if (res < 0 && res != NLOpt.nlopt_result.NLOPT_FORCED_STOP) {
-        throw new InvalidOperationException($"NLOpt failed {res} {NLOpt.nlopt_get_errmsg(nlopt)}");
-      } else {
+        // throw new InvalidOperationException($"NLOpt failed {res} {NLOpt.nlopt_get_errmsg(nlopt)}");
+        return;
+      } else if(minf <= bestError) {
+        bestSolution = x;
+        bestError = minf;
+
         // calculate constraints of final solution
         double[] _ = new double[x.Length];
@@ -296,8 +298,11 @@
       }
 
-      UpdateBestSolution(sse / target.Length, curX);
+      // UpdateBestSolution(sse / target.Length, curX);
       RaiseFunctionEvaluated();
 
-      if (double.IsNaN(sse)) return double.MaxValue;
+      if (double.IsNaN(sse)) {
+        if(grad!=null) Array.Clear(grad, 0, grad.Length); 
+        return double.MaxValue;
+      }
       return sse / target.Length;
     }
@@ -364,5 +369,5 @@
       var constraintData = Marshal.PtrToStructure<ConstraintData>(data);
 
-      if (grad != null) for (int j = 0; j < grad.Length; j++) grad[j] = 0; // clear grad
+      if (grad != null) Array.Clear(grad, 0, grad.Length);
 
       var interval = intervalEvaluator.Evaluate(constraintData.Tree, dataIntervals, constraintData.ParameterNodes,
@@ -399,6 +404,8 @@
 
       UpdateConstraintViolations(constraintData.Idx, interval.UpperBound);
-      if (double.IsNaN(interval.UpperBound)) return double.MaxValue;
-      else return interval.UpperBound;
+      if (double.IsNaN(interval.UpperBound)) {
+        Array.Clear(grad, 0, grad.Length);
+        return double.MaxValue;
+      } else return interval.UpperBound;
     }
 
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/Interpreter.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/Interpreter.cs	(revision 17239)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/Interpreter.cs	(revision 17240)
@@ -781,4 +781,7 @@
   }
 
+  // this is our own implementation of interval arithmetic
+  // for a well worked out definition of interval operations for IEEE reals see:
+  // Stahl: Interval Methods for Bounding the Range of Polynomials and Solving Systems of Nonlinear Equations, Dissertation, JKU, 1995
   [DebuggerDisplay("[{low.Value}..{high.Value}]")]
   public class AlgebraicInterval : IAlgebraicType<AlgebraicInterval> {
