Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/26/10 16:18:45 (14 years ago)
Author:
gkronber
Message:

Fixed bugs in SubtreeCrossover, ArgumentCreater and ArgumentDuplicater and updated unit tests for symbolic expression tree operators. #1103

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs

    r4068 r4106  
    9090    private static bool IsMatchingPointType(SymbolicExpressionTreeNode parent, int replacedSubtreeIndex, SymbolicExpressionTreeNode branch) {
    9191      // check syntax constraints of direct parent - child relation
    92       if (!parent.Grammar.IsAllowedChild(parent.Symbol, branch.Symbol, replacedSubtreeIndex)) return false;
     92      if (!parent.Grammar.ContainsSymbol(branch.Symbol) ||
     93          !parent.Grammar.IsAllowedChild(parent.Symbol, branch.Symbol, replacedSubtreeIndex)) return false;
    9394
    9495      bool result = true;
     
    9798        result =
    9899          result &&
     100          parent.Grammar.ContainsSymbol(n.Symbol) &&
    99101          n.SubTrees.Count >= parent.Grammar.GetMinSubtreeCount(n.Symbol) &&
    100           n.SubTrees.Count <= parent.Grammar.GetMaxSubtreeCount(n.Symbol) &&
    101           parent.Grammar.ContainsSymbol(n.Symbol);
     102          n.SubTrees.Count <= parent.Grammar.GetMaxSubtreeCount(n.Symbol);
    102103      });
    103104      return result;
Note: See TracChangeset for help on using the changeset viewer.