Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/28/15 17:50:53 (9 years ago)
Author:
gkronber
Message:

#2471

  • implemented a demo for value approximation with gbt and a trivial feature function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/SearchTree.cs

    r12923 r12924  
    88namespace HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction {
    99  internal class SearchTree<TValue> {
    10     private class Node<TValue> {
     10    private class Node {
    1111      internal TValue value;
    12       internal Node<TValue> parent;
    13       internal Node<TValue>[] children;
     12      internal Node parent;
     13      internal Node[] children;
    1414      // children == null -> never visited
    1515      // children[i] != null -> visited at least once, still allowed
     
    1717    }
    1818
    19     private Node<TValue> root;
     19    private Node root;
    2020
    2121    // for iteration
    22     private Node<TValue> currentNode;
     22    private Node currentNode;
    2323
    2424    public SearchTree() {
    25       root = new Node<TValue>();
     25      root = new Node();
    2626      currentNode = root;
    2727    }
     
    3838      Contract.Assert(values.Any());
    3939      Contract.Assert(currentNode.children == null);
    40       currentNode.children = values.Select(val => new Node<TValue>() { value = val, parent = currentNode }).ToArray();
     40      currentNode.children = values.Select(val => new Node() { value = val, parent = currentNode }).ToArray();
    4141    }
    4242
     
    7171    }
    7272
    73     private void RemoveRecursively(Node<TValue> node) {
     73    private void RemoveRecursively(Node node) {
    7474      // when the last child has been removed we must remove the current node from it's parent
    7575      while (node.parent != null && node.children.All(ch => ch == null)) {
Note: See TracChangeset for help on using the changeset viewer.