Index: /trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs
===================================================================
--- /trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs	(revision 17907)
+++ /trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/IntervalTest.cs	(revision 17908)
@@ -12,4 +12,20 @@
     private readonly Interval e = new Interval(4, 6);
 
+    private void CheckLowerAndUpperBoundOfInterval(Interval expected, Interval calculated) {
+      var lowerBoundExpected = expected.LowerBound;
+      var upperBoundExpected = expected.UpperBound;
+      var lowerBoundCalculated = calculated.LowerBound;
+      var upperBoundCalculated = calculated.UpperBound;
+
+      if(double.IsNaN(lowerBoundExpected) && double.IsNaN(lowerBoundCalculated)) {
+        Assert.IsTrue(double.IsNaN(lowerBoundExpected) && double.IsNaN(lowerBoundCalculated));
+      } else if (double.IsNaN(upperBoundExpected) && double.IsNaN(upperBoundCalculated)) {
+        Assert.IsTrue(double.IsNaN(upperBoundExpected) && double.IsNaN(upperBoundCalculated));
+      } else {
+        Assert.AreEqual(lowerBoundExpected, lowerBoundCalculated, 1e-9);
+        Assert.AreEqual(upperBoundExpected, upperBoundCalculated, 1e-9);
+      } 
+    }
+
     [TestMethod]
     [TestCategory("Problems.DataAnalysis")]
@@ -33,9 +49,9 @@
 
       //[-1, 1] - [-2, 2] = [-3, 3]
-      Assert.AreEqual<Interval>(Interval.Subtract(a, b), new Interval(-3, 3));
+      CheckLowerAndUpperBoundOfInterval(Interval.Subtract(a, b), new Interval(-3, 3));
       //([-1, 1] - [-2, 2]) - [0, 3] = [-6, 3]
-      Assert.AreEqual<Interval>(Interval.Subtract(Interval.Subtract(a, b), c), new Interval(-6, 3));
+      CheckLowerAndUpperBoundOfInterval(Interval.Subtract(Interval.Subtract(a, b), c), new Interval(-6, 3));
       //([-1, 1] - [0, 3]) - [-2, 2] = [-6, 3]
-      Assert.AreEqual<Interval>(Interval.Subtract(Interval.Subtract(a, c), b), new Interval(-6, 3));
+      CheckLowerAndUpperBoundOfInterval(Interval.Subtract(Interval.Subtract(a, c), b), new Interval(-6, 3));
     }
 
@@ -47,12 +63,12 @@
 
       //[-1, 1] * [-2, 2] = [-2, 2]
-      Assert.AreEqual<Interval>(Interval.Multiply(a, b), new Interval(-2, 2));
+      CheckLowerAndUpperBoundOfInterval(Interval.Multiply(a, b), new Interval(-2, 2));
       //([-1, 1] * [-2, 2]) * [0, 3] = [-6, 6]
-      Assert.AreEqual<Interval>(Interval.Multiply(Interval.Multiply(a, b), c), new Interval(-6, 6));
+      CheckLowerAndUpperBoundOfInterval(Interval.Multiply(Interval.Multiply(a, b), c), new Interval(-6, 6));
       //([-1, 1] * [0, 3]) * [-2, 2] = [-6, 6]
-      Assert.AreEqual<Interval>(Interval.Multiply(Interval.Multiply(a, c), b), new Interval(-6, 6));
+      CheckLowerAndUpperBoundOfInterval(Interval.Multiply(Interval.Multiply(a, c), b), new Interval(-6, 6));
 
       // [-2, 0] * [-2, 0]  = [0, 4]
-      Assert.AreEqual<Interval>(new Interval(0, 4), Interval.Multiply(new Interval(-2, 0), new Interval(-2, 0)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0, 4), Interval.Multiply(new Interval(-2, 0), new Interval(-2, 0)));
     }
 
@@ -64,16 +80,16 @@
 
       //[4, 6] / [1, 3] = [4/3, 6]
-      Assert.AreEqual<Interval>(Interval.Divide(e, d), new Interval(4.0 / 3.0, 6));
+      CheckLowerAndUpperBoundOfInterval(Interval.Divide(e, d), new Interval(4.0 / 3.0, 6));
       //([4, 6] / [1, 3]) / [1, 3] = [4/9, 6]
-      Assert.AreEqual<Interval>(Interval.Divide(Interval.Divide(e, d), d), new Interval(4.0 / 9.0, 6));
+      CheckLowerAndUpperBoundOfInterval(Interval.Divide(Interval.Divide(e, d), d), new Interval(4.0 / 9.0, 6));
       //[4, 6] / [0, 3] = [4/3, +Inf]
-      Assert.AreEqual<Interval>(Interval.Divide(e, c), new Interval(4.0 / 3.0, double.PositiveInfinity));
+      CheckLowerAndUpperBoundOfInterval(Interval.Divide(e, c), new Interval(4.0 / 3.0, double.PositiveInfinity));
       //[-1, 1] / [0, 3] = [+Inf, -Inf]
-      Assert.AreEqual<Interval>(Interval.Divide(a, c), new Interval(double.NegativeInfinity, double.PositiveInfinity));
+      CheckLowerAndUpperBoundOfInterval(Interval.Divide(a, c), new Interval(double.NegativeInfinity, double.PositiveInfinity));
       //Devision by 0 ==> IsInfiniteOrUndefined == true
       Assert.IsTrue(Interval.Divide(e, c).IsInfiniteOrUndefined);
       //Devision by 0 ==> IsInfiniteOrUndefined == true
       Assert.IsTrue(Interval.Divide(a, c).IsInfiniteOrUndefined);
-      Assert.AreEqual<Interval>(Interval.Divide(d, b), new Interval(double.NegativeInfinity, double.PositiveInfinity));
+      CheckLowerAndUpperBoundOfInterval(Interval.Divide(d, b), new Interval(double.NegativeInfinity, double.PositiveInfinity));
     }
 
@@ -84,14 +100,14 @@
       //sine depends on interval
       //sin([0, 2*pi]) = [-1, 1]
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(0, 2 * Math.PI)), new Interval(-1, 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(0, 2 * Math.PI)), new Interval(-1, 1));
       //sin([-pi/2, pi/2]) = [sin(-pi/2), sin(pi/2)]
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(-1 * Math.PI / 2, Math.PI / 2)), new Interval(-1, 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(-1 * Math.PI / 2, Math.PI / 2)), new Interval(-1, 1));
       //sin([0, pi/2]) = [sin(0), sin(pi/2)]
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(0, Math.PI / 2)), new Interval(0, 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(0, Math.PI / 2)), new Interval(0, 1));
       //sin([pi, 3*pi/2]) = [sin(pi), sin(3*pi/2)]
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(Math.PI, 3 * Math.PI / 2)), new Interval(-1, 0));
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(1, 2)), new Interval(Math.Min(Math.Sin(1), Math.Sin(2)), 1));
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(1, 3)), new Interval(Math.Min(Math.Sin(1), Math.Sin(3)), 1));
-      Assert.AreEqual<Interval>(Interval.Sine(new Interval(Math.PI, 5 * Math.PI / 2)), new Interval(-1, 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(Math.PI, 3 * Math.PI / 2)), new Interval(-1, 0));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(1, 2)), new Interval(Math.Min(Math.Sin(1), Math.Sin(2)), 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(1, 3)), new Interval(Math.Min(Math.Sin(1), Math.Sin(3)), 1));
+      CheckLowerAndUpperBoundOfInterval(Interval.Sine(new Interval(Math.PI, 5 * Math.PI / 2)), new Interval(-1, 1));
     }
 
@@ -101,6 +117,6 @@
     public void CosineIntervalTest() {
       //Cosine uses sine Interval.Sine(Interval.Subtract(a, new Interval(Math.PI / 2, Math.PI / 2)));
-      Assert.AreEqual<Interval>(Interval.Cosine(new Interval(0, 2 * Math.PI)), new Interval(-1, 1));
-      Assert.AreEqual<Interval>(new Interval(-1, 1), Interval.Cosine(new Interval(Math.PI, 4 * Math.PI / 2)));
+      CheckLowerAndUpperBoundOfInterval(Interval.Cosine(new Interval(0, 2 * Math.PI)), new Interval(-1, 1));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, 1), Interval.Cosine(new Interval(Math.PI, 4 * Math.PI / 2)));
     }
 
@@ -110,10 +126,10 @@
     public void LogIntervalTest() {
       //Log([3, 5]) = [log(3), log(5)]
-      Assert.AreEqual<Interval>(new Interval(Math.Log(3), Math.Log(5)), Interval.Logarithm(new Interval(3, 5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(Math.Log(3), Math.Log(5)), Interval.Logarithm(new Interval(3, 5)));
       //Log([0.5, 1]) = [log(0.5), log(1)]
-      Assert.AreEqual<Interval>(new Interval(Math.Log(0.5), 0), Interval.Logarithm(new Interval(0.5, 1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(Math.Log(0.5), 0), Interval.Logarithm(new Interval(0.5, 1)));
       //Log([-1, 5]) = [NaN, log(5)]
       var result = Interval.Logarithm(new Interval(-1, 5));
-      Assert.AreEqual<Interval>(new Interval(double.NaN, Math.Log(5)),result);
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NaN, Math.Log(5)),result);
       Assert.IsTrue(result.IsInfiniteOrUndefined);
     }
@@ -125,5 +141,5 @@
     public void ExponentialIntervalTest() {
       //Exp([0, 1]) = [exp(0), exp(1)]
-      Assert.AreEqual<Interval>(new Interval(1, Math.Exp(1)), Interval.Exponential(new Interval(0, 1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(1, Math.Exp(1)), Interval.Exponential(new Interval(0, 1)));
     }
 
@@ -133,7 +149,7 @@
     [TestProperty("Time", "short")]
     public void SquareIntervalTest() {
-      Assert.AreEqual<Interval>(new Interval(1, 4), Interval.Square(new Interval(1, 2)));
-      Assert.AreEqual<Interval>(new Interval(1, 4), Interval.Square(new Interval(-2, -1)));
-      Assert.AreEqual<Interval>(new Interval(0, 4), Interval.Square(new Interval(-2, 2)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(1, 4), Interval.Square(new Interval(1, 2)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(1, 4), Interval.Square(new Interval(-2, -1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0, 4), Interval.Square(new Interval(-2, 2)));
     }
 
@@ -142,6 +158,6 @@
     [TestProperty("Time", "short")]
     public void SquarerootIntervalTest() {
-      Assert.AreEqual<Interval>(new Interval(-2, 2), Interval.SquareRoot(new Interval(1, 4)));
-      Assert.AreEqual<Interval>(new Interval(double.NaN, double.NaN), Interval.SquareRoot(new Interval(-4, -1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-2, 2), Interval.SquareRoot(new Interval(1, 4)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NaN, double.NaN), Interval.SquareRoot(new Interval(-4, -1)));
     }
 
@@ -150,7 +166,7 @@
     [TestProperty("Time", "short")]
     public void CubeIntervalTest() {
-      Assert.AreEqual<Interval>(new Interval(1, 8), Interval.Cube(new Interval(1, 2)));
-      Assert.AreEqual<Interval>(new Interval(-8, -1), Interval.Cube(new Interval(-2, -1)));
-      Assert.AreEqual<Interval>(new Interval(-8, 8), Interval.Cube(new Interval(-2, 2)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(1, 8), Interval.Cube(new Interval(1, 2)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-8, -1), Interval.Cube(new Interval(-2, -1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-8, 8), Interval.Cube(new Interval(-2, 2)));
     }
 
@@ -159,7 +175,7 @@
     [TestProperty("Time", "short")]
     public void CubeRootIntervalTest() {
-      Assert.AreEqual<Interval>(new Interval(1, 2), Interval.CubicRoot(new Interval(1, 8)));
-      Assert.AreEqual<Interval>(new Interval(-2, -2), Interval.CubicRoot(new Interval(-8, -8)));
-      Assert.AreEqual<Interval>(new Interval(-2, 2), Interval.CubicRoot(new Interval(-8, 8)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(1, 2), Interval.CubicRoot(new Interval(1, 8)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-2, -2), Interval.CubicRoot(new Interval(-8, -8)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-2, 2), Interval.CubicRoot(new Interval(-8, 8)));
       Assert.AreEqual(new Interval(2, 2), Interval.CubicRoot(new Interval(8, 8)));
       Assert.AreEqual(new Interval(-Math.Pow(6, 1.0 / 3), 2), Interval.CubicRoot(new Interval(-6, 8)));
@@ -313,45 +329,42 @@
     [TestProperty("Time", "short")]
     public void GeometricTest() {
-      Assert.AreEqual(new Interval(-1, -0.936456687290796), Interval.Cosine(new Interval(3, 3.5)));
-      Assert.AreEqual(new Interval(-1, -0.936456687290796), Interval.Cosine(new Interval(-3.5, -3)));
-      Assert.AreEqual(new Interval(-1, 1), Interval.Cosine(new Interval(-3.5, 3)));
-      Assert.AreEqual(new Interval(-0.839071529076452, 0.843853958732493), Interval.Cosine(new Interval(10, 12)));
-      Assert.AreEqual(new Interval(0.136737218207833, 0.907446781450197), Interval.Cosine(new Interval(13, 14)));
-      Assert.AreEqual(new Interval(-0.839071529076452, 1), Interval.Cosine(new Interval(10, 14)));
-      Assert.AreEqual(new Interval(-1, 0.136737218207833), Interval.Cosine(new Interval(14, 16)));
-      Assert.AreEqual(new Interval(-0.839071529076452, 0.004425697988051), Interval.Cosine(new Interval(-11, -10)));
-      Assert.AreEqual(new Interval(0.136737218207833, 0.907446781450197), Interval.Cosine(new Interval(-14, -13)));
-      Assert.AreEqual(new Interval(-1, 0.136737218207833), Interval.Cosine(new Interval(-16, -14)));
-      Assert.AreEqual(new Interval(0.101585703696621, 1), Interval.Cosine(new Interval(-102, -100)));
-      Assert.AreEqual(new Interval(-1, 1), Interval.Cosine(new Interval(4.6e15, 4.7e15)));
-      Assert.AreEqual(new Interval(0.87758256189037265, 0.87758256189037276), Interval.Cosine(new Interval(0.5, 0.5)));
-      Assert.AreEqual(new Interval(-0.09904103659872825, 0.8775825618903728), Interval.Cosine(new Interval(0.5, 1.67)));
-      Assert.AreEqual(new Interval(-1.0, 0.77556587851025016), Interval.Cosine(new Interval(2.1, 5.6)));
-      Assert.AreEqual(new Interval(-1.0, 1.0), Interval.Cosine(new Interval(0.5, 8.5)));
-      Assert.AreEqual(new Interval(-1.0, -0.09904103659872801), Interval.Cosine(new Interval(1.67, 3.2)));
-
-
-      Assert.AreEqual(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(double.NegativeInfinity, double.PositiveInfinity)));
-      Assert.AreEqual(new Interval(0, 1.55740772465490223051), Interval.Tangens(new Interval(0, 1)));
-      Assert.AreEqual(new Interval(-1.55740772465490223051, 0), Interval.Tangens(new Interval(-1, 0)));
-      Assert.AreEqual(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(-2, -1)));
-      Assert.AreEqual(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(202, 203)));
-      Assert.AreEqual(new Interval(0.54630248984379048, 0.5463024898437906), Interval.Tangens(new Interval(0.5, 0.5)));
-      Assert.AreEqual(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(0.5,
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, -0.936456687290796), Interval.Cosine(new Interval(3, 3.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, -0.936456687290796), Interval.Cosine(new Interval(-3.5, -3)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, 1), Interval.Cosine(new Interval(-3.5, 3)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-0.839071529076452, 0.843853958732493), Interval.Cosine(new Interval(10, 12)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.136737218207833, 0.907446781450197), Interval.Cosine(new Interval(13, 14)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-0.839071529076452, 1), Interval.Cosine(new Interval(10, 14)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, 0.136737218207833), Interval.Cosine(new Interval(14, 16)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-0.839071529076452, 0.004425697988051), Interval.Cosine(new Interval(-11, -10)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.136737218207833, 0.907446781450197), Interval.Cosine(new Interval(-14, -13)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, 0.136737218207833), Interval.Cosine(new Interval(-16, -14)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.101585703696621, 1), Interval.Cosine(new Interval(-102, -100)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1, 1), Interval.Cosine(new Interval(4.6e15, 4.7e15)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.87758256189037265, 0.87758256189037276), Interval.Cosine(new Interval(0.5, 0.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-0.09904103659872825, 0.8775825618903728), Interval.Cosine(new Interval(0.5, 1.67)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 0.77556587851025016), Interval.Cosine(new Interval(2.1, 5.6)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 1.0), Interval.Cosine(new Interval(0.5, 8.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, -0.09904103659872801), Interval.Cosine(new Interval(1.67, 3.2)));
+
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(double.NegativeInfinity, double.PositiveInfinity)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0, 1.55740772465490223051), Interval.Tangens(new Interval(0, 1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.55740772465490223051, 0), Interval.Tangens(new Interval(-1, 0)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(-2, -1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(202, 203)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.54630248984379048, 0.5463024898437906), Interval.Tangens(new Interval(0.5, 0.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(0.5,
         1.67)));
-      //Assert.AreEqual(new Interval(-10.047182299210307, 0.5847385445957865), Interval.Tangens(new Interval(1.67, 3.2)));
-      Assert.AreEqual(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(
+
+      CheckLowerAndUpperBoundOfInterval(new Interval(double.NegativeInfinity, double.PositiveInfinity), Interval.Tangens(new Interval(
         6.638314112824137, 8.38263151220128)));
 
-
-
-      Assert.AreEqual(new Interval(0.47942553860420295, 0.47942553860420301), Interval.Sine(new Interval(0.5, 0.5)));
-      Assert.AreEqual(new Interval(4.7942553860420295e-01, 1.0), Interval.Sine(new Interval(0.5, 1.67)));
-      Assert.AreEqual(new Interval(-5.8374143427580093e-02, 9.9508334981018021e-01), Interval.Sine(new Interval(1.67,
+      CheckLowerAndUpperBoundOfInterval(new Interval(0.47942553860420295, 0.47942553860420301), Interval.Sine(new Interval(0.5, 0.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(4.7942553860420295e-01, 1.0), Interval.Sine(new Interval(0.5, 1.67)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-5.8374143427580093e-02, 9.9508334981018021e-01), Interval.Sine(new Interval(1.67,
         3.2)));
-      Assert.AreEqual(new Interval(-1.0, 0.863209366648874), Interval.Sine(new Interval(2.1, 5.6)));
-      Assert.AreEqual(new Interval(-1.0, 1.0), Interval.Sine(new Interval(0.5, 8.5)));
-      Assert.AreEqual(new Interval(-1.0, 0.9775301176650971), Interval.Sine(new Interval(-4.5, 0.1)));
-      Assert.AreEqual(new Interval(-1.0, 1.0), Interval.Sine(new Interval(1.3, 6.3)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 0.863209366648874), Interval.Sine(new Interval(2.1, 5.6)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 1.0), Interval.Sine(new Interval(0.5, 8.5)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 0.9775301176650971), Interval.Sine(new Interval(-4.5, 0.1)));
+      CheckLowerAndUpperBoundOfInterval(new Interval(-1.0, 1.0), Interval.Sine(new Interval(1.3, 6.3)));
     }
 
