Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/13/18 13:31:24 (7 years ago)
Author:
mkommend
Message:

#1973: Adapted symbolic expression tree compilers to allow more than 256 child nodes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeLinearCompiler.cs

    r15583 r15766  
    2727      var root = tree.Root.GetSubtree(0).GetSubtree(0);
    2828      var code = new LinearInstruction[root.GetLength()];
    29       code[0] = new LinearInstruction { dynamicNode = root, nArguments = (byte)root.SubtreeCount, opCode = opCodeMapper(root) };
     29      if (root.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
     30      code[0] = new LinearInstruction { dynamicNode = root, nArguments = (ushort)root.SubtreeCount, opCode = opCodeMapper(root) };
    3031      int c = 1, i = 0;
    3132      foreach (var node in root.IterateNodesBreadth()) {
    3233        for (int j = 0; j < node.SubtreeCount; ++j) {
    3334          var s = node.GetSubtree(j);
    34           code[c + j] = new LinearInstruction { dynamicNode = s, nArguments = (byte)s.SubtreeCount, opCode = opCodeMapper(s) };
     35          if (s.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
     36          code[c + j] = new LinearInstruction { dynamicNode = s, nArguments = (ushort)s.SubtreeCount, opCode = opCodeMapper(s) };
    3537        }
    3638        code[i].childIndex = c;
Note: See TracChangeset for help on using the changeset viewer.