Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/22/11 19:04:54 (13 years ago)
Author:
gkronber
Message:

#1418 unified size/height vs. length/depth terminology and adapted unit tests for symbolic expression tree encoding version 3.4

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators
Files:
3 edited

Legend:

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

    r5529 r5549  
    101101      ArgumentTreeNode newArgumentNode = MakeArgumentNode(newArgumentIndex);
    102102
    103       // this operation potentially creates very big trees so the access to the size property might throw overflow exception
     103      // this operation potentially creates very big trees so the access to the length property might throw overflow exception
    104104      try {
    105         if (CreateNewArgumentForDefun(random, clonedTree, selectedDefunBranch, newArgumentNode) && clonedTree.Size <= maxTreeLength && clonedTree.Height <= maxTreeDepth) {
     105        if (CreateNewArgumentForDefun(random, clonedTree, selectedDefunBranch, newArgumentNode) && clonedTree.Length <= maxTreeLength && clonedTree.Depth <= maxTreeDepth) {
    106106
    107107          // size constraints are fulfilled
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineCreater.cs

    r5510 r5549  
    8686        // allowed maximum number of ADF reached => abort
    8787        return false;
    88       if (symbolicExpressionTree.Size + 4 > maxTreeLength)
    89         // defining a new function causes an size increase by 4 nodes (max) if the max tree size is reached => abort
     88      if (symbolicExpressionTree.Length + 4 > maxTreeLength)
     89        // defining a new function causes an length increase by 4 nodes (max) if the max tree length is reached => abort
    9090        return false;
    9191      string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefinitions * 10 - 1)).ToString(); // >= 100 functions => ###
     
    9595      // select a random body (either the result producing branch or an ADF branch)
    9696      var bodies = from node in symbolicExpressionTree.Root.SubTrees
    97                    select new { Tree = node, Size = node.GetSize() };
    98       var totalNumberOfBodyNodes = bodies.Select(x => x.Size).Sum();
     97                   select new { Tree = node, Length = node.GetLength() };
     98      var totalNumberOfBodyNodes = bodies.Select(x => x.Length).Sum();
    9999      int r = random.Next(totalNumberOfBodyNodes);
    100100      int aggregatedNumberOfBodyNodes = 0;
    101101      ISymbolicExpressionTreeNode selectedBody = null;
    102102      foreach (var body in bodies) {
    103         aggregatedNumberOfBodyNodes += body.Size;
     103        aggregatedNumberOfBodyNodes += body.Length;
    104104        if (aggregatedNumberOfBodyNodes > r)
    105105          selectedBody = body.Tree;
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDeleter.cs

    r5529 r5549  
    9595        var selectedSymbol = allowedSymbolsList.SelectRandom(weights, random);
    9696
    97         int minPossibleSize = invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol);
    98         int maxSize = Math.Max(minPossibleSize, invocationCutPoint.ReplacedChild.GetSize());
    99         int minPossibleHeight = invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol);
    100         int maxHeight = Math.Max(minPossibleHeight, invocationCutPoint.ReplacedChild.GetHeight());
     97        int minPossibleLength = invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol);
     98        int maxLength = Math.Max(minPossibleLength, invocationCutPoint.ReplacedChild.GetLength());
     99        int minPossibleDepth = invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol);
     100        int maxDepth = Math.Max(minPossibleDepth, invocationCutPoint.ReplacedChild.GetDepth());
    101101        replacementTree = selectedSymbol.CreateTreeNode();
    102102        if (replacementTree.HasLocalParameters)
     
    105105        invocationCutPoint.Parent.InsertSubTree(invocationCutPoint.ReplacedChildIndex, replacementTree);
    106106
    107         ProbabilisticTreeCreator.PTC2(random, replacementTree, maxSize, maxHeight, 0, 0);
     107        ProbabilisticTreeCreator.PTC2(random, replacementTree, maxLength, maxDepth, 0, 0);
    108108
    109109        invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
Note: See TracChangeset for help on using the changeset viewer.