Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13673


Ignore:
Timestamp:
03/09/16 14:05:49 (8 years ago)
Author:
bwerth
Message:

#1087 fixed bug in DTLZ1, DTLZ3 and DTLZ7

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions
Files:
8 added
3 edited

Legend:

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

    r13672 r13673  
    4949        throw new Exception("The dimensionality of the problem(ProblemSize) must be larger or equal than the dimensionality of the solution(SolutionSize) ");
    5050      }
     51      double[] res = new double[objectives];
     52      int k = r.Length - objectives + 1;
     53      double g = 0;
    5154
    52       double[] res = new double[objectives];
     55      for (int i = r.Length - k; i < r.Length; i++) {
     56        g += (r[i] - 0.5) * (r[i] - 0.5) - Math.Cos(20.0 * Math.PI * (r[i] - 0.5));
     57      };
     58      g += k;
     59      g *= 100;
    5360
    54       //calculate g(Xm)
    55       double sum = 0, length = 0;
    56       for (int i = objectives; i < r.Length; i++) {
    57         double d = r[i] - 0.5;
    58         sum += d * d - Math.Cos(20 * Math.PI * d);
    59         length += r[i] * r[i];
    60       }
    61       length = Math.Sqrt(length);
    62       double g = 100 * (length + sum);
    63 
    64       //calculating f0...fM-1
    6561      for (int i = 0; i < objectives; i++) {
    66         double f = 0.5 * (i == 0 ? 1 : (1 - r[objectives - i - 1])) * (1 + g);
    67         for (int j = 0; j < objectives - i - 1; j++) {
    68           f *= r[j];
    69         }
    70         res[i] = f;
     62        res[i] = 0.5 * (1.0 + g);
     63        for (int j = 0; j < objectives - i - 1; ++j)
     64          res[i] *= (r[j]);
     65        if (i > 0)
     66          res[i] *= 1 - r[objectives - i - 1];
    7167      }
    7268      return res;
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ3.cs

    r13672 r13673  
    5151
    5252      //calculate g(Xm)
    53       double sum = 0, length = 0;
    54       for (int i = objectives; i < r.Length; i++) {
     53      double sum = 0;
     54      int length = r.Length - objectives + 1;
     55      for (int i = r.Length-length; i < r.Length; i++) {
    5556        double d = r[i] - 0.5;
    5657        sum += d * d - Math.Cos(20 * Math.PI * d);
    57         length += r[i] * r[i];
     58       
    5859      }
    59       length = Math.Sqrt(length);
    6060      double g = 100 * (length + sum);
    6161
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ7.cs

    r13672 r13673  
    5252
    5353      //calculate g(Xm)
    54       double g = 0, length = 0;
     54      double g = 0, length = length = r.Length - objectives + 1;
    5555      for (int i = objectives; i < r.Length; i++) {
    5656        g += r[i];
    57         length += r[i] * r[i];
    5857      }
    59       length = Math.Sqrt(length);
    6058      g = 1.0 + 9.0 / length * g;
    6159      if (length == 0) { g = 1; }
Note: See TracChangeset for help on using the changeset viewer.