Changeset 5686 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
- Timestamp:
- 03/15/11 13:34:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
r5580 r5686 29 29 [StorableClass] 30 30 [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")] 31 public class ArithmeticExpressionGrammar : DefaultSymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {31 public class ArithmeticExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar { 32 32 33 33 [StorableConstructor] … … 59 59 60 60 foreach (var funSymb in functionSymbols) { 61 SetMinSubtreeCount(funSymb, 1); 62 SetMaxSubtreeCount(funSymb, 3); 61 SetSubtreeCount(funSymb, 1, 3); 63 62 } 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); 68 65 69 66 // allow each symbol as child of the start symbol 70 67 foreach (var symb in allSymbols) { 71 SetAllowedChild(StartSymbol, symb, 0);68 AddAllowedChildSymbol(StartSymbol, symb); 72 69 } 73 70 74 71 // 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); 80 75 } 81 76 }
Note: See TracChangeset
for help on using the changeset viewer.