Changeset 16141 for branches/2817-BinPackingSpeedup/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler
- Timestamp:
- 09/14/18 11:47:37 (6 years ago)
- Location:
- branches/2817-BinPackingSpeedup
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup
- Property svn:mergeinfo changed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/branches/2839_HiveProjectManagement/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 16057 /trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 15766,16117
- Property svn:mergeinfo changed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/Instruction.cs
r16140 r16141 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; -
branches/2817-BinPackingSpeedup/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeCompiler.cs
r16140 r16141 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) { -
branches/2817-BinPackingSpeedup/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeLinearCompiler.cs
r16140 r16141 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.