- Timestamp:
- 07/27/10 00:07:36 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Interpretation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Interpretation/ITreeInterpreter.cs
r4089 r4108 26 26 namespace HeuristicLab.Problems.ExternalEvaluation.GP { 27 27 public interface ISymbolicExpressionTreeInterpreter : IItem { 28 double InterpretTree(SymbolicExpressionTree tree, Dictionary<string, double> variables); 28 void Prepare(SymbolicExpressionTree tree); 29 double InterpretTree(Dictionary<string, double> variables); 29 30 } 30 31 } -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Interpretation/TreeInterpreter.cs
r4089 r4108 92 92 private Instruction[] code; 93 93 private int pc; 94 94 95 95 public override bool CanChangeName { 96 96 get { return false; } … … 104 104 } 105 105 106 public double InterpretTree(SymbolicExpressionTree tree, Dictionary<string, double> variables) { 107 this.variables = variables; 106 public void Prepare(SymbolicExpressionTree tree) { 108 107 var compiler = new SymbolicExpressionTreeCompiler(); 109 108 code = compiler.Compile(tree, MapSymbolToOpCode); 109 } 110 111 public double InterpretTree(Dictionary<string, double> variables) { 112 this.variables = variables; 110 113 pc = 0; 111 114 argStackPointer = 0; … … 123 126 private int argStackPointer; 124 127 125 p ublicdouble Evaluate() {128 private double Evaluate() { 126 129 var currentInstr = code[pc++]; 127 130 switch (currentInstr.opCode) {
Note: See TracChangeset
for help on using the changeset viewer.