Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/08 14:29:31 (16 years ago)
Author:
gkronber
Message:
  • minor refactoring of TreeGardener
  • added descriptive comments for tree-creation methods
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/ChangeNodeTypeManipulation.cs

    r167 r180  
    128128
    129129    private IFunctionTree ChangeTerminalType(IFunctionTree parent, IFunctionTree child, int childIndex, TreeGardener gardener, MersenneTwister random) {
    130       IList<IFunction> allowedChildren;
     130      IList<IFunction> allowedTerminals;
    131131      if (parent == null) {
    132         allowedChildren = gardener.Terminals;
     132        allowedTerminals = gardener.Terminals;
    133133      } else {
    134         allowedChildren = new List<IFunction>();
     134        allowedTerminals = new List<IFunction>();
    135135        var allAllowedChildren = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
    136136        foreach(IFunction c in allAllowedChildren) {
    137           if(gardener.IsTerminal(c)) allowedChildren.Add(c);
     137          if(gardener.IsTerminal(c)) allowedTerminals.Add(c);
    138138        }
    139139      }
    140140      // selecting from the terminals should always work since the current child was also a terminal
    141141      // so in the worst case we will just create a new terminal of the same type again.
    142       return gardener.CreateRandomTree(allowedChildren[random.Next(allowedChildren.Count)], 1, 1, false);
     142      return gardener.CreateRandomTree(allowedTerminals, 1, 1);
    143143    }
    144144
Note: See TracChangeset for help on using the changeset viewer.