Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/16 15:03:51 (8 years ago)
Author:
bwerth
Message:

#1087 added more functions (IHR1-4, IHR6, CIGTAB, ELLI)

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR
Files:
1 added
1 copied

Legend:

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

    r13872 r13936  
    1919 */
    2020#endregion
     21using System;
    2122using System.Collections.Generic;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Encodings.RealVectorEncoding;
     
    2628namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
    2729  [StorableClass]
    28   public abstract class DTLZ : MultiObjectiveTestFunction {
     30  public abstract class IHR : MultiObjectiveTestFunction {
    2931
    3032
     
    3537
    3638    public override double[,] Bounds(int objectives) {
    37       return new double[,] { { 0, 1 } };
     39      return new double[,] { { -1, 1 } };
    3840    }
    3941
     
    4244    }
    4345
    44     public override int MinimumSolutionLength {
     46    public override int MinimumSolutionLength
     47    {
    4548      get { return 2; }
    4649    }
    47     public override int MaximumSolutionLength {
     50    public override int MaximumSolutionLength
     51    {
    4852      get { return int.MaxValue; }
    4953    }
    5054
    5155
    52     public override int MinimumObjectives {
     56    public override int MinimumObjectives
     57    {
    5358      get { return 2; }
    5459    }
    55     public override int MaximumObjectives {
    56       get { return int.MaxValue; }
     60    public override int MaximumObjectives
     61    {
     62      get { return 2; }
    5763    }
    5864
     
    6672
    6773    [StorableConstructor]
    68     protected DTLZ(bool deserializing) : base(deserializing) { }
    69     protected DTLZ(DTLZ original, Cloner cloner) : base(original, cloner) { }
    70     public DTLZ() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
     74    protected IHR(bool deserializing) : base(deserializing) { }
     75    protected IHR(IHR original, Cloner cloner) : base(original, cloner) { }
     76    public IHR() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }
    7177
    72     public abstract override double[] Evaluate(RealVector r, int objecitves);
     78    public override double[] Evaluate(RealVector r, int objectives) {
     79      if (r.Length < objectives) {
     80        throw new ArgumentException("The dimensionality of the problem(ProblemSize) must be larger than or equal to the number of objectives");
     81      }
     82      RealVector y = Y(r);
     83      return new double[] { F1(y), F2(r, y) };
     84    }
     85    protected abstract double F1(RealVector y);
     86    protected abstract double F2(RealVector r, RealVector y);
     87    protected abstract double G(RealVector y);
    7388
     89
     90    protected double H(double x, RealVector r) {
     91      return 1.0 / (1 + Math.Exp(-x / Math.Sqrt(r.Length)));
     92    }
     93    protected double HF(double x, RealVector r) {
     94      double ymax = 1;
     95      return Math.Abs(r[0]) <= ymax ? x : 1 + Math.Abs(r[0]);    //replace  with maximum of first column of matrix used in Y(x)
     96    }
     97    protected double HG(double x) {
     98      return (x * x) / (Math.Abs(x) + 0.1);
     99    }
     100    protected RealVector Y(RealVector x) {
     101      return x; //replace with matrix*x
     102    }
    74103  }
    75104}
Note: See TracChangeset for help on using the changeset viewer.