Changeset 5733 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDeleter.cs
- Timestamp:
- 03/17/11 14:07:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDeleter.cs
r5686 r5733 62 62 var selectedDefunBranch = functionDefiningBranches.SelectRandom(random); 63 63 // remove the selected defun 64 int defunSubtreeIndex = symbolicExpressionTree.Root.IndexOfSub Tree(selectedDefunBranch);65 symbolicExpressionTree.Root.RemoveSub Tree(defunSubtreeIndex);64 int defunSubtreeIndex = symbolicExpressionTree.Root.IndexOfSubtree(selectedDefunBranch); 65 symbolicExpressionTree.Root.RemoveSubtree(defunSubtreeIndex); 66 66 67 67 // remove references to deleted function 68 foreach (var subtree in symbolicExpressionTree.Root.Sub Trees.OfType<SymbolicExpressionTreeTopLevelNode>()) {68 foreach (var subtree in symbolicExpressionTree.Root.Subtrees.OfType<SymbolicExpressionTreeTopLevelNode>()) { 69 69 var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>() 70 70 where symb.FunctionName == selectedDefunBranch.FunctionName … … 84 84 // the invocations below it are removed already 85 85 var invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix() 86 from subtree in node.Sub Trees.OfType<InvokeFunctionTreeNode>()86 from subtree in node.Subtrees.OfType<InvokeFunctionTreeNode>() 87 87 where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName 88 88 select new CutPoint(node, subtree)).FirstOrDefault(); … … 101 101 if (replacementTree.HasLocalParameters) 102 102 replacementTree.ResetLocalParameters(random); 103 invocationCutPoint.Parent.RemoveSub Tree(invocationCutPoint.ChildIndex);104 invocationCutPoint.Parent.InsertSub Tree(invocationCutPoint.ChildIndex, replacementTree);103 invocationCutPoint.Parent.RemoveSubtree(invocationCutPoint.ChildIndex); 104 invocationCutPoint.Parent.InsertSubtree(invocationCutPoint.ChildIndex, replacementTree); 105 105 106 106 ProbabilisticTreeCreator.PTC2(random, replacementTree, maxLength, maxDepth); 107 107 108 108 invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix() 109 from subtree in node.Sub Trees.OfType<InvokeFunctionTreeNode>()109 from subtree in node.Subtrees.OfType<InvokeFunctionTreeNode>() 110 110 where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName 111 111 select new CutPoint(node, subtree)).FirstOrDefault();
Note: See TracChangeset
for help on using the changeset viewer.