Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/10 12:12:29 (14 years ago)
Author:
gkronber
Message:

Changed way the grammar is stored in tree nodes to make it more efficient and fixed bugs in symbolic expression tree operators. #290 (Implement ADFs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureAlteringOperators/SubroutineDeleter.cs

    r3360 r3369  
    6868
    6969      // remove references to deleted function
    70       foreach (var subtree in symbolicExpressionTree.Root.SubTrees) {
     70      foreach (var subtree in symbolicExpressionTree.Root.SubTrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
    7171        var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
    7272                                    where symb.FunctionName == selectedDefunBranch.FunctionName
     
    9999        int minPossibleHeight = invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol);
    100100        int maxHeight = Math.Max(minPossibleHeight, invocationCutPoint.ReplacedChild.GetHeight());
    101 
    102         replacementTree = ProbabilisticTreeCreator.PTC2(random, invocationCutPoint.Parent.Grammar, selectedSymbol, maxSize, maxHeight, 0, 0);
     101        replacementTree = selectedSymbol.CreateTreeNode();
    103102        invocationCutPoint.Parent.RemoveSubTree(invocationCutPoint.ReplacedChildIndex);
    104103        invocationCutPoint.Parent.InsertSubTree(invocationCutPoint.ReplacedChildIndex, replacementTree);
     104
     105        ProbabilisticTreeCreator.PTC2(random, replacementTree, maxSize, maxHeight, 0, 0);
    105106
    106107        invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
Note: See TracChangeset for help on using the changeset viewer.