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.ArtificialAnt/3.4/ArtificialAntExpressionGrammar.cs

    r5517 r5686  
    2828namespace HeuristicLab.Problems.ArtificialAnt {
    2929  [StorableClass]
    30   public class ArtificialAntExpressionGrammar : DefaultSymbolicExpressionGrammar {
     30  public class ArtificialAntExpressionGrammar : SymbolicExpressionGrammar {
    3131
    3232    public ArtificialAntExpressionGrammar()
     
    5353
    5454      allSymbols.ForEach(s => AddSymbol(s));
    55       SetMinSubtreeCount(ifFoodAhead, 2);
    56       SetMaxSubtreeCount(ifFoodAhead, 2);
    57       SetMinSubtreeCount(prog2, 2);
    58       SetMaxSubtreeCount(prog2, 2);
    59       SetMinSubtreeCount(prog3, 3);
    60       SetMaxSubtreeCount(prog3, 3);
    61       SetMinSubtreeCount(move, 0);
    62       SetMaxSubtreeCount(move, 0);
    63       SetMinSubtreeCount(left, 0);
    64       SetMaxSubtreeCount(left, 0);
    65       SetMinSubtreeCount(right, 0);
    66       SetMaxSubtreeCount(right, 0);
     55      SetSubtreeCount(ifFoodAhead, 2, 3);
     56      SetSubtreeCount(prog2, 2, 2);
     57      SetSubtreeCount(prog3, 3, 3);
     58      SetSubtreeCount(move, 0, 0);
     59      SetSubtreeCount(left, 0, 0);
     60      SetSubtreeCount(right, 0, 0);
    6761
    6862      // each symbols is allowed as child of the start symbol
    69       allSymbols.ForEach(s => SetAllowedChild(StartSymbol, s, 0));
     63      allSymbols.ForEach(s => AddAllowedChildSymbol(StartSymbol, s));
     64      allSymbols.ForEach(s => AddAllowedChildSymbol(DefunSymbol, s));
    7065
    7166      // each symbol is allowed as child of all other symbols (except for terminals that have MaxSubtreeCount == 0
    72       foreach (var parent in allSymbols) {
    73         for (int argIndex = 0; argIndex < GetMaxSubtreeCount(parent); argIndex++) {
    74           foreach (var child in allSymbols) {
    75             SetAllowedChild(parent, child, argIndex);
    76           }
     67      foreach (var parent in nonTerminalSymbols) {
     68        foreach (var child in allSymbols) {
     69          AddAllowedChildSymbol(parent, child);
    7770        }
    7871      }
Note: See TracChangeset for help on using the changeset viewer.