Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/05/12 19:00:39 (11 years ago)
Author:
gkronber
Message:

#1081: locking for update of evaluated solutions in interpreter and added cloning for fields in result collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisExpressionTreeInterpreter.cs

    r8798 r9004  
    8282
    8383      string targetVariable = TargetVariable;
    84       EvaluatedSolutions.Value++; // increment the evaluated solutions counter
    85       var state = PrepareInterpreterState(tree, dataset, targetVariableCache);
     84      lock (EvaluatedSolutions) {
     85        EvaluatedSolutions.Value++; // increment the evaluated solutions counter
     86      }
     87      var state = PrepareInterpreterState(tree, dataset, targetVariableCache, TargetVariable);
    8688      var rowsEnumerator = rows.GetEnumerator();
    8789      var horizonsEnumerator = horizons.GetEnumerator();
     
    114116    }
    115117
    116     private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset, double[] targetVariableCache) {
     118    private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset, double[] targetVariableCache, string targetVariable) {
    117119      Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
    118120      int necessaryArgStackSize = 0;
     
    120122        if (instr.opCode == OpCodes.Variable) {
    121123          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
    122           if (variableTreeNode.VariableName == TargetVariable)
     124          if (variableTreeNode.VariableName == targetVariable)
    123125            instr.iArg0 = targetVariableCache;
    124126          else
     
    126128        } else if (instr.opCode == OpCodes.LagVariable) {
    127129          var variableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    128           if (variableTreeNode.VariableName == TargetVariable)
     130          if (variableTreeNode.VariableName == targetVariable)
    129131            instr.iArg0 = targetVariableCache;
    130132          else
     
    132134        } else if (instr.opCode == OpCodes.VariableCondition) {
    133135          var variableTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    134           if (variableTreeNode.VariableName == TargetVariable)
     136          if (variableTreeNode.VariableName == targetVariable)
    135137            instr.iArg0 = targetVariableCache;
    136138          else
Note: See TracChangeset for help on using the changeset viewer.