Changeset 4688
- Timestamp:
- 10/29/10 20:26:45 (14 years ago)
- Location:
- branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs
r4098 r4688 21 21 22 22 using System.Linq; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 72 73 [StorableConstructor] 73 74 protected BestSingleObjectiveTestFunctionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 75 protected BestSingleObjectiveTestFunctionSolutionAnalyzer(BestSingleObjectiveTestFunctionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 74 76 public BestSingleObjectiveTestFunctionSolutionAnalyzer() 75 77 : base() { … … 89 91 /// </summary> 90 92 [StorableHook(HookType.AfterDeserialization)] 91 private void CompatibilityMethod() {93 private void AfterDeserialization() { 92 94 // BackwardsCompatibility3.3 93 95 // Bounds are introduced in 3.3.0.3894 94 96 if (!Parameters.ContainsKey("Bounds")) 95 97 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function.")); 98 } 99 100 public override IDeepCloneable Clone(Cloner cloner) { 101 return new BestSingleObjectiveTestFunctionSolutionAnalyzer(this, cloner); 96 102 } 97 103 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/AckleyEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 65 66 } 66 67 68 [StorableConstructor] 69 protected AckleyEvaluator(bool deserializing) : base(deserializing) { } 70 protected AckleyEvaluator(AckleyEvaluator original, Cloner cloner) : base(original, cloner) { } 71 public AckleyEvaluator() : base() { } 72 73 public override IDeepCloneable Clone(Cloner cloner) { 74 return new AckleyEvaluator(this, cloner); 75 } 76 67 77 public override RealVector GetBestKnownSolution(int dimension) { 68 78 return new RealVector(dimension); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BealeEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 65 66 } 66 67 68 [StorableConstructor] 69 protected BealeEvaluator(bool deserializing) : base(deserializing) { } 70 protected BealeEvaluator(BealeEvaluator original, Cloner cloner) : base(original, cloner) { } 71 public BealeEvaluator() : base() { } 72 73 public override IDeepCloneable Clone(Cloner cloner) { 74 return new BealeEvaluator(this, cloner); 75 } 76 67 77 public override RealVector GetBestKnownSolution(int dimension) { 68 78 if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension"); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BoothEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 64 65 } 65 66 67 [StorableConstructor] 68 protected BoothEvaluator(bool deserializing) : base(deserializing) { } 69 protected BoothEvaluator(BoothEvaluator original, Cloner cloner) : base(original, cloner) { } 70 public BoothEvaluator() : base() { } 71 72 public override IDeepCloneable Clone(Cloner cloner) { 73 return new BoothEvaluator(this, cloner); 74 } 75 66 76 public override RealVector GetBestKnownSolution(int dimension) { 67 77 if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension"); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/GriewankEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 64 65 public override int MaximumProblemSize { 65 66 get { return int.MaxValue; } 67 } 68 69 [StorableConstructor] 70 protected GriewankEvaluator(bool deserializing) : base(deserializing) { } 71 protected GriewankEvaluator(GriewankEvaluator original, Cloner cloner) : base(original, cloner) { } 72 public GriewankEvaluator() : base() { } 73 74 public override IDeepCloneable Clone(Cloner cloner) { 75 return new GriewankEvaluator(this, cloner); 66 76 } 67 77 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/LevyEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 62 63 public override int MaximumProblemSize { 63 64 get { return int.MaxValue; } 65 } 66 67 [StorableConstructor] 68 protected LevyEvaluator(bool deserializing) : base(deserializing) { } 69 protected LevyEvaluator(LevyEvaluator original, Cloner cloner) : base(original, cloner) { } 70 public LevyEvaluator() : base() { } 71 72 public override IDeepCloneable Clone(Cloner cloner) { 73 return new LevyEvaluator(this, cloner); 64 74 } 65 75 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MatyasEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 64 65 } 65 66 67 [StorableConstructor] 68 protected MatyasEvaluator(bool deserializing) : base(deserializing) { } 69 protected MatyasEvaluator(MatyasEvaluator original, Cloner cloner) : base(original, cloner) { } 70 public MatyasEvaluator() : base() { } 71 72 public override IDeepCloneable Clone(Cloner cloner) { 73 return new MatyasEvaluator(this, cloner); 74 } 75 66 76 public override RealVector GetBestKnownSolution(int dimension) { 67 77 if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension"); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MultinormalEvaluator.cs
r4068 r4688 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Diagnostics; 4 25 using System.Linq; 26 using HeuristicLab.Common; 5 27 using HeuristicLab.Core; 6 28 using HeuristicLab.Data; … … 23 45 } 24 46 private static Random Random = new Random(); 25 26 [StorableConstructor]27 public MultinormalEvaluator(bool deserializing) { }28 47 29 48 private Dictionary<int, List<RealVector>> stdCenters; … … 66 85 } 67 86 87 [StorableConstructor] 88 protected MultinormalEvaluator(bool deserializing) : base(deserializing) { } 89 protected MultinormalEvaluator(MultinormalEvaluator original, Cloner cloner) : base(original, cloner) { } 68 90 public MultinormalEvaluator() { 69 91 Parameters.Add(new ValueParameter<ItemList<RealVector>>("Centers", "Centers of normal distributions")); … … 72 94 centers = new ItemList<RealVector>(); 73 95 s_2s = new RealVector(); 96 } 97 98 public override IDeepCloneable Clone(Cloner cloner) { 99 return new MultinormalEvaluator(this, cloner); 74 100 } 75 101 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RastriginEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 83 84 } 84 85 86 [StorableConstructor] 87 protected RastriginEvaluator(bool deserializing) : base(deserializing) { } 88 protected RastriginEvaluator(RastriginEvaluator original, Cloner cloner) : base(original, cloner) { } 85 89 /// <summary> 86 90 /// Initializes a new instance of the RastriginEvaluator with one parameter (<c>A</c>). … … 89 93 : base() { 90 94 Parameters.Add(new ValueParameter<DoubleValue>("A", "The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.", new DoubleValue(10))); 95 } 96 97 public override IDeepCloneable Clone(Cloner cloner) { 98 return new RastriginEvaluator(this, cloner); 91 99 } 92 100 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RosenbrockEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 68 69 } 69 70 71 [StorableConstructor] 72 protected RosenbrockEvaluator(bool deserializing) : base(deserializing) { } 73 protected RosenbrockEvaluator(RosenbrockEvaluator original, Cloner cloner) : base(original, cloner) { } 74 public RosenbrockEvaluator() : base() { } 75 76 public override IDeepCloneable Clone(Cloner cloner) { 77 return new RosenbrockEvaluator(this, cloner); 78 } 79 70 80 public override RealVector GetBestKnownSolution(int dimension) { 71 81 if (dimension < 2) throw new ArgumentException(Name + ": This function is not defined for 1 dimension."); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SchwefelEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 64 65 } 65 66 67 [StorableConstructor] 68 protected SchwefelEvaluator(bool deserializing) : base(deserializing) { } 69 protected SchwefelEvaluator(SchwefelEvaluator original, Cloner cloner) : base(original, cloner) { } 70 public SchwefelEvaluator() : base() { } 71 72 public override IDeepCloneable Clone(Cloner cloner) { 73 return new SchwefelEvaluator(this, cloner); 74 } 75 66 76 public override RealVector GetBestKnownSolution(int dimension) { 67 77 return null; -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SingleObjectiveTestFunctionProblemEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 67 68 get { return (ILookupParameter<RealVector>)Parameters["Point"]; } 68 69 } 70 71 [StorableConstructor] 72 protected SingleObjectiveTestFunctionProblemEvaluator(bool deserializing) : base(deserializing) { } 73 protected SingleObjectiveTestFunctionProblemEvaluator(SingleObjectiveTestFunctionProblemEvaluator original, Cloner cloner) : base(original, cloner) { } 69 74 /// <summary> 70 75 /// Initializes a new instance of <see cref="SingleObjectiveTestFunctionEvaluator"/> with two parameters 71 76 /// (<c>Quality</c> and <c>Point</c>). 72 77 /// </summary> 73 public SingleObjectiveTestFunctionProblemEvaluator() { 78 public SingleObjectiveTestFunctionProblemEvaluator() 79 : base() { 74 80 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Result of the evaluation of a solution.")); 75 81 Parameters.Add(new LookupParameter<RealVector>("Point", "The point at which the function should be evaluated.")); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SphereEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 66 67 } 67 68 69 public override IDeepCloneable Clone(Cloner cloner) { 70 return new SphereEvaluator(this, cloner); 71 } 72 68 73 public override RealVector GetBestKnownSolution(int dimension) { 69 74 return new RealVector(dimension); … … 97 102 } 98 103 104 [StorableConstructor] 105 protected SphereEvaluator(bool deserializing) : base(deserializing) { } 106 protected SphereEvaluator(SphereEvaluator original, Cloner cloner) : base(original, cloner) { } 99 107 /// <summary> 100 108 /// Initializes a new instance of the SphereEvaluator with two parameters (<c>C</c> and <c>Alpha</c>). -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SumSquaresEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 63 64 } 64 65 66 [StorableConstructor] 67 protected SumSquaresEvaluator(bool deserializing) : base(deserializing) { } 68 protected SumSquaresEvaluator(SumSquaresEvaluator original, Cloner cloner) : base(original, cloner) { } 69 public SumSquaresEvaluator() : base() { } 70 71 public override IDeepCloneable Clone(Cloner cloner) { 72 return new SumSquaresEvaluator(this, cloner); 73 } 74 65 75 public override RealVector GetBestKnownSolution(int dimension) { 66 76 return new RealVector(dimension); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/ZakharovEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 67 68 } 68 69 70 [StorableConstructor] 71 protected ZakharovEvaluator(bool deserializing) : base(deserializing) { } 72 protected ZakharovEvaluator(ZakharovEvaluator original, Cloner cloner) : base(original, cloner) { } 73 public ZakharovEvaluator() : base() { } 74 75 public override IDeepCloneable Clone(Cloner cloner) { 76 return new ZakharovEvaluator(this, cloner); 77 } 78 69 79 /// <summary> 70 80 /// Evaluates the test function for a specific <paramref name="point"/>. -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AckleyAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(AckleyEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected AckleyAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected AckleyAdditiveMoveEvaluator(AckleyAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public AckleyAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new AckleyAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AdditiveMoveEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 51 52 } 52 53 54 [StorableConstructor] 55 protected AdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 56 protected AdditiveMoveEvaluator(AdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 53 57 protected AdditiveMoveEvaluator() 54 58 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BealeAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(BealeEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected BealeAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected BealeAdditiveMoveEvaluator(BealeAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public BealeAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new BealeAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BoothAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(BoothEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected BoothAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected BoothAdditiveMoveEvaluator(BoothAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public BoothAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new BoothAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/GriewankAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(GriewankEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected GriewankAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected GriewankAdditiveMoveEvaluator(GriewankAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public GriewankAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new GriewankAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/LevyAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(LevyEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected LevyAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected LevyAdditiveMoveEvaluator(LevyAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public LevyAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new LevyAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MatyasAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(MatyasEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected MatyasAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected MatyasAdditiveMoveEvaluator(MatyasAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public MatyasAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new MatyasAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MultinormalAdditiveMoveEvaluator.cs
r4068 r4688 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.RealVectorEncoding; … … 35 36 } 36 37 37 MultinormalEvaluator evaluator = new MultinormalEvaluator(); 38 38 [StorableConstructor] 39 protected MultinormalAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 40 protected MultinormalAdditiveMoveEvaluator(MultinormalAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 39 41 public MultinormalAdditiveMoveEvaluator() { 40 42 Parameters.Add(new LookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>("Evaluator", "")); 43 } 44 45 public override IDeepCloneable Clone(Cloner cloner) { 46 return new MultinormalAdditiveMoveEvaluator(this, cloner); 41 47 } 42 48 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 47 48 } 48 49 50 [StorableConstructor] 51 protected RastriginAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 52 protected RastriginAdditiveMoveEvaluator(RastriginAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 49 53 public RastriginAdditiveMoveEvaluator() { 50 54 Parameters.Add(new ValueParameter<DoubleValue>("A", "The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.", new DoubleValue(10))); 55 } 56 57 public override IDeepCloneable Clone(Cloner cloner) { 58 return new RastriginAdditiveMoveEvaluator(this, cloner); 51 59 } 52 60 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RealVectorAdditiveMoveWrapper.cs
r3450 r4688 36 36 this.vector = new RealVector(); 37 37 } 38 39 38 public RealVectorAdditiveMoveWrapper(AdditiveMove move, RealVector vector) { 40 39 dimension = move.Dimension; -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RosenbrockAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(RosenbrockEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected RosenbrockAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected RosenbrockAdditiveMoveEvaluator(RosenbrockAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public RosenbrockAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new RosenbrockAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SchwefelAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(SchwefelEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected SchwefelAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected SchwefelAdditiveMoveEvaluator(SchwefelAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public SchwefelAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new SchwefelAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 61 62 } 62 63 64 [StorableConstructor] 65 protected SphereAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 66 protected SphereAdditiveMoveEvaluator(SphereAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 63 67 public SphereAdditiveMoveEvaluator() { 64 68 Parameters.Add(new ValueParameter<DoubleValue>("C", "The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.", new DoubleValue(1))); 65 69 Parameters.Add(new ValueParameter<DoubleValue>("Alpha", "The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.", new DoubleValue(2))); 70 } 71 72 public override IDeepCloneable Clone(Cloner cloner) { 73 return new SphereAdditiveMoveEvaluator(this, cloner); 66 74 } 67 75 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SumSquaresAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(SumSquaresEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected SumSquaresAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected SumSquaresAdditiveMoveEvaluator(SumSquaresAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public SumSquaresAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new SumSquaresAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/ZakharovAdditiveMoveEvaluator.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; … … 31 32 get { return typeof(ZakharovEvaluator); } 32 33 } 34 35 [StorableConstructor] 36 protected ZakharovAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { } 37 protected ZakharovAdditiveMoveEvaluator(ZakharovAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 38 public ZakharovAdditiveMoveEvaluator() : base() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new ZakharovAdditiveMoveEvaluator(this, cloner); 42 } 43 33 44 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 45 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/RealVectorToRealVectorEncoder.cs
r4068 r4688 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 25 26 using HeuristicLab.Operators; 26 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 28 30 namespace HeuristicLab.Problems.TestFunctions { … … 55 57 } 56 58 59 [StorableConstructor] 60 protected RealVectorToRealVectorEncoder(bool deserializing) : base(deserializing) { } 61 protected RealVectorToRealVectorEncoder(RealVectorToRealVectorEncoder original, Cloner cloner) : base(original, cloner) { } 57 62 public RealVectorToRealVectorEncoder() 58 63 : base() { … … 62 67 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope bounds matrix should be cloned.")); 63 68 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.")); 69 } 70 71 public override IDeepCloneable Clone(Cloner cloner) { 72 return new RealVectorToRealVectorEncoder(this, cloner); 64 73 } 65 74 -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r4419 r4688 134 134 [StorableConstructor] 135 135 private SingleObjectiveTestFunctionProblem(bool deserializing) : base(deserializing) { } 136 private SingleObjectiveTestFunctionProblem(SingleObjectiveTestFunctionProblem original, Cloner cloner) 137 : base(original, cloner) { 138 operators = original.operators.Where(x => original.IsNotFieldReferenced(x)).Select(x => cloner.Clone(x)).ToList(); 139 strategyVectorCreator = cloner.Clone(original.strategyVectorCreator); 140 operators.Add(strategyVectorCreator); 141 strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover); 142 operators.Add(strategyVectorCrossover); 143 strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator); 144 operators.Add(strategyVectorManipulator); 145 AttachEventHandlers(); 146 } 136 147 public SingleObjectiveTestFunctionProblem() 137 148 : base() { … … 164 175 165 176 public override IDeepCloneable Clone(Cloner cloner) { 166 SingleObjectiveTestFunctionProblem clone = (SingleObjectiveTestFunctionProblem)base.Clone(cloner); 167 clone.operators = operators.Where(x => IsNotFieldReferenced(x)).Select(x => (IOperator)cloner.Clone(x)).ToList(); 168 clone.strategyVectorCreator = (StdDevStrategyVectorCreator)cloner.Clone(strategyVectorCreator); 169 clone.operators.Add(clone.strategyVectorCreator); 170 clone.strategyVectorCrossover = (StdDevStrategyVectorCrossover)cloner.Clone(strategyVectorCrossover); 171 clone.operators.Add(strategyVectorCrossover); 172 clone.strategyVectorManipulator = (StdDevStrategyVectorManipulator)cloner.Clone(strategyVectorManipulator); 173 clone.operators.Add(strategyVectorManipulator); 174 clone.AttachEventHandlers(); 175 return clone; 177 return new SingleObjectiveTestFunctionProblem(this, cloner); 176 178 } 177 179 … … 299 301 #region Helpers 300 302 [StorableHook(HookType.AfterDeserialization)] 301 private void AfterDeserialization Hook() {303 private void AfterDeserialization() { 302 304 // BackwardsCompatibility3.3 303 305 #region Backwards compatible code (remove with 3.4) -
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionSolution.cs
r3894 r4688 122 122 } 123 123 124 [StorableConstructor] 125 protected SingleObjectiveTestFunctionSolution(bool deserializing) : base(deserializing) { } 126 protected SingleObjectiveTestFunctionSolution(SingleObjectiveTestFunctionSolution original, Cloner cloner) 127 : base(original, cloner) { 128 bestKnownRealVector = cloner.Clone(original.bestKnownRealVector); 129 bestRealVector = cloner.Clone(original.bestRealVector); 130 bestQuality = cloner.Clone(original.bestQuality); 131 population = cloner.Clone(original.population); 132 evaluator = cloner.Clone(original.evaluator); 133 bounds = cloner.Clone(original.bounds); 134 Initialize(); 135 } 124 136 public SingleObjectiveTestFunctionSolution() : base() { } 125 137 public SingleObjectiveTestFunctionSolution(RealVector realVector, DoubleValue quality, ISingleObjectiveTestFunctionProblemEvaluator evaluator) … … 130 142 Initialize(); 131 143 } 132 [StorableConstructor]133 private SingleObjectiveTestFunctionSolution(bool deserializing) : base(deserializing) { }134 144 135 145 [StorableHook(HookType.AfterDeserialization)] 146 private void AfterDeserialization() { 147 Initialize(); 148 } 149 136 150 private void Initialize() { 137 151 if (bestKnownRealVector != null) RegisterBestKnownRealVectorEvents(); … … 143 157 144 158 public override IDeepCloneable Clone(Cloner cloner) { 145 SingleObjectiveTestFunctionSolution clone = new SingleObjectiveTestFunctionSolution(); 146 cloner.RegisterClonedObject(this, clone); 147 clone.bestKnownRealVector = (RealVector)cloner.Clone(bestKnownRealVector); 148 clone.bestRealVector = (RealVector)cloner.Clone(bestRealVector); 149 clone.bestQuality = (DoubleValue)cloner.Clone(bestQuality); 150 clone.population = (ItemArray<RealVector>)cloner.Clone(population); 151 clone.evaluator = (ISingleObjectiveTestFunctionProblemEvaluator)cloner.Clone(evaluator); 152 clone.bounds = (DoubleMatrix)cloner.Clone(bounds); 153 clone.Initialize(); 154 return clone; 159 return new SingleObjectiveTestFunctionSolution(this, cloner); 155 160 } 156 161
Note: See TracChangeset
for help on using the changeset viewer.