Changeset 15795
- Timestamp:
- 02/21/18 10:44:54 (7 years ago)
- Location:
- branches/2886_SymRegGrammarEnumeration
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Grammar.cs
r15794 r15795 27 27 public NonterminalSymbol SimpleTerm; 28 28 29 public NonterminalSymbol InvExpr; 30 public NonterminalSymbol InvTerm; 31 29 32 public TerminalSymbol Addition; 30 33 public TerminalSymbol Multiplication; … … 74 77 SimpleTerm = new NonterminalSymbol("SimpleTerm"); 75 78 79 InvExpr = new NonterminalSymbol("InvExpr"); 80 InvTerm = new NonterminalSymbol("InvTerm"); 81 76 82 Addition = new TerminalSymbol("+"); 77 83 Multiplication = new TerminalSymbol("*"); … … 93 99 94 100 Term.AddProduction(Factor, Term, Multiplication); 95 Term.AddProduction(Expr, Inv, Term, Multiplication);96 101 Term.AddProduction(Factor); 102 Term.AddProduction(InvExpr, Inv); 97 103 98 104 Factor.AddProduction(Var); … … 110 116 SimpleTerm.AddProduction(Var, SimpleTerm, Multiplication); 111 117 SimpleTerm.AddProduction(Var); 118 119 InvExpr.AddProduction(InvTerm, InvExpr, Addition); 120 InvExpr.AddProduction(InvTerm); 121 122 InvTerm.AddProduction(Factor, InvTerm, Multiplication); 123 InvTerm.AddProduction(Factor); 112 124 #endregion 113 125 … … 137 149 138 150 Stack<Symbol> parseStack = new Stack<Symbol>(sentence); 139 CancelOutCompoundInverse(parseStack);140 151 141 152 Symbol peek = parseStack.Peek(); … … 145 156 146 157 private string[] GetSubtreeHashes(Stack<Symbol> parseStack) { 147 CancelOutCompoundInverse(parseStack);148 158 Symbol currentSymbol = parseStack.Pop(); 149 159 … … 237 247 } 238 248 249 /* 239 250 private void CancelOutCompoundInverse(Stack<Symbol> parseStack) { 240 251 // Resolve compound divisions … … 250 261 parseStack.Push(Inv); 251 262 } // else: compound divisions fully cancel out each other. 252 } 263 } */ 253 264 #endregion 254 265 -
branches/2886_SymRegGrammarEnumeration/Test/TreeHashingTest.cs
r15791 r15795 132 132 } 133 133 134 /* DEPRECATED; SINCE WE DO NOT ALLOW COMPOUND DIVISIONS 134 135 [TestMethod] 135 136 [TestCategory("TreeHashing")] … … 158 159 [TestMethod] 159 160 [TestCategory("TreeHashing")] 160 public void a_UncancelableCompoundInverse() {161 public void UncancelableCompoundInverse() { 161 162 // 1 / ( 1/b + sin(a*c) ) 162 163 SymbolString s1 = new SymbolString(new Symbol[] { varB, grammar.Inv, varA, varC, grammar.Multiplication, grammar.Sin, grammar.Addition, grammar.Inv }); … … 168 169 169 170 Assert.AreNotEqual(hash1, hash2); 170 } 171 }*/ 171 172 172 173 #region parser
Note: See TracChangeset
for help on using the changeset viewer.