Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 13:34:38 (14 years ago)
Author:
mkommend
Message:

#1418: Finally added results from the grammar refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs

    r5580 r5686  
    2929  [StorableClass]
    3030  [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
    31   public class ArithmeticExpressionGrammar : DefaultSymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
     31  public class ArithmeticExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
    3232
    3333    [StorableConstructor]
     
    5959
    6060      foreach (var funSymb in functionSymbols) {
    61         SetMinSubtreeCount(funSymb, 1);
    62         SetMaxSubtreeCount(funSymb, 3);
     61        SetSubtreeCount(funSymb, 1, 3);
    6362      }
    64       SetMinSubtreeCount(constant, 0);
    65       SetMaxSubtreeCount(constant, 0);
    66       SetMinSubtreeCount(variableSymbol, 0);
    67       SetMaxSubtreeCount(variableSymbol, 0);
     63      SetSubtreeCount(constant, 0, 0);
     64      SetSubtreeCount(variableSymbol, 0, 0);
    6865
    6966      // allow each symbol as child of the start symbol
    7067      foreach (var symb in allSymbols) {
    71         SetAllowedChild(StartSymbol, symb, 0);
     68        AddAllowedChildSymbol(StartSymbol, symb);
    7269      }
    7370
    7471      // allow each symbol as child of every other symbol (except for terminals that have maxSubtreeCount == 0)
    75       foreach (var parent in allSymbols) {
    76         for (int i = 0; i < GetMaxSubtreeCount(parent); i++)
    77           foreach (var child in allSymbols) {
    78             SetAllowedChild(parent, child, i);
    79           }
     72      foreach (var parent in functionSymbols) {
     73        foreach (var child in allSymbols)
     74          AddAllowedChildSymbol(parent, child);
    8075      }
    8176    }
Note: See TracChangeset for help on using the changeset viewer.