Changeset 7615 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
- Timestamp:
- 03/15/12 09:11:17 (13 years ago)
- 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 21 21 22 22 using System; 23 using System.Collections. ObjectModel;23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Collections.Generic;26 25 using System.Reflection; 27 26 using System.Reflection.Emit; … … 48 47 internal delegate double CompiledFunction(int sampleIndex, IList<double>[] columns, IList<double>[] cachedValues, int cacheStartIndex); 49 48 private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic"; 49 private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions"; 50 50 #region private classes 51 51 private class InterpreterState { … … 156 156 get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; } 157 157 } 158 159 public IValueParameter<IntValue> EvaluatedSolutionsParameter { 160 get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; } 161 } 158 162 #endregion 159 163 … … 162 166 get { return CheckExpressionsWithIntervalArithmeticParameter.Value; } 163 167 set { CheckExpressionsWithIntervalArithmeticParameter.Value = value; } 168 } 169 170 public IntValue EvaluatedSolutions { 171 get { return EvaluatedSolutionsParameter.Value; } 172 set { EvaluatedSolutionsParameter.Value = value; } 164 173 } 165 174 #endregion … … 176 185 : base("SymbolicDataAnalysisExpressionTreeILEmittingInterpreter", "Interpreter for symbolic expression trees.") { 177 186 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 179 205 180 206 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) { … … 188 214 if (CheckExpressionsWithIntervalArithmetic.Value) 189 215 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); 216 EvaluatedSolutions.Value++; // increment the evaluated solutions counter 190 217 var compiler = new SymbolicExpressionTreeCompiler(); 191 218 Instruction[] code = compiler.Compile(tree, MapSymbolToOpCode);
Note: See TracChangeset
for help on using the changeset viewer.