Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT6.cs @ 13515

Last change on this file since 13515 was 13515, checked in by bwerth, 8 years ago

#1087 minor bugfixes and added unittests

File size: 2.3 KB
Line 
1using System;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Data;
5using HeuristicLab.Encodings.RealVectorEncoding;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
9  [Item("ZDT6", "ZDT6 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
10  [StorableClass]
11  public class ZDT6 : MultiObjectiveTestFunction {
12
13    public override DoubleMatrix Bounds {
14      get {
15        return new DoubleMatrix(new double[,] { { 0, 1 } });
16      }
17    }
18
19    public override bool[] Maximization {
20      get {
21        return new bool[] { false, false };
22      }
23    }
24
25    public override int MaximumProblemSize {
26      get {
27        return int.MaxValue;
28      }
29    }
30
31    public override int MaximumSolutionSize {
32      get {
33        return 2;
34      }
35    }
36
37    public override int MinimumProblemSize {
38      get {
39        return 1;
40      }
41    }
42
43    public override int MinimumSolutionSize {
44      get {
45        return 2;
46      }
47    }
48
49    public override int ActualSolutionSize {
50      get {
51        return 2;
52      }
53
54      set {
55      }
56    }
57
58    public override RealVector[] OptimalParetoFront {
59      get {
60        throw new NotImplementedException();
61      }
62    }
63
64    public override RealVector ReferencePoint {
65      get { return new RealVector(new double[] { 11.0, 11.0 }); }
66    }
67
68
69    public override double BestKnownHypervolume {
70      get{ return 119.51857519692037009; }
71    }
72
73    [StorableConstructor]
74    protected ZDT6(bool deserializing) : base(deserializing) { }
75    protected ZDT6(ZDT6 original, Cloner cloner) : base(original, cloner) { }
76    public ZDT6() : base() { }
77
78    public override IDeepCloneable Clone(Cloner cloner) {
79      return new ZDT6(this, cloner);
80    }
81
82
83
84    public override double[] Evaluate(RealVector r) {
85      double g = 0;
86      for (int i = 1; i < r.Length; i++) g += r[i];
87      g = 1.0 + 9.0 * Math.Pow(g / (r.Length - 1), 0.25);
88      double f1 = 1 - Math.Exp(-4 * r[0]) * Math.Pow(Math.Sin(6 * Math.PI * r[0]), 6);
89      double d = f1 / g;
90      return new double[] { f1, g*(1.0 - d * d) };
91    }
92  }
93}
Note: See TracBrowser for help on using the repository browser.