Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/10 01:20:49 (14 years ago)
Author:
abeham
Message:

Updated test functions problem #934

File:
1 edited

Legend:

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

    r3150 r3154  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    27 using HeuristicLab.Operators;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
    29 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    3029  /// <summary>
    3130  /// Sphere Function<br/>
     
    3332  /// Optimum: 0.0 at (0, 0, ..., 0)
    3433  /// </summary>
    35   public class SphereEvaluator : TestFunctionEvaluatorBase {
    36     /// <inheritdoc select="summary"/>
    37     public override string Description {
    38       get { return
    39 @"Sphere Function
    40 
    41 Domain:  [-5.12 , 5.12]^n
    42 Optimum: 0.0 at (0, 0, ..., 0)";
    43           }
     34  [Item("SphereEvaluator", "Evaluates the Sphere function on a given point. The optimum of this function is 0 at the origin.")]
     35  [StorableClass]
     36  public class SphereEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Rosenbrock function is a minimization problem.
     39    /// </summary>
     40    public override bool Maximization {
     41      get { return false; }
     42    }
     43    /// <summary>
     44    /// Gets the optimum function value (0).
     45    /// </summary>
     46    public override double BestKnownQuality {
     47      get { return 0; }
     48    }
     49    /// <summary>
     50    /// Gets the lower and upper bound of the function.
     51    /// </summary>
     52    public override DoubleMatrix Bounds {
     53      get { return new DoubleMatrix(new double[,] { { -5.12, 5.12 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (1).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 1; }
     60    }
     61    /// <summary>
     62    /// Gets the (theoretical) maximum problem size (2^31 - 1).
     63    /// </summary>
     64    public override int MaximumProblemSize {
     65      get { return int.MaxValue; }
    4466    }
    4567
     
    4971    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    5072    /// <returns>The result value of the Sphere function at the given point.</returns>
    51     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    5274      double result = 0;
    5375      for (int i = 0; i < point.Length; i++)
     
    6284    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    6385    /// <returns>The result value of the Sphere function at the given point.</returns>
    64     protected override double EvaluateFunction(double[] point) {
     86    protected override double EvaluateFunction(RealVector point) {
    6587      return Apply(point);
    6688    }
Note: See TracChangeset for help on using the changeset viewer.