Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18105 for trunk


Ignore:
Timestamp:
12/03/21 16:01:40 (3 years ago)
Author:
dpiringe
Message:

#3139

  • merged branch back into trunk
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs

    r17180 r18105  
    5252    }
    5353
    54     public ILookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
    55       get { return (ILookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
     54    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
     55      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
    5656    }
    5757    public ValueLookupParameter<DataTable> SymbolicExpressionTreeLengthsParameter {
     
    102102      : base() {
    103103      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose length should be calculated."));
    104       Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximum allowed symbolic expression tree length"));
     104      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximum allowed symbolic expression tree length"));
    105105      Parameters.Add(new ValueLookupParameter<DataTable>(SymbolicExpressionTreeLengthsParameterName, "The data table to store the symbolic expression tree lengths."));
    106106      Parameters.Add(new ValueLookupParameter<DataTableHistory>(SymbolicExpressionTreeLengthsHistoryParameterName, "The data table to store the symbolic expression tree lengths history."));
     
    118118    [StorableHook(HookType.AfterDeserialization)]
    119119    private void AfterDeserialization() {
     120      // reset MaximumSymbolicExpressionTreeLengthParameterName to ValueLookupParameter
     121      if (Parameters.TryGetValue(MaximumSymbolicExpressionTreeLengthParameterName, out IParameter treeLengthParam) && !(treeLengthParam is ValueLookupParameter<IntValue>))
     122        Parameters.Remove(MaximumSymbolicExpressionTreeLengthParameterName);
     123      if(!Parameters.ContainsKey(MaximumSymbolicExpressionTreeLengthParameterName))
     124        Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximum allowed symbolic expression tree length"));
     125
    120126      // check if all the parameters are present and accounted for
    121       if (!Parameters.ContainsKey(StoreHistoryParameterName)) {
     127      if (!Parameters.ContainsKey(StoreHistoryParameterName))
    122128        Parameters.Add(new ValueParameter<BoolValue>(StoreHistoryParameterName, "True if the tree lengths history of the population should be stored.", new BoolValue(false)));
    123       }
    124       if (!Parameters.ContainsKey(UpdateIntervalParameterName)) {
     129     
     130      if (!Parameters.ContainsKey(UpdateIntervalParameterName))
    125131        Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
    126       }
     132
    127133      //necessary code to correct UpdateCounterParameter - type was changed from LookupParameter to ValueParameter
    128       if (Parameters.ContainsKey(UpdateCounterParameterName) && (Parameters[UpdateCounterParameterName] is LookupParameter<IntValue>))
     134      if (Parameters.TryGetValue(UpdateCounterParameterName, out IParameter updateCounterParam) && updateCounterParam is LookupParameter<IntValue>)
    129135        Parameters.Remove(UpdateCounterParameterName);
    130136      if (!Parameters.ContainsKey(UpdateCounterParameterName)) {
Note: See TracChangeset for help on using the changeset viewer.