Ignore:
Timestamp:
04/29/15 15:19:58 (6 years ago)
Author:
bburlacu
Message:

#2359: The changes in r12358 look fine to me. Added total number of pruned nodes in the analyzer's data table. Removed unused parameter names in the SymbolicDataAnalysisSingleObjectivePruningAnalyzer.

File:
1 edited

Legend:

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

    r12358 r12361  
    4545    private const string TotalNumberOfPrunedSubtreesParameterName = "Number of pruned subtrees";
    4646    private const string TotalNumberOfPrunedTreesParameterName = "Number of pruned trees";
     47    private const string TotalNumberOfPrunedNodesParameterName = "Number of pruned nodes";
    4748    private const string RandomParameterName = "Random";
    48     private const string PruneOnlyZeroImpactNodesParameterName = "PruneOnlyZeroImpactNodes";
    49     private const string NodeImpactThresholdParameterName = "ImpactThreshold";
    50     private const string PruningOperatorParameterName = "PruningOperator";
    5149    private const string ResultsParameterName = "Results";
    5250    private const string PopulationSizeParameterName = "PopulationSize";
     
    5452
    5553    #region private members
     54    private DataReducer prunedNodesReducer;
    5655    private DataReducer prunedSubtreesReducer;
    5756    private DataReducer prunedTreesReducer;
     
    122121    protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner)
    123122      : base(original, cloner) {
     123      if (original.prunedNodesReducer != null)
     124        this.prunedNodesReducer = (DataReducer)original.prunedNodesReducer.Clone();
    124125      if (original.prunedSubtreesReducer != null)
    125126        this.prunedSubtreesReducer = (DataReducer)original.prunedSubtreesReducer.Clone();
     
    230231      UpdateCounter = 0;
    231232
    232       if (prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }
     233      if (prunedNodesReducer == null || prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }
    233234
    234235      var prune = CreatePruningOperation();
     236      var reducePrunedNodes = ExecutionContext.CreateChildOperation(prunedNodesReducer);
    235237      var reducePrunedSubtrees = ExecutionContext.CreateChildOperation(prunedSubtreesReducer);
    236238      var reducePrunedTrees = ExecutionContext.CreateChildOperation(prunedTreesReducer);
     
    238240      var collectResults = ExecutionContext.CreateChildOperation(resultsCollector);
    239241
    240       return new OperationCollection { prune, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };
     242      return new OperationCollection { prune, reducePrunedNodes, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };
    241243    }
    242244
    243245    private void InitializeOperators() {
     246      prunedNodesReducer = new DataReducer();
     247      prunedNodesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedNodesParameter.ActualName;
     248      prunedNodesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values
     249      prunedNodesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter
     250      prunedNodesReducer.TargetParameter.ActualName = TotalNumberOfPrunedNodesParameterName;
     251
    244252      prunedSubtreesReducer = new DataReducer();
    245253      prunedSubtreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedSubtreesParameter.ActualName;
     
    255263
    256264      valuesCollector = new DataTableValuesCollector();
     265      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedNodesParameterName));
    257266      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedSubtreesParameterName));
    258267      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedTreesParameterName));
Note: See TracChangeset for help on using the changeset viewer.