Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj (revision 14068)
@@ -169,5 +169,5 @@
-
+
@@ -176,5 +176,5 @@
-
+
@@ -198,5 +198,5 @@
-
+
@@ -206,7 +206,7 @@
-
-
-
+
+
+
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs (revision 14068)
@@ -170,7 +170,8 @@
///
/// a double array that holds the distances that describe how much every contraint is violated (0 is not violated). If the current TestFunction does not have constraints an array of length 0 is returned
- public double[] checkContraints(RealVector individual) {
- if (TestFunction is IConstrainedTestFunction) {
- return ((IConstrainedTestFunction)TestFunction).CheckConstraints(individual, Objectives);
+ public double[] CheckContraints(RealVector individual) {
+ var constrainedTestFunction = (IConstrainedTestFunction)TestFunction;
+ if (constrainedTestFunction != null) {
+ return constrainedTestFunction.CheckConstraints(individual, Objectives);
}
return new double[0];
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/CIGTAB.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/CIGTAB.cs (revision 14067)
+++ (revision )
@@ -1,94 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("CIGTAB", "to be aded")]
- [StorableClass]
- public class CIGTAB : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -10, 10 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override double[] ReferencePoint(int objecitves) {
- return new double[] { 11, 11 };
- }
-
- public override IEnumerable OptimalParetoFront(int objecitves) {
- List res = new List();
- for (int i = 0; i <= 500; i++) {
- RealVector r = new RealVector(2);
- r[0] = 2 / 500.0 * i;
- r[1] = 2 / 500.0 * i;
- res.Add(this.Evaluate(r, 2));
- }
- return res;
- }
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
- }
-
- [StorableConstructor]
- protected CIGTAB(bool deserializing) : base(deserializing) { }
- protected CIGTAB(CIGTAB original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new CIGTAB(this, cloner);
- }
-
- public CIGTAB() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The CIGTAB problem must always have 2 objectives");
- double x = r[0];
- double a = 1000;
- double sum = x * x;
- for (int i = 1; i < r.Length - 1; i++) {
- sum += a * r[i] * r[i];
- }
- sum += a * a * r[r.Length - 1] * r[r.Length - 1];
-
- //objective1
- double f0 = 1 / (a * a * r.Length) * sum;
-
- x = x - 2;
- sum = x * x;
- for (int i = 1; i < r.Length - 1; i++) {
- sum += a * (r[i] - 2) * (r[i] - 2);
- }
-
- sum += a * a * (r[r.Length - 1] - 2) * (r[r.Length - 1] - 2);
- //objective0
- double f1 = 1 / (a * a * r.Length) * sum;
-
- return new double[] { f0, f1 };
- }
- }
-}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ.cs (revision 14068)
@@ -19,4 +19,5 @@
*/
#endregion
+
using System.Collections.Generic;
using HeuristicLab.Common;
@@ -27,19 +28,18 @@
[StorableClass]
public abstract class DTLZ : MultiObjectiveTestFunction {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
if (objectives == 2) return PFStore.get(this.ItemName + ".2D");
return null;
}
- public override double[,] Bounds(int objectives) {
+ protected override double[,] GetBounds(int objectives) {
return new double[,] { { 0, 1 } };
}
- public override bool[] Maximization(int objectives) {
+ protected override bool[] GetMaximization(int objectives) {
return new bool[objectives];
}
- public override double[] ReferencePoint(int objectives) {
+ protected override double[] GetReferencePoint(int objectives) {
double[] rp = new double[objectives];
for (int i = 0; i < objectives; i++) {
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ1.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ1.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class DTLZ1 : DTLZ {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
if (objectives == 2) return 120 + 7.0 / 8;
return -1;
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ2.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ2.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ2.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class DTLZ2 : DTLZ {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
return -1;
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ3.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ3.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ3.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class DTLZ3 : DTLZ {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
return -1;
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ4.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ4.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ4.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class DTLZ4 : DTLZ {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
if (objectives == 2) return 121.0 - 1.0 / 4.0 * Math.PI;
return -1;
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ7.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ7.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ7.cs (revision 14068)
@@ -30,6 +30,5 @@
[StorableClass]
public class DTLZ7 : DTLZ {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
if (objectives == 2) return 116.1138716447221;
return -1;
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ8.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ8.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ/DTLZ8.cs (revision 14068)
@@ -60,5 +60,5 @@
}
for (int j = 0; j < M - 1; j++) {
- if (res[objectives - 1] + 4 * res[j] - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
+ if (res[objectives - 1] + 4 * res[j] - 1 < 0) return IllegalValue(objectives, GetMaximization(objectives));
}
double min = Double.PositiveInfinity;
@@ -70,5 +70,5 @@
}
- if (2 * res[objectives - 1] + min - 1 < 0) return IllegalValue(objectives, Maximization(objectives));
+ if (2 * res[objectives - 1] + min - 1 < 0) return IllegalValue(objectives, GetMaximization(objectives));
return res;
}
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ELLI1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ELLI1.cs (revision 14067)
+++ (revision )
@@ -1,91 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("ELLI", "to be aded")]
- [StorableClass]
- public class ELLI : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -10, 10 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override double[] ReferencePoint(int objecitves) {
- return new double[] { 11, 11 };
- }
-
- public override IEnumerable OptimalParetoFront(int objecitves) {
- List res = new List();
- for (int i = 0; i <= 500; i++) {
- RealVector r = new RealVector(2);
- r[0] = 2 / 500.0 * i;
- r[1] = 2 / 500.0 * i;
- res.Add(this.Evaluate(r, 2));
- }
- return res;
- }
-
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
- }
-
- [StorableConstructor]
- protected ELLI(bool deserializing) : base(deserializing) { }
- protected ELLI(ELLI original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new ELLI(this, cloner);
- }
-
- public ELLI() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The ELLI problem must always have 2 objectives");
- double x = r[0];
- double a = 1000;
- double sum = 0.0;
- for (int i = 0; i < r.Length; i++) {
- sum += Math.Pow(a, 2 * i / (r.Length - 1)) * r[i] * r[i];
- }
-
- //objective1
- double f0 = 1 / (a * a * r.Length) * sum;
-
- sum = 0.0;
- for (int i = 0; i < r.Length; i++) {
- sum += Math.Pow(a, 2 * i / (r.Length - 1)) * (r[i] - 2) * (r[i] - 2);
- }
- //objective0
- double f1 = 1 / (a * a * r.Length) * sum;
-
- return new double[] { f0, f1 };
- }
- }
-}
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Fonseca.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Fonseca.cs (revision 14067)
+++ (revision )
@@ -1,86 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("Fonseca", "Fonseca and Flemming function from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
- [StorableClass]
- public class Fonseca : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -4, 4 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override IEnumerable OptimalParetoFront(int objectives) {
- return PFStore.get(this.ItemName);
- }
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
- }
-
- public override double[] ReferencePoint(int objectives) {
- return new double[] { 11, 11 };
- }
-
- [StorableConstructor]
- protected Fonseca(bool deserializing) : base(deserializing) { }
- protected Fonseca(Fonseca original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new Fonseca(this, cloner);
- }
- public Fonseca() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
-
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The Fonseca problem must always have 2 objectives");
- double f0 = 0.0, aux = 1.0 / Math.Sqrt(r.Length);
-
- //objective1
- for (int i = 0; i < r.Length; i++) {
- double d = r[i] - aux;
- f0 += d * d;
- }
- f0 = 1 - Math.Exp(-f0);
-
- //objective2
- double f1 = 0.0;
- for (int i = 0; i < r.Length; i++) {
- double d = r[i] + aux;
- f1 += d * d;
- }
- f1 = 1 - Math.Exp(-f1);
-
- double[] res = { f0, f1 };
- return res;
- }
-
- }
-}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs (revision 14068)
@@ -28,19 +28,18 @@
[StorableClass]
public abstract class IHR : MultiObjectiveTestFunction {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
if (objectives == 2) return PFStore.get(this.ItemName + ".2D");
return null;
}
- public override double[,] Bounds(int objectives) {
+ protected override double[,] GetBounds(int objectives) {
return new double[,] { { -1, 1 } };
}
- public override bool[] Maximization(int objectives) {
+ protected override bool[] GetMaximization(int objectives) {
return new bool[objectives];
}
- public override double[] ReferencePoint(int objectives) {
+ protected override double[] GetReferencePoint(int objectives) {
double[] rp = new double[objectives];
for (int i = 0; i < objectives; i++) {
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR1.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR1.cs (revision 14068)
@@ -30,6 +30,5 @@
[StorableClass]
public class IHR1 : IHR {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
List res = new List();
for (int i = 0; i <= 500; i++) {
@@ -40,6 +39,7 @@
return res;
}
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR2.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR2.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR2.cs (revision 14068)
@@ -30,6 +30,5 @@
[StorableClass]
public class IHR2 : IHR {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
List res = new List();
for (int i = 0; i <= 500; i++) {
@@ -41,6 +40,7 @@
return res;
}
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR3.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR3.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR3.cs (revision 14068)
@@ -30,6 +30,5 @@
[StorableClass]
public class IHR3 : IHR {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
List res = new List();
for (int i = 0; i <= 500; i++) {
@@ -41,6 +40,7 @@
return res;
}
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR4.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR4.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR4.cs (revision 14068)
@@ -30,7 +30,5 @@
[StorableClass]
public class IHR4 : IHR {
-
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
List res = new List();
for (int i = 0; i <= 500; i++) {
@@ -41,9 +39,10 @@
return res;
}
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
}
- public override double[,] Bounds(int objectives) {
+ protected override double[,] GetBounds(int objectives) {
return new double[,] { { -5, 5 } };
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR6.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR6.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR6.cs (revision 14068)
@@ -30,6 +30,5 @@
[StorableClass]
public class IHR6 : IHR {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
List res = new List();
for (int i = 0; i <= 500; i++) {
@@ -40,6 +39,7 @@
return res;
}
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
}
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Kursawe.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Kursawe.cs (revision 14067)
+++ (revision )
@@ -1,79 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("Kursawe", "Kursawe function from // http://darwin.di.uminho.pt/jecoli/index.php/Multiobjective_example [30.11.2015]")]
- [StorableClass]
- public class Kursawe : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -5, 5 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override IEnumerable OptimalParetoFront(int objecitves) {
- return PFStore.get(this.ItemName);
- }
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
- }
- public override double[] ReferencePoint(int objectives) {
- return new double[] { 11, 11 };
- }
-
- [StorableConstructor]
- protected Kursawe(bool deserializing) : base(deserializing) { }
- protected Kursawe(Kursawe original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new Kursawe(this, cloner);
- }
- public Kursawe() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 3, maximumSolutionLength: int.MaxValue) { }
-
-
-
-
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The Kursawe problem must always have 2 objectives");
- //objective 1
- double f0 = 0.0;
- for (int i = 0; i < r.Length - 1; i++) {
- f0 += -10 * Math.Exp(-0.2 * Math.Sqrt(r[i] * r[i] + r[i + 1] * r[i + 1]));
- }
- //objective2
- double f1 = 0.0;
- for (int i = 0; i < r.Length; i++) {
- f1 += Math.Pow(Math.Abs(r[i]), 0.8) + 5 * Math.Sin(Math.Pow(r[i], 3));
- }
-
- return new double[] { f0, f1 };
- }
- }
-}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/CIGTAB.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/CIGTAB.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/CIGTAB.cs (revision 14068)
@@ -0,0 +1,94 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("CIGTAB", "to be aded")]
+ [StorableClass]
+ public class CIGTAB : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -10, 10 } };
+ }
+
+ protected override bool[] GetMaximization(int objecitves) {
+ return new bool[2];
+ }
+
+ protected override double[] GetReferencePoint(int objecitves) {
+ return new double[] { 11, 11 };
+ }
+
+ protected override IEnumerable GetOptimalParetoFront(int objecitves) {
+ List res = new List();
+ for (int i = 0; i <= 500; i++) {
+ RealVector r = new RealVector(2);
+ r[0] = 2 / 500.0 * i;
+ r[1] = 2 / 500.0 * i;
+ res.Add(this.Evaluate(r, 2));
+ }
+ return res;
+ }
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
+ }
+
+ [StorableConstructor]
+ protected CIGTAB(bool deserializing) : base(deserializing) { }
+ protected CIGTAB(CIGTAB original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new CIGTAB(this, cloner);
+ }
+
+ public CIGTAB() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The CIGTAB problem must always have 2 objectives");
+ double x = r[0];
+ double a = 1000;
+ double sum = x * x;
+ for (int i = 1; i < r.Length - 1; i++) {
+ sum += a * r[i] * r[i];
+ }
+ sum += a * a * r[r.Length - 1] * r[r.Length - 1];
+
+ //objective1
+ double f0 = 1 / (a * a * r.Length) * sum;
+
+ x = x - 2;
+ sum = x * x;
+ for (int i = 1; i < r.Length - 1; i++) {
+ sum += a * (r[i] - 2) * (r[i] - 2);
+ }
+
+ sum += a * a * (r[r.Length - 1] - 2) * (r[r.Length - 1] - 2);
+ //objective0
+ double f1 = 1 / (a * a * r.Length) * sum;
+
+ return new double[] { f0, f1 };
+ }
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/ELLI1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/ELLI1.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/ELLI1.cs (revision 14068)
@@ -0,0 +1,90 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("ELLI", "to be aded")]
+ [StorableClass]
+ public class ELLI : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -10, 10 } };
+ }
+
+ protected override bool[] GetMaximization(int objecitves) {
+ return new bool[2];
+ }
+
+ protected override double[] GetReferencePoint(int objecitves) {
+ return new double[] { 11, 11 };
+ }
+
+ protected override IEnumerable GetOptimalParetoFront(int objecitves) {
+ List res = new List();
+ for (int i = 0; i <= 500; i++) {
+ RealVector r = new RealVector(2);
+ r[0] = 2 / 500.0 * i;
+ r[1] = 2 / 500.0 * i;
+ res.Add(this.Evaluate(r, 2));
+ }
+ return res;
+ }
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
+ }
+
+ [StorableConstructor]
+ protected ELLI(bool deserializing) : base(deserializing) { }
+ protected ELLI(ELLI original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new ELLI(this, cloner);
+ }
+
+ public ELLI() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The ELLI problem must always have 2 objectives");
+ double x = r[0];
+ double a = 1000;
+ double sum = 0.0;
+ for (int i = 0; i < r.Length; i++) {
+ sum += Math.Pow(a, 2 * i / (r.Length - 1)) * r[i] * r[i];
+ }
+
+ //objective1
+ double f0 = 1 / (a * a * r.Length) * sum;
+
+ sum = 0.0;
+ for (int i = 0; i < r.Length; i++) {
+ sum += Math.Pow(a, 2 * i / (r.Length - 1)) * (r[i] - 2) * (r[i] - 2);
+ }
+ //objective0
+ double f1 = 1 / (a * a * r.Length) * sum;
+
+ return new double[] { f0, f1 };
+ }
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Fonseca.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Fonseca.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Fonseca.cs (revision 14068)
@@ -0,0 +1,86 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("Fonseca", "Fonseca and Flemming function from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
+ [StorableClass]
+ public class Fonseca : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -4, 4 } };
+ }
+
+ protected override bool[] GetMaximization(int objecitves) {
+ return new bool[2];
+ }
+
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
+ return PFStore.get(this.ItemName);
+ }
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
+ }
+
+ protected override double[] GetReferencePoint(int objectives) {
+ return new double[] { 11, 11 };
+ }
+
+ [StorableConstructor]
+ protected Fonseca(bool deserializing) : base(deserializing) { }
+ protected Fonseca(Fonseca original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new Fonseca(this, cloner);
+ }
+ public Fonseca() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
+
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The Fonseca problem must always have 2 objectives");
+ double f0 = 0.0, aux = 1.0 / Math.Sqrt(r.Length);
+
+ //objective1
+ for (int i = 0; i < r.Length; i++) {
+ double d = r[i] - aux;
+ f0 += d * d;
+ }
+ f0 = 1 - Math.Exp(-f0);
+
+ //objective2
+ double f1 = 0.0;
+ for (int i = 0; i < r.Length; i++) {
+ double d = r[i] + aux;
+ f1 += d * d;
+ }
+ f1 = 1 - Math.Exp(-f1);
+
+ double[] res = { f0, f1 };
+ return res;
+ }
+
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Kursawe.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Kursawe.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/Kursawe.cs (revision 14068)
@@ -0,0 +1,80 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("Kursawe", "Kursawe function from // http://darwin.di.uminho.pt/jecoli/index.php/Multiobjective_example [30.11.2015]")]
+ [StorableClass]
+ public class Kursawe : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -5, 5 } };
+ }
+
+ protected override bool[] GetMaximization(int objecitves) {
+ return new bool[2];
+ }
+
+ protected override IEnumerable GetOptimalParetoFront(int objecitves) {
+ return PFStore.get(this.ItemName);
+ }
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
+ }
+
+ protected override double[] GetReferencePoint(int objectives) {
+ return new double[] { 11, 11 };
+ }
+
+ [StorableConstructor]
+ protected Kursawe(bool deserializing) : base(deserializing) { }
+ protected Kursawe(Kursawe original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new Kursawe(this, cloner);
+ }
+ public Kursawe() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 3, maximumSolutionLength: int.MaxValue) { }
+
+
+
+
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The Kursawe problem must always have 2 objectives");
+ //objective 1
+ double f0 = 0.0;
+ for (int i = 0; i < r.Length - 1; i++) {
+ f0 += -10 * Math.Exp(-0.2 * Math.Sqrt(r[i] * r[i] + r[i + 1] * r[i + 1]));
+ }
+ //objective2
+ double f1 = 0.0;
+ for (int i = 0; i < r.Length; i++) {
+ f1 += Math.Pow(Math.Abs(r[i]), 0.8) + 5 * Math.Sin(Math.Pow(r[i], 3));
+ }
+
+ return new double[] { f0, f1 };
+ }
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN1.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN1.cs (revision 14068)
@@ -0,0 +1,77 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("SchafferN1", "Schaffer function N.1 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
+ [StorableClass]
+ public class SchafferN1 : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -1e5, 1e5 } };
+ }
+
+ protected override bool[] GetMaximization(int objectives) {
+ return new bool[2];
+ }
+
+ protected override double[] GetReferencePoint(int objectives) {
+ return new double[] { 1e5, 1e5 };
+ }
+
+
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
+ return PFStore.get("Schaffer");
+ }
+
+ protected override double GetBestKnownHypervolume(int objectives) {
+ return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
+ }
+
+ [StorableConstructor]
+ protected SchafferN1(bool deserializing) : base(deserializing) { }
+ protected SchafferN1(SchafferN1 original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new SchafferN1(this, cloner);
+ }
+
+ public SchafferN1() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: 1) { }
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives");
+ if (r.Length != 1) return null;
+ double x = r[0];
+
+ //objective1
+ double f0 = x * x;
+
+ //objective0
+ double f1 = x - 2;
+ f1 *= f1;
+
+ return new double[] { f0, f1 };
+ }
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN2.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN2.cs (revision 14068)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Misc/SchafferN2.cs (revision 14068)
@@ -0,0 +1,77 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
+ [Item("SchafferN2", "Schaffer function N.2 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
+ [StorableClass]
+ public class SchafferN2 : MultiObjectiveTestFunction {
+ protected override double[,] GetBounds(int objectives) {
+ return new double[,] { { -5, 10 } };
+ }
+
+ protected override bool[] GetMaximization(int objecitves) {
+ return new bool[2];
+ }
+
+ protected override double[] GetReferencePoint(int objecitves) {
+ return new double[] { 100, 100 };
+ }
+
+
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
+ throw new NotImplementedException();
+ }
+
+ [StorableConstructor]
+ protected SchafferN2(bool deserializing) : base(deserializing) { }
+ protected SchafferN2(SchafferN2 original, Cloner cloner) : base(original, cloner) { }
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new SchafferN2(this, cloner);
+ }
+
+ public SchafferN2() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: 1) { }
+
+
+ public override double[] Evaluate(RealVector r, int objectives) {
+ if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives");
+ double x = r[0];
+
+ //objective1
+ double f0;
+ if (x <= 1) f0 = -x;
+ else if (x <= 3) f0 = x - 2;
+ else if (x <= 4) f0 = 4 - x;
+ else f0 = x - 4;
+
+ //objective0
+ double f1 = x - 5;
+ f1 *= f1;
+
+ return new double[] { f0, f1 };
+ }
+ }
+}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs (revision 14068)
@@ -20,4 +20,5 @@
#endregion
+using System;
using System.Collections.Generic;
using HeuristicLab.Common;
@@ -69,27 +70,51 @@
/// Returns whether the actual function constitutes a maximization or minimization problem.
///
- public abstract bool[] Maximization(int objectives);
+ public bool[] Maximization(int objectives) {
+ CheckObjectives(objectives);
+ return GetMaximization(objectives);
+ }
+ protected abstract bool[] GetMaximization(int objectives);
///
/// Gets the lower and upper bound of the function.
///
- public abstract double[,] Bounds(int objectives);
-
+ public double[,] Bounds(int objectives) {
+ CheckObjectives(objectives);
+ return GetBounds(objectives);
+ }
+ protected abstract double[,] GetBounds(int objectives);
///
/// retrieves the optimal pareto front (if known from a file)
///
- public abstract IEnumerable OptimalParetoFront(int objectives);
+ public IEnumerable OptimalParetoFront(int objectives) {
+ CheckObjectives(objectives);
+ return GetOptimalParetoFront(objectives);
+ }
+ protected abstract IEnumerable GetOptimalParetoFront(int objectives);
///
/// returns a Reference Point for Hypervolume calculation (default=(11|11))
///
- public abstract double[] ReferencePoint(int objectives);
-
+ public double[] ReferencePoint(int objectives) {
+ CheckObjectives(objectives);
+ return GetReferencePoint(objectives);
+ }
+ protected abstract double[] GetReferencePoint(int objectives);
///
/// returns the best known Hypervolume for this test function (default=-1)
- ///
+ ///
public virtual double BestKnownHypervolume(int objectives) {
+ CheckObjectives(objectives);
+ return GetBestKnownHypervolume(objectives);
+ }
+
+ protected virtual double GetBestKnownHypervolume(int objectives) {
return -1;
+ }
+
+ protected void CheckObjectives(int objectives) {
+ if (objectives < MinimumObjectives) throw new ArgumentException(string.Format("There must be at least {0} objectives", MinimumObjectives));
+ if (objectives > MaximumObjectives) throw new ArgumentException(string.Format("There must be at most {0} objectives", MaximumObjectives));
}
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN1.cs (revision 14067)
+++ (revision )
@@ -1,78 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("SchafferN1", "Schaffer function N.1 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
- [StorableClass]
- public class SchafferN1 : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -1e5, 1e5 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override double[] ReferencePoint(int objecitves) {
- return new double[] { 1e5, 1e5 };
- }
-
-
- public override IEnumerable OptimalParetoFront(int objecitves) {
- return PFStore.get("Schaffer");
- }
- public override double BestKnownHypervolume(int objectives) {
- return Hypervolume.Calculate(OptimalParetoFront(objectives), ReferencePoint(objectives), Maximization(objectives));
-
- }
-
- [StorableConstructor]
- protected SchafferN1(bool deserializing) : base(deserializing) { }
- protected SchafferN1(SchafferN1 original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new SchafferN1(this, cloner);
- }
-
- public SchafferN1() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: 1) { }
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives");
- if (r.Length != 1) return null;
- double x = r[0];
-
- //objective1
- double f0 = x * x;
-
- //objective0
- double f1 = x - 2;
- f1 *= f1;
-
- return new double[] { f0, f1 };
- }
- }
-}
Index: anches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN2.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN2.cs (revision 14067)
+++ (revision )
@@ -1,78 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
- [Item("SchafferN2", "Schaffer function N.2 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
- [StorableClass]
- public class SchafferN2 : MultiObjectiveTestFunction {
-
- public override double[,] Bounds(int objectives) {
- return new double[,] { { -5, 10 } };
- }
-
- public override bool[] Maximization(int objecitves) {
- return new bool[2];
- }
-
- public override double[] ReferencePoint(int objecitves) {
- return new double[] { 100, 100 };
- }
-
-
- public override IEnumerable OptimalParetoFront(int objectives) {
- throw new NotImplementedException();
- }
-
- [StorableConstructor]
- protected SchafferN2(bool deserializing) : base(deserializing) { }
- protected SchafferN2(SchafferN2 original, Cloner cloner) : base(original, cloner) { }
- public override IDeepCloneable Clone(Cloner cloner) {
- return new SchafferN2(this, cloner);
- }
-
- public SchafferN2() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: 1) { }
-
-
- public override double[] Evaluate(RealVector r, int objectives) {
- if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives");
- double x = r[0];
-
- //objective1
- double f0;
- if (x <= 1) f0 = -x;
- else if (x <= 3) f0 = x - 2;
- else if (x <= 4) f0 = 4 - x;
- else f0 = x - 4;
-
- //objective0
- double f1 = x - 5;
- f1 *= f1;
-
- return new double[] { f0, f1 };
- }
- }
-}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT.cs (revision 14068)
@@ -28,22 +28,21 @@
[StorableClass]
public abstract class ZDT : MultiObjectiveTestFunction {
-
- public override IEnumerable OptimalParetoFront(int objectives) {
+ protected override IEnumerable GetOptimalParetoFront(int objectives) {
return PFStore.get(this.ItemName);
}
- public override double[,] Bounds(int objectives) {
+ protected override double[,] GetBounds(int objectives) {
return new double[,] { { 0, 1 } };
}
- public override bool[] Maximization(int objectives) {
+ protected override bool[] GetMaximization(int objectives) {
return new bool[objectives];
}
- public override double[] ReferencePoint(int objecitives) {
+ protected override double[] GetReferencePoint(int objecitives) {
return new double[] { 11.0, 11.0 };
}
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return -1;
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT1.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT1.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT1.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class ZDT1 : ZDT {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return 120 + 2.0 / 3;
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT2.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT2.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT2.cs (revision 14068)
@@ -28,6 +28,5 @@
[StorableClass]
public class ZDT2 : ZDT {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return 120 + 1.0 / 3;
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT3.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT3.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT3.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class ZDT3 : ZDT {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return 128.77811613069076060;
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT4.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT4.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT4.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class ZDT4 : ZDT {
-
- public override double[,] Bounds(int objectives) {
+ protected override double[,] GetBounds(int objectives) {
double[,] bounds = new double[objectives, 2];
bounds[0, 0] = 0; bounds[0, 1] = 1;
@@ -40,5 +39,5 @@
}
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return 120 + 2.0 / 3;
}
Index: /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT6.cs
===================================================================
--- /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT6.cs (revision 14067)
+++ /branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT/ZDT6.cs (revision 14068)
@@ -29,6 +29,5 @@
[StorableClass]
public class ZDT6 : ZDT {
-
- public override double BestKnownHypervolume(int objectives) {
+ protected override double GetBestKnownHypervolume(int objectives) {
return 117.51857519692037009; //presumed typo on the ETH-homepage (119.518... is listed there but this doesnot match values for any given Pareto front
}