Changeset 17872


Ignore:
Timestamp:
03/09/21 11:52:12 (7 months ago)
Author:
gkronber
Message:

#3067 bugfix in AfterDeserialization hook

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs

    r17871 r17872  
    8888    private void AfterDeserialization() {
    8989      // replace with PercentValue for files which had CrossoverProbability as DoubleValue
    90       if (Parameters.ContainsKey(CrossoverProbabilityParameterName)) {
    91         var oldValue = ((IFixedValueParameter<DoubleValue>)Parameters[CrossoverProbabilityParameterName]).Value.Value;
    92         Parameters.Remove(CrossoverProbabilityParameterName);
     90      if (Parameters.ContainsKey(CrossoverProbabilityParameterName) && (Parameters[CrossoverProbabilityParameterName] is IFixedValueParameter<DoubleValue> oldParam)) {
     91        var oldValue = oldParam.Value.Value;
     92        Parameters.Remove(oldParam);
    9393        Parameters.Add(new FixedValueParameter<PercentValue>(CrossoverProbabilityParameterName, "The probability that a crossover is performed. Otherwise a copy of the first parent is returned.", new PercentValue(oldValue)));
    9494      }
Note: See TracChangeset for help on using the changeset viewer.