Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/19 22:56:49 (5 years ago)
Author:
abeham
Message:

#2521: Refactor Analyze method of encoding-specific problems, simplify Analyze of SO-TF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/MultiObjectiveTestFunction.cs

    r16723 r16950  
    2222using System;
    2323using System.Collections.Generic;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    2728using HeuristicLab.Encodings.RealVectorEncoding;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
     
    7171    /// </summary>
    7272    public bool[] Maximization(int objectives) {
    73       CheckObjectives(objectives);
     73      ThrowIfObjectivesOutOfRange(objectives);
    7474      return GetMaximization(objectives);
    7575    }
     
    7979    /// </summary>
    8080    public double[,] Bounds(int objectives) {
    81       CheckObjectives(objectives);
     81      ThrowIfObjectivesOutOfRange(objectives);
    8282      return GetBounds(objectives);
    8383    }
     
    8888    /// </summary>
    8989    public IEnumerable<double[]> OptimalParetoFront(int objectives) {
    90       CheckObjectives(objectives);
     90      ThrowIfObjectivesOutOfRange(objectives);
    9191      return GetOptimalParetoFront(objectives);
    9292    }
     
    9797    /// </summary>
    9898    public double[] ReferencePoint(int objectives) {
    99       CheckObjectives(objectives);
     99      ThrowIfObjectivesOutOfRange(objectives);
    100100      return GetReferencePoint(objectives);
    101101    }
     
    106106    /// </summary>     
    107107    public virtual double OptimalHypervolume(int objectives) {
    108       CheckObjectives(objectives);
     108      ThrowIfObjectivesOutOfRange(objectives);
    109109      return GetBestKnownHypervolume(objectives);
    110110    }
     
    114114    }
    115115
    116     protected void CheckObjectives(int objectives) {
     116    protected void ThrowIfObjectivesOutOfRange(int objectives) {
    117117      if (objectives < MinimumObjectives) throw new ArgumentException(string.Format("There must be at least {0} objectives", MinimumObjectives));
    118118      if (objectives > MaximumObjectives) throw new ArgumentException(string.Format("There must be at most {0} objectives", MaximumObjectives));
     
    121121    [StorableConstructor]
    122122    protected MultiObjectiveTestFunction(StorableConstructorFlag _) : base(_) { }
    123 
    124123    protected MultiObjectiveTestFunction(MultiObjectiveTestFunction original, Cloner cloner)
    125124      : base(original, cloner) {
     
    129128      MaximumSolutionLength = original.MaximumSolutionLength;
    130129    }
    131 
    132130    protected MultiObjectiveTestFunction(int minimumObjectives, int maximumObjectives, int minimumSolutionLength, int maximumSolutionLength)
    133131      : base() {
Note: See TracChangeset for help on using the changeset viewer.