Changeset 18087 for branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
- Timestamp:
- 11/19/21 16:16:54 (3 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Tests
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
r17226 r18087 274 274 [TestProperty("Time", "long")] 275 275 public void TestCompiledInterpreterEstimatedValuesConsistency() { 276 const double delta = 1e- 12;276 const double delta = 1e-8; 277 277 278 278 var twister = new MersenneTwister(); … … 288 288 grammar.ConfigureAsDefaultRegressionGrammar(); 289 289 grammar.Symbols.First(x => x.Name == "Power Functions").Enabled = true; 290 grammar.Symbols.First(x => x is Cube).Enabled = true; 291 grammar.Symbols.First(x => x is CubeRoot).Enabled = true; 292 grammar.Symbols.First(x => x is Square).Enabled = true; 293 grammar.Symbols.First(x => x is SquareRoot).Enabled = true; 294 grammar.Symbols.First(x => x is Absolute).Enabled = true; 295 grammar.Symbols.First(x => x is Sine).Enabled = true; 296 grammar.Symbols.First(x => x is Cosine).Enabled = true; 297 grammar.Symbols.First(x => x is Tangent).Enabled = true; 298 grammar.Symbols.First(x => x is Root).Enabled = false; 299 grammar.Symbols.First(x => x is Power).Enabled = false; 290 300 291 301 var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 10, 0, 0); … … 311 321 var v2 = valuesMatrix[n][row]; 312 322 if (double.IsNaN(v1) && double.IsNaN(v2)) continue; 313 if ( Math.Abs(v1 - v2) >delta) {323 if (v1 != v2 && Math.Abs(1.0 - v1 / v2) >= delta) { 314 324 Console.WriteLine(formatter.Format(tree)); 315 325 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList()) { … … 339 349 } 340 350 string errorMessage = string.Format("Interpreters {0} and {1} do not agree on tree {2} and row {3} (seed = {4}).", interpreters[m].Name, interpreters[n].Name, i, row, seed); 341 Assert.AreEqual(v1, v2, delta, errorMessage); 351 Assert.IsTrue(double.IsNaN(v1) && double.IsNaN(v2) || 352 v1 == v2 || // in particular 0 = 0 353 Math.Abs(1.0 - v1 / v2) < delta, errorMessage); 342 354 } 343 355 }
Note: See TracChangeset
for help on using the changeset viewer.