Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Common;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
|
---|
8 | [Item("ZDT4", "ZDT4 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
|
---|
9 | [StorableClass]
|
---|
10 | public class ZDT4 : ZDT {
|
---|
11 |
|
---|
12 | public override double[,] Bounds(int objectives) {
|
---|
13 | double[,] bounds = new double[objectives, 2];
|
---|
14 | bounds[0, 0] = 0; bounds[0, 1] = 1;
|
---|
15 | for (int i = 1; i < objectives; i++) {
|
---|
16 | bounds[i, 0] = -5;
|
---|
17 | bounds[i, 1] = 5;
|
---|
18 | }
|
---|
19 |
|
---|
20 | return bounds;
|
---|
21 | }
|
---|
22 |
|
---|
23 | public override double BestKnownHypervolume(int objectives) {
|
---|
24 | return 120 + 2.0 / 3;
|
---|
25 | }
|
---|
26 |
|
---|
27 | [StorableConstructor]
|
---|
28 | protected ZDT4(bool deserializing) : base(deserializing) { }
|
---|
29 | protected ZDT4(ZDT4 original, Cloner cloner) : base(original, cloner) { }
|
---|
30 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
31 | return new ZDT4(this, cloner);
|
---|
32 | }
|
---|
33 | public ZDT4() : base() { }
|
---|
34 |
|
---|
35 | public override double[] Evaluate(RealVector r) {
|
---|
36 | double g = 0;
|
---|
37 | for (int i = 1; i < r.Length; i++) {
|
---|
38 | double v = r[i];
|
---|
39 | g += v * v - 10 * Math.Cos(4 * Math.PI * v);
|
---|
40 | }
|
---|
41 | g = 1.0 + 10.0 * (r.Length - 1) + g;
|
---|
42 | double d = r[0] / g;
|
---|
43 | return new double[] { r[0], 1-Math.Sqrt(d) };
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.