Changeset 289
- Timestamp:
- 06/03/08 17:29:31 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/TreeGardener.cs
r288 r289 128 128 parent.InsertSubTree(a, RandomSelect(GetAllowedSubFunctions(parent.Function, a).Where(f => IsTerminal(f)).ToArray()).GetTreeNode()); 129 129 } else { 130 IFunction selectedFunction = RandomSelect(GetAllowedSubFunctions(parent.Function, a).Where(f => !IsTerminal(f)).ToArray()); 130 IFunction selectedFunction = RandomSelect(GetAllowedSubFunctions(parent.Function, a).Where( 131 f => !IsTerminal(f) && GetMinimalTreeHeight(f) + (d-1) <= maxDepth).ToArray()); 131 132 IFunctionTree newTree = selectedFunction.GetTreeNode(); 132 133 parent.RemoveSubTree(a); … … 153 154 int a = (int)nextExtension[1]; 154 155 int d = (int)nextExtension[2]; 155 IFunction selectedTerminal = RandomSelect(terminals);156 156 parent.RemoveSubTree(a); 157 parent.InsertSubTree(a, selectedTerminal.GetTreeNode());157 parent.InsertSubTree(a, CreateRandomTree(GetAllowedSubFunctions(parent.Function, a), 1, 1)); // append a tree with minimal possible height 158 158 } 159 159 return root;
Note: See TracChangeset
for help on using the changeset viewer.