Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/11 17:49:23 (14 years ago)
Author:
gkronber
Message:

#1418 Removed grammar specific members from ISymbolicExpressionTreeNode interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs

    r5521 r5529  
    216216      int argumentIndex, int maxFunctionDefinitions, int maxFunctionArguments) {
    217217      // determine possible symbols that will lead to the smallest possible tree
    218       var possibleSymbols = (from s in parent.GetAllowedSymbols(argumentIndex)
     218      var possibleSymbols = (from s in parent.Grammar.GetAllowedSymbols(parent.Symbol, argumentIndex)
    219219                             group s by parent.Grammar.GetMinExpressionLength(s) into g
    220220                             orderby g.Key
     
    227227      parent.InsertSubTree(argumentIndex, tree);
    228228      InitializeNewTreeNode(random, root, tree, maxFunctionDefinitions, maxFunctionArguments);
    229       for (int i = 0; i < tree.GetMinSubtreeCount(); i++) {
     229      for (int i = 0; i < tree.Grammar.GetMinSubtreeCount(tree.Symbol); i++) {
    230230        // insert a dummy sub-tree and add the pending extension to the list
    231231        var dummy = new SymbolicExpressionTreeNode();
     
    285285    private static int SampleArity(IRandom random, ISymbolicExpressionTreeNode node, int targetSize) {
    286286      // select actualArity randomly with the constraint that the sub-trees in the minimal arity can become large enough
    287       int minArity = node.GetMinSubtreeCount();
    288       int maxArity = node.GetMaxSubtreeCount();
     287      int minArity = node.Grammar.GetMinSubtreeCount(node.Symbol);
     288      int maxArity = node.Grammar.GetMaxSubtreeCount(node.Symbol);
    289289      if (maxArity > targetSize) {
    290290        maxArity = targetSize;
     
    294294      long aggregatedLongestExpressionLength = 0;
    295295      for (int i = 0; i < maxArity; i++) {
    296         aggregatedLongestExpressionLength += (from s in node.GetAllowedSymbols(i)
     296        aggregatedLongestExpressionLength += (from s in node.Grammar.GetAllowedSymbols(node.Symbol, i)
    297297                                              select node.Grammar.GetMaxExpressionLength(s)).Max();
    298298        if (aggregatedLongestExpressionLength < targetSize) minArity = i;
     
    304304      long aggregatedShortestExpressionLength = 0;
    305305      for (int i = 0; i < maxArity; i++) {
    306         aggregatedShortestExpressionLength += (from s in node.GetAllowedSymbols(i)
     306        aggregatedShortestExpressionLength += (from s in node.Grammar.GetAllowedSymbols(node.Symbol, i)
    307307                                               select node.Grammar.GetMinExpressionLength(s)).Min();
    308308        if (aggregatedShortestExpressionLength > targetSize) {
Note: See TracChangeset for help on using the changeset viewer.