Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4118


Ignore:
Timestamp:
07/27/10 19:54:20 (14 years ago)
Author:
abeham
Message:

#1090

  • Fixed problem plugins reloading their operators on deserialization in following problems (forgot on them in the first commit)
    • SupportVectorRegressionProblem
    • SymbolicTimeSeriesPrognosisProblem
  • Fixed a bug in the FeatureSelectionProblem introduced in r4098
  • Fixed the issues mentioned in the code review of mkommend
Location:
trunk/sources
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs

    r4106 r4118  
    278278    #region Helpers
    279279    [StorableHook(HookType.AfterDeserialization)]
     280    private void AfterDeserializationHook() {
     281      // BackwardsCompatibility3.3
     282      #region Backwards compatible code (remove with 3.4)
     283      if (operators == null) InitializeOperators();
     284      #endregion
     285      AttachEventHandlers();
     286    }
     287
    280288    private void AttachEventHandlers() {
    281       // Start BackwardsCompatibility3.3 (remove with 3.4)
    282       if (operators == null) InitializeOperators();
    283       // End BackwardsCompatibility3.3
    284289      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    285290      SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.FeatureSelection/3.3/FeatureSelectionProblem.cs

    r4098 r4118  
    9090
    9191    [StorableConstructor]
    92     private FeatureSelectionProblem(bool deserializing) : base() { }
     92    protected FeatureSelectionProblem(bool deserializing) : base(deserializing) { }
    9393    public FeatureSelectionProblem()
    9494      : base() {
     
    106106
    107107      InitializeOperators();
    108       AttachEventHandlers();
     108      RegisterParameterEvents();
     109      RegisterParameterValueEvents();
    109110    }
    110111
    111112    [StorableHook(HookType.AfterDeserialization)]
    112113    private void AfterDeserializationHook() {
     114      // BackwardsCompatibility3.3
     115      #region Backwards compatible code (remove with 3.4)
     116      if (operators == null) InitializeOperators();
     117      #endregion
    113118      RegisterParameterEvents();
    114119      RegisterParameterValueEvents();
     
    118123      FeatureSelectionProblem clone = (FeatureSelectionProblem)base.Clone(cloner);
    119124      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
    120       clone.AttachEventHandlers();
     125      clone.RegisterParameterEvents();
     126      clone.RegisterParameterValueEvents();
    121127      return clone;
    122128    }
     
    168174
    169175    #region Helpers
    170     private void AttachEventHandlers() {
    171       // Start BackwardsCompatibility3.3 (remove with 3.4)
    172       if (operators == null) InitializeOperators();
    173       // End BackwardsCompatibility3.3
    174       RegisterParameterEvents();
    175       RegisterParameterValueEvents();
    176     }
    177 
    178176    private void InitializeOperators() {
    179177      operators = new List<IOperator>();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/MultiObjectiveSymbolicVectorRegressionProblem.cs

    r4068 r4118  
    6666    #endregion
    6767
     68    [StorableConstructor]
     69    protected MultiObjectiveSymbolicVectorRegressionProblem(bool deserializing) : base(deserializing) { }
    6870    public MultiObjectiveSymbolicVectorRegressionProblem()
    6971      : base() {
     
    7577      Initialize();
    7678    }
    77 
    78     [StorableConstructor]
    79     private MultiObjectiveSymbolicVectorRegressionProblem(bool deserializing) : base() { }
    80 
     79   
    8180    [StorableHook(HookType.AfterDeserialization)]
    8281    private void AfterDeserializationHook() {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/SymbolicVectorRegressionProblem.cs

    r4068 r4118  
    119119    }
    120120
    121     private List<IOperator> operators;
    122121    public override IEnumerable<IOperator> Operators {
    123122      get { return operators; }
     
    154153    [Storable]
    155154    private SymbolicVectorRegressionGrammar grammar;
    156 
     155    [Storable]
     156    private List<IOperator> operators;
     157
     158    [StorableConstructor]
     159    protected SymbolicVectorRegressionProblem(bool deserializing) : base(deserializing) { }
    157160    public SymbolicVectorRegressionProblem()
    158161      : base() {
     
    175178      UpdateGrammar();
    176179      UpdateEstimationLimits();
    177       Initialize();
    178     }
    179 
    180     [StorableConstructor]
    181     private SymbolicVectorRegressionProblem(bool deserializing) : base() { }
     180      InitializeOperators();
     181      RegisterParameterEvents();
     182      RegisterParameterValueEvents();
     183    }
    182184
    183185    [StorableHook(HookType.AfterDeserialization)]
    184186    private void AfterDeserializationHook() {
    185       Initialize();
     187      // BackwardsCompatibility3.3
     188      #region Backwards compatible code (remove with 3.4)
     189      if (operators == null) InitializeOperators();
     190      #endregion
     191      RegisterParameterEvents();
     192      RegisterParameterValueEvents();
    186193    }
    187194
    188195    public override IDeepCloneable Clone(Cloner cloner) {
    189196      SymbolicVectorRegressionProblem clone = (SymbolicVectorRegressionProblem)base.Clone(cloner);
    190       clone.Initialize();
     197      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     198      clone.RegisterParameterEvents();
     199      clone.RegisterParameterValueEvents();
    191200      return clone;
    192201    }
     
    254263    protected void AddOperator(IOperator op) {
    255264      operators.Add(op);
    256     }
    257 
    258     private void Initialize() {
    259       InitializeOperators();
    260       RegisterParameterEvents();
    261       RegisterParameterValueEvents();
    262265    }
    263266
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SingleObjectiveSymbolicTimeSeriesPrognosisProblem.cs

    r4113 r4118  
    8585    #endregion
    8686
    87 
     87    [StorableConstructor]
     88    protected SingleObjectiveSymbolicTimeSeriesPrognosisProblem(bool deserializing) : base(deserializing) { }
    8889    public SingleObjectiveSymbolicTimeSeriesPrognosisProblem()
    8990      : base() {
     
    9697      ParameterizeEvaluator();
    9798
    98       Initialize();
     99      InitializeOperators();
     100      AttachEventHandlers();
    99101    }
    100 
    101     [StorableConstructor]
    102     protected SingleObjectiveSymbolicTimeSeriesPrognosisProblem(bool deserializing) : base(deserializing) { }
    103102
    104103    [StorableHook(HookType.AfterDeserialization)]
    105104    private void AfterDeserializationHook() {
    106       Initialize();
     105      AttachEventHandlers();
    107106    }
    108107
    109108    public override IDeepCloneable Clone(Cloner cloner) {
    110109      SingleObjectiveSymbolicTimeSeriesPrognosisProblem clone = (SingleObjectiveSymbolicTimeSeriesPrognosisProblem)base.Clone(cloner);
    111       clone.Initialize();
     110      clone.AttachEventHandlers();
    112111      return clone;
    113112    }
     
    135134
    136135    #region Helpers
    137     private void Initialize() {
    138       InitializeOperators();
     136    private void AttachEventHandlers() {
    139137    }
    140138
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SymbolicTimeSeriesPrognosisProblem.cs

    r4113 r4118  
    122122      set { FunctionTreeGrammarParameter.Value = value; }
    123123    }
    124     private List<IOperator> operators;
    125124    public override IEnumerable<IOperator> Operators {
    126125      get { return operators; }
     
    157156    [Storable]
    158157    private SymbolicTimeSeriesPrognosisGrammar grammar;
    159 
     158    [Storable]
     159    private List<IOperator> operators;
     160
     161    [StorableConstructor]
     162    protected SymbolicTimeSeriesPrognosisProblem(bool deserializing) : base(deserializing) { }
    160163    public SymbolicTimeSeriesPrognosisProblem()
    161164      : base() {
     
    179182
    180183      UpdateGrammar();
    181       Initialize();
    182     }
    183 
    184     [StorableConstructor]
    185     protected SymbolicTimeSeriesPrognosisProblem(bool deserializing) : base(deserializing) { }
     184      InitializeOperators();
     185      RegisterParameterEvents();
     186      RegisterParameterValueEvents();
     187    }
    186188
    187189    [StorableHook(HookType.AfterDeserialization)]
    188190    private void AfterDeserializationHook() {
    189       Initialize();
     191      // BackwardsCompatibility3.3
     192      #region Backwards compatible code (remove with 3.4)
     193      if (operators == null) InitializeOperators();
     194      #endregion
     195      RegisterParameterEvents();
     196      RegisterParameterValueEvents();
    190197    }
    191198
    192199    public override IDeepCloneable Clone(Cloner cloner) {
    193200      SymbolicTimeSeriesPrognosisProblem clone = (SymbolicTimeSeriesPrognosisProblem)base.Clone(cloner);
     201      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
    194202      clone.grammar = (SymbolicTimeSeriesPrognosisGrammar)cloner.Clone(grammar);
    195       clone.Initialize();
     203      clone.RegisterParameterEvents();
     204      clone.RegisterParameterValueEvents();
    196205      return clone;
    197206    }
     
    253262    protected void AddOperator(IOperator op) {
    254263      operators.Add(op);
    255     }
    256 
    257     private void Initialize() {
    258       InitializeOperators();
    259       RegisterParameterEvents();
    260       RegisterParameterValueEvents();
    261264    }
    262265
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r4098 r4118  
    183183
    184184    [StorableConstructor]
    185     private SymbolicRegressionProblem(bool deserializing) : base() { }
     185    protected SymbolicRegressionProblem(bool deserializing) : base(deserializing) { }
    186186    public SymbolicRegressionProblem()
    187187      : base() {
     
    213213      UpdateEstimationLimits();
    214214      InitializeOperators();
    215       AttachEventHandlers();
     215      RegisterParameterEvents();
     216      RegisterParameterValueEvents();
    216217    }
    217218
     
    219220      SymbolicRegressionProblem clone = (SymbolicRegressionProblem)base.Clone(cloner);
    220221      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
    221       clone.AttachEventHandlers();
     222      clone.RegisterParameterEvents();
     223      clone.RegisterParameterValueEvents();
    222224      return clone;
    223225    }
     
    303305    #region Helpers
    304306    [StorableHook(HookType.AfterDeserialization)]
    305     private void AttachEventHandlers() {
    306       // Start BackwardsCompatibility3.3 (remove with 3.4)
     307    private void AfterDeserializationHook() {
     308      // BackwardsCompatibility3.3
     309      #region Backwards compatible code (remove with 3.4)
    307310      if (operators == null) InitializeOperators();
    308       // End BackwardsCompatibility3.3
     311      #endregion
    309312      RegisterParameterEvents();
    310313      RegisterParameterValueEvents();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblem.cs

    r4068 r4118  
    5050    #endregion
    5151
     52    [StorableConstructor]
     53    protected DataAnalysisProblem(bool deserializing) : base(deserializing) { }
    5254    public DataAnalysisProblem()
    5355      : base() {
     
    5658      RegisterParameterValueEvents();
    5759    }
    58 
    59     [StorableConstructor]
    60     private DataAnalysisProblem(bool deserializing) : base() { }
    6160
    6261    [StorableHook(HookType.AfterDeserialization)]
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/ParameterAdjustmentProblem/SupportVectorMachineParameterAdjustmentProblem.cs

    r4100 r4118  
    129129
    130130    [StorableConstructor]
    131     private SupportVectorMachineParameterAdjustmentProblem(bool deserializing) : base() { }
     131    private SupportVectorMachineParameterAdjustmentProblem(bool deserializing) : base(deserializing) { }
    132132    public SupportVectorMachineParameterAdjustmentProblem()
    133133      : base() {
     
    216216    #region Helpers
    217217    [StorableHook(HookType.AfterDeserialization)]
     218    private void AfterDeserializationHook() {
     219      // BackwardsCompatibility3.3
     220      #region Backwards compatible code (remove with 3.4)
     221      if (operators == null) InitializeOperators();
     222      #endregion
     223      AttachEventHandlers();
     224    }
     225
    218226    private void AttachEventHandlers() {
    219       // Start BackwardsCompatibility3.3 (remove with 3.4)
    220       if (operators == null) InitializeOperators();
    221       // End BackwardsCompatibility3.3
    222227      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    223228      SolutionCreator.RealVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_RealVectorParameter_ActualNameChanged);
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r4098 r4118  
    193193    #region Helpers
    194194    [StorableHook(HookType.AfterDeserialization)]
     195    private void AfterDeserializationHook() {
     196      AttachEventHandlers();
     197    }
     198
    195199    private void AttachEventHandlers() {
    196200      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
  • trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs

    r4098 r4118  
    138138
    139139    [StorableConstructor]
    140     private KnapsackProblem(bool deserializing) : base() { }
     140    private KnapsackProblem(bool deserializing) : base(deserializing) { }
    141141    public KnapsackProblem()
    142142      : base() {
     
    255255    #region Helpers
    256256    [StorableHook(HookType.AfterDeserialization)]
     257    private void AfterDeserializationHook() {
     258      // BackwardsCompatibility3.3
     259      #region Backwards compatible code (remove with 3.4)
     260      if (operators == null) InitializeOperators();
     261      #endregion
     262      AttachEventHandlers();
     263    }
     264
    257265    private void AttachEventHandlers() {
    258       // Start BackwardsCompatibility3.3 (remove with 3.4)
    259       if (operators == null) InitializeOperators();
    260       // End BackwardsCompatibility3.3
    261266      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    262267      SolutionCreator.BinaryVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_BinaryVectorParameter_ActualNameChanged);
  • trunk/sources/HeuristicLab.Problems.OneMax/3.3/OnemaxProblem.cs

    r4098 r4118  
    109109
    110110    [StorableConstructor]
    111     private OneMaxProblem(bool deserializing) : base() { }
     111    private OneMaxProblem(bool deserializing) : base(deserializing) { }
    112112    public OneMaxProblem()
    113113      : base() {
     
    198198    #region Helpers
    199199    [StorableHook(HookType.AfterDeserialization)]
     200    private void AfterDeserializationHook() {
     201      // BackwardsCompatibility3.3
     202      #region Backwards compatible code (remove with 3.4)
     203      if (operators == null) InitializeOperators();
     204      #endregion
     205      AttachEventHandlers();
     206    }
     207
    200208    private void AttachEventHandlers() {
    201       // Start BackwardsCompatibility3.3 (remove with 3.4)
    202       if (operators == null) InitializeOperators();
    203       // End BackwardsCompatibility3.3
    204209      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    205210      SolutionCreator.BinaryVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_BinaryVectorParameter_ActualNameChanged);
     
    207212      LengthParameter.ValueChanged += new EventHandler(LengthParameter_ValueChanged);
    208213      LengthParameter.Value.ValueChanged += new EventHandler(Length_ValueChanged);
    209       BestKnownQualityParameter.Value.Value = Length.Value;
    210214      BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged);
    211215    }
     216
    212217    private void ParameterizeSolutionCreator() {
    213218      SolutionCreator.LengthParameter.ActualName = LengthParameter.Name;
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

    r4098 r4118  
    131131
    132132    [StorableConstructor]
    133     private SingleObjectiveTestFunctionProblem(bool deserializing) : base() { }
     133    private SingleObjectiveTestFunctionProblem(bool deserializing) : base(deserializing) { }
    134134    public SingleObjectiveTestFunctionProblem()
    135135      : base() {
     
    297297    #region Helpers
    298298    [StorableHook(HookType.AfterDeserialization)]
     299    private void AfterDeserializationHook() {
     300      // BackwardsCompatibility3.3
     301      #region Backwards compatible code (remove with 3.4)
     302      if (operators == null) InitializeOperators();
     303      #endregion
     304      AttachEventHandlers();
     305    }
     306
    299307    private void AttachEventHandlers() {
    300       // Start BackwardsCompatibility3.3 (remove with 3.4)
    301       if (operators == null) InitializeOperators();
    302       // End BackwardsCompatibility3.3
    303308      ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged);
    304309      ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged);
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs

    r4098 r4118  
    132132
    133133    [StorableConstructor]
    134     private TravelingSalesmanProblem(bool deserializing) : base() { }
     134    private TravelingSalesmanProblem(bool deserializing) : base(deserializing) { }
    135135    public TravelingSalesmanProblem()
    136136      : base() {
     
    246246    #region Helpers
    247247    [StorableHook(HookType.AfterDeserialization)]
     248    private void AfterDeserializationHook() {
     249      // BackwardsCompatibility3.3
     250      #region Backwards compatible code (remove with 3.4)
     251      if (operators == null) InitializeOperators();
     252      #endregion
     253      AttachEventHandlers();
     254    }
     255
    248256    private void AttachEventHandlers() {
    249       // Start BackwardsCompatibility3.3 (remove with 3.4)
    250       if (operators == null) InitializeOperators();
    251       // End BackwardsCompatibility3.3
    252257      CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
    253258      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4098 r4118  
    182182
    183183    [StorableConstructor]
    184     private VehicleRoutingProblem(bool deserializing) : base() { }
     184    private VehicleRoutingProblem(bool deserializing) : base(deserializing) { }
    185185    public VehicleRoutingProblem()
    186186      : base() {
     
    295295    #region Helpers
    296296    [StorableHook(HookType.AfterDeserialization)]
     297    private void AfterDeserializationHook() {
     298      // BackwardsCompatibility3.3
     299      #region Backwards compatible code (remove with 3.4)
     300      if (operators == null) InitializeOperators();
     301      #endregion
     302      AttachEventHandlers();
     303    }
     304
    297305    private void AttachEventHandlers() {
    298       // Start BackwardsCompatibility3.3 (remove with 3.4)
    299       if (operators == null) InitializeOperators();
    300       // End BackwardsCompatibility3.3
    301306      CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
    302307      Vehicles.ValueChanged += new EventHandler(VehiclesValue_ValueChanged);
Note: See TracChangeset for help on using the changeset viewer.