Changeset 18105
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/3139_ParameterChange_SymbolicExpressionTreeLengthAnalyzer (added) merged: 18079-18080,18102
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/branches/3139_ParameterChange_SymbolicExpressionTreeLengthAnalyzer/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 18080,18102
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs
r17180 r18105 52 52 } 53 53 54 public I LookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {55 get { return (I LookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }54 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter { 55 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; } 56 56 } 57 57 public ValueLookupParameter<DataTable> SymbolicExpressionTreeLengthsParameter { … … 102 102 : base() { 103 103 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")); 105 105 Parameters.Add(new ValueLookupParameter<DataTable>(SymbolicExpressionTreeLengthsParameterName, "The data table to store the symbolic expression tree lengths.")); 106 106 Parameters.Add(new ValueLookupParameter<DataTableHistory>(SymbolicExpressionTreeLengthsHistoryParameterName, "The data table to store the symbolic expression tree lengths history.")); … … 118 118 [StorableHook(HookType.AfterDeserialization)] 119 119 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 120 126 // check if all the parameters are present and accounted for 121 if (!Parameters.ContainsKey(StoreHistoryParameterName)) {127 if (!Parameters.ContainsKey(StoreHistoryParameterName)) 122 128 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)) 125 131 Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1))); 126 } 132 127 133 //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>) 129 135 Parameters.Remove(UpdateCounterParameterName); 130 136 if (!Parameters.ContainsKey(UpdateCounterParameterName)) {
Note: See TracChangeset
for help on using the changeset viewer.