- Timestamp:
- 12/27/21 11:00:03 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicExpressionTreeBottomUpSimilarityCalculatorTest.cs
r18148 r18173 7 7 [TestClass] 8 8 public class BottomUpSimilarityCalculatorTest { 9 private readonly SymbolicExpressionImporter importer = new SymbolicExpressionImporter();10 9 private readonly InfixExpressionParser parser = new InfixExpressionParser(); 11 10 … … 13 12 private const int Rows = 1; 14 13 private const int Columns = 10; 15 16 public BottomUpSimilarityCalculatorTest() {17 var parser = new InfixExpressionParser();18 }19 14 20 15 [TestMethod] … … 28 23 29 24 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 parser25 TestMatchedNodes("1 - 1", "2 - 2", 3, strict: false); 31 26 32 27 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); 34 29 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); 37 32 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); 40 35 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); 43 38 44 39 TestMatchedNodes("SIN(SIN(SIN(X1)))", "SIN(SIN(SIN(X1)))", 4, strict: true); … … 47 42 TestMatchedNodes("SIN(SIN(SIN(X1)))", "COS(COS(COS(X1)))", 1, strict: true); 48 43 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"; 51 46 52 47 TestMatchedNodes(lhs, lhs, 24, strict: true);
Note: See TracChangeset
for help on using the changeset viewer.