Changeset 148 for branches/FunctionsAndStructIdRefactoring
- Timestamp:
- 04/22/08 11:17:08 (17 years ago)
- Location:
- branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs
r143 r148 120 120 121 121 // match the sub-trees of the child with the allowed sub-trees of the parent 122 IFunction [] possibleChilds = gardener.GetAllowedSubFunctions(parent.Function, childIndex).SelectMany(allowedFun => child.SubTrees123 .Where(subTree => allowedFun == subTree.Function)). Select(t=>t.Function).ToArray(); // Actually we should probably use OperatorEqualityComparer here (gkronber 21.04.08)122 IFunctionTree[] possibleChilds = gardener.GetAllowedSubFunctions(parent.Function, childIndex).SelectMany(allowedFun => child.SubTrees 123 .Where(subTree => allowedFun == subTree.Function)).ToArray(); // Actually we should probably use OperatorEqualityComparer here (gkronber 21.04.08) 124 124 125 125 if (possibleChilds.Length > 0) { 126 126 // replace child with a random child of the child 127 127 // make a clone to simplify removing obsolete branches from the function-tree 128 IFunction selectedChild = possibleChilds[random.Next(possibleChilds.Length)];128 IFunctionTree selectedChild = possibleChilds[random.Next(possibleChilds.Length)]; 129 129 parent.RemoveSubTree(childIndex); 130 parent.InsertSubTree(childIndex, new FunctionTree(selectedChild));130 parent.InsertSubTree(childIndex, selectedChild); 131 131 132 132 if (!gardener.IsValidTree(root)) { -
branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification/TreeGardener.cs
r145 r148 329 329 int max = ((NumberOfSubOperatorsConstraint)constraint).MaxOperators.Data; 330 330 int min = ((NumberOfSubOperatorsConstraint)constraint).MinOperators.Data; 331 if(tree.SubTrees.Count < min || tree.SubTrees.Count > max) return false; 331 if(tree.SubTrees.Count < min || tree.SubTrees.Count > max) 332 return false; 332 333 } 333 334 }
Note: See TracChangeset
for help on using the changeset viewer.