Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18173 for trunk


Ignore:
Timestamp:
12/27/21 11:00:03 (2 years ago)
Author:
gkronber
Message:

#2938: fixed BottomUpSimilarityCalculatorTest because the parser now parses (a - b) as (- a b) instead of (+ a (- b))

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicExpressionTreeBottomUpSimilarityCalculatorTest.cs

    r18148 r18173  
    77  [TestClass]
    88  public class BottomUpSimilarityCalculatorTest {
    9     private readonly SymbolicExpressionImporter importer = new SymbolicExpressionImporter();
    109    private readonly InfixExpressionParser parser = new InfixExpressionParser();
    1110
     
    1312    private const int Rows = 1;
    1413    private const int Columns = 10;
    15 
    16     public BottomUpSimilarityCalculatorTest() {
    17       var parser = new InfixExpressionParser();
    18     }
    1914
    2015    [TestMethod]
     
    2823
    2924      TestMatchedNodes("1 - 1", "2 - 2", 0, strict: true);
    30       TestMatchedNodes("1 - 1", "2 - 2", 4, strict: false); // 4, because of the way strings are parsed into trees by the infix parser
     25      TestMatchedNodes("1 - 1", "2 - 2", 3, strict: false);
    3126
    3227      TestMatchedNodes("2 - 1", "1 - 2", 2, strict: true);
    33       TestMatchedNodes("2 - 1", "1 - 2", 4, strict: false);
     28      TestMatchedNodes("2 - 1", "1 - 2", 3, strict: false);
    3429
    35       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) + (X3 * X4)", 7, strict: true);
    36       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) + (X3 * X4)", 7, strict: false);
     30      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 + X3 * X4", 7, strict: true);
     31      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 + X3 * X4", 7, strict: false);
    3732
    38       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) + (X5 * X6)", 3, strict: true);
    39       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) + (X5 * X6)", 3, strict: false);
     33      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 + X5 * X6", 3, strict: true);
     34      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 + X5 * X6", 3, strict: false);
    4035
    41       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) - (X5 * X6)", 3, strict: true);
    42       TestMatchedNodes("(X1 * X2) + (X3 * X4)", "(X1 * X2) - (X5 * X6)", 3, strict: false);
     36      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 - X5 * X6", 3, strict: true);
     37      TestMatchedNodes("X1 * X2 + X3 * X4", "X1 * X2 - X5 * X6", 3, strict: false);
    4338
    4439      TestMatchedNodes("SIN(SIN(SIN(X1)))", "SIN(SIN(SIN(X1)))", 4, strict: true);
     
    4742      TestMatchedNodes("SIN(SIN(SIN(X1)))", "COS(COS(COS(X1)))", 1, strict: true);
    4843
    49       const string lhs = "(0.006153 + (X9 * X7 * X2 * 0.229506) + (X6 * X10 * X3 * 0.924598) + (X2 * X1 * 0.951272) + (X4 * X3 * 0.992570) + (X6 * X5 * 1.027299))";
    50       const string rhs = "(0.006153 + (X10 * X7 * X2 * 0.229506) + (X6 * X10 * X3 * 0.924598) + (X2 * X1 * 0.951272) + (X4 * X3 * 0.992570) + (X6 * X5 * 1.027299))";
     44      const string lhs = "0.006153 + X9 * X7 * X2 * 0.229506 + X6 * X10 * X3 * 0.924598 + X2 * X1 * 0.951272 + X4 * X3 * 0.992570 + X6 * X5 * 1.027299";
     45      const string rhs = "0.006153 + X10 * X7 * X2 * 0.229506 + X6 * X10 * X3 * 0.924598 + X2 * X1 * 0.951272 + X4 * X3 * 0.992570 + X6 * X5 * 1.027299";
    5146
    5247      TestMatchedNodes(lhs, lhs, 24, strict: true);
Note: See TracChangeset for help on using the changeset viewer.