Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4669


Ignore:
Timestamp:
10/29/10 17:43:17 (12 years ago)
Author:
mkommend
Message:

Refactored Algorithms.* and fixed BoolValue (ticket #922).

Location:
branches/CloningRefactoring
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Algorithms.EvolutionStrategy/3.3/EvolutionStrategyMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    9495
    9596    [StorableConstructor]
    96     private EvolutionStrategyMainLoop(bool deserializing) : base() { }
     97    private EvolutionStrategyMainLoop(bool deserializing) : base(deserializing) { }
     98    private EvolutionStrategyMainLoop(EvolutionStrategyMainLoop original, Cloner cloner)
     99      : base(original, cloner) {
     100    }
     101    public override IDeepCloneable Clone(Cloner cloner) {
     102      return new EvolutionStrategyMainLoop(this, cloner);
     103    }
    97104    public EvolutionStrategyMainLoop()
    98105      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.EvolutionStrategy/3.3/WithoutRepeatingBatchedRandomSelector.cs

    r4068 r4669  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    4041    public IValueLookupParameter<IntValue> ParentsPerChildParameter {
    4142      get { return (IValueLookupParameter<IntValue>)Parameters["ParentsPerChild"]; }
     43    }
     44
     45    [StorableConstructor]
     46    protected WithoutRepeatingBatchedRandomSelector(bool deserializing) : base(deserializing) { }
     47    protected WithoutRepeatingBatchedRandomSelector(WithoutRepeatingBatchedRandomSelector original, Cloner cloner)
     48      : base(original, cloner) {
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new WithoutRepeatingBatchedRandomSelector(this, cloner);
    4252    }
    4353
  • branches/CloningRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r4477 r4669  
    192192    [StorableConstructor]
    193193    private GeneticAlgorithm(bool deserializing) : base(deserializing) { }
    194 
     194    [StorableHook(HookType.AfterDeserialization)]
     195    private void AfterDeserialization() {
     196      Initialize();
     197    }
     198
     199    private GeneticAlgorithm(GeneticAlgorithm original, Cloner cloner)
     200      : base(original, cloner) {
     201      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     202      Initialize();
     203    }
    195204    public override IDeepCloneable Clone(Cloner cloner) {
    196       GeneticAlgorithm clone = (GeneticAlgorithm)base.Clone(cloner);
    197       clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
    198       clone.Initialize();
    199       return clone;
     205      return new GeneticAlgorithm(this, cloner);
    200206    }
    201207
     
    265271
    266272    #region Helpers
    267     [StorableHook(HookType.AfterDeserialization)]
    268273    private void Initialize() {
    269274      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    8283
    8384    [StorableConstructor]
    84     private GeneticAlgorithmMainLoop(bool deserializing) : base() { }
     85    private GeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
     86    private GeneticAlgorithmMainLoop(GeneticAlgorithmMainLoop original, Cloner cloner)
     87      : base(original, cloner) {
     88    }
     89    public override IDeepCloneable Clone(Cloner cloner) {
     90      return new GeneticAlgorithmMainLoop(this, cloner);
     91    }
    8592    public GeneticAlgorithmMainLoop()
    8693      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r4437 r4669  
    197197    [StorableConstructor]
    198198    private IslandGeneticAlgorithm(bool deserializing) : base(deserializing) { }
     199    [StorableHook(HookType.AfterDeserialization)]
     200    private void AfterDeserialization() {
     201      Initialize();
     202    }
     203    private IslandGeneticAlgorithm(IslandGeneticAlgorithm original, Cloner cloner)
     204      : base(original, cloner) {
     205      islandQualityAnalyzer = cloner.Clone(original.islandQualityAnalyzer);
     206      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     207      Initialize();
     208    }
     209    public override IDeepCloneable Clone(Cloner cloner) {
     210      return new IslandGeneticAlgorithm(this, cloner);
     211    }
     212
    199213    public IslandGeneticAlgorithm()
    200214      : base() {
     
    282296    }
    283297
    284     public override IDeepCloneable Clone(Cloner cloner) {
    285       IslandGeneticAlgorithm clone = (IslandGeneticAlgorithm)base.Clone(cloner);
    286       clone.islandQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(islandQualityAnalyzer);
    287       clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
    288       clone.Initialize();
    289       return clone;
    290     }
    291 
    292298    public override void Prepare() {
    293299      if (Problem != null) base.Prepare();
     
    362368
    363369    #region Helpers
    364     [StorableHook(HookType.AfterDeserialization)]
    365370    private void Initialize() {
    366371      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    103104
    104105    [StorableConstructor]
    105     private IslandGeneticAlgorithmMainLoop(bool deserializing) : base() { }
     106    private IslandGeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
     107    private IslandGeneticAlgorithmMainLoop(IslandGeneticAlgorithmMainLoop original, Cloner cloner)
     108      : base(original, cloner) {
     109    }
     110    public override IDeepCloneable Clone(Cloner cloner) {
     111      return new IslandGeneticAlgorithmMainLoop(this, cloner);
     112    }
    106113    public IslandGeneticAlgorithmMainLoop()
    107114      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs

    r4437 r4669  
    125125    [StorableConstructor]
    126126    private LocalSearch(bool deserializing) : base(deserializing) { }
     127    [StorableHook(HookType.AfterDeserialization)]
     128    private void AfterDeserialization() {
     129      Initialize();
     130    }
     131    private LocalSearch(LocalSearch original, Cloner cloner)
     132      : base(original, cloner) {
     133      moveQualityAnalyzer = cloner.Clone(original.moveQualityAnalyzer);
     134      Initialize();
     135    }
     136    public override IDeepCloneable Clone(Cloner cloner) {
     137      return new LocalSearch(this, cloner);
     138    }
    127139    public LocalSearch()
    128140      : base() {
     
    166178    }
    167179
    168     public override IDeepCloneable Clone(Cloner cloner) {
    169       LocalSearch clone = (LocalSearch)base.Clone(cloner);
    170       clone.moveQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(moveQualityAnalyzer);
    171       clone.Initialize();
    172       return clone;
    173     }
    174 
    175180    public override void Prepare() {
    176181      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null)
     
    256261
    257262    #region Helpers
    258     [StorableHook(HookType.AfterDeserialization)]
    259263    private void Initialize() {
    260264      if (Problem != null) {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    7980
    8081    [StorableConstructor]
    81     private LocalSearchMainLoop(bool deserializing) : base() { }
     82    private LocalSearchMainLoop(bool deserializing) : base(deserializing) { }
    8283    public LocalSearchMainLoop()
    8384      : base() {
    8485      Initialize();
     86    }
     87    private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner)
     88      : base(original, cloner) {
     89    }
     90    public override IDeepCloneable Clone(Cloner cloner) {
     91      return new LocalSearchMainLoop(this, cloner);
    8592    }
    8693
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r4437 r4669  
    253253    [StorableConstructor]
    254254    private IslandOffspringSelectionGeneticAlgorithm(bool deserializing) : base(deserializing) { }
     255    [StorableHook(HookType.AfterDeserialization)]
     256    private void AfterDeserialization() {
     257      Initialize();
     258    }
     259    private IslandOffspringSelectionGeneticAlgorithm(IslandOffspringSelectionGeneticAlgorithm original, Cloner cloner)
     260      : base(original, cloner) {
     261      islandQualityAnalyzer = cloner.Clone(original.islandQualityAnalyzer);
     262      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     263      islandSelectionPressureAnalyzer = cloner.Clone(original.islandSelectionPressureAnalyzer);
     264      selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
     265      Initialize();
     266    }
     267    public override IDeepCloneable Clone(Cloner cloner) {
     268      return new IslandOffspringSelectionGeneticAlgorithm(this, cloner);
     269    }
    255270    public IslandOffspringSelectionGeneticAlgorithm()
    256271      : base() {
     
    357372      Initialize();
    358373    }
    359 
    360     public override IDeepCloneable Clone(Cloner cloner) {
    361       IslandOffspringSelectionGeneticAlgorithm clone = (IslandOffspringSelectionGeneticAlgorithm)base.Clone(cloner);
    362       clone.islandQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(islandQualityAnalyzer);
    363       clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
    364       clone.islandSelectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(islandSelectionPressureAnalyzer);
    365       clone.selectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(selectionPressureAnalyzer);
    366       clone.Initialize();
    367       return clone;
    368     }
    369 
    370374    public override void Prepare() {
    371375      if (Problem != null) base.Prepare();
     
    454458
    455459    #region Helpers
    456     [StorableHook(HookType.AfterDeserialization)]
    457460    private void Initialize() {
    458461      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    126127
    127128    [StorableConstructor]
    128     private IslandOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base() { }
     129    private IslandOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
     130    private IslandOffspringSelectionGeneticAlgorithmMainLoop(IslandOffspringSelectionGeneticAlgorithmMainLoop original, Cloner cloner)
     131      : base(original, cloner) {
     132    }
     133    public override IDeepCloneable Clone(Cloner cloner) {
     134      return new IslandOffspringSelectionGeneticAlgorithmMainLoop(this, cloner);
     135    }
    129136    public IslandOffspringSelectionGeneticAlgorithmMainLoop()
    130137      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r4437 r4669  
    200200    [StorableConstructor]
    201201    private OffspringSelectionGeneticAlgorithm(bool deserializing) : base(deserializing) { }
     202    [StorableHook(HookType.AfterDeserialization)]
     203    private void AfterDeserialization() {
     204      Initialize();
     205    }
     206    private OffspringSelectionGeneticAlgorithm(OffspringSelectionGeneticAlgorithm original, Cloner cloner)
     207      : base(original, cloner) {
     208      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     209      selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
     210      Initialize();
     211    }
     212    public override IDeepCloneable Clone(Cloner cloner) {
     213      return new OffspringSelectionGeneticAlgorithm(this, cloner);
     214    }
    202215    public OffspringSelectionGeneticAlgorithm()
    203216      : base() {
     
    272285    }
    273286
    274     public override IDeepCloneable Clone(Cloner cloner) {
    275       OffspringSelectionGeneticAlgorithm clone = (OffspringSelectionGeneticAlgorithm)base.Clone(cloner);
    276       clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
    277       clone.selectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(selectionPressureAnalyzer);
    278       clone.Initialize();
    279       return clone;
    280     }
     287
    281288
    282289    public override void Prepare() {
     
    345352
    346353    #region Helpers
    347     [StorableHook(HookType.AfterDeserialization)]
    348354    private void Initialize() {
    349355      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    9293
    9394    [StorableConstructor]
    94     private OffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base() { }
     95    private OffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
     96    private OffspringSelectionGeneticAlgorithmMainLoop(OffspringSelectionGeneticAlgorithmMainLoop original, Cloner cloner)
     97      : base(original, cloner) {
     98    }
     99    public override IDeepCloneable Clone(Cloner cloner) {
     100      return new OffspringSelectionGeneticAlgorithmMainLoop(this, cloner);
     101    }
    95102    public OffspringSelectionGeneticAlgorithmMainLoop()
    96103      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    8788
    8889    [StorableConstructor]
    89     private OffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base() { }
     90    private OffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { }
     91    private OffspringSelectionGeneticAlgorithmMainOperator(OffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)
     92      : base(original, cloner) {
     93    }
     94    public override IDeepCloneable Clone(Cloner cloner) {
     95      return new OffspringSelectionGeneticAlgorithmMainOperator(this, cloner);
     96    }
    9097    public OffspringSelectionGeneticAlgorithmMainOperator()
    9198      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r4437 r4669  
    229229    [StorableConstructor]
    230230    private SASEGASA(bool deserializing) : base(deserializing) { }
     231    [StorableHook(HookType.AfterDeserialization)]
     232    private void AfterDeserialization() {
     233      Initialize();
     234    }
     235    private SASEGASA(SASEGASA original, Cloner cloner)
     236      : base(original, cloner) {
     237      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     238      villageQualityAnalyzer = cloner.Clone(original.villageQualityAnalyzer);
     239      selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
     240      villageSelectionPressureAnalyzer = cloner.Clone(original.villageSelectionPressureAnalyzer);
     241      Initialize();
     242    }
     243    public override IDeepCloneable Clone(Cloner cloner) {
     244      return new SASEGASA(this, cloner);
     245    }
    231246    public SASEGASA()
    232247      : base() {
     
    316331    }
    317332
    318     public override IDeepCloneable Clone(Cloner cloner) {
    319       SASEGASA clone = (SASEGASA)base.Clone(cloner);
    320       clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
    321       clone.villageQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(villageQualityAnalyzer);
    322       clone.selectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(selectionPressureAnalyzer);
    323       clone.villageSelectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(villageSelectionPressureAnalyzer);
    324       clone.Initialize();
    325       return clone;
    326     }
    327 
    328333    public override void Prepare() {
    329334      if (Problem != null) base.Prepare();
     
    408413
    409414    #region Helpers
    410     [StorableHook(HookType.AfterDeserialization)]
    411415    private void Initialize() {
    412416      NumberOfVillagesParameter.ValueChanged += new EventHandler(NumberOfVillagesParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    108109
    109110    [StorableConstructor]
    110     private SASEGASAMainLoop(bool deserializing) : base() { }
     111    private SASEGASAMainLoop(bool deserializing) : base(deserializing) { }
     112    private SASEGASAMainLoop(SASEGASAMainLoop original, Cloner cloner)
     113      : base(original, cloner) {
     114    }
     115    public override IDeepCloneable Clone(Cloner cloner) {
     116      return new SASEGASAMainLoop(this, cloner);
     117    }
    111118    public SASEGASAMainLoop()
    112119      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r4437 r4669  
    143143    [StorableConstructor]
    144144    private SimulatedAnnealing(bool deserializing) : base(deserializing) { }
     145    [StorableHook(HookType.AfterDeserialization)]
     146    private void AfterDeserialization() {
     147      Initialize();
     148    }
     149    private SimulatedAnnealing(SimulatedAnnealing original, Cloner cloner)
     150      : base(original, cloner) {
     151      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     152      Initialize();
     153    }
     154    public override IDeepCloneable Clone(Cloner cloner) {
     155      return new SimulatedAnnealing(this, cloner);
     156    }
    145157    public SimulatedAnnealing()
    146158      : base() {
     
    194206    }
    195207
    196     public override IDeepCloneable Clone(Cloner cloner) {
    197       SimulatedAnnealing clone = (SimulatedAnnealing)base.Clone(cloner);
    198       clone.qualityAnalyzer = (QualityAnalyzer)cloner.Clone(qualityAnalyzer);
    199       clone.Initialize();
    200       return clone;
    201     }
    202 
    203208    public override void Prepare() {
    204209      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null)
     
    282287
    283288    #region Helpers
    284     [StorableHook(HookType.AfterDeserialization)]
    285289    private void Initialize() {
    286290      if (Problem != null) {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs

    r4068 r4669  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    8384
    8485    [StorableConstructor]
    85     private SimulatedAnnealingMainLoop(bool deserializing) : base() { }
     86    private SimulatedAnnealingMainLoop(bool deserializing) : base(deserializing) { }
     87    private SimulatedAnnealingMainLoop(SimulatedAnnealingMainLoop original, Cloner cloner)
     88      : base(original, cloner) {
     89    }
     90    public override IDeepCloneable Clone(Cloner cloner) {
     91      return new SimulatedAnnealingMainLoop(this, cloner);
     92    }
    8693    public SimulatedAnnealingMainLoop()
    8794      : base() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.TabuSearch/3.3/TabuListCreator.cs

    r4068 r4669  
    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() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.TabuSearch/3.3/TabuNeighborhoodAnalyzer.cs

    r4068 r4669  
    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() {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r4437 r4669  
    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) {
  • branches/CloningRefactoring/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs

    r4068 r4669  
    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
  • branches/CloningRefactoring/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSelector.cs

    r4068 r4669  
    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
  • branches/CloningRefactoring/HeuristicLab.Data/3.3/BoolValue.cs

    r4662 r4669  
    3535    }
    3636
    37     [StorableConstructor]
    38     protected BoolValue(bool deserializing) : base(deserializing) { }
    3937    protected BoolValue(BoolValue original, Cloner cloner)
    4038      : base(original, cloner) {
    4139    }
    4240    public BoolValue() : base() { }
     41    [StorableConstructor]
    4342    public BoolValue(bool value) : base(value) { }
    4443
Note: See TracChangeset for help on using the changeset viewer.