Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/20/21 18:13:55 (3 years ago)
Author:
dpiringe
Message:

#3026

  • merged trunk into branch
Location:
branches/3026_IntegrationIntoSymSpace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace

  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests

  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r17180 r18027  
    274274    [TestProperty("Time", "long")]
    275275    public void TestCompiledInterpreterEstimatedValuesConsistency() {
    276       const double delta = 1e-12;
     276      const double delta = 1e-8;
    277277
    278278      var twister = new MersenneTwister();
     
    288288      grammar.ConfigureAsDefaultRegressionGrammar();
    289289      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;
    290300
    291301      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 10, 0, 0);
     
    311321              var v2 = valuesMatrix[n][row];
    312322              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) {
    314324                Console.WriteLine(formatter.Format(tree));
    315325                foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList()) {
     
    339349              }
    340350              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);
    342354            }
    343355          }
Note: See TracChangeset for help on using the changeset viewer.