Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17402 for trunk


Ignore:
Timestamp:
01/16/20 13:32:43 (4 years ago)
Author:
bburlacu
Message:

#3051: Correctly add static attribute.

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs

    r16768 r17402  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
     
    181202
    182203    [ThreadStatic]
    183     private Dictionary<string, double[]> cachedData;
     204    private static Dictionary<string, double[]> cachedData;
    184205
    185206    [ThreadStatic]
    186     private IDataset dataset;
     207    private static IDataset cachedDataset;
    187208
    188209    private void InitCache(IDataset dataset) {
    189       this.dataset = dataset;
     210      cachedDataset = dataset;
    190211      cachedData = new Dictionary<string, double[]>();
    191212      foreach (var v in dataset.DoubleVariables) {
     
    196217    public void InitializeState() {
    197218      cachedData = null;
    198       dataset = null;
     219      cachedDataset = null;
    199220      EvaluatedSolutions = 0;
    200221    }
    201222
    202223    private double[] GetValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
    203       if (cachedData == null || this.dataset != dataset) {
     224      if (cachedData == null || cachedDataset != dataset) {
    204225        InitCache(dataset);
    205226      }
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs

    r17180 r17402  
    9999
    100100    [ThreadStatic]
    101     private IDataset dataset;
     101    private static IDataset cachedDataset;
    102102
    103103    private static readonly HashSet<byte> supportedOpCodes = new HashSet<byte>() {
     
    127127      if (!rows.Any()) return Enumerable.Empty<double>();
    128128
    129       if (cachedData == null || this.dataset != dataset) {
     129      if (cachedData == null || cachedDataset != dataset) {
    130130        InitCache(dataset);
    131131      }
     
    152152
    153153    private void InitCache(IDataset dataset) {
    154       this.dataset = dataset;
     154      cachedDataset = dataset;
    155155
    156156      // free handles to old data
     
    178178        cachedData = null;
    179179      }
    180       dataset = null;
     180      cachedDataset = null;
    181181      EvaluatedSolutions = 0;
    182182    }
Note: See TracChangeset for help on using the changeset viewer.