Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/12 09:11:17 (12 years ago)
Author:
gkronber
Message:

#1081 merged r7462:7609 from trunk into time series branch

Location:
branches/HeuristicLab.TimeSeries
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r7268 r7615  
    2121
    2222using System;
    23 using System.Collections.ObjectModel;
     23using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Collections.Generic;
    2625using System.Reflection;
    2726using System.Reflection.Emit;
     
    4847    internal delegate double CompiledFunction(int sampleIndex, IList<double>[] columns, IList<double>[] cachedValues, int cacheStartIndex);
    4948    private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
     49    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
    5050    #region private classes
    5151    private class InterpreterState {
     
    156156      get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
    157157    }
     158
     159    public IValueParameter<IntValue> EvaluatedSolutionsParameter {
     160      get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
     161    }
    158162    #endregion
    159163
     
    162166      get { return CheckExpressionsWithIntervalArithmeticParameter.Value; }
    163167      set { CheckExpressionsWithIntervalArithmeticParameter.Value = value; }
     168    }
     169
     170    public IntValue EvaluatedSolutions {
     171      get { return EvaluatedSolutionsParameter.Value; }
     172      set { EvaluatedSolutionsParameter.Value = value; }
    164173    }
    165174    #endregion
     
    176185      : base("SymbolicDataAnalysisExpressionTreeILEmittingInterpreter", "Interpreter for symbolic expression trees.") {
    177186      Parameters.Add(new ValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.", new BoolValue(false)));
    178     }
     187      Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     188    }
     189
     190    [StorableHook(HookType.AfterDeserialization)]
     191    private void AfterDeserialization() {
     192      if (!Parameters.ContainsKey(EvaluatedSolutionsParameterName))
     193        Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     194    }
     195
     196    #region IStatefulItem
     197    public void InitializeState() {
     198      EvaluatedSolutions.Value = 0;
     199    }
     200
     201    public void ClearState() {
     202      EvaluatedSolutions.Value = 0;
     203    }
     204    #endregion
    179205
    180206    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
     
    188214      if (CheckExpressionsWithIntervalArithmetic.Value)
    189215        throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
     216      EvaluatedSolutions.Value++; // increment the evaluated solutions counter
    190217      var compiler = new SymbolicExpressionTreeCompiler();
    191218      Instruction[] code = compiler.Compile(tree, MapSymbolToOpCode);
Note: See TracChangeset for help on using the changeset viewer.