Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3315


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

Location:
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3
Files:
12 edited
2 moved

Legend:

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

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Ackley Function<br/>
    31   /// Domain:  [-32.768 , 32.768]^n <br/>
    32   /// Optimum: 0.0 at (0, 0, ..., 0)
     30  /// The Ackley function as described in Eiben, A.E. and Smith, J.E. 2003. Introduction to Evolutionary Computation. Natural Computing Series, Springer-Verlag Berlin Heidelberg
     31  /// is highly multimodal. It has a single global minimum at the origin with value 0.
    3332  /// </summary
    34   [Item("AckleyEvaluator", "Evaluates the Ackley function on a given point. The optimum of this function is 0 at the origin.")]
     33  [Item("AckleyEvaluator", "Evaluates the Ackley function 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.")]
    3534  [StorableClass]
    3635  public class AckleyEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    7877      for (int i = 0; i < point.Length; i++)
    7978        val += point[i] * point[i];
    80       val *= 1.0 / point.Length;
    81       val = Math.Sqrt(val);
    82       val *= -0.2;
     79      val /= point.Length;
     80      val = -0.2 * Math.Sqrt(val);
    8381      result -= 20 * Math.Exp(val);
    8482
     
    8684      for (int i = 0; i < point.Length; i++)
    8785        val += Math.Cos(2 * Math.PI * point[i]);
    88       val *= 1.0 / point.Length;
     86      val /= point.Length;
    8987      result -= Math.Exp(val);
    9088      return (result);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BealeEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Beale Function<br/>
    31   /// Domain:  [-4.5 , 4.5]^2<br/>
    32   /// Optimum: 0.0 at (3.0, 0.5)
     30  /// The Beale function is defined for 2 dimensions with an optimum of 0 at (3, 0.5).
     31  /// It is implemented as described in Moré, J.J., Garbow, B., and Hillstrom, K. 1981. Testing unconstrained optimization software. ACM Transactions on Mathematical Software 7, pp. 136-140, ACM.
    3332  /// </summary>
    34   [Item("BealeEvaluator", "Evaluates the Beale function on a given point. The optimum of this function is 0 at (3,0.5).")]
     33  [Item("BealeEvaluator", "Evaluates the Beale function on a given point. The optimum of this function is 0 at (3,0.5). It is implemented as described in Moré, J.J., Garbow, B., and Hillstrom, K. 1981. Testing unconstrained optimization software. ACM Transactions on Mathematical Software 7, pp. 136-140, ACM.")]
    3534  [StorableClass]
    3635  public class BealeEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    7271    /// <returns>The result value of the Beale function at the given point.</returns>
    7372    public static double Apply(RealVector point) {
    74       return Math.Pow(1.5 - point[0] * (1 - point[1]), 2) + Math.Pow(2.25 - point[0] * (1 - (point[1] * point[1])), 2) + Math.Pow((2.625 - point[0] * (1 - (point[1] * point[1] * point[1]))), 2);
     73      double x1 = point[0], x2 = point[1];
     74      double f1 = 1.5 - x1 * (1 - x2);
     75      double f2 = 2.25 - x1 * (1 - x2 * x2);
     76      double f3 = 2.625 - x1 * (1 - x2 * x2 * x2);
     77      return (f1 * f1) + (f2 * f2) + (f3 * f3);
    7578    }
    7679
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BoothEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Booth Function<br/>
    31   /// Domain:  [-10.0 , 10.0]^2<br/>
    32   /// Optimum: 0.0 at (1.0, 3.0)
     30  /// The Booth function is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page816.htm, last accessed April 12th, 2010.
    3331  /// </summary>
    34   [Item("BoothEvaluator", "Evaluates the Booth function on a given point. The optimum of this function is 0 at (1,3).")]
     32  [Item("BoothEvaluator", "Evaluates the Booth function on a given point. The optimum of this function is 0 at (1,3). It is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page816.htm, last accessed April 12th, 2010.")]
    3533  [StorableClass]
    3634  public class BoothEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    7270    /// <returns>The result value of the Booth function at the given point.</returns>
    7371    public static double Apply(RealVector point) {
    74       return Math.Pow(point[0] + 2 * point[1] - 7, 2) + Math.Pow(2 * point[0] + point[1] - 5, 2);
     72      return (point[0] + 2 * point[1] - 7) * (point[0] + 2 * point[1] - 7)
     73        + (2 * point[0] + point[1] - 5) * (2 * point[0] + point[1] - 5);
    7574    }
    7675
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/GriewankEvaluator.cs

    r3307 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Griewangk Function<br/>
    31   /// Domain:  [-600.0 , 600.0]^n<br/>
    32   /// Optimum: 0.0 at (0, 0, ..., 0)
     30  /// The Griewank function is introduced in Griewank, A.O. 1981. Generalized descent for global optimization. Journal of Optimization Theory and Applications 34, pp. 11-39.
     31  /// It is a multimodal fitness function in the range [-600,600]^n.
     32  /// Here it is implemented as described (without the modifications) in Locatelli, M. 2003. A note on the Griewank test function. Journal of Global Optimization 25, pp. 169-174, Springer.
    3333  /// </summary>
    34   [Item("GriewangkEvaluator", "Evaluates the Griewangk function on a given point. The optimum of this function is 0 at the origin.")]
     34  [Item("GriewankEvaluator", "Evaluates the Griewank function on a given point. The optimum of this function is 0 at the origin. It is introduced by Griewank A.O. 1981 and implemented as described (without the modifications) in Locatelli, M. 2003. A note on the Griewank test function. Journal of Global Optimization 25, pp. 169-174, Springer.")]
    3535  [StorableClass]
    36   public class GriewangkEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     36  public class GriewankEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
    3737    /// <summary>
    3838    /// Returns false as the Griewangk function is a minimization problem.
     
    5454    }
    5555    /// <summary>
    56     /// Gets the minimum problem size (2).
     56    /// Gets the minimum problem size (1).
    5757    /// </summary>
    5858    public override int MinimumProblemSize {
    59       get { return 2; }
     59      get { return 1; }
    6060    }
    6161    /// <summary>
     
    6565      get { return int.MaxValue; }
    6666    }
     67
     68    /// <summary>
     69    /// If dimension of the problem is less or equal than 100 the values of Math.Sqrt(i + 1) are precomputed.
     70    /// </summary>
     71    private double[] sqrts;
    6772
    6873    /// <summary>
     
    8489
    8590      result = result - val + 1;
    86       return (result);
     91      return result;
     92    }
     93
     94    /// <summary>
     95    /// Evaluates the test function for a specific <paramref name="point"/>. It uses an array of precomputed values for Math.Sqrt(i + 1) with i = 0..N
     96    /// </summary>
     97    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
     98    /// <param name="sqrts">The precomputed array of square roots.</param>
     99    /// <returns>The result value of the Griewangk function at the given point.</returns>
     100    private static double Apply(RealVector point, double[] sqrts) {
     101      double result = 0;
     102      double val = 0;
     103
     104      for (int i = 0; i < point.Length; i++)
     105        result += point[i] * point[i];
     106      result = result / 4000;
     107
     108      val = Math.Cos(point[0]);
     109      for (int i = 1; i < point.Length; i++)
     110        val *= Math.Cos(point[i] / sqrts[i]);
     111
     112      result = result - val + 1;
     113      return result;
    87114    }
    88115
     
    94121    /// <returns>The result value of the Griewangk function at the given point.</returns>
    95122    protected override double EvaluateFunction(RealVector point) {
    96       return Apply(point);
     123      if (point.Length > 100)
     124        return Apply(point);
     125      else {
     126        if (sqrts == null || sqrts.Length < point.Length) ComputeSqrts(point.Length);
     127        return Apply(point, sqrts);
     128      }
     129    }
     130
     131    private void ComputeSqrts(int length) {
     132      sqrts = new double[length];
     133      for (int i = 0; i < length; i++) sqrts[i] = Math.Sqrt(i + 1);
    97134    }
    98135  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/LevyEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Levy Function<br/>
    31   /// Domain:  [-10.0 , 10.0]^n<br/>
    32   /// Optimum: 0.0 at (1.0, 1.0, ..., 1.0)
     30  /// The Levy function is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page2056.htm, last accessed April 12th, 2010.
    3331  /// </summary>
    34   [Item("LevyEvaluator", "Evaluates the Levy function on a given point. The optimum of this function is 0 at (1,1,...,1).")]
     32  [Item("LevyEvaluator", "Evaluates the Levy function on a given point. The optimum of this function is 0 at (1,1,...,1). It is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page2056.htm, last accessed April 12th, 2010.")]
    3533  [StorableClass]
    3634  public class LevyEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    8078      }
    8179
    82       s = Math.Pow(Math.Sin(Math.PI * z[1]), 2);
     80      s = Math.Sin(Math.PI * z[0]);
     81      s *= s;
    8382
    8483      for (int i = 0; i < length - 1; i++) {
    85         s += Math.Pow(z[i] - 1, 2) * (1 + 10 * Math.Pow(Math.Sin(Math.PI * z[i] + 1), 2));
     84        s += (z[i] - 1) * (z[i] - 1) * (1 + 10 * Math.Pow(Math.Sin(Math.PI * z[i] + 1), 2));
    8685      }
    8786
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MatyasEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Matyas Function<br/>
    31   /// Domain:  [-10.0 , 10.0]^2<br/>
    32   /// Optimum: 0.0 at (0.0, 0.0)
     30  /// The Matyas function is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page2213.htm, last accessed April 12th, 2010.
    3331  /// </summary>
    34   [Item("MatyasEvaluator", "Evaluates the Matyas function on a given point. The optimum of this function is 0 at the origin.")]
     32  [Item("MatyasEvaluator", "Evaluates the Matyas function on a given point. The optimum of this function is 0 at the origin. It is implemented as described on http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page2213.htm, last accessed April 12th, 2010.")]
    3533  [StorableClass]
    3634  public class MatyasEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
  • 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  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RosenbrockEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Rosenbrock Function<br/>
    31   /// Domain:  [-2.048 , 2.048]^n<br/>
    32   /// Optimum: 0.0 at (1, 1, ..., 1)
     30  /// The Rosenbrock function features a flat valley in which the global optimum is located.
     31  /// It is implemented as generalized Rosenbrock function as for example given in Shang, Y.-W. and Qiu, Y.-H. 2006. A Note on the Extended Rosenbrock Function. Evolutionary Computation 14, pp. 119-126, MIT Press.
    3332  /// </summary>
    34   [Item("RosenbrockEvaluator", "Evaluates the Rosenbrock function on a given point. The optimum of this function is 0 at (1,1,...,1).")]
     33  [Item("RosenbrockEvaluator", @"The Rosenbrock function features a flat valley in which the global optimum is located.
     34For 2 and 3 dimensions the optimum of this function is 0 at (1,1,...,1), for 4 to 30 dimensions there is an additional local minimum.
     35It is unknown how many local minima there are for dimensions greater than 30.
     36It is implemented as generalized Rosenbrock function as for example given in Shang, Y.-W. and Qiu, Y.-H. 2006. A Note on the Extended Rosenbrock Function. Evolutionary Computation 14, pp. 119-126, MIT Press.")]
    3537  [StorableClass]
    3638  public class RosenbrockEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    7476      double result = 0;
    7577      for (int i = 0; i < point.Length - 1; i++) {
    76         result += 100 * (point[i + 1] - point[i] * point[i]) * (point[i + 1] - point[i] * point[i]);
    77         result += (1 - point[i]) * (1 - point[i]);
     78        result += 100 * (point[i] * point[i] - point[i + 1]) * (point[i] * point[i] - point[i + 1]);
     79        result += (point[i] - 1) * (point[i] - 1);
    7880      }
    7981      return result;
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SchwefelEvaluator.cs

    r3170 r3315  
    2828namespace HeuristicLab.Problems.TestFunctions {
    2929  /// <summary>
    30   /// Schwefel Function (Sine Root)<br/>
    31   /// Domain:  [-500.0 , 500.0]^n<br/>
    32   /// Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712)
     30  /// The Schwefel function (sine root) is implemented as described in Affenzeller, M. and Wagner, S. 2005. Offspring Selection: A New Self-Adaptive Selection Scheme for Genetic Algorithms.  Ribeiro, B., Albrecht, R. F., Dobnikar, A., Pearson, D. W., and Steele, N. C. (eds.). Adaptive and Natural Computing Algorithms, pp. 218-221, Springer.
    3331  /// </summary>
    34   [Item("SchwefelEvaluator", "Evaluates the Schwefel function on a given point. The optimum of this function is 0 at (420.968746453712,420.968746453712,...,420.968746453712).")]
     32  [Item("SchwefelEvaluator", "Evaluates the Schwefel function (sine root) on a given point. The optimum of this function is 0 at (420.968746453712,420.968746453712,...,420.968746453712). It is implemented as described in Affenzeller, M. and Wagner, S. 2005. Offspring Selection: A New Self-Adaptive Selection Scheme for Genetic Algorithms.  Ribeiro, B., Albrecht, R. F., Dobnikar, A., Pearson, D. W., and Steele, N. C. (eds.). Adaptive and Natural Computing Algorithms, pp. 218-221, Springer.")]
    3533  [StorableClass]
    3634  public class SchwefelEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SphereEvaluator.cs

    r3170 r3315  
    2525using HeuristicLab.Encodings.RealVectorEncoding;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Parameters;
    2728
    2829namespace HeuristicLab.Problems.TestFunctions {
    2930  /// <summary>
    30   /// Sphere Function<br/>
    31   /// Domain:  [-5.12 , 5.12]^n<br/>
    32   /// Optimum: 0.0 at (0, 0, ..., 0)
     31  /// The sphere function is a unimodal function that has its optimum at the origin.
     32  /// It is implemented as described in Beyer, H.-G. and Schwefel, H.-P. 2002. Evolution Strategies - A Comprehensive Introduction Natural Computing, 1, pp. 3-52.
    3333  /// </summary>
    34   [Item("SphereEvaluator", "Evaluates the Sphere function on a given point. The optimum of this function is 0 at the origin.")]
     34  [Item("SphereEvaluator", "Evaluates the Sphere function y = C * ||X||^Alpha on a given point. The optimum of this function is 0 at the origin. It is implemented as described in Beyer, H.-G. and Schwefel, H.-P. 2002. Evolution Strategies - A Comprehensive Introduction Natural Computing, 1, pp. 3-52.")]
    3535  [StorableClass]
    3636  public class SphereEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
    3737    /// <summary>
    38     /// Returns false as the Rosenbrock function is a minimization problem.
     38    /// Returns false as the Sphere function is a minimization problem.
    3939    /// </summary>
    4040    public override bool Maximization {
     
    6565      get { return int.MaxValue; }
    6666    }
     67    /// <summary>
     68    /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.
     69    /// </summary>
     70    public ValueParameter<DoubleValue> CParameter {
     71      get { return (ValueParameter<DoubleValue>)Parameters["C"]; }
     72    }
     73    /// <summary>
     74    /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.
     75    /// </summary>
     76    public ValueParameter<DoubleValue> AlphaParameter {
     77      get { return (ValueParameter<DoubleValue>)Parameters["Alpha"]; }
     78    }
     79    /// <summary>
     80    /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.
     81    /// </summary>
     82    public DoubleValue C {
     83      get { return CParameter.Value; }
     84      set { if (value != null) CParameter.Value = value; }
     85    }
     86    /// <summary>
     87    /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.
     88    /// </summary>
     89    public DoubleValue Alpha {
     90      get { return AlphaParameter.Value; }
     91      set { if (value != null) AlphaParameter.Value = value; }
     92    }
    6793
     94    /// <summary>
     95    /// Initializes a new instance of the SphereEvaluator with two parameters (<c>C</c> and <c>Alpha</c>).
     96    /// </summary>
     97    public SphereEvaluator()
     98      : base() {
     99      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)));
     100      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)));
     101    }
    68102    /// <summary>
    69103    /// Evaluates the test function for a specific <paramref name="point"/>.
     
    71105    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    72106    /// <returns>The result value of the Sphere function at the given point.</returns>
    73     public static double Apply(RealVector point) {
     107    public static double Apply(RealVector point, double c, double alpha) {
    74108      double result = 0;
    75109      for (int i = 0; i < point.Length; i++)
    76110        result += point[i] * point[i];
    77       return result;
     111      if (alpha != 2) result = Math.Pow(Math.Sqrt(result), alpha);
     112      return c * result;
    78113    }
    79114
     
    85120    /// <returns>The result value of the Sphere function at the given point.</returns>
    86121    protected override double EvaluateFunction(RealVector point) {
    87       return Apply(point);
     122      return Apply(point, C.Value, Alpha.Value);
    88123    }
    89124  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/HeuristicLab.Problems.TestFunctions-3.3.csproj

    r3187 r3315  
    8787    <Compile Include="Evaluators\BealeEvaluator.cs" />
    8888    <Compile Include="Evaluators\BoothEvaluator.cs" />
    89     <Compile Include="Evaluators\GriewangkEvaluator.cs" />
     89    <Compile Include="Evaluators\GriewankEvaluator.cs" />
    9090    <Compile Include="Evaluators\LevyEvaluator.cs" />
    9191    <Compile Include="Evaluators\MatyasEvaluator.cs" />
     
    105105    <Compile Include="MoveEvaluators\BealeAdditiveMoveEvaluator.cs" />
    106106    <Compile Include="MoveEvaluators\BoothAdditiveMoveEvaluator.cs" />
     107    <Compile Include="MoveEvaluators\GriewankAdditiveMoveEvaluator.cs" />
    107108    <Compile Include="MoveEvaluators\ZakharovAdditiveMoveEvaluator.cs" />
    108109    <Compile Include="MoveEvaluators\SumSquaresAdditiveMoveEvaluator.cs" />
     
    113114    <Compile Include="MoveEvaluators\RastriginAdditiveMoveEvaluator.cs" />
    114115    <Compile Include="MoveEvaluators\LevyAdditiveMoveEvaluator.cs" />
    115     <Compile Include="MoveEvaluators\GriewangkAdditiveMoveEvaluator.cs" />
    116116    <Compile Include="MoveEvaluators\AdditiveMoveEvaluator.cs" />
    117117    <Compile Include="MoveEvaluators\RealVectorAdditiveMoveWrapper.cs" />
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/GriewankAdditiveMoveEvaluator.cs

    r3307 r3315  
    2525
    2626namespace HeuristicLab.Problems.TestFunctions {
    27   [Item("GriewangkAdditiveMoveEvaluator", "Class for evaluating an additive move on the Griewangk function.")]
     27  [Item("GriewankAdditiveMoveEvaluator", "Class for evaluating an additive move on the Griewank function.")]
    2828  [StorableClass]
    29   public class GriewangkAdditiveMoveEvaluator : AdditiveMoveEvaluator {
     29  public class GriewankAdditiveMoveEvaluator : AdditiveMoveEvaluator {
    3030    public override System.Type EvaluatorType {
    31       get { return typeof(GriewangkEvaluator); }
     31      get { return typeof(GriewankEvaluator); }
    3232    }
    3333    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3434      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
    35       return GriewangkEvaluator.Apply(wrapper);
     35      return GriewankEvaluator.Apply(wrapper);
    3636    }
    3737  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs

    r3187 r3315  
    3333    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3434      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
    35       return RastriginEvaluator.Apply(wrapper);
     35      return RastriginEvaluator.Apply(wrapper, 10); // FIXME: the parameters have to be wired
    3636    }
    3737  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs

    r3187 r3315  
    3333    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3434      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
    35       return SphereEvaluator.Apply(wrapper);
     35      return SphereEvaluator.Apply(wrapper, 1, 2); // FIXME: the parameters have to be wired.
    3636    }
    3737  }
Note: See TracChangeset for help on using the changeset viewer.