Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/17/11 14:07:47 (13 years ago)
Author:
mkommend
Message:

#1418: Corrected problem interfaces & unified naming of subtrees.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDeleter.cs

    r5686 r5733  
    6262      var selectedDefunBranch = functionDefiningBranches.SelectRandom(random);
    6363      // remove the selected defun
    64       int defunSubtreeIndex = symbolicExpressionTree.Root.IndexOfSubTree(selectedDefunBranch);
    65       symbolicExpressionTree.Root.RemoveSubTree(defunSubtreeIndex);
     64      int defunSubtreeIndex = symbolicExpressionTree.Root.IndexOfSubtree(selectedDefunBranch);
     65      symbolicExpressionTree.Root.RemoveSubtree(defunSubtreeIndex);
    6666
    6767      // remove references to deleted function
    68       foreach (var subtree in symbolicExpressionTree.Root.SubTrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
     68      foreach (var subtree in symbolicExpressionTree.Root.Subtrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
    6969        var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
    7070                                    where symb.FunctionName == selectedDefunBranch.FunctionName
     
    8484      // the invocations below it are removed already
    8585      var invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
    86                                 from subtree in node.SubTrees.OfType<InvokeFunctionTreeNode>()
     86                                from subtree in node.Subtrees.OfType<InvokeFunctionTreeNode>()
    8787                                where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName
    8888                                select new CutPoint(node, subtree)).FirstOrDefault();
     
    101101        if (replacementTree.HasLocalParameters)
    102102          replacementTree.ResetLocalParameters(random);
    103         invocationCutPoint.Parent.RemoveSubTree(invocationCutPoint.ChildIndex);
    104         invocationCutPoint.Parent.InsertSubTree(invocationCutPoint.ChildIndex, replacementTree);
     103        invocationCutPoint.Parent.RemoveSubtree(invocationCutPoint.ChildIndex);
     104        invocationCutPoint.Parent.InsertSubtree(invocationCutPoint.ChildIndex, replacementTree);
    105105
    106106        ProbabilisticTreeCreator.PTC2(random, replacementTree, maxLength, maxDepth);
    107107
    108108        invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
    109                               from subtree in node.SubTrees.OfType<InvokeFunctionTreeNode>()
     109                              from subtree in node.Subtrees.OfType<InvokeFunctionTreeNode>()
    110110                              where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName
    111111                              select new CutPoint(node, subtree)).FirstOrDefault();
Note: See TracChangeset for help on using the changeset viewer.