Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/03/15 00:03:18 (9 years ago)
Author:
aballeit
Message:

#2283 limit parallelism

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeNode.cs

    r12762 r12832  
    1414        public string phrase;
    1515        public TreeNode parent;
    16         public List<TreeNode> children;
     16        public TreeNode[] children;
    1717        public IBanditPolicyActionInfo actionInfo;
    18         public int level;
     18        public ushort level;
    1919
    20         public TreeNode(TreeNode parent, string phrase, IBanditPolicyActionInfo actionInfo, int level)
     20        public TreeNode(TreeNode parent, string phrase, IBanditPolicyActionInfo actionInfo, ushort level)
    2121        {
    2222            this.parent = parent;
     
    3434            return children.Select(n => n.actionInfo);
    3535        }
     36
     37        internal void RemoveChildren(TreeNode currentNode)
     38        {
     39            TreeNode[] newChildren = new TreeNode[children.Length-1];
     40            int counter = 0;
     41            for (int i = 0; i < children.Length; i++)
     42            {
     43                if (children[i] != currentNode)
     44                {
     45                    newChildren[counter] = children[i];
     46                    counter++;
     47                }
     48            }
     49            children = newChildren;
     50        }
    3651    }
    3752}
Note: See TracChangeset for help on using the changeset viewer.