- Timestamp:
- 04/13/10 09:47:06 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs
r3315 r3318 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 24 using HeuristicLab.Encodings.RealVectorEncoding; 25 using HeuristicLab.Parameters; 23 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Encodings.RealVectorEncoding;25 27 26 28 namespace HeuristicLab.Problems.TestFunctions { 27 29 [Item("RastriginAdditiveMoveEvaluator", "Class for evaluating an additive move on the Rastrigin function.")] 28 30 [StorableClass] 29 public class RastriginAdditiveMoveEvaluator : AdditiveMoveEvaluator {31 public class RastriginAdditiveMoveEvaluator : AdditiveMoveEvaluator, IRastriginMoveEvaluator { 30 32 public override System.Type EvaluatorType { 31 33 get { return typeof(RastriginEvaluator); } 32 34 } 35 /// <summary> 36 /// 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. 37 /// </summary> 38 public ValueParameter<DoubleValue> AParameter { 39 get { return (ValueParameter<DoubleValue>)Parameters["A"]; } 40 } 41 /// <summary> 42 /// 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. 43 /// </summary> 44 public DoubleValue A { 45 get { return AParameter.Value; } 46 set { if (value != null) AParameter.Value = value; } 47 } 48 33 49 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 50 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); 35 return RastriginEvaluator.Apply(wrapper, 10); // FIXME: the parameters have to be wired51 return RastriginEvaluator.Apply(wrapper, A.Value); 36 52 } 37 53 } -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs
r3315 r3318 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 24 using HeuristicLab.Encodings.RealVectorEncoding; 25 using HeuristicLab.Parameters; 23 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Encodings.RealVectorEncoding;25 27 26 28 namespace HeuristicLab.Problems.TestFunctions { 27 29 [Item("SphereAdditiveMoveEvaluator", "Class for evaluating an additive move on the Sphere function.")] 28 30 [StorableClass] 29 public class SphereAdditiveMoveEvaluator : AdditiveMoveEvaluator { 31 public class SphereAdditiveMoveEvaluator : AdditiveMoveEvaluator, ISphereMoveEvaluator { 32 /// <summary> 33 /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1. 34 /// </summary> 35 public ValueParameter<DoubleValue> CParameter { 36 get { return (ValueParameter<DoubleValue>)Parameters["C"]; } 37 } 38 /// <summary> 39 /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2. 40 /// </summary> 41 public ValueParameter<DoubleValue> AlphaParameter { 42 get { return (ValueParameter<DoubleValue>)Parameters["Alpha"]; } 43 } 44 /// <summary> 45 /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1. 46 /// </summary> 47 public DoubleValue C { 48 get { return CParameter.Value; } 49 set { if (value != null) CParameter.Value = value; } 50 } 51 /// <summary> 52 /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2. 53 /// </summary> 54 public DoubleValue Alpha { 55 get { return AlphaParameter.Value; } 56 set { if (value != null) AlphaParameter.Value = value; } 57 } 58 30 59 public override System.Type EvaluatorType { 31 60 get { return typeof(SphereEvaluator); } … … 33 62 protected override double Evaluate(double quality, RealVector point, AdditiveMove move) { 34 63 RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point); 35 return SphereEvaluator.Apply(wrapper, 1, 2); // FIXME: the parameters have to be wired.64 return SphereEvaluator.Apply(wrapper, C.Value, Alpha.Value); 36 65 } 37 66 }
Note: See TracChangeset
for help on using the changeset viewer.