Free cookie consent management tool by TermsFeed Policy Generator

Changeset 449 for trunk


Ignore:
Timestamp:
08/05/08 15:40:29 (16 years ago)
Author:
gkronber
Message:

Use PTC2 random tree creation for all random-tree-creation-needs except for RampedHalfHalf (which uses MakeBalancedTree and MakeUnbalancedTree) (ticket #225)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/TreeGardener.cs

    r448 r449  
    100100
    101101    internal IFunctionTree PTC2(IRandom random, int size, int maxDepth) {
     102      return PTC2(random, GetRandomRoot(size, maxDepth), size, maxDepth);
     103    }
     104
     105    internal IFunctionTree PTC2(IRandom random, IFunction rootF, int size, int maxDepth) {
    102106      if(size <= 1 || maxDepth <= 1) return RandomSelect(terminals).GetTreeNode();
    103107      List<object[]> list = new List<object[]>();
    104       IFunctionTree root = GetRandomRoot(size, maxDepth).GetTreeNode();
     108      IFunctionTree root = rootF.GetTreeNode();
    105109
    106110      int currentSize = 1;
     
    212216      IFunctionTree root;
    213217      if(balanceTrees) {
    214         root = MakeBalancedTree(selectedFunction, maxTreeHeight - 1);
     218        root = PTC2(random, selectedFunction, maxTreeSize -1, maxTreeHeight - 1);
    215219      } else {
    216         root = MakeUnbalancedTree(selectedFunction, maxTreeHeight - 1);
     220        root = PTC2(random, selectedFunction, maxTreeSize - 1, maxTreeHeight - 1);
    217221      }
    218222      return root;
Note: See TracChangeset for help on using the changeset viewer.