Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15836


Ignore:
Timestamp:
03/12/18 08:17:28 (7 years ago)
Author:
gkronber
Message:

#1973: merged r15766 from trunk to stable

Location:
stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/Instruction.cs

    r15584 r15836  
    2929    public byte opCode;
    3030    // number of arguments of the current instruction
    31     public byte nArguments;
     31    public ushort nArguments;
    3232    // an optional object value (addresses for calls, argument index for arguments)
    3333    public object data;
  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeCompiler.cs

    r15584 r15836  
    6363        Instruction instr = new Instruction();
    6464        int subtreesCount = node.SubtreeCount;
    65         if (subtreesCount > 255) throw new ArgumentException("Number of subtrees is too big (>255)");
    66         instr.nArguments = (byte)subtreesCount;
     65        if (subtreesCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (> 65.535)");
     66        instr.nArguments = (ushort)subtreesCount;
    6767        instr.opCode = opCodeMapper(node);
    6868        if (node.Symbol is Argument) {
  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeLinearCompiler.cs

    r15584 r15836  
    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.