Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Functions/SingleObjectiveTestFunction.cs @ 13403

Last change on this file since 13403 was 13403, checked in by abeham, 8 years ago

#2521:

  • Adapted single-objective test function problem to new problem infrastructure
  • Added additional interfaces to RealVectorEncoding
  • Fixed IParticleUpdater interface (must implement IStochasticOperator if it contains a Random parameter)
File size: 3.2 KB
RevLine 
[3170]1#region License Information
2/* HeuristicLab
[12012]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[3170]4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
[4722]22using HeuristicLab.Common;
[3170]23using HeuristicLab.Core;
24using HeuristicLab.Data;
25using HeuristicLab.Encodings.RealVectorEncoding;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Problems.TestFunctions {
29  /// <summary>
30  /// Base class for a test function evaluator.
31  /// </summary>
[13403]32  [Item("Single-Objective Function", "Base class for single objective functions.")]
[3170]33  [StorableClass]
[13403]34  public abstract class SingleObjectiveTestFunction : ParameterizedNamedItem, ISingleObjectiveTestFunction {
[3170]35    /// <summary>
[3520]36    /// These operators should not change their name through the GUI
37    /// </summary>
38    public override bool CanChangeName {
39      get { return false; }
40    }
41    /// <summary>
[3170]42    /// Returns whether the actual function constitutes a maximization or minimization problem.
43    /// </summary>
44    public abstract bool Maximization { get; }
45    /// <summary>
46    /// Gets the lower and upper bound of the function.
47    /// </summary>
48    public abstract DoubleMatrix Bounds { get; }
49    /// <summary>
50    /// Gets the optimum function value.
51    /// </summary>
52    public abstract double BestKnownQuality { get; }
53    /// <summary>
54    /// Gets the minimum problem size.
55    /// </summary>
56    public abstract int MinimumProblemSize { get; }
57    /// <summary>
58    /// Gets the maximum problem size.
59    /// </summary>
60    public abstract int MaximumProblemSize { get; }
61
[4722]62    [StorableConstructor]
[13403]63    protected SingleObjectiveTestFunction(bool deserializing) : base(deserializing) { }
64    protected SingleObjectiveTestFunction(SingleObjectiveTestFunction original, Cloner cloner) : base(original, cloner) { }
65    protected SingleObjectiveTestFunction() : base() { }
[3170]66
[3665]67    public virtual double Evaluate2D(double x, double y) {
[9407]68      return Evaluate(new RealVector(new double[] { x, y }));
[3665]69    }
70
[3170]71    /// <summary>
72    /// Evaluates the test function for a specific <paramref name="point"/>.
73    /// </summary>
74    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
75    /// <returns>The result value of the function at the given point.</returns>
[9407]76    public abstract double Evaluate(RealVector point);
[9345]77
78    /// <summary>
79    /// Gets the best known solution for this function.
80    /// </summary>
81    public abstract RealVector GetBestKnownSolution(int dimension);
[3170]82  }
83}
Note: See TracBrowser for help on using the repository browser.