Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/25/09 17:46:17 (15 years ago)
Author:
gkronber
Message:

Fixed #645 (Tree evaluators precompile the model for each evaluation of a row).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs

    r1873 r1891  
    6262    }
    6363
     64    public void PrepareForEvaluation(IFunctionTree functionTree) {
     65      BakedFunctionTree bakedTree = functionTree as BakedFunctionTree;
     66      if (bakedTree == null) throw new ArgumentException("TreeEvaluators can only evaluate BakedFunctionTrees");
     67
     68      List<LightWeightFunction> linearRepresentation = bakedTree.LinearRepresentation;
     69      codeArr = new Instr[linearRepresentation.Count];
     70      int i = 0;
     71      foreach (LightWeightFunction f in linearRepresentation) {
     72        codeArr[i++] = TranslateToInstr(f);
     73      }
     74    }
     75
    6476    private Instr TranslateToInstr(LightWeightFunction f) {
    6577      Instr instr = new Instr();
     
    8698    }
    8799
    88     public double Evaluate(IFunctionTree functionTree, int sampleIndex) {
    89       BakedFunctionTree bakedTree = functionTree as BakedFunctionTree;
    90       if (bakedTree == null) throw new ArgumentException("TreeEvaluators can only evaluate BakedFunctionTrees");
    91 
    92       List<LightWeightFunction> linearRepresentation = bakedTree.LinearRepresentation;
    93       codeArr = new Instr[linearRepresentation.Count];
    94       int i = 0;
    95       foreach (LightWeightFunction f in linearRepresentation) {
    96         codeArr[i++] = TranslateToInstr(f);
    97       }
    98 
     100    public double Evaluate(int sampleIndex) {
    99101      PC = 0;
    100102      this.sampleIndex = sampleIndex;
Note: See TracChangeset for help on using the changeset viewer.