Changeset 14068 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs
- Timestamp:
- 07/14/16 14:33:15 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs
r14067 r14068 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 69 70 /// Returns whether the actual function constitutes a maximization or minimization problem. 70 71 /// </summary> 71 public abstract bool[] Maximization(int objectives); 72 public bool[] Maximization(int objectives) { 73 CheckObjectives(objectives); 74 return GetMaximization(objectives); 75 } 76 protected abstract bool[] GetMaximization(int objectives); 72 77 /// <summary> 73 78 /// Gets the lower and upper bound of the function. 74 79 /// </summary> 75 public abstract double[,] Bounds(int objectives); 76 80 public double[,] Bounds(int objectives) { 81 CheckObjectives(objectives); 82 return GetBounds(objectives); 83 } 84 protected abstract double[,] GetBounds(int objectives); 77 85 78 86 /// <summary> 79 87 /// retrieves the optimal pareto front (if known from a file) 80 88 /// </summary> 81 public abstract IEnumerable<double[]> OptimalParetoFront(int objectives); 89 public IEnumerable<double[]> OptimalParetoFront(int objectives) { 90 CheckObjectives(objectives); 91 return GetOptimalParetoFront(objectives); 92 } 93 protected abstract IEnumerable<double[]> GetOptimalParetoFront(int objectives); 82 94 83 95 /// <summary> 84 96 /// returns a Reference Point for Hypervolume calculation (default=(11|11)) 85 97 /// </summary> 86 public abstract double[] ReferencePoint(int objectives); 87 98 public double[] ReferencePoint(int objectives) { 99 CheckObjectives(objectives); 100 return GetReferencePoint(objectives); 101 } 102 protected abstract double[] GetReferencePoint(int objectives); 88 103 89 104 /// <summary> 90 105 /// returns the best known Hypervolume for this test function (default=-1) 91 /// </summary> 106 /// </summary> 92 107 public virtual double BestKnownHypervolume(int objectives) { 108 CheckObjectives(objectives); 109 return GetBestKnownHypervolume(objectives); 110 } 111 112 protected virtual double GetBestKnownHypervolume(int objectives) { 93 113 return -1; 114 } 115 116 protected void CheckObjectives(int objectives) { 117 if (objectives < MinimumObjectives) throw new ArgumentException(string.Format("There must be at least {0} objectives", MinimumObjectives)); 118 if (objectives > MaximumObjectives) throw new ArgumentException(string.Format("There must be at most {0} objectives", MaximumObjectives)); 94 119 } 95 120
Note: See TracChangeset
for help on using the changeset viewer.