Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/10 23:39:40 (14 years ago)
Author:
abeham
Message:

Documented some of the test functions with literature references.
Renamed Griewangk function as it is actually called Griewank function.
Schwefel is hard to find, used self-citation as Potter and DeJong's description from 1994 seems wrong
Levy is almost impossible to find and defined only for 2 variables, the implementation looks fishy (there was also a bug)
Booth, and Matyas are also just from a single website
Still missing is Zakharov and SumSquares
#934

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RastriginEvaluator.cs

    r3170 r3315  
    2525using HeuristicLab.Encodings.RealVectorEncoding;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Parameters;
    2728
    2829namespace HeuristicLab.Problems.TestFunctions {
    2930  /// <summary>
    30   /// Rastrigin Function<br/>
    31   /// Domain:  [-5.12 , 5.12]^n <br/>
    32   /// Optimum: 0.0 at (0, 0, ..., 0)
     31  /// The generalized Rastrigin function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))) is a highly multimodal function that has its optimal value 0 at the origin.
     32  /// It is implemented as described in Eiben, A.E. and Smith, J.E. 2003. Introduction to Evolutionary Computation. Natural Computing Series, Springer-Verlag Berlin Heidelberg.
    3333  /// </summary
    34   [Item("RastriginEvaluator", "Evaluates the Rastrigin function on a given point. The optimum of this function is 0 at the origin.")]
     34  [Item("RastriginEvaluator", "Evaluates the generalized Rastrigin function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))) on a given point. The optimum of this function is 0 at the origin. It is implemented as described in Eiben, A.E. and Smith, J.E. 2003. Introduction to Evolutionary Computation. Natural Computing Series, Springer-Verlag Berlin Heidelberg.")]
    3535  [StorableClass]
    3636  public class RastriginEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    6565      get { return int.MaxValue; }
    6666    }
     67    /// <summary>
     68    /// 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.
     69    /// </summary>
     70    public ValueParameter<DoubleValue> AParameter {
     71      get { return (ValueParameter<DoubleValue>)Parameters["A"]; }
     72    }
     73    /// <summary>
     74    /// 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.
     75    /// </summary>
     76    public DoubleValue A {
     77      get { return AParameter.Value; }
     78      set { if (value != null) AParameter.Value = value; }
     79    }
     80
     81    /// <summary>
     82    /// Initializes a new instance of the RastriginEvaluator with one parameter (<c>A</c>).
     83    /// </summary>
     84    public RastriginEvaluator()
     85      : base() {
     86      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)));
     87    }
    6788
    6889    /// <summary>
     
    7192    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    7293    /// <returns>The result value of the Rastrigin function at the given point.</returns>
    73     public static double Apply(RealVector point) {
    74       double result = 10 * point.Length;
     94    public static double Apply(RealVector point, double a) {
     95      double result = a * point.Length;
    7596      for (int i = 0; i < point.Length; i++) {
    7697        result += point[i] * point[i];
    77         result -= 10 * Math.Cos(2 * Math.PI * point[i]);
     98        result -= a * Math.Cos(2 * Math.PI * point[i]);
    7899      }
    79100      return (result);
     
    87108    /// <returns>The result value of the Rastrigin function at the given point.</returns>
    88109    protected override double EvaluateFunction(RealVector point) {
    89       return Apply(point);
     110      return Apply(point, A.Value);
    90111    }
    91112  }
Note: See TracChangeset for help on using the changeset viewer.