Free cookie consent management tool by TermsFeed Policy Generator

Changeset 288


Ignore:
Timestamp:
06/03/08 17:13:38 (16 years ago)
Author:
gkronber
Message:

added code to account for constraints regarding the set of allowed sub-functions

File:
1 edited

Legend:

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

    r286 r288  
    126126        if(d == maxDepth) {
    127127          parent.RemoveSubTree(a);
    128           parent.InsertSubTree(a, RandomSelect(terminals).GetTreeNode());
     128          parent.InsertSubTree(a, RandomSelect(GetAllowedSubFunctions(parent.Function, a).Where(f => IsTerminal(f)).ToArray()).GetTreeNode());
    129129        } else {
    130           IFunction selectedFunction = RandomSelect(functions);
     130          IFunction selectedFunction = RandomSelect(GetAllowedSubFunctions(parent.Function, a).Where(f => !IsTerminal(f)).ToArray());
    131131          IFunctionTree newTree = selectedFunction.GetTreeNode();
    132132          parent.RemoveSubTree(a);
Note: See TracChangeset for help on using the changeset viewer.