1 | using System;
|
---|
2 | using HeuristicLab.Common;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.Data;
|
---|
5 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
|
---|
9 | [Item("ZDT2", "ZDT2 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
|
---|
10 | [StorableClass]
|
---|
11 | public class ZDT2 : 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 | public override int ActualSolutionSize {
|
---|
49 | get {
|
---|
50 | return 2;
|
---|
51 | }
|
---|
52 |
|
---|
53 | set {
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | public override RealVector[] OptimalParetoFront {
|
---|
58 | get {
|
---|
59 | throw new NotImplementedException();
|
---|
60 | }
|
---|
61 | }
|
---|
62 | public override RealVector ReferencePoint {
|
---|
63 | get { return new RealVector(new double[] { 11.0, 11.0 }); }
|
---|
64 | }
|
---|
65 |
|
---|
66 | public override double BestKnownHypervolume {
|
---|
67 | get { return 120+1.0/3; }
|
---|
68 | }
|
---|
69 |
|
---|
70 | [StorableConstructor]
|
---|
71 | protected ZDT2(bool deserializing) : base(deserializing) { }
|
---|
72 | protected ZDT2(ZDT2 original, Cloner cloner) : base(original, cloner) { }
|
---|
73 | public ZDT2() : base() { }
|
---|
74 |
|
---|
75 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
76 | return new ZDT2(this, cloner);
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 | public override double[] Evaluate(RealVector r) {
|
---|
82 | double g = 0;
|
---|
83 | for (int i = 1; i < r.Length; i++) g += r[i];
|
---|
84 | g = 1.0 + 9.0 * g / (r.Length - 1);
|
---|
85 | double d = r[0] / g;
|
---|
86 | return new double[] { r[0], g * (1.0 - d * d) };
|
---|
87 | }
|
---|
88 | }
|
---|
89 | }
|
---|