Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/14/16 13:34:21 (8 years ago)
Author:
mkommend
Message:

#1087: Refactored multi-objective test functions.

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/CIGTAB.cs

    r13988 r14067  
    3737    public override bool[] Maximization(int objecitves) {
    3838      return new bool[2];
    39     }
    40 
    41     public override int MinimumSolutionLength {
    42       get { return 1; }
    43     }
    44     public override int MaximumSolutionLength {
    45       get { return int.MaxValue; }
    46     }
    47 
    48     public override int MinimumObjectives {
    49       get { return 2; }
    50     }
    51 
    52     public override int MaximumObjectives {
    53       get { return 2; }
    5439    }
    5540
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ.cs

    r13988 r14067  
    4141    }
    4242
    43     public override int MinimumSolutionLength {
    44       get { return 2; }
    45     }
    46     public override int MaximumSolutionLength {
    47       get { return int.MaxValue; }
    48     }
    49 
    50 
    51     public override int MinimumObjectives {
    52       get { return 2; }
    53     }
    54     public override int MaximumObjectives {
    55       get { return int.MaxValue; }
    56     }
    57 
    5843    public override double[] ReferencePoint(int objectives) {
    5944      double[] rp = new double[objectives];
     
    6752    protected DTLZ(bool deserializing) : base(deserializing) { }
    6853    protected DTLZ(DTLZ original, Cloner cloner) : base(original, cloner) { }
    69     public DTLZ() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
     54    public DTLZ() : base(minimumObjectives: 2, maximumObjectives: int.MaxValue, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
    7055
    7156    public abstract override double[] Evaluate(RealVector r, int objecitves);
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ8.cs

    r13988 r14067  
    2929  [StorableClass]
    3030  public class DTLZ8 : DTLZ, IConstrainedTestFunction {
     31    public static double[] IllegalValue(int size, bool[] maximization) {
     32      double[] res = new double[size];
     33      for (int i = 0; i < size; i++) {
     34        res[i] = maximization[i] ? Double.MinValue : Double.MaxValue;
     35      }
     36      return res;
     37    }
    3138
    3239    [StorableConstructor]
     
    5360      }
    5461      for (int j = 0; j < M - 1; j++) {
    55         if (res[objectives - 1] + 4 * res[j] - 1 < 0) return MultiObjectiveTestFunction.IllegalValue(objectives, Maximization(objectives));
     62        if (res[objectives - 1] + 4 * res[j] - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
    5663      }
    5764      double min = Double.PositiveInfinity;
     
    6370      }
    6471
    65       if (2 * res[objectives - 1] + min - 1 < 0) return MultiObjectiveTestFunction.IllegalValue(objectives, Maximization(objectives));
     72      if (2 * res[objectives - 1] + min - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
    6673      return res;
    6774    }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ELLI1.cs

    r13988 r14067  
    3737    public override bool[] Maximization(int objecitves) {
    3838      return new bool[2];
    39     }
    40 
    41     public override int MinimumSolutionLength {
    42       get { return 1; }
    43     }
    44     public override int MaximumSolutionLength {
    45       get { return int.MaxValue; }
    46     }
    47 
    48     public override int MinimumObjectives {
    49       get { return 2; }
    50     }
    51 
    52     public override int MaximumObjectives {
    53       get { return 2; }
    5439    }
    5540
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Fonseca.cs

    r13771 r14067  
    4040    }
    4141
    42     public override int MaximumSolutionLength {
    43       get { return int.MaxValue; }
    44     }
    45 
    46     public override int MinimumSolutionLength {
    47       get { return 1; }
    48     }
    49 
    50     public override int MinimumObjectives {
    51       get { return 2; }
    52     }
    53 
    54     public override int MaximumObjectives {
    55       get { return 2; }
    56     }
    57 
    58 
    5942    public override IEnumerable<double[]> OptimalParetoFront(int objectives) {
    6043      return PFStore.get(this.ItemName);
     
    7457      return new Fonseca(this, cloner);
    7558    }
    76     public Fonseca() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1) { }
     59    public Fonseca() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
    7760
    7861
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs

    r13989 r14067  
    4242    }
    4343
    44     public override int MinimumSolutionLength {
    45       get { return 2; }
    46     }
    47     public override int MaximumSolutionLength {
    48       get { return int.MaxValue; }
    49     }
    50 
    51     public override int MinimumObjectives {
    52       get { return 2; }
    53     }
    54     public override int MaximumObjectives {
    55       get { return 2; }
    56     }
    57 
    5844    public override double[] ReferencePoint(int objectives) {
    5945      double[] rp = new double[objectives];
     
    6753    protected IHR(bool deserializing) : base(deserializing) { }
    6854    protected IHR(IHR original, Cloner cloner) : base(original, cloner) { }
    69     public IHR() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
     55    public IHR() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
    7056
    7157    public override double[] Evaluate(RealVector r, int objectives) {
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Kursawe.cs

    r13771 r14067  
    3939    }
    4040
    41     public override int MinimumObjectives {
    42       get { return 2; }
    43     }
    44     public override int MaximumObjectives {
    45       get { return 2; }
    46     }
    47 
    48     public override int MinimumSolutionLength {
    49       get { return 3; }
    50     }
    51     public override int MaximumSolutionLength {
    52       get { return int.MaxValue; }
    53     }
    54 
    5541    public override IEnumerable<double[]> OptimalParetoFront(int objecitves) {
    5642      return PFStore.get(this.ItemName);
     
    6955      return new Kursawe(this, cloner);
    7056    }
    71     public Kursawe() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 3) { }
     57    public Kursawe() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 3, maximumSolutionLength: int.MaxValue) { }
    7258
    7359
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs

    r13771 r14067  
    3535  [StorableClass]
    3636  public abstract class MultiObjectiveTestFunction : ParameterizedNamedItem, IMultiObjectiveTestFunction {
    37     public static double[] IllegalValue(int size, bool[] maximization) {
    38       double[] res = new double[size];
    39       for (int i = 0; i < size; i++) {
    40         res[i] = maximization[i] ? double.MinValue : double.MaxValue;
    41       }
    42       return res;
    43     }
    44 
    4537    /// <summary>
    4638    /// These operators should not change their name through the GUI
     
    4941      get { return false; }
    5042    }
     43
     44    /// <summary>
     45    /// Gets the minimum problem size.
     46    /// </summary>
     47    [Storable]
     48    public int MinimumSolutionLength { get; private set; }
     49    /// <summary>
     50    /// Gets the maximum problem size.
     51    /// </summary>
     52    [Storable]
     53    public int MaximumSolutionLength { get; private set; }
     54
     55
     56    /// <summary>
     57    /// Gets the minimum solution size.
     58    /// </summary>
     59    [Storable]
     60    public int MinimumObjectives { get; private set; }
     61    /// <summary>
     62    /// Gets the maximum solution size.
     63    /// </summary>
     64    [Storable]
     65    public int MaximumObjectives { get; private set; }
     66
     67
    5168    /// <summary>
    5269    /// Returns whether the actual function constitutes a maximization or minimization problem.
     
    5774    /// </summary>
    5875    public abstract double[,] Bounds(int objectives);
    59     /// <summary>
    60     /// Gets the minimum problem size.
    61     /// </summary>
    62     public abstract int MinimumSolutionLength { get; }
    63     /// <summary>
    64     /// Gets the maximum problem size.
    65     /// </summary>
    66     public abstract int MaximumSolutionLength { get; }
    6776
    68 
    69     /// <summary>
    70     /// Gets and sets the actual solution size.
    71     /// </summary>
    72     ///
    73     [Storable]
    74     private int objectives;
    75     /// <summary>
    76     /// Gets the minimum solution size.
    77     /// </summary>
    78     public abstract int MinimumObjectives { get; }
    79     /// <summary>
    80     /// Gets the maximum solution size.
    81     /// </summary>
    82     public abstract int MaximumObjectives { get; }
    8377
    8478    /// <summary>
     
    8781    public abstract IEnumerable<double[]> OptimalParetoFront(int objectives);
    8882
    89 
    9083    /// <summary>
    91     /// returns a Reference Point for Hypervolume calculation (currently default=(11|11))
     84    /// returns a Reference Point for Hypervolume calculation (default=(11|11))
    9285    /// </summary>
    9386    public abstract double[] ReferencePoint(int objectives);
     
    9588
    9689    /// <summary>
    97     /// returns the best known Hypervolume for this Problem   (currently default=-1)
     90    /// returns the best known Hypervolume for this test function   (default=-1)
    9891    /// </summary>
    9992    public virtual double BestKnownHypervolume(int objectives) {
     
    10396    [StorableConstructor]
    10497    protected MultiObjectiveTestFunction(bool deserializing) : base(deserializing) { }
    105     protected MultiObjectiveTestFunction(MultiObjectiveTestFunction original, Cloner cloner) : base(original, cloner) {
    106       this.objectives = original.objectives;
     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;
    107105    }
    108     protected MultiObjectiveTestFunction(int minimumObjectives = 1, int maximumObjectives = int.MaxValue, int minimumSolutionLength = 1, int maximumSolutionLength = int.MaxValue) : base() {
    109       Parameters.Add(new FixedValueParameter<IntValue>("MinimumObjectives", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(minimumObjectives)));
    110       Parameters.Add(new FixedValueParameter<IntValue>("MaximumObjectives", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(maximumObjectives)));
    111       Parameters.Add(new FixedValueParameter<IntValue>("MinimumSolutionLength", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(minimumSolutionLength)));
    112       Parameters.Add(new FixedValueParameter<IntValue>("MaximumSolutionLength", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(maximumSolutionLength)));
     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;
    113120    }
    114121
     
    119126    /// <returns>The result values of the function at the given point.</returns>
    120127    public abstract double[] Evaluate(RealVector point, int objectives);
    121 
    122128  }
    123129}
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN1.cs

    r13771 r14067  
    3939    }
    4040
    41     public override int MinimumSolutionLength {
    42       get { return 1; }
    43     }
    44     public override int MaximumSolutionLength {
    45       get { return 1; }
    46     }
    47 
    48 
    49     public override int MinimumObjectives {
    50       get { return 2; }
    51     }
    52 
    53     public override int MaximumObjectives {
    54       get { return 2; }
    55     }
    56 
    57 
    5841    public override double[] ReferencePoint(int objecitves) {
    5942      return new double[] { 1e5, 1e5 };
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN2.cs

    r13771 r14067  
    3939    }
    4040
    41     public override int MinimumSolutionLength {
    42       get { return 1; }
    43     }
    44 
    45     public override int MaximumSolutionLength {
    46       get { return 1; }
    47     }
    48 
    49     public override int MinimumObjectives {
    50       get { return 2; }
    51     }
    52 
    53     public override int MaximumObjectives {
    54       get { return 2; }
    55     }
    56 
    5741    public override double[] ReferencePoint(int objecitves) {
    5842      return new double[] { 100, 100 };
     
    7256
    7357    public SchafferN2() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: 1) { }
    74 
    75 
    76 
    7758
    7859
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT.cs

    r13989 r14067  
    4141    }
    4242
    43     public override int MinimumSolutionLength {
    44       get { return 1; }
    45     }
    46 
    47     public override int MaximumSolutionLength {
    48       get { return int.MaxValue; }
    49     }
    50 
    51     public override int MinimumObjectives {
    52       get { return 2; }
    53     }
    54 
    55     public override int MaximumObjectives {
    56       get { return 2; }
    57     }
    58 
    5943    public override double[] ReferencePoint(int objecitives) {
    6044      return new double[] { 11.0, 11.0 };
     
    6751    [StorableConstructor]
    6852    protected ZDT(bool deserializing) : base(deserializing) { }
    69     protected ZDT(MultiObjectiveTestFunction original, Cloner cloner) : base(original, cloner) {
     53    protected ZDT(MultiObjectiveTestFunction original, Cloner cloner)
     54      : base(original, cloner) {
    7055    }
    71     protected ZDT() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1) { }
     56    protected ZDT() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
    7257
    7358    public override double[] Evaluate(RealVector r, int objectives) {
Note: See TracChangeset for help on using the changeset viewer.