Free cookie consent management tool by TermsFeed Policy Generator

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

added Size and Height properties to interface IFunctionTree and removed the helper methods from TreeGardener (specific implementations of size and height properties in classes implementing IFunctionTree can be more efficient than the general functions in TreeGardener)

File:
1 edited

Legend:

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

    r238 r324  
    6565
    6666        // update the variables in the scope with the new values
    67         GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(newTree);
    68         GetVariableValue<IntData>("TreeHeight", scope, true).Data = gardener.GetTreeHeight(newTree);
     67        GetVariableValue<IntData>("TreeSize", scope, true).Data = newTree.Size;
     68        GetVariableValue<IntData>("TreeHeight", scope, true).Data = newTree.Height;
    6969        scope.GetVariable(scope.TranslateName("FunctionTree")).Value = newTree;
    7070       
     
    8686        int parentLevel = gardener.GetBranchLevel(root, parent);
    8787        int maxSubTreeHeight = maxTreeHeight - parentLevel;
    88         int maxSubTreeSize = maxTreeSize - (treeSize - gardener.GetTreeSize(parent.SubTrees[childIndex]));
     88        int maxSubTreeSize = maxTreeSize - (treeSize - parent.SubTrees[childIndex].Size);
    8989
    9090        // create a random function tree
     
    9595        Debug.Assert(gardener.IsValidTree(root));
    9696        // update the values of treeSize and treeHeight
    97         GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(root);
    98         GetVariableValue<IntData>("TreeHeight", scope, true).Data = gardener.GetTreeHeight(root);
     97        GetVariableValue<IntData>("TreeSize", scope, true).Data = root.Size;
     98        GetVariableValue<IntData>("TreeHeight", scope, true).Data = root.Height;
    9999        // the root hasn't changed so we don't need to update
    100100        // return a CompositeOperation that randomly initializes all nodes of the new subtree
Note: See TracChangeset for help on using the changeset viewer.