Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3154


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

Updated test functions problem #934

Location:
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3
Files:
13 edited

Legend:

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

    r3150 r3154  
    2222using System;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Encodings.RealVectorEncoding;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    2727
    2828namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
     
    3232  /// Optimum: 0.0 at (0, 0, ..., 0)
    3333  /// </summary
    34   [Item("AckleyEvaluator", "Evaluates the Ackley function on a given point. The optimum of the Ackley Function is 0 at the origin.")]
     34  [Item("AckleyEvaluator", "Evaluates the Ackley function on a given point. The optimum of this function is 0 at the origin.")]
    3535  [StorableClass]
    3636  public class AckleyEvaluator : SingleObjectiveTestFunctionEvaluator {
     
    4242    }
    4343    /// <summary>
     44    /// Gets the optimum function value (0).
     45    /// </summary>
     46    public override double BestKnownQuality {
     47      get { return 0; }
     48    }
     49    /// <summary>
    4450    /// Gets the lower and upper bound of the function.
    4551    /// </summary>
    4652    public override DoubleMatrix Bounds {
    4753      get { return new DoubleMatrix(new double[,] { { -32.768, 32.768 } }); }
    48     }
    49     /// <summary>
    50     /// Gets the optimum function value (0).
    51     /// </summary>
    52     public override double BestKnownQuality {
    53       get { return 0; }
    5454    }
    5555    /// <summary>
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/BealeEvaluator.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;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Beale Function<br/>
     
    3032  /// Optimum: 0.0 at (3.0, 0.5)
    3133  /// </summary>
    32   public class BealeEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get { return
    36 @"Beale Function
    37 
    38 Domain:  [-4.5 , 4.5]^2
    39 Optimum: 0.0 at (3.0, 0.5)";
    40           }
     34  [Item("BealeEvaluator", "Evaluates the Beale function on a given point. The optimum of this function is 0 at (3,0.5).")]
     35  [StorableClass]
     36  public class BealeEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Beale 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[,] { { -4.5, 4.5 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     60    }
     61    /// <summary>
     62    /// Gets the maximum problem size (2).
     63    /// </summary>
     64    public override int MaximumProblemSize {
     65      get { return 2; }
    4166    }
    4267
     
    4671    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4772    /// <returns>The result value of the Beale function at the given point.</returns>
    48     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    4974      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);
    5075    }
     
    5681    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    5782    /// <returns>The result value of the Beale function at the given point.</returns>
    58     protected override double EvaluateFunction(double[] point) {
     83    protected override double EvaluateFunction(RealVector point) {
    5984      return Apply(point);
    6085    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/BoothEvaluator.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;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Booth Function<br/>
     
    3032  /// Optimum: 0.0 at (1.0, 3.0)
    3133  /// </summary>
    32   public class BoothEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get {
    36         return
    37           @"Booth Function
    38 
    39 Domain:  [-10.0 , 10.0]^2
    40 Optimum: 0.0 at (1.0, 3.0)";
    41       }
     34  [Item("BoothEvaluator", "Evaluates the Booth function on a given point. The optimum of this function is 0 at (1,3).")]
     35  [StorableClass]
     36  public class BoothEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Booth 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[,] { { -10, 10 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     60    }
     61    /// <summary>
     62    /// Gets the maximum problem size (2).
     63    /// </summary>
     64    public override int MaximumProblemSize {
     65      get { return 2; }
    4266    }
    4367
     
    4771    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4872    /// <returns>The result value of the Booth function at the given point.</returns>
    49     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    5074      return Math.Pow(point[0] + 2 * point[1] - 7, 2) + Math.Pow(2 * point[0] + point[1] - 5, 2);
    5175    }
     
    5781    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    5882    /// <returns>The result value of the Booth function at the given point.</returns>
    59     protected override double EvaluateFunction(double[] point) {
     83    protected override double EvaluateFunction(RealVector point) {
    6084      return Apply(point);
    6185    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/GriewangkEvaluator.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  /// Griewangk Function<br/>
     
    3332  /// Optimum: 0.0 at (0, 0, ..., 0)
    3433  /// </summary>
    35   public class GriewangkEvaluator : TestFunctionEvaluatorBase {
    36     /// <inheritdoc select="summary"/>
    37     public override string Description {
    38       get { return
    39 @"Griewangk Function
    40 
    41 Domain:  [-600.0 , 600.0]^n
    42 Optimum: 0.0 at (0, 0, ..., 0)";
    43           }
     34  [Item("GriewangkEvaluator", "Evaluates the Griewangk function on a given point. The optimum of this function is 0 at the origin.")]
     35  [StorableClass]
     36  public class GriewangkEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Griewangk 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[,] { { -600, 600 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     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 Griewangk 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      double val = 0;
     
    7193    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    7294    /// <returns>The result value of the Griewangk function at the given point.</returns>
    73     protected override double EvaluateFunction(double[] point) {
     95    protected override double EvaluateFunction(RealVector point) {
    7496      return Apply(point);
    7597    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/LevyEvaluator.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;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Levy Function<br/>
     
    3032  /// Optimum: 0.0 at (1.0, 1.0, ..., 1.0)
    3133  /// </summary>
    32   public class LevyEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get { return
    36 @"Levy Function
    37 
    38 Domain:  [-10.0 , 10.0]^n
    39 Optimum: 0.0 at (1.0, 1.0, ..., 1.0)";
    40           }
     34  [Item("LevyEvaluator", "Evaluates the Levy function on a given point. The optimum of this function is 0 at (1,1,...,1).")]
     35  [StorableClass]
     36  public class LevyEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Levy 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[,] { { -10, 10 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     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; }
    4166    }
    4267
     
    4671    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4772    /// <returns>The result value of the Levy function at the given point.</returns>
    48     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    4974      int length = point.Length;
    5075      double[] z = new double[length];
     
    7095    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    7196    /// <returns>The result value of the Levy function at the given point.</returns>
    72     protected override double EvaluateFunction(double[] point) {
     97    protected override double EvaluateFunction(RealVector point) {
    7398      return Apply(point);
    7499    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/MatyasEvaluator.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;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Matyas Function<br/>
     
    3032  /// Optimum: 0.0 at (0.0, 0.0)
    3133  /// </summary>
    32   public class MatyasEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get { return
    36 @"Matyas Function
    37 
    38 Domain:  [-10.0 , 10.0]^2
    39 Optimum: 0.0 at (0.0, 0.0)";
    40           }
     34  [Item("MatyasEvaluator", "Evaluates the Matyas function on a given point. The optimum of this function is 0 at the origin.")]
     35  [StorableClass]
     36  public class MatyasEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Beale 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[,] { { -10, 10 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     60    }
     61    /// <summary>
     62    /// Gets the maximum problem size (2).
     63    /// </summary>
     64    public override int MaximumProblemSize {
     65      get { return 2; }
    4166    }
    4267
     
    4671    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4772    /// <returns>The result value of the Matyas function at the given point.</returns>
    48     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    4974      return 0.26 * (point[0] * point[0] + point[1] * point[1]) - 0.48 * point[0] * point[1];
    5075    }
     
    5681    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    5782    /// <returns>The result value of the Matyas function at the given point.</returns>
    58     protected override double EvaluateFunction(double[] point) {
     83    protected override double EvaluateFunction(RealVector point) {
    5984      return Apply(point);
    6085    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/RastriginEvaluator.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  /// Rastrigin Function<br/>
    32   /// Domain:  [-5.12 , 5.12]^n<br/>
     31  /// Domain:  [-5.12 , 5.12]^n <br/>
    3332  /// Optimum: 0.0 at (0, 0, ..., 0)
    34   /// </summary>
    35   public class RastriginEvaluator : TestFunctionEvaluatorBase {
    36     /// <inheritdoc select="summary"/>
    37     public override string Description {
    38       get { return
    39 @"Rastrigin Function
    40 
    41 Domain:  [-5.12 , 5.12]^n
    42 Optimum: 0.0 at (0, 0, ..., 0)";
    43           }
     33  /// </summary
     34  [Item("RastriginEvaluator", "Evaluates the Rastrigin function on a given point. The optimum of this function is 0 at the origin.")]
     35  [StorableClass]
     36  public class RastriginEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Rastrigin 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 Rastrigin function at the given point.</returns>
    51     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    5274      double result = 10 * point.Length;
    5375      for (int i = 0; i < point.Length; i++) {
     
    6486    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    6587    /// <returns>The result value of the Rastrigin function at the given point.</returns>
    66     protected override double EvaluateFunction(double[] point) {
     88    protected override double EvaluateFunction(RealVector point) {
    6789      return Apply(point);
    6890    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/RosenbrockEvaluator.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  /// Rosenbrock Function<br/>
     
    3332  /// Optimum: 0.0 at (1, 1, ..., 1)
    3433  /// </summary>
    35   public class RosenbrockEvaluator : TestFunctionEvaluatorBase {
    36     /// <inheritdoc select="summary"/>
    37     public override string Description {
    38       get { return
    39 @"Rosenbrock Function
    40 
    41 Domain:  [-2.048 , 2.048]^n
    42 Optimum: 0.0 at (1, 1, ..., 1)";
    43           }
     34  [Item("RosenbrockEvaluator", "Evaluates the Rosenbrock function on a given point. The optimum of this function is 0 at (1,1,...,1).")]
     35  [StorableClass]
     36  public class RosenbrockEvaluator : 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[,] { { -2.048, 2.048 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     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 Rosenbrock 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 - 1; i++) {
     
    6486    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    6587    /// <returns>The result value of the Rosenbrock function at the given point.</returns>
    66     protected override double EvaluateFunction(double[] point) {
     88    protected override double EvaluateFunction(RealVector point) {
    6789      return Apply(point);
    6890    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/SchwefelEvaluator.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  /// Schwefel Function (Sine Root)<br/>
     
    3332  /// Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712)
    3433  /// </summary>
    35   public class SchwefelEvaluator : TestFunctionEvaluatorBase {
    36     /// <inheritdoc select="summary"/>
    37     public override string Description {
    38       get { return
    39 @"Schwefel Function (Sine Root)
    40 
    41 Domain:  [-500.0 , 500.0]^n
    42 Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712)";
    43           }
     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).")]
     35  [StorableClass]
     36  public class SchwefelEvaluator : 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[,] { { -500, 500 } }); }
     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 Schwefel function at the given point.</returns>
    51     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    5274      double result = 418.982887272433 * point.Length;
    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 Schwefel 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    }
  • 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    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/ZakharovEvaluator.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;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Zakharov Function<br/>
     
    3032  /// Optimum: 0.0 at (0.0, 0.0, ..., 0.0)
    3133  /// </summary>
    32   public class ZakharovEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get { return
    36 @"Zakharov Function
    37 
    38 Domain:  [-5.0 , 10.0]^n
    39 Optimum: 0.0 at (0.0, 0.0, ..., 0.0)";
    40           }
     34  [Item("ZakharovEvaluator", "Evaluates the Zakharov function on a given point. The optimum of this function is 0 at the origin.")]
     35  [StorableClass]
     36  public class ZakharovEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Ackley 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, 10 } }); }
     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; }
    4166    }
    4267
     
    4671    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4772    /// <returns>The result value of the Zakharov function at the given point.</returns>
    48     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    4974      int length = point.Length;
    5075      double s1 = 0;
     
    6489    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    6590    /// <returns>The result value of the Zakharov function at the given point.</returns>
    66     protected override double EvaluateFunction(double[] point) {
     91    protected override double EvaluateFunction(RealVector point) {
    6792      return Apply(point);
    6893    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/HeuristicLab.Problems.TestFunctions.SingleObjective-3.3.csproj

    r3150 r3154  
    5353  <ItemGroup>
    5454    <Compile Include="Evaluators\AckleyEvaluator.cs" />
     55    <Compile Include="Evaluators\BealeEvaluator.cs" />
     56    <Compile Include="Evaluators\BoothEvaluator.cs" />
     57    <Compile Include="Evaluators\GriewangkEvaluator.cs" />
     58    <Compile Include="Evaluators\LevyEvaluator.cs" />
     59    <Compile Include="Evaluators\MatyasEvaluator.cs" />
     60    <Compile Include="Evaluators\RastriginEvaluator.cs" />
     61    <Compile Include="Evaluators\RosenbrockEvaluator.cs" />
     62    <Compile Include="Evaluators\SchwefelEvaluator.cs" />
    5563    <Compile Include="Evaluators\SingleObjectiveTestFunctionEvaluator.cs" />
     64    <Compile Include="Evaluators\SphereEvaluator.cs" />
     65    <Compile Include="Evaluators\ZakharovEvaluator.cs" />
    5666    <Compile Include="HeuristicLabProblemsTestFunctionsSingleObjectivePlugin.cs" />
    5767    <Compile Include="Interfaces\ISingleObjectiveTestFunctionEvaluator.cs" />
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/SingleObjectiveTestFunction.cs

    r3150 r3154  
    8383
    8484    #region Properties
     85    public BoolValue Maximization {
     86      get { return MaximizationParameter.Value; }
     87      set { MaximizationParameter.Value = value; }
     88    }
    8589    public DoubleMatrix Bounds {
    8690      get { return BoundsParameter.Value; }
     
    193197    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
    194198      ParameterizeEvaluator();
     199      Maximization.Value = Evaluator.Maximization;
     200      BoundsParameter.Value = Evaluator.Bounds;
     201      if (ProblemSize.Value < Evaluator.MinimumProblemSize)
     202        ProblemSize.Value = Evaluator.MinimumProblemSize;
     203      else if (ProblemSize.Value > Evaluator.MaximumProblemSize)
     204        ProblemSize.Value = Evaluator.MaximumProblemSize;
     205      BestKnownQuality = new DoubleValue(Evaluator.BestKnownQuality);
    195206      Evaluator_QualityParameter_ActualNameChanged(null, EventArgs.Empty);
    196207    }
     
    200211    private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {
    201212      ParameterizeVisualizer();
     213    }
     214    private void BoundsParameter_ValueChanged(object sender, EventArgs e) {
     215      Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged);
     216      Bounds_ToStringChanged(null, EventArgs.Empty);
     217    }
     218    private void Bounds_ToStringChanged(object sender, EventArgs e) {
     219      if (Bounds.Columns != 2 || Bounds.Rows < 1)
     220        Bounds = new DoubleMatrix(1, 2);
     221    }
     222    private void Bounds_ItemChanged(object sender, EventArgs<int, int> e) {
     223      if (e.Value2 == 0 && Bounds[e.Value, 1] <= Bounds[e.Value, 0])
     224        Bounds[e.Value, 1] = Bounds[e.Value, 0] + 0.1;
     225      if (e.Value2 == 1 && Bounds[e.Value, 0] >= Bounds[e.Value, 1])
     226        Bounds[e.Value, 0] = Bounds[e.Value, 1] - 0.1;
    202227    }
    203228    #endregion
     
    209234      ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged);
    210235      ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged);
     236      BoundsParameter.ValueChanged += new EventHandler(BoundsParameter_ValueChanged);
     237      Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged);
     238      Bounds.ItemChanged += new EventHandler<EventArgs<int, int>>(Bounds_ItemChanged);
    211239      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    212240      SolutionCreator.RealVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_RealVectorParameter_ActualNameChanged);
Note: See TracChangeset for help on using the changeset viewer.