Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/20/08 11:06:11 (16 years ago)
Author:
gkronber
Message:

refactoring: removed method GetMinMaxArity in TreeGardener (#263 (List of allowed sub-functions for each function should be cached))

Location:
trunk/sources/HeuristicLab.StructureIdentification/Manipulation
Files:
2 edited

Legend:

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

    r324 r526  
    152152      // try to make a tree with the same arity as the old child.
    153153      int actualArity = child.SubTrees.Count;
    154       // arity of the selected operator
    155       int minArity;
    156       int maxArity;
    157154      // create a new tree-node for a randomly selected function
    158155      IFunction selectedFunction = allowedFunctions[random.Next(allowedFunctions.Count)];
    159       gardener.GetMinMaxArity(selectedFunction, out minArity, out maxArity);
     156      // arity of the selected operator
     157      int minArity = selectedFunction.MinArity;
     158      int maxArity = selectedFunction.MaxArity;
    160159      // if the old child had too many sub-trees then the new child should keep as many sub-trees as possible
    161160      if (actualArity > maxArity)
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/DeleteSubTreeManipulation.cs

    r324 r526  
    7474      // select a branch to prune
    7575      int childIndex = random.Next(parent.SubTrees.Count);
    76       int min;
    77       int max;
    78       gardener.GetMinMaxArity(parent.Function, out min, out max);
    79       if(parent.SubTrees.Count > min) {
     76      if(parent.SubTrees.Count > parent.Function.MinArity) {
    8077        parent.RemoveSubTree(childIndex);
    8178        // actually since the next sub-trees are shifted in the place of the removed branch
Note: See TracChangeset for help on using the changeset viewer.