Changeset 5864


Ignore:
Timestamp:
03/29/11 15:00:56 (11 years ago)
Author:
gkronber
Message:

#1411: fixed implementation of evaluators to store total evaluated nodes value in a variable in the global scope.

File:
1 edited

Legend:

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

    r5851 r5864  
    109109
    110110    protected void AddEvaluatedNodes(double numberOfNodes) {
    111       if (EvaluatedNodesParameter.ActualValue == null) EvaluatedNodesParameter.ActualValue = new DoubleValue();
     111      if (EvaluatedNodesParameter.ActualValue == null) {
     112        // variable for evaluated nodes does not exist yet
     113        // search global scope
     114        var scope = ExecutionContext.Scope;
     115        while (scope.Parent != null) scope = scope.Parent;
     116        // add variable into global scope
     117        scope.Variables.Add(new HeuristicLab.Core.Variable(EvaluatedNodesParameter.ActualName, new DoubleValue()));
     118      }
    112119      double curEvaluatedNodes = EvaluatedNodesParameter.ActualValue.Value;
    113120      EvaluatedNodesParameter.ActualValue = new DoubleValue(curEvaluatedNodes + numberOfNodes);
Note: See TracChangeset for help on using the changeset viewer.