Free cookie consent management tool by TermsFeed Policy Generator

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

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

Location:
branches/CloningRefactoring/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • 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() {
Note: See TracChangeset for help on using the changeset viewer.