Changeset 148 for branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification/Manipulation
- Timestamp:
- 04/22/08 11:17:08 (17 years ago)
- File:
-
- 1 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)) {
Note: See TracChangeset
for help on using the changeset viewer.