Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3985 for trunk


Ignore:
Timestamp:
06/30/10 15:12:41 (14 years ago)
Author:
gkronber
Message:

Fixed statements that modify the list of sub-trees of a SymbolicExpressionTreeNodes directly. #938

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentCreater.cs

    r3539 r3985  
    136136        // call recursively for all subtree
    137137        List<SymbolicExpressionTreeNode> subtrees = new List<SymbolicExpressionTreeNode>(branch.SubTrees);
    138         while (branch.SubTrees.Count > 0) branch.SubTrees.RemoveAt(0);
     138        while (branch.SubTrees.Count > 0) branch.RemoveSubTree(0);
    139139        foreach (var subtree in subtrees) {
    140140          branch.AddSubTree(ReplaceArgumentsInBranch(subtree, argumentTrees));
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineCreater.cs

    r3539 r3985  
    168168      // remove the subtrees so that we can clone only the root node
    169169      List<SymbolicExpressionTreeNode> subtrees = new List<SymbolicExpressionTreeNode>(node.SubTrees);
    170       while (node.SubTrees.Count > 0) node.SubTrees.RemoveAt(0);
     170      while (node.SubTrees.Count > 0) node.RemoveSubTree(0);
    171171      // recursively apply function for subtrees or append a argument terminal node
    172172      foreach (var subtree in subtrees) {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs

    r3722 r3985  
    7070      string newFunctionName = allowedFunctionNames.Except(UsedFunctionNames(symbolicExpressionTree)).First();
    7171      duplicatedDefunBranch.FunctionName = newFunctionName;
    72       symbolicExpressionTree.Root.SubTrees.Add(duplicatedDefunBranch);
     72      symbolicExpressionTree.Root.AddSubTree(duplicatedDefunBranch);
    7373      duplicatedDefunBranch.Grammar = (ISymbolicExpressionGrammar)selectedBranch.Grammar.Clone();
    7474      // add an invoke symbol for each branch that is allowed to invoke the original function
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r3927 r3985  
    112112      SymbolicExpressionTree tree = new SymbolicExpressionTree(root);
    113113      foreach (SymbolicExpressionTreeNode node in this.simplifiedExpressionTree.IterateNodesPrefix()) {
    114         start.SubTrees.Clear();
     114        while(start.SubTrees.Count > 0) start.RemoveSubTree(0);
    115115        start.AddSubTree(node);
    116116        double constantTreeNodeValue = interpreter.GetSymbolicExpressionTreeValues(tree, Content.ProblemData.Dataset, trainingSamples).Median();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SymbolicSimplifier.cs

    r3904 r3985  
    5353    private SymbolicExpressionTreeNode MacroExpand(SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode node, IList<SymbolicExpressionTreeNode> argumentTrees) {
    5454      List<SymbolicExpressionTreeNode> subtrees = new List<SymbolicExpressionTreeNode>(node.SubTrees);
    55       while (node.SubTrees.Count > 0) node.SubTrees.RemoveAt(0);
     55      while (node.SubTrees.Count > 0) node.RemoveSubTree(0);
    5656      if (node.Symbol is InvokeFunction) {
    5757        var invokeSym = node.Symbol as InvokeFunction;
     
    214214      } else {
    215215        var div = divSymbol.CreateTreeNode();
    216         div.SubTrees.Add(a);
    217         div.SubTrees.Add(b);
     216        div.AddSubTree(a);
     217        div.AddSubTree(b);
    218218        return div;
    219219      }
     
    270270      } else {
    271271        var add = addSymbol.CreateTreeNode();
    272         add.SubTrees.Add(a);
    273         add.SubTrees.Add(b);
     272        add.AddSubTree(a);
     273        add.AddSubTree(b);
    274274        MergeVariables(add);
    275275        return add;
Note: See TracChangeset for help on using the changeset viewer.