Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/DTLZ/DTLZ7.cs @ 17388

Last change on this file since 17388 was 17180, checked in by swagner, 5 years ago

#2875: Removed years in copyrights

File size: 2.7 KB
RevLine 
[13672]1#region License Information
2/* HeuristicLab
[17180]3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[13672]4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
[13620]23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Encodings.RealVectorEncoding;
[16565]26using HEAL.Attic;
[13620]27
[14111]28namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
[13620]29  [Item("DTLZ7", "Testfunction as defined as DTLZ6 in http://repository.ias.ac.in/81671/ [30.11.15] NOTE: The website http://people.ee.ethz.ch/~sop/download/supplementary/testproblems/dtlz7/index.php [16.12.2015] lables this function as DTLZ7")]
[16565]30  [StorableType("D98AAC02-652E-4ED4-9365-5589E970CFBD")]
[13620]31  public class DTLZ7 : DTLZ {
[14068]32    protected override double GetBestKnownHypervolume(int objectives) {
[13620]33      if (objectives == 2) return 116.1138716447221;
34      return -1;
35    }
36
37    [StorableConstructor]
[16565]38    protected DTLZ7(StorableConstructorFlag _) : base(_) { }
[13620]39    protected DTLZ7(DTLZ7 original, Cloner cloner) : base(original, cloner) { }
40    public override IDeepCloneable Clone(Cloner cloner) {
41      return new DTLZ7(this, cloner);
42    }
43    public DTLZ7() : base() { }
44
45    public override double[] Evaluate(RealVector r, int objectives) {
46      if (r.Length < objectives) {
[13725]47        throw new ArgumentException("The dimensionality of the problem(ProblemSize) must be larger than or equal to the number of objectives");
[13620]48      }
49      double[] res = new double[objectives];
50
51      //calculate g(Xm)
[13673]52      double g = 0, length = length = r.Length - objectives + 1;
[13620]53      for (int i = objectives; i < r.Length; i++) {
54        g += r[i];
55      }
56      g = 1.0 + 9.0 / length * g;
57      if (length == 0) { g = 1; }
58
59      //calculating f0...fM-2
60      for (int i = 0; i < objectives - 1; i++) {
61        res[i] = r[i];
62      }
63      //calculate fM-1
64      double h = objectives;
65      for (int i = 0; i < objectives - 1; i++) {
66        h -= res[i] / (1 + g) * (1 + Math.Sin(3 * Math.PI * res[i]));
67      }
68      res[objectives - 1] = (1 + g) * h;
69
70      return res;
71    }
72  }
73}
Note: See TracBrowser for help on using the repository browser.