Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/23/12 16:05:57 (12 years ago)
Author:
mkommend
Message:

#1682: Integrated new gp crossovers into the trunk and corrected the parameter wiring.

File:
1 edited

Legend:

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

    r7259 r7506  
    3434  public sealed class SymbolicDataAnalysisExpressionTreeInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
    3535    private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
     36    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
    3637    #region private classes
    3738    private class InterpreterState {
     
    176177      get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
    177178    }
     179
     180    public IValueParameter<IntValue> EvaluatedSolutionsParameter {
     181      get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
     182    }
    178183    #endregion
    179184
     
    183188      set { CheckExpressionsWithIntervalArithmeticParameter.Value = value; }
    184189    }
     190
     191    public IntValue EvaluatedSolutions {
     192      get { return EvaluatedSolutionsParameter.Value; }
     193      set { EvaluatedSolutionsParameter.Value = value; }
     194    }
    185195    #endregion
    186 
    187196
    188197    [StorableConstructor]
     
    196205      : base("SymbolicDataAnalysisExpressionTreeInterpreter", "Interpreter for symbolic expression trees including automatically defined functions.") {
    197206      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)));
    198     }
     207      Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     208    }
     209
     210    [StorableHook(HookType.AfterDeserialization)]
     211    private void AfterDeserialization() {
     212      if (!Parameters.ContainsKey(EvaluatedSolutionsParameterName))
     213        Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     214    }
     215
     216    #region IStatefulItem
     217    public void InitializeState() {
     218      EvaluatedSolutions.Value = 0;
     219    }
     220
     221    public void ClearState() {
     222    }
     223    #endregion
    199224
    200225    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
    201226      if (CheckExpressionsWithIntervalArithmetic.Value)
    202227        throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
     228      EvaluatedSolutions.Value++; // increment the evaluated solutions counter
    203229      var compiler = new SymbolicExpressionTreeCompiler();
    204230      Instruction[] code = compiler.Compile(tree, MapSymbolToOpCode);
Note: See TracChangeset for help on using the changeset viewer.