Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14068


Ignore:
Timestamp:
07/14/16 14:33:15 (8 years ago)
Author:
mkommend
Message:

#1087: Added checks for min and max objectives to testfunctions.

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3
Files:
1 added
22 edited
6 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj

    r14066 r14068  
    169169    <Compile Include="Instances\DTLZInstanceProvider.cs" />
    170170    <Compile Include="Interfaces\IMOFrontModel.cs" />
    171     <Compile Include="Testfunctions\CIGTAB.cs" />
     171    <Compile Include="Testfunctions\Misc\CIGTAB.cs" />
    172172    <Compile Include="Testfunctions\IHR\IHR.cs" />
    173173    <Compile Include="Testfunctions\IHR\IHR1.cs" />
     
    176176    <Compile Include="Testfunctions\IHR\IHR3.cs" />
    177177    <Compile Include="Testfunctions\IHR\IHR2.cs" />
    178     <Compile Include="Testfunctions\ELLI1.cs" />
     178    <Compile Include="Testfunctions\Misc\ELLI1.cs" />
    179179    <Compile Include="Views\MOSolution.cs" />
    180180    <Compile Include="Views\MOFrontScatterPlotView.cs">
     
    198198    <Compile Include="Testfunctions\DTLZ\DTLZ3.cs" />
    199199    <Compile Include="Testfunctions\DTLZ\DTLZ2.cs" />
    200     <Compile Include="Testfunctions\Kursawe.cs" />
     200    <Compile Include="Testfunctions\Misc\Kursawe.cs" />
    201201    <Compile Include="Testfunctions\DTLZ\DTLZ1.cs" />
    202202    <Compile Include="Testfunctions\ZDT\ZDT.cs" />
     
    206206    <Compile Include="Testfunctions\ZDT\ZDT2.cs" />
    207207    <Compile Include="Testfunctions\ZDT\ZDT1.cs" />
    208     <Compile Include="Testfunctions\SchafferN2.cs" />
    209     <Compile Include="Testfunctions\SchafferN1.cs" />
    210     <Compile Include="Testfunctions\Fonseca.cs" />
     208    <Compile Include="Testfunctions\Misc\SchafferN2.cs" />
     209    <Compile Include="Testfunctions\Misc\SchafferN1.cs" />
     210    <Compile Include="Testfunctions\Misc\Fonseca.cs" />
    211211    <Compile Include="Testfunctions\MultiObjectiveTestFunction.cs" />
    212212  </ItemGroup>
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs

    r14065 r14068  
    170170    /// <param name="individual"></param>
    171171    /// <returns>a double array that holds the distances that describe how much every contraint is violated (0 is not violated). If the current TestFunction does not have constraints an array of length 0 is returned</returns>
    172     public double[] checkContraints(RealVector individual) {
    173       if (TestFunction is IConstrainedTestFunction) {
    174         return ((IConstrainedTestFunction)TestFunction).CheckConstraints(individual, Objectives);
     172    public double[] CheckContraints(RealVector individual) {
     173      var constrainedTestFunction = (IConstrainedTestFunction)TestFunction;
     174      if (constrainedTestFunction != null) {
     175        return constrainedTestFunction.CheckConstraints(individual, Objectives);
    175176      }
    176177      return new double[0];
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ.cs

    r14067 r14068  
    1919 */
    2020#endregion
     21
    2122using System.Collections.Generic;
    2223using HeuristicLab.Common;
     
    2728  [StorableClass]
    2829  public abstract class DTLZ : MultiObjectiveTestFunction {
    29 
    30     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     30    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3131      if (objectives == 2) return PFStore.get(this.ItemName + ".2D");
    3232      return null;
    3333    }
    3434
    35     public override double[,] Bounds(int objectives) {
     35    protected override double[,] GetBounds(int objectives) {
    3636      return new double[,] { { 0, 1 } };
    3737    }
    3838
    39     public override bool[] Maximization(int objectives) {
     39    protected override bool[] GetMaximization(int objectives) {
    4040      return new bool[objectives];
    4141    }
    4242
    43     public override double[] ReferencePoint(int objectives) {
     43    protected override double[] GetReferencePoint(int objectives) {
    4444      double[] rp = new double[objectives];
    4545      for (int i = 0; i < objectives; i++) {
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ1.cs

    r13725 r14068  
    2929  [StorableClass]
    3030  public class DTLZ1 : DTLZ {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      if (objectives == 2) return 120 + 7.0 / 8;
    3433      return -1;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ2.cs

    r13988 r14068  
    2929  [StorableClass]
    3030  public class DTLZ2 : DTLZ {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
    3433      return -1;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ3.cs

    r13725 r14068  
    2929  [StorableClass]
    3030  public class DTLZ3 : DTLZ {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
    3433      return -1;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ4.cs

    r13725 r14068  
    2929  [StorableClass]
    3030  public class DTLZ4 : DTLZ {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
    3433      return -1;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ7.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class DTLZ7 : DTLZ {
    32 
    33     public override double BestKnownHypervolume(int objectives) {
     32    protected override double GetBestKnownHypervolume(int objectives) {
    3433      if (objectives == 2) return 116.1138716447221;
    3534      return -1;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ8.cs

    r14067 r14068  
    6060      }
    6161      for (int j = 0; j < M - 1; j++) {
    62         if (res[objectives - 1] + 4 * res[j] - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
     62        if (res[objectives - 1] + 4 * res[j] - 1 < 0) return IllegalValue(objectives, GetMaximization(objectives));
    6363      }
    6464      double min = Double.PositiveInfinity;
     
    7070      }
    7171
    72       if (2 * res[objectives - 1] + min - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
     72      if (2 * res[objectives - 1] + min - 1 < 0) return IllegalValue(objectives, GetMaximization(objectives));
    7373      return res;
    7474    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs

    r14067 r14068  
    2828  [StorableClass]
    2929  public abstract class IHR : MultiObjectiveTestFunction {
    30 
    31     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     30    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3231      if (objectives == 2) return PFStore.get(this.ItemName + ".2D");
    3332      return null;
    3433    }
    3534
    36     public override double[,] Bounds(int objectives) {
     35    protected override double[,] GetBounds(int objectives) {
    3736      return new double[,] { { -1, 1 } };
    3837    }
    3938
    40     public override bool[] Maximization(int objectives) {
     39    protected override bool[] GetMaximization(int objectives) {
    4140      return new bool[objectives];
    4241    }
    4342
    44     public override double[] ReferencePoint(int objectives) {
     43    protected override double[] GetReferencePoint(int objectives) {
    4544      double[] rp = new double[objectives];
    4645      for (int i = 0; i < objectives; i++) {
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR1.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class IHR1 : IHR {
    32 
    33     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     32    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3433      List<double[]> res = new List<double[]>();
    3534      for (int i = 0; i <= 500; i++) {
     
    4039      return res;
    4140    }
    42     public override double BestKnownHypervolume(int objectives) {
    43       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     41
     42    protected override double GetBestKnownHypervolume(int objectives) {
     43      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4444    }
    4545
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR2.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class IHR2 : IHR {
    32 
    33     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     32    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3433      List<double[]> res = new List<double[]>();
    3534      for (int i = 0; i <= 500; i++) {
     
    4140      return res;
    4241    }
    43     public override double BestKnownHypervolume(int objectives) {
    44       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     42
     43    protected override double GetBestKnownHypervolume(int objectives) {
     44      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4545    }
    4646
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR3.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class IHR3 : IHR {
    32 
    33     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     32    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3433      List<double[]> res = new List<double[]>();
    3534      for (int i = 0; i <= 500; i++) {
     
    4140      return res;
    4241    }
    43     public override double BestKnownHypervolume(int objectives) {
    44       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     42
     43    protected override double GetBestKnownHypervolume(int objectives) {
     44      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4545    }
    4646
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR4.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class IHR4 : IHR {
    32 
    33 
    34     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     32    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3533      List<double[]> res = new List<double[]>();
    3634      for (int i = 0; i <= 500; i++) {
     
    4139      return res;
    4240    }
    43     public override double BestKnownHypervolume(int objectives) {
    44       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     41
     42    protected override double GetBestKnownHypervolume(int objectives) {
     43      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4544    }
    4645
    47     public override double[,] Bounds(int objectives) {
     46    protected override double[,] GetBounds(int objectives) {
    4847      return new double[,] { { -5, 5 } };
    4948    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR6.cs

    r13988 r14068  
    3030  [StorableClass]
    3131  public class IHR6 : IHR {
    32 
    33     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     32    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3433      List<double[]> res = new List<double[]>();
    3534      for (int i = 0; i <= 500; i++) {
     
    4039      return res;
    4140    }
    42     public override double BestKnownHypervolume(int objectives) {
    43       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     41
     42    protected override double GetBestKnownHypervolume(int objectives) {
     43      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4444    }
    4545
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/CIGTAB.cs

    r14067 r14068  
    3030  [StorableClass]
    3131  public class CIGTAB : MultiObjectiveTestFunction {
    32 
    33     public override double[,] Bounds(int objectives) {
     32    protected override double[,] GetBounds(int objectives) {
    3433      return new double[,] { { -10, 10 } };
    3534    }
    3635
    37     public override bool[] Maximization(int objecitves) {
     36    protected override bool[] GetMaximization(int objecitves) {
    3837      return new bool[2];
    3938    }
    4039
    41     public override double[] ReferencePoint(int objecitves) {
     40    protected override double[] GetReferencePoint(int objecitves) {
    4241      return new double[] { 11, 11 };
    4342    }
    4443
    45     public override IEnumerable<double[]> OptimalParetoFront(int objecitves) {
     44    protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) {
    4645      List<double[]> res = new List<double[]>();
    4746      for (int i = 0; i <= 500; i++) {
     
    5352      return res;
    5453    }
    55     public override double BestKnownHypervolume(int objectives) {
    56       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     54
     55    protected override double GetBestKnownHypervolume(int objectives) {
     56      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    5757    }
    5858
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/ELLI1.cs

    r14067 r14068  
    3030  [StorableClass]
    3131  public class ELLI : MultiObjectiveTestFunction {
    32 
    33     public override double[,] Bounds(int objectives) {
     32    protected override double[,] GetBounds(int objectives) {
    3433      return new double[,] { { -10, 10 } };
    3534    }
    3635
    37     public override bool[] Maximization(int objecitves) {
     36    protected override bool[] GetMaximization(int objecitves) {
    3837      return new bool[2];
    3938    }
    4039
    41     public override double[] ReferencePoint(int objecitves) {
     40    protected override double[] GetReferencePoint(int objecitves) {
    4241      return new double[] { 11, 11 };
    4342    }
    4443
    45     public override IEnumerable<double[]> OptimalParetoFront(int objecitves) {
     44    protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) {
    4645      List<double[]> res = new List<double[]>();
    4746      for (int i = 0; i <= 500; i++) {
     
    5453    }
    5554
    56     public override double BestKnownHypervolume(int objectives) {
    57       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     55    protected override double GetBestKnownHypervolume(int objectives) {
     56      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    5857    }
    5958
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Fonseca.cs

    r14067 r14068  
    3131  [StorableClass]
    3232  public class Fonseca : MultiObjectiveTestFunction {
    33 
    34     public override double[,] Bounds(int objectives) {
     33    protected override double[,] GetBounds(int objectives) {
    3534      return new double[,] { { -4, 4 } };
    3635    }
    3736
    38     public override bool[] Maximization(int objecitves) {
     37    protected override bool[] GetMaximization(int objecitves) {
    3938      return new bool[2];
    4039    }
    4140
    42     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     41    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    4342      return PFStore.get(this.ItemName);
    4443    }
    45     public override double BestKnownHypervolume(int objectives) {
    46       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     44
     45    protected override double GetBestKnownHypervolume(int objectives) {
     46      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4747    }
    4848
    49     public override double[] ReferencePoint(int objectives) {
     49    protected override double[] GetReferencePoint(int objectives) {
    5050      return new double[] { 11, 11 };
    5151    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Kursawe.cs

    r14067 r14068  
    3030  [StorableClass]
    3131  public class Kursawe : MultiObjectiveTestFunction {
    32 
    33     public override double[,] Bounds(int objectives) {
     32    protected override double[,] GetBounds(int objectives) {
    3433      return new double[,] { { -5, 5 } };
    3534    }
    3635
    37     public override bool[] Maximization(int objecitves) {
     36    protected override bool[] GetMaximization(int objecitves) {
    3837      return new bool[2];
    3938    }
    4039
    41     public override IEnumerable<double[]> OptimalParetoFront(int objecitves) {
     40    protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) {
    4241      return PFStore.get(this.ItemName);
    4342    }
    44     public override double BestKnownHypervolume(int objectives) {
    45       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
     43
     44    protected override double GetBestKnownHypervolume(int objectives) {
     45      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4646    }
    47     public override double[] ReferencePoint(int objectives) {
     47
     48    protected override double[] GetReferencePoint(int objectives) {
    4849      return new double[] { 11, 11 };
    4950    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN1.cs

    r14067 r14068  
    3030  [StorableClass]
    3131  public class SchafferN1 : MultiObjectiveTestFunction {
    32 
    33     public override double[,] Bounds(int objectives) {
     32    protected override double[,] GetBounds(int objectives) {
    3433      return new double[,] { { -1e5, 1e5 } };
    3534    }
    3635
    37     public override bool[] Maximization(int objecitves) {
     36    protected override bool[] GetMaximization(int objectives) {
    3837      return new bool[2];
    3938    }
    4039
    41     public override double[] ReferencePoint(int objecitves) {
     40    protected override double[] GetReferencePoint(int objectives) {
    4241      return new double[] { 1e5, 1e5 };
    4342    }
    4443
    4544
    46     public override IEnumerable<double[]> OptimalParetoFront(int objecitves) {
     45    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    4746      return PFStore.get("Schaffer");
    4847    }
    49     public override double BestKnownHypervolume(int objectives) {
    50       return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
    5148
     49    protected override double GetBestKnownHypervolume(int objectives) {
     50      return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    5251    }
    5352
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN2.cs

    r14067 r14068  
    3030  [StorableClass]
    3131  public class SchafferN2 : MultiObjectiveTestFunction {
    32 
    33     public override double[,] Bounds(int objectives) {
     32    protected override double[,] GetBounds(int objectives) {
    3433      return new double[,] { { -5, 10 } };
    3534    }
    3635
    37     public override bool[] Maximization(int objecitves) {
     36    protected override bool[] GetMaximization(int objecitves) {
    3837      return new bool[2];
    3938    }
    4039
    41     public override double[] ReferencePoint(int objecitves) {
     40    protected override double[] GetReferencePoint(int objecitves) {
    4241      return new double[] { 100, 100 };
    4342    }
    4443
    4544
    46     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     45    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    4746      throw new NotImplementedException();
    4847    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs

    r14067 r14068  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    6970    /// Returns whether the actual function constitutes a maximization or minimization problem.
    7071    /// </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);
    7277    /// <summary>
    7378    /// Gets the lower and upper bound of the function.
    7479    /// </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);
    7785
    7886    /// <summary>
    7987    /// retrieves the optimal pareto front (if known from a file)
    8088    /// </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);
    8294
    8395    /// <summary>
    8496    /// returns a Reference Point for Hypervolume calculation (default=(11|11))
    8597    /// </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);
    88103
    89104    /// <summary>
    90105    /// returns the best known Hypervolume for this test function   (default=-1)
    91     /// </summary>
     106    /// </summary>     
    92107    public virtual double BestKnownHypervolume(int objectives) {
     108      CheckObjectives(objectives);
     109      return GetBestKnownHypervolume(objectives);
     110    }
     111
     112    protected virtual double GetBestKnownHypervolume(int objectives) {
    93113      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));
    94119    }
    95120
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT.cs

    r14067 r14068  
    2828  [StorableClass]
    2929  public abstract class ZDT : MultiObjectiveTestFunction {
    30 
    31     public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
     30    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    3231      return PFStore.get(this.ItemName);
    3332    }
    3433
    35     public override double[,] Bounds(int objectives) {
     34    protected override double[,] GetBounds(int objectives) {
    3635      return new double[,] { { 0, 1 } };
    3736    }
    3837
    39     public override bool[] Maximization(int objectives) {
     38    protected override bool[] GetMaximization(int objectives) {
    4039      return new bool[objectives];
    4140    }
    4241
    43     public override double[] ReferencePoint(int objecitives) {
     42    protected override double[] GetReferencePoint(int objecitives) {
    4443      return new double[] { 11.0, 11.0 };
    4544    }
    4645
    47     public override double BestKnownHypervolume(int objectives) {
     46    protected override double GetBestKnownHypervolume(int objectives) {
    4847      return -1;
    4948    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT1.cs

    r13672 r14068  
    2929  [StorableClass]
    3030  public class ZDT1 : ZDT {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      return 120 + 2.0 / 3;
    3433    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT2.cs

    r13672 r14068  
    2828  [StorableClass]
    2929  public class ZDT2 : ZDT {
    30 
    31     public override double BestKnownHypervolume(int objectives) {
     30    protected override double GetBestKnownHypervolume(int objectives) {
    3231      return 120 + 1.0 / 3;
    3332    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT3.cs

    r13672 r14068  
    2929  [StorableClass]
    3030  public class ZDT3 : ZDT {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      return 128.77811613069076060;
    3433    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT4.cs

    r13988 r14068  
    2929  [StorableClass]
    3030  public class ZDT4 : ZDT {
    31 
    32     public override double[,] Bounds(int objectives) {
     31    protected override double[,] GetBounds(int objectives) {
    3332      double[,] bounds = new double[objectives, 2];
    3433      bounds[0, 0] = 0; bounds[0, 1] = 1;
     
    4039    }
    4140
    42     public override double BestKnownHypervolume(int objectives) {
     41    protected override double GetBestKnownHypervolume(int objectives) {
    4342      return 120 + 2.0 / 3;
    4443    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT6.cs

    r13988 r14068  
    2929  [StorableClass]
    3030  public class ZDT6 : ZDT {
    31 
    32     public override double BestKnownHypervolume(int objectives) {
     31    protected override double GetBestKnownHypervolume(int objectives) {
    3332      return 117.51857519692037009;            //presumed typo on the ETH-homepage (119.518... is listed there but this doesnot match values for any given Pareto front
    3433    }
Note: See TracChangeset for help on using the changeset viewer.