Changeset 699
- Timestamp:
- 10/27/08 15:13:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/BakedTreeEvaluator.cs
r656 r699 31 31 namespace HeuristicLab.GP.StructureIdentification { 32 32 public class BakedTreeEvaluator { 33 private const int MAX_TREE_SIZE = 4096;34 33 private const double EPSILON = 1.0e-7; 35 34 … … 43 42 } 44 43 45 private Instr[] codeArr;44 private List<Instr> code; 46 45 private int PC; 47 46 private Dataset dataset; … … 50 49 51 50 public BakedTreeEvaluator() { 52 codeArr = new Instr[MAX_TREE_SIZE]; 53 for(int i = 0; i < MAX_TREE_SIZE; i++) { 54 codeArr[i] = new Instr(); 55 } 51 code = new List<Instr>(); 56 52 } 57 53 … … 59 55 this.dataset = dataset; 60 56 List<LightWeightFunction> linearRepresentation = functionTree.LinearRepresentation; 61 int i = 0;57 code.Clear(); 62 58 foreach(LightWeightFunction f in linearRepresentation) { 63 TranslateToInstr(f, codeArr[i++]); 64 } 65 } 66 67 private Instr TranslateToInstr(LightWeightFunction f, Instr instr) { 59 Instr curInstr = new Instr(); 60 TranslateToInstr(f, curInstr); 61 code.Add(curInstr); 62 } 63 } 64 65 private void TranslateToInstr(LightWeightFunction f, Instr instr) { 68 66 instr.arity = f.arity; 69 67 instr.symbol = EvaluatorSymbolTable.MapFunction(f.functionType); … … 85 83 } 86 84 } 87 return instr;88 85 } 89 86 … … 98 95 int i = 1; 99 96 while(i > 0) { 100 i += code Arr[PC++].arity;97 i += code[PC++].arity; 101 98 i--; 102 99 } … … 104 101 105 102 private double EvaluateBakedCode() { 106 Instr currInstr = code Arr[PC++];103 Instr currInstr = code[PC++]; 107 104 switch(currInstr.symbol) { 108 105 case EvaluatorSymbolTable.VARIABLE: {
Note: See TracChangeset
for help on using the changeset viewer.