Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/18 10:44:54 (7 years ago)
Author:
lkammere
Message:

#2886: Remove nested divisions from grammar and hashing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Grammar.cs

    r15794 r15795  
    2727    public NonterminalSymbol SimpleTerm;
    2828
     29    public NonterminalSymbol InvExpr;
     30    public NonterminalSymbol InvTerm;
     31
    2932    public TerminalSymbol Addition;
    3033    public TerminalSymbol Multiplication;
     
    7477      SimpleTerm = new NonterminalSymbol("SimpleTerm");
    7578
     79      InvExpr = new NonterminalSymbol("InvExpr");
     80      InvTerm = new NonterminalSymbol("InvTerm");
     81
    7682      Addition = new TerminalSymbol("+");
    7783      Multiplication = new TerminalSymbol("*");
     
    9399
    94100      Term.AddProduction(Factor, Term, Multiplication);
    95       Term.AddProduction(Expr, Inv, Term, Multiplication);
    96101      Term.AddProduction(Factor);
     102      Term.AddProduction(InvExpr, Inv);
    97103
    98104      Factor.AddProduction(Var);
     
    110116      SimpleTerm.AddProduction(Var, SimpleTerm, Multiplication);
    111117      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);
    112124      #endregion
    113125
     
    137149
    138150      Stack<Symbol> parseStack = new Stack<Symbol>(sentence);
    139       CancelOutCompoundInverse(parseStack);
    140151
    141152      Symbol peek = parseStack.Peek();
     
    145156
    146157    private string[] GetSubtreeHashes(Stack<Symbol> parseStack) {
    147       CancelOutCompoundInverse(parseStack);
    148158      Symbol currentSymbol = parseStack.Pop();
    149159
     
    237247    }
    238248
     249    /*
    239250    private void CancelOutCompoundInverse(Stack<Symbol> parseStack) {
    240251      // Resolve compound divisions
     
    250261        parseStack.Push(Inv);
    251262      } // else: compound divisions fully cancel out each other.
    252     }
     263    } */
    253264    #endregion
    254265
Note: See TracChangeset for help on using the changeset viewer.