[13421] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[13672] | 3 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[13421] | 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 |
|
---|
[13620] | 22 | using System.Collections.Generic;
|
---|
[13421] | 23 | using HeuristicLab.Common;
|
---|
| 24 | using HeuristicLab.Core;
|
---|
[13672] | 25 | using HeuristicLab.Data;
|
---|
[13421] | 26 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
[13672] | 27 | using HeuristicLab.Parameters;
|
---|
[13421] | 28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 29 |
|
---|
[13515] | 30 | namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
|
---|
[13421] | 31 | /// <summary>
|
---|
| 32 | /// Base class for a test function evaluator.
|
---|
| 33 | /// </summary>
|
---|
[13451] | 34 | [Item("Multi-Objective Function", "Base class for multi objective functions.")]
|
---|
[13421] | 35 | [StorableClass]
|
---|
| 36 | public abstract class MultiObjectiveTestFunction : ParameterizedNamedItem, IMultiObjectiveTestFunction {
|
---|
| 37 | /// <summary>
|
---|
| 38 | /// These operators should not change their name through the GUI
|
---|
| 39 | /// </summary>
|
---|
| 40 | public override bool CanChangeName {
|
---|
| 41 | get { return false; }
|
---|
| 42 | }
|
---|
[14067] | 43 |
|
---|
[13421] | 44 | /// <summary>
|
---|
| 45 | /// Gets the minimum problem size.
|
---|
| 46 | /// </summary>
|
---|
[14067] | 47 | [Storable]
|
---|
| 48 | public int MinimumSolutionLength { get; private set; }
|
---|
[13421] | 49 | /// <summary>
|
---|
| 50 | /// Gets the maximum problem size.
|
---|
| 51 | /// </summary>
|
---|
[14067] | 52 | [Storable]
|
---|
| 53 | public int MaximumSolutionLength { get; private set; }
|
---|
[13620] | 54 |
|
---|
| 55 |
|
---|
[13421] | 56 | /// <summary>
|
---|
[14067] | 57 | /// Gets the minimum solution size.
|
---|
[13421] | 58 | /// </summary>
|
---|
[13620] | 59 | [Storable]
|
---|
[14067] | 60 | public int MinimumObjectives { get; private set; }
|
---|
[13448] | 61 | /// <summary>
|
---|
[14067] | 62 | /// Gets the maximum solution size.
|
---|
[13448] | 63 | /// </summary>
|
---|
[14067] | 64 | [Storable]
|
---|
| 65 | public int MaximumObjectives { get; private set; }
|
---|
| 66 |
|
---|
| 67 |
|
---|
[13421] | 68 | /// <summary>
|
---|
[14067] | 69 | /// Returns whether the actual function constitutes a maximization or minimization problem.
|
---|
[13421] | 70 | /// </summary>
|
---|
[14067] | 71 | public abstract bool[] Maximization(int objectives);
|
---|
| 72 | /// <summary>
|
---|
| 73 | /// Gets the lower and upper bound of the function.
|
---|
| 74 | /// </summary>
|
---|
| 75 | public abstract double[,] Bounds(int objectives);
|
---|
[13421] | 76 |
|
---|
[14067] | 77 |
|
---|
[13515] | 78 | /// <summary>
|
---|
| 79 | /// retrieves the optimal pareto front (if known from a file)
|
---|
| 80 | /// </summary>
|
---|
[13620] | 81 | public abstract IEnumerable<double[]> OptimalParetoFront(int objectives);
|
---|
[13515] | 82 |
|
---|
[13562] | 83 | /// <summary>
|
---|
[14067] | 84 | /// returns a Reference Point for Hypervolume calculation (default=(11|11))
|
---|
[13562] | 85 | /// </summary>
|
---|
[13620] | 86 | public abstract double[] ReferencePoint(int objectives);
|
---|
[13515] | 87 |
|
---|
[13562] | 88 |
|
---|
| 89 | /// <summary>
|
---|
[14067] | 90 | /// returns the best known Hypervolume for this test function (default=-1)
|
---|
[13562] | 91 | /// </summary>
|
---|
[13620] | 92 | public virtual double BestKnownHypervolume(int objectives) {
|
---|
| 93 | return -1;
|
---|
| 94 | }
|
---|
[13515] | 95 |
|
---|
[13421] | 96 | [StorableConstructor]
|
---|
| 97 | protected MultiObjectiveTestFunction(bool deserializing) : base(deserializing) { }
|
---|
[14067] | 98 |
|
---|
| 99 | protected MultiObjectiveTestFunction(MultiObjectiveTestFunction original, Cloner cloner)
|
---|
| 100 | : base(original, cloner) {
|
---|
| 101 | MinimumObjectives = original.MinimumObjectives;
|
---|
| 102 | MaximumObjectives = original.MaximumObjectives;
|
---|
| 103 | MinimumSolutionLength = original.MinimumSolutionLength;
|
---|
| 104 | MaximumSolutionLength = original.MaximumSolutionLength;
|
---|
[13725] | 105 | }
|
---|
[14067] | 106 |
|
---|
| 107 | protected MultiObjectiveTestFunction(int minimumObjectives, int maximumObjectives, int minimumSolutionLength, int maximumSolutionLength)
|
---|
| 108 | : base() {
|
---|
| 109 | Parameters.Add(new FixedValueParameter<IntValue>("Minimum Objectives",
|
---|
| 110 | "The dimensionality of the problem instance (number of variables in the function).",
|
---|
| 111 | (IntValue)new IntValue(minimumObjectives).AsReadOnly()) { GetsCollected = false });
|
---|
| 112 | Parameters.Add(new FixedValueParameter<IntValue>("Maximum Objectives", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumObjectives).AsReadOnly()) { GetsCollected = false });
|
---|
| 113 | Parameters.Add(new FixedValueParameter<IntValue>("Minimum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(minimumSolutionLength).AsReadOnly()) { GetsCollected = false });
|
---|
| 114 | Parameters.Add(new FixedValueParameter<IntValue>("Maximum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumSolutionLength).AsReadOnly()) { GetsCollected = false });
|
---|
| 115 |
|
---|
| 116 | MinimumObjectives = minimumObjectives;
|
---|
| 117 | MaximumObjectives = maximumObjectives;
|
---|
| 118 | MinimumSolutionLength = minimumSolutionLength;
|
---|
| 119 | MaximumSolutionLength = maximumSolutionLength;
|
---|
[13620] | 120 | }
|
---|
[13421] | 121 |
|
---|
| 122 | /// <summary>
|
---|
| 123 | /// Evaluates the test function for a specific <paramref name="point"/>.
|
---|
| 124 | /// </summary>
|
---|
| 125 | /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
|
---|
| 126 | /// <returns>The result values of the function at the given point.</returns>
|
---|
[13620] | 127 | public abstract double[] Evaluate(RealVector point, int objectives);
|
---|
[13421] | 128 | }
|
---|
| 129 | }
|
---|