Changeset 17293 for branches/2994-AutoDiffForIntervals
- Timestamp:
- 10/02/19 17:03:17 (5 years ago)
- Location:
- branches/2994-AutoDiffForIntervals/HeuristicLab.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/AutoDiffIntervalTest.cs
r17290 r17293 1 1 using System; 2 using System.Collections.Generic; 2 3 using HeuristicLab.Problems.DataAnalysis.Symbolic; 3 4 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 31 32 Assert.IsTrue(double.IsNaN(b.LowerBound.Value)); 32 33 } else { 33 Assert.AreEqual(a.LowerBound.Value.Value, b.LowerBound.Value.Value, 1e-10);34 Assert.AreEqual(a.LowerBound.Value.Value, b.LowerBound.Value.Value, Math.Abs(a.LowerBound.Value.Value)*1e-4); // relative error < 0.1% 34 35 } 35 36 … … 37 38 Assert.IsTrue(double.IsNaN(b.UpperBound.Value)); 38 39 } else { 39 Assert.AreEqual(a.UpperBound.Value.Value, b.UpperBound.Value.Value, 1e-10);40 Assert.AreEqual(a.UpperBound.Value.Value, b.UpperBound.Value.Value, Math.Abs(a.UpperBound.Value.Value) * 1e-4); 40 41 } 41 42 } -
branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/AutoDiffIntervalInterpreterTest.cs
r17288 r17293 209 209 EvaluateTest("sqr(R/r)", new Interval(0.2 * 0.2 / (0.8 * 0.8), 0.5 * 0.5 / (0.5 * 0.5)), dataIntervals); 210 210 } 211 212 213 214 [TestMethod] 215 [TestCategory("Problems.DataAnalysis")] 216 [TestProperty("Time", "short")] 217 public void TestExpressions() { 218 var parser = new InfixExpressionParser(); 219 var evaluator = new IntervalEvaluator(); 220 var intervals = new Dictionary<string, Interval>() { 221 {"x", new Interval(1, 2) } 222 }; 223 224 var t = parser.Parse("SQR(EXP(CUBE((2.10981074965936*'x'))))"); 225 var r = evaluator.Evaluate(t, intervals); 226 AssertInterval(143638040.396283, 1.81198989971641E+65, r); 227 } 228 229 private void AssertInterval(double expectedLow, double expectedHigh, Interval r) { 230 Assert.AreEqual(expectedLow, r.LowerBound, Math.Abs(expectedLow * 1e-5)); 231 Assert.AreEqual(expectedHigh, r.UpperBound, Math.Abs(expectedHigh* 1e-5)); 232 } 211 233 } 212 234 }
Note: See TracChangeset
for help on using the changeset viewer.