Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuListCreator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
     
    3940    }
    4041
     42    [StorableConstructor]
     43    protected TabuListCreator(bool deserializing) : base(deserializing) { }
     44    protected TabuListCreator(TabuListCreator original, Cloner cloner)
     45      : base(original, cloner) {
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new TabuListCreator(this, cloner);
     49    }
     50
    4151    public TabuListCreator()
    4252      : base() {
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuNeighborhoodAnalyzer.cs

    r4068 r4722  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Algorithms.TabuSearch {
     32  [StorableClass]
     33  [Item("TabuNeighborhoodAnalyzer", "Analyzes the tabu neighborhood")]
    3034  public class TabuNeighborhoodAnalyzer : SingleSuccessorOperator, IAnalyzer {
    3135    public ScopeTreeLookupParameter<BoolValue> IsTabuParameter {
     
    3943    }
    4044
     45    [StorableConstructor]
     46    protected TabuNeighborhoodAnalyzer(bool deserializing) : base(deserializing) { }
     47    protected TabuNeighborhoodAnalyzer(TabuNeighborhoodAnalyzer original, Cloner cloner)
     48      : base(original, cloner) {
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new TabuNeighborhoodAnalyzer(this, cloner);
     52    }
    4153    public TabuNeighborhoodAnalyzer()
    4254      : base() {
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r4437 r4722  
    190190    [StorableConstructor]
    191191    private TabuSearch(bool deserializing) : base(deserializing) { }
    192 
     192    [StorableHook(HookType.AfterDeserialization)]
     193    private void AfterDeserialization() {
     194      Initialize();
     195    }
     196    private TabuSearch(TabuSearch original, Cloner cloner)
     197      : base(original, cloner) {
     198      moveQualityAnalyzer = cloner.Clone(original.moveQualityAnalyzer);
     199      tabuNeighborhoodAnalyzer = cloner.Clone(original.tabuNeighborhoodAnalyzer);
     200      Initialize();
     201    }
    193202    public override IDeepCloneable Clone(Cloner cloner) {
    194       TabuSearch clone = (TabuSearch)base.Clone(cloner);
    195       clone.moveQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(moveQualityAnalyzer);
    196       clone.tabuNeighborhoodAnalyzer = (TabuNeighborhoodAnalyzer)cloner.Clone(tabuNeighborhoodAnalyzer);
    197       clone.Initialize();
    198       return clone;
     203      return new TabuSearch(this, cloner);
    199204    }
    200205
     
    313318
    314319    #region Helpers
    315     [StorableHook(HookType.AfterDeserialization)]
    316320    private void Initialize() {
    317321      if (Problem != null) {
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs

    r4068 r4722  
    2121
    2222using HeuristicLab.Analysis;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8586
    8687    [StorableConstructor]
    87     private TabuSearchMainLoop(bool deserializing) : base() { }
     88    private TabuSearchMainLoop(bool deserializing) : base(deserializing) { }
    8889    public TabuSearchMainLoop()
    8990      : base() {
    9091      Initialize();
     92    }
     93    private TabuSearchMainLoop(TabuSearchMainLoop original, Cloner cloner)
     94      : base(original, cloner) {
     95    }
     96    public override IDeepCloneable Clone(Cloner cloner) {
     97      return new TabuSearchMainLoop(this, cloner);
    9198    }
    9299
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSelector.cs

    r4068 r4722  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    7879      get { return CopySelectedParameter.Value; }
    7980      set { CopySelectedParameter.Value = value; }
     81    }
     82
     83    [StorableConstructor]
     84    protected TabuSelector(bool deserializing) : base(deserializing) { }
     85    protected TabuSelector(TabuSelector original, Cloner cloner)
     86      : base(original, cloner) {
     87    }
     88    public override IDeepCloneable Clone(Cloner cloner) {
     89      return new TabuSelector(this, cloner);
    8090    }
    8191
Note: See TracChangeset for help on using the changeset viewer.