Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 09:51:22 (14 years ago)
Author:
svonolfe
Message:

Implemented review comments from swagner (#1392)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SuccessProgressAnalysis/HeuristicLab.Operators/3.3/StochasticMultiBranch.cs

    r5492 r5682  
    4949      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    5050    }
    51     public ValueParameter<BoolValue> ReportExecutedOperatorParameter {
    52       get { return (ValueParameter<BoolValue>)Parameters["ReportExecutedOperator"]; }
     51    public ValueParameter<BoolValue> TraceSelectedOperatorParameter {
     52      get { return (ValueParameter<BoolValue>)Parameters["TraceSelectedOperator"]; }
    5353    }
    54     public ValueLookupParameter<StringValue> ExecutedOperatorParameter {
    55       get { return (ValueLookupParameter<StringValue>)Parameters["ExecutedOperator"]; }
     54    public ValueLookupParameter<StringValue> SelectedOperatorParameter {
     55      get { return (ValueLookupParameter<StringValue>)Parameters["SelectedOperator"]; }
    5656    }
    5757
     
    6464    private void AfterDeserializationHook() {
    6565      #region Backwards Compatibility
    66       if (!Parameters.ContainsKey("ExecutedOperator")) {
    67         Parameters.Add(new ValueLookupParameter<StringValue>("ExecutedOperator", "The operator that was executed."));
     66      if (!Parameters.ContainsKey("SelectedOperator")) {
     67        Parameters.Add(new ValueLookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
    6868      }
    69       if (!Parameters.ContainsKey("ReportExecutedOperator")) {
    70         Parameters.Add(new ValueParameter<BoolValue>("ReportExecutedOperator", "Report the executed operator", new BoolValue(false)));
     69      if (!Parameters.ContainsKey("TraceSelectedOperator")) {
     70        Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false)));
    7171      }
    7272      #endregion
     
    8686      Parameters.Add(new ValueLookupParameter<DoubleArray>("Probabilities", "The array of relative probabilities for each operator.", new DoubleArray()));
    8787      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    88       Parameters.Add(new ValueLookupParameter<StringValue>("ExecutedOperator", "The operator that was executed."));
    89       Parameters.Add(new ValueParameter<BoolValue>("ReportExecutedOperator", "Report the executed operator", new BoolValue(false)));
     88      Parameters.Add(new ValueLookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
     89      Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false)));
    9090    }
    9191
     
    136136      }
    137137      IOperator successor = null;
     138      int index = -1;
    138139      var checkedOperators = Operators.CheckedItems;
    139140      if (checkedOperators.Count() > 0) {
     
    147148          if (sum > r) {
    148149            successor = indexedItem.Value;
     150            index = indexedItem.Index;
    149151            break;
    150152          }
     
    153155      OperationCollection next = new OperationCollection(base.Apply());
    154156      if (successor != null) {
    155         if(ReportExecutedOperatorParameter.Value.Value)
    156           ExecutedOperatorParameter.ActualValue = new StringValue(successor.Name);
     157        if (TraceSelectedOperatorParameter.Value.Value)
     158          SelectedOperatorParameter.ActualValue = new StringValue(index + ": " + successor.Name);
    157159
    158160        if (CreateChildOperation)
     
    160162        else next.Insert(0, ExecutionContext.CreateOperation(successor));
    161163      } else {
    162         if (ReportExecutedOperatorParameter.Value.Value)
    163           ExecutedOperatorParameter.ActualValue = new StringValue("");
     164        if (TraceSelectedOperatorParameter.Value.Value)
     165          SelectedOperatorParameter.ActualValue = new StringValue("");
    164166      }
    165167      return next;
Note: See TracChangeset for help on using the changeset viewer.