Index: /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/AutoDiffIntervalTest.cs
===================================================================
--- /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/AutoDiffIntervalTest.cs	(revision 17205)
+++ /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/AutoDiffIntervalTest.cs	(revision 17205)
@@ -0,0 +1,212 @@
+﻿using System;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Problems.DataAnalysis.Tests {
+  [TestClass]
+  public class AutoDiffIntervalTest {
+    private readonly AlgebraicInterval a = new AlgebraicInterval(-1, 1);
+    private readonly AlgebraicInterval b = new AlgebraicInterval(-2, 2);
+    private readonly AlgebraicInterval c = new AlgebraicInterval(0, 3);
+    private readonly AlgebraicInterval d = new AlgebraicInterval(1, 3);
+    private readonly AlgebraicInterval e = new AlgebraicInterval(4, 6);
+    private readonly IntervalEvaluator eval = new  IntervalEvaluator();
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalAddOperation() {
+      //add        [x1,x2] + [y1,y2] = [x1 + y1,x2 + y2]
+
+      // [-1,1] + [-2,2] = [-3,3]
+      Assert.AreEqual(Add(a, b), new AlgebraicInterval(-3, 3));
+      //([-1, 1] + [-2, 2]) + [0, 3] = [-3, 6]
+      Assert.AreEqual(Add(Add(a, b), c), new AlgebraicInterval(-3, 6));
+      //([-1, 1] + [0, 3]) + [-2, 2] = [-3, 6]
+      Assert.AreEqual(Add(Add(a, c), b), new AlgebraicInterval(-3, 6));
+    }
+
+    private static AlgebraicInterval Add(AlgebraicInterval a, AlgebraicInterval b) {
+      return a.Clone().Add(b);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalSubOperation() {
+      //subtract   [x1,x2] − [y1,y2] = [x1 − y2,x2 − y1]
+
+      //[-1, 1] - [-2, 2] = [-3, 3]
+      Assert.AreEqual(Subtract(a, b), new AlgebraicInterval(-3, 3));
+      //([-1, 1] - [-2, 2]) - [0, 3] = [-6, 3]
+      Assert.AreEqual(Subtract(Subtract(a, b), c), new AlgebraicInterval(-6, 3));
+      //([-1, 1] - [0, 3]) - [-2, 2] = [-6, 3]
+      Assert.AreEqual(Subtract(Subtract(a, c), b), new AlgebraicInterval(-6, 3));
+    }
+
+    private AlgebraicInterval Subtract(AlgebraicInterval a, AlgebraicInterval b) {
+      return a.Clone().Sub(b);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalMutlipyOperation() {
+      //multiply   [x1,x2] * [y1,y2] = [min(x1*y1,x1*y2,x2*y1,x2*y2),max(x1*y1,x1*y2,x2*y1,x2*y2)]
+
+      //[-1, 1] * [-2, 2] = [-2, 2]
+      Assert.AreEqual(Multiply(a, b), new AlgebraicInterval(-2, 2));
+      //([-1, 1] * [-2, 2]) * [0, 3] = [-6, 6]
+      Assert.AreEqual(Multiply(Multiply(a, b), c), new AlgebraicInterval(-6, 6));
+      //([-1, 1] * [0, 3]) * [-2, 2] = [-6, 6]
+      Assert.AreEqual(Multiply(Multiply(a, c), b), new AlgebraicInterval(-6, 6));
+
+      // [-2, 0] * [-2, 0]  = [0, 4]
+      Assert.AreEqual(new AlgebraicInterval(0, 4), Multiply(new AlgebraicInterval(-2, 0), new AlgebraicInterval(-2, 0)));
+    }
+
+    private AlgebraicInterval Multiply(AlgebraicInterval a, AlgebraicInterval b) {
+      return a.Clone().Mul(b);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalDivideOperation() {
+      //divide  [x1, x2] / [y1, y2] = [x1, x2] * (1/[y1, y2]), where 1 / [y1,y2] = [1 / y2,1 / y1] if 0 not in [y_1, y_2].
+
+      //[4, 6] / [1, 3] = [4/3, 6]
+      Assert.AreEqual(Divide(e, d), new AlgebraicInterval(4.0 / 3.0, 6));
+      //([4, 6] / [1, 3]) / [1, 3] = [4/9, 6]
+      Assert.AreEqual(Divide(Divide(e, d), d), new AlgebraicInterval(4.0 / 9.0, 6));
+      //[4, 6] / [0, 3] = [4/3, +Inf]
+      Assert.AreEqual(Divide(e, c), new AlgebraicInterval(4.0 / 3.0, double.PositiveInfinity));
+      //[-1, 1] / [0, 3] = [+Inf, -Inf]
+      Assert.AreEqual(Divide(a, c), new AlgebraicInterval(double.NegativeInfinity, double.PositiveInfinity));
+      //Devision by 0 ==> IsInfiniteOrUndefined == true
+      
+      //Devision by 0 ==> IsInfiniteOrUndefined == true
+      
+      Assert.AreEqual(Divide(d, b), new AlgebraicInterval(double.NegativeInfinity, double.PositiveInfinity));
+    }
+
+    private AlgebraicInterval Divide(AlgebraicInterval e, AlgebraicInterval d) {
+      return e.Clone().Div(d);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalSineOperator() {
+      //sine depends on interval
+      //sin([0, 2*pi]) = [-1, 1]
+      Assert.AreEqual(Sine(new AlgebraicInterval(0, 2 * Math.PI)), new AlgebraicInterval(-1, 1));
+      //sin([-pi/2, pi/2]) = [sin(-pi/2), sin(pi/2)]
+      Assert.AreEqual(Sine(new AlgebraicInterval(-1 * Math.PI / 2, Math.PI / 2)), new AlgebraicInterval(-1, 1));
+      //sin([0, pi/2]) = [sin(0), sin(pi/2)]
+      Assert.AreEqual(Sine(new AlgebraicInterval(0, Math.PI / 2)), new AlgebraicInterval(0, 1));
+      //sin([pi, 3*pi/2]) = [sin(pi), sin(3*pi/2)]
+      Assert.AreEqual(Sine(new AlgebraicInterval(Math.PI, 3 * Math.PI / 2)), new AlgebraicInterval(-1, 0));
+      Assert.AreEqual(Sine(new AlgebraicInterval(1, 2)), new AlgebraicInterval(Math.Min(Math.Sin(1), Math.Sin(2)), 1));
+      Assert.AreEqual(Sine(new AlgebraicInterval(1, 3)), new AlgebraicInterval(Math.Min(Math.Sin(1), Math.Sin(3)), 1));
+      Assert.AreEqual(Sine(new AlgebraicInterval(Math.PI, 5 * Math.PI / 2)), new AlgebraicInterval(-1, 1));
+    }
+
+    private AlgebraicInterval Sine(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.Sin();
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalCosineOperator() {
+      //Cosine uses sine Sine(Subtract(a, new AlgebraicInterval(Math.PI / 2, Math.PI / 2)));
+      Assert.AreEqual(Cosine(new AlgebraicInterval(0, 2 * Math.PI)), new AlgebraicInterval(-1, 1));
+      Assert.AreEqual(new AlgebraicInterval(-1, 1), Cosine(new AlgebraicInterval(Math.PI, 4 * Math.PI / 2)));
+    }
+
+    private AlgebraicInterval Cosine(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.Cos();
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalLogOperator() {
+      //Log([3, 5]) = [log(3), log(5)]
+      Assert.AreEqual(new AlgebraicInterval(Math.Log(3), Math.Log(5)), Logarithm(new AlgebraicInterval(3, 5)));
+      //Log([0.5, 1]) = [log(0.5), log(1)]
+      Assert.AreEqual(new AlgebraicInterval(Math.Log(0.5), 0), Logarithm(new AlgebraicInterval(0.5, 1)));
+      //Log([-1, 5]) = [NaN, log(5)]
+      var result = Logarithm(new AlgebraicInterval(-1, 5));
+      Assert.AreEqual(new AlgebraicInterval(double.NaN, Math.Log(5)),result);
+      
+    }
+
+    private AlgebraicInterval Logarithm(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.Log();
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalExpOperator() {
+      //Exp([0, 1]) = [exp(0), exp(1)]
+      Assert.AreEqual(new AlgebraicInterval(1, Math.Exp(1)), Exponential(new AlgebraicInterval(0, 1)));
+    }
+
+    private AlgebraicInterval Exponential(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.Exp();
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalSqrOperator() {
+      Assert.AreEqual(new AlgebraicInterval(1, 4), Square(new AlgebraicInterval(1, 2)));
+      Assert.AreEqual(new AlgebraicInterval(1, 4), Square(new AlgebraicInterval(-2, -1)));
+      Assert.AreEqual(new AlgebraicInterval(0, 4), Square(new AlgebraicInterval(-2, 2)));
+    }
+
+    private AlgebraicInterval Square(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.IntPower(2);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalSqrtOperator() {
+      Assert.AreEqual(new AlgebraicInterval(1, 2), SquareRoot(new AlgebraicInterval(1, 4)));
+      Assert.AreEqual(new AlgebraicInterval(double.NaN, double.NaN), SquareRoot(new AlgebraicInterval(-4, -1)));
+    }
+
+    private AlgebraicInterval SquareRoot(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.IntRoot(2);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalCubeOperator() {
+      Assert.AreEqual(new AlgebraicInterval(1, 8), Cube(new AlgebraicInterval(1, 2)));
+      Assert.AreEqual(new AlgebraicInterval(-8, -1), Cube(new AlgebraicInterval(-2, -1)));
+      Assert.AreEqual(new AlgebraicInterval(-8, 8), Cube(new AlgebraicInterval(-2, 2)));
+    }
+
+    private AlgebraicInterval Cube(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.IntPower(3);
+    }
+
+    [TestMethod]
+    [TestCategory("Problems.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void TestIntervalCbrtOperator() {
+      Assert.AreEqual(new AlgebraicInterval(1, 2), CubicRoot(new AlgebraicInterval(1, 8)));
+      Assert.AreEqual(new AlgebraicInterval(double.NaN, double.NaN), CubicRoot(new AlgebraicInterval(-8, -1)));
+    }
+
+    private AlgebraicInterval CubicRoot(AlgebraicInterval algebraicInterval) {
+      return algebraicInterval.IntRoot(3);
+    }
+  }
+}
Index: /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Tests.csproj
===================================================================
--- /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 17204)
+++ /branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 17205)
@@ -292,4 +292,8 @@
       <HintPath>..\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
       <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Extensions-0.1, Version=0.1.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Extensions-0.1.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4">
@@ -593,4 +597,5 @@
     <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\ClassificationVariableImpactCalculationTest.cs" />
     <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\DatasetTest.cs" />
+    <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\AutoDiffIntervalTest.cs" />
     <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\IntervalTest.cs" />
     <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\RegressionVariableImpactCalculationTest.cs" />
@@ -711,11 +716,4 @@
     </EmbeddedResource>
   </ItemGroup>
-  <ItemGroup>
-    <Reference Include="HEAL.Attic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\bin\HEAL.Attic.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
