Changeset 14423


Ignore:
Timestamp:
11/27/16 12:58:44 (3 years ago)
Author:
gkronber
Message:

#2529: removed caching of traget variable values because it didn't work correctly.

File:
1 edited

Legend:

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

    r14185 r14423  
    4545    }
    4646
    47     [ThreadStatic]
    48     private static double[] targetVariableCache;
    49     [ThreadStatic]
    50     private static List<int> invalidateCacheIndexes;
    51 
    5247    [StorableConstructor]
    5348    private SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(bool deserializing) : base(deserializing) { }
     
    7772      if (CheckExpressionsWithIntervalArithmetic)
    7873        throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
    79       if (targetVariableCache == null || targetVariableCache.GetLength(0) < dataset.Rows)
    80         targetVariableCache = dataset.GetDoubleValues(TargetVariable).ToArray();
    81       if (invalidateCacheIndexes == null)
    82         invalidateCacheIndexes = new List<int>(10);
    8374
    8475      string targetVariable = TargetVariable;
     76      double[] targetVariableCache = dataset.GetDoubleValues(targetVariable).ToArray();
    8577      lock (syncRoot) {
    8678        EvaluatedSolutions++; // increment the evaluated solutions counter
     
    10092          vProgs[i] = Evaluate(dataset, ref localRow, state);
    10193          targetVariableCache[localRow] = vProgs[i];
    102           invalidateCacheIndexes.Add(localRow);
    10394          state.Reset();
    10495        }
    10596        yield return vProgs;
    106 
    107         int j = 0;
    108         foreach (var targetValue in dataset.GetDoubleValues(targetVariable, invalidateCacheIndexes)) {
    109           targetVariableCache[invalidateCacheIndexes[j]] = targetValue;
    110           j++;
    111         }
    112         invalidateCacheIndexes.Clear();
    11397      }
    11498
Note: See TracChangeset for help on using the changeset viewer.