Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/10 19:18:32 (15 years ago)
Author:
abeham
Message:

#934

  • added BestKnownSolution to test functions
  • added unit tests
Location:
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators
Files:
13 edited

Legend:

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

    r3450 r3781  
    6666    }
    6767
     68    public override RealVector GetBestKnownSolution(int dimension) {
     69      return new RealVector(dimension);
     70    }
     71
    6872    /// <summary>
    6973    /// Evaluates the Ackley function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BealeEvaluator.cs

    r3376 r3781  
    6666    }
    6767
     68    public override RealVector GetBestKnownSolution(int dimension) {
     69      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
     70      return new RealVector(new double[] { 3, 0.5 });
     71    }
    6872    /// <summary>
    6973    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BoothEvaluator.cs

    r3376 r3781  
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
     69      return new RealVector(new double[] { 1, 3 });
     70    }
    6771    /// <summary>
    6872    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/GriewankEvaluator.cs

    r3376 r3781  
    6767    }
    6868
     69    public override RealVector GetBestKnownSolution(int dimension) {
     70      return new RealVector(dimension);
     71    }
    6972    /// <summary>
    7073    /// If dimension of the problem is less or equal than 100 the values of Math.Sqrt(i + 1) are precomputed.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/LevyEvaluator.cs

    r3376 r3781  
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      if (dimension < 2) throw new ArgumentException(Name + ": This function is not defined for 1 dimension.");
     69      RealVector result = new RealVector(dimension);
     70      for (int i = 0; i < dimension; i++) result[i] = 1;
     71      return result;
     72    }
    6773    /// <summary>
    6874    /// Evaluates the test function for a specific <paramref name="point"/>.
     
    8086
    8187      s = Math.Sin(Math.PI * z[0]);
     88      if (Math.Abs(s) < 1e-15) s = 0; // Math.Sin(Math.PI) == 0.00000000000000012246063538223773
    8289      s *= s;
    8390
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MatyasEvaluator.cs

    r3376 r3781  
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
     69      return new RealVector(dimension);
     70    }
    6771    /// <summary>
    6872    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RastriginEvaluator.cs

    r3376 r3781  
    8080    }
    8181
     82    public override RealVector GetBestKnownSolution(int dimension) {
     83      return new RealVector(dimension);
     84    }
     85
    8286    /// <summary>
    8387    /// Initializes a new instance of the RastriginEvaluator with one parameter (<c>A</c>).
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RosenbrockEvaluator.cs

    r3376 r3781  
    6969    }
    7070
     71    public override RealVector GetBestKnownSolution(int dimension) {
     72      if (dimension < 2) throw new ArgumentException(Name + ": This function is not defined for 1 dimension.");
     73      RealVector result = new RealVector(dimension);
     74      for (int i = 0; i < dimension; i++) result[i] = 1;
     75      return result;
     76    }
     77
    7178    /// <summary>
    7279    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SchwefelEvaluator.cs

    r3376 r3781  
    3131  /// 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.
    3232  /// </summary>
    33   [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.")]
     33  [Item("SchwefelEvaluator", "Evaluates the Schwefel function (sine root) on a given point. In the given bounds [-500;500] the optimum of this function is close to 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.")]
    3434  [StorableClass]
    3535  public class SchwefelEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
     
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      return null;
     69    }
     70
    6771    /// <summary>
    6872    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SingleObjectiveTestFunctionProblemEvaluator.cs

    r3665 r3781  
    8787      return EvaluateFunction(new RealVector(new double[] { x, y }));
    8888    }
     89    /// <summary>
     90    /// Gets the best known solution for this function.
     91    /// </summary>
     92    public abstract RealVector GetBestKnownSolution(int dimension);
    8993
    9094    /// <summary>
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SphereEvaluator.cs

    r3376 r3781  
    6666      get { return int.MaxValue; }
    6767    }
     68
     69    public override RealVector GetBestKnownSolution(int dimension) {
     70      return new RealVector(dimension);
     71    }
     72
    6873    /// <summary>
    6974    /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SumSquaresEvaluator.cs

    r3376 r3781  
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      return new RealVector(dimension);
     69    }
     70
    6771    /// <summary>
    6872    /// Evaluates the test function for a specific <paramref name="point"/>.
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/ZakharovEvaluator.cs

    r3376 r3781  
    6565    }
    6666
     67    public override RealVector GetBestKnownSolution(int dimension) {
     68      return new RealVector(dimension);
     69    }
     70
    6771    /// <summary>
    6872    /// Evaluates the test function for a specific <paramref name="point"/>.
Note: See TracChangeset for help on using the changeset viewer.