- Timestamp:
- 03/12/18 08:17:28 (7 years ago)
- Location:
- stable
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
-
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 15766
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/Instruction.cs
r15584 r15836 29 29 public byte opCode; 30 30 // number of arguments of the current instruction 31 public bytenArguments;31 public ushort nArguments; 32 32 // an optional object value (addresses for calls, argument index for arguments) 33 33 public object data; -
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeCompiler.cs
r15584 r15836 63 63 Instruction instr = new Instruction(); 64 64 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; 67 67 instr.opCode = opCodeMapper(node); 68 68 if (node.Symbol is Argument) { -
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeLinearCompiler.cs
r15584 r15836 27 27 var root = tree.Root.GetSubtree(0).GetSubtree(0); 28 28 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) }; 30 31 int c = 1, i = 0; 31 32 foreach (var node in root.IterateNodesBreadth()) { 32 33 for (int j = 0; j < node.SubtreeCount; ++j) { 33 34 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) }; 35 37 } 36 38 code[i].childIndex = c;
Note: See TracChangeset
for help on using the changeset viewer.