Free cookie consent management tool by TermsFeed Policy Generator

Changeset 452 for trunk


Ignore:
Timestamp:
08/05/08 16:51:35 (16 years ago)
Author:
gkronber
Message:

fixed a bug that caused generation of invalid individuals (#225)

File:
1 edited

Legend:

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

    r451 r452  
    104104
    105105    internal IFunctionTree PTC2(IRandom random, IFunction rootF, int size, int maxDepth) {
    106       if(size <= 1 || maxDepth <= 1) return RandomSelect(terminals).GetTreeNode();
     106      IFunctionTree root = rootF.GetTreeNode();
     107      if(size <= 1 || maxDepth <= 1) return root;
    107108      List<object[]> list = new List<object[]>();
    108       IFunctionTree root = rootF.GetTreeNode();
    109 
    110109      int currentSize = 1;
    111110      int totalListMinSize = 0;
     
    167166        int d = (int)nextExtension[2];
    168167        parent.RemoveSubTree(a);
    169         parent.InsertSubTree(a, CreateRandomTree(GetAllowedSubFunctions(parent.Function, a), 1, 1)); // append a tree with minimal possible height
     168        parent.InsertSubTree(a,
     169          CreateRandomTree(GetAllowedSubFunctions(parent.Function, a), 1, 1)); // append a tree with minimal possible height
    170170      }
    171171      return root;
     
    200200      // build the tree
    201201      IFunctionTree root;
    202       root = PTC2(random, selectedFunction, maxTreeSize - 1, maxTreeHeight - 1);
     202      root = PTC2(random, selectedFunction, maxTreeSize, maxTreeHeight);
    203203      return root;
    204204    }
Note: See TracChangeset for help on using the changeset viewer.