Changeset 4722 for trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm
- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r4477 r4722 192 192 [StorableConstructor] 193 193 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 } 195 204 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); 200 206 } 201 207 … … 265 271 266 272 #region Helpers 267 [StorableHook(HookType.AfterDeserialization)]268 273 private void Initialize() { 269 274 PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged); -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs
r4068 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 82 83 83 84 [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 } 85 92 public GeneticAlgorithmMainLoop() 86 93 : base() { -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r4437 r4722 197 197 [StorableConstructor] 198 198 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 199 213 public IslandGeneticAlgorithm() 200 214 : base() { … … 282 296 } 283 297 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 292 298 public override void Prepare() { 293 299 if (Problem != null) base.Prepare(); … … 362 368 363 369 #region Helpers 364 [StorableHook(HookType.AfterDeserialization)]365 370 private void Initialize() { 366 371 PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged); -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r4068 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 103 104 104 105 [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 } 106 113 public IslandGeneticAlgorithmMainLoop() 107 114 : base() {
Note: See TracChangeset
for help on using the changeset viewer.