Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/25/10 01:04:14 (14 years ago)
Author:
abeham
Message:

#1090

  • Fixed initialization of operators and made operator list storable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r4068 r4098  
    147147      get { return BestKnownQualityParameter.Value; }
    148148    }
    149     private List<IOperator> operators;
    150149    public override IEnumerable<IOperator> Operators {
    151150      get { return operators; }
     
    180179    #endregion
    181180
     181    [Storable]
     182    private List<IOperator> operators;
     183
     184    [StorableConstructor]
     185    private SymbolicRegressionProblem(bool deserializing) : base() { }
    182186    public SymbolicRegressionProblem()
    183187      : base() {
     
    208212      UpdateGrammar();
    209213      UpdateEstimationLimits();
    210       Initialize();
    211     }
    212 
    213     [StorableConstructor]
    214     private SymbolicRegressionProblem(bool deserializing) : base() { }
    215 
    216     [StorableHook(HookType.AfterDeserialization)]
    217     private void AfterDeserializationHook() {
    218       RegisterParameterEvents();
    219       RegisterParameterValueEvents();
     214      InitializeOperators();
     215      AttachEventHandlers();
    220216    }
    221217
    222218    public override IDeepCloneable Clone(Cloner cloner) {
    223219      SymbolicRegressionProblem clone = (SymbolicRegressionProblem)base.Clone(cloner);
    224       clone.Initialize();
     220      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     221      clone.AttachEventHandlers();
    225222      return clone;
    226223    }
     
    305302
    306303    #region Helpers
    307     private void Initialize() {
    308       InitializeOperators();
     304    [StorableHook(HookType.AfterDeserialization)]
     305    private void AttachEventHandlers() {
     306      // Start BackwardsCompatibility3.3 (remove with 3.4)
     307      if (operators == null) InitializeOperators();
     308      // End BackwardsCompatibility3.3
    309309      RegisterParameterEvents();
    310310      RegisterParameterValueEvents();
Note: See TracChangeset for help on using the changeset viewer.