Changeset 17225 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions
- Timestamp:
- 08/29/19 13:53:26 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/DTLZ/DTLZ.cs
r16723 r17225 28 28 [StorableType("3ED6C22E-EA6E-4336-BC49-884CE151E514")] 29 29 public abstract class DTLZ : MultiObjectiveTestFunction { 30 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {30 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 31 31 if (objectives == 2) return ParetoFrontStore.GetParetoFront("DTLZ.ParetoFronts." + this.ItemName + ".2D"); 32 32 return null; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR1.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 30 31 [StorableType("16DF9415-9D12-4FB9-A985-7EEAE05A24CA")] 31 32 public class IHR1 : IHR { 32 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {33 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 33 34 List<double[]> res = new List<double[]>(); 34 35 for (int i = 0; i <= 500; i++) { … … 41 42 42 43 protected override double GetBestKnownHypervolume(int objectives) { 43 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));44 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 44 45 } 45 46 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR2.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 30 31 [StorableType("3E06E73F-61CD-4B99-99A8-84E6E9C0EFC9")] 31 32 public class IHR2 : IHR { 32 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {33 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 33 34 List<double[]> res = new List<double[]>(); 34 35 for (int i = 0; i <= 500; i++) { … … 42 43 43 44 protected override double GetBestKnownHypervolume(int objectives) { 44 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));45 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 45 46 } 46 47 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR3.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 30 31 [StorableType("316D5351-762D-4883-ACEF-06F4EAFA73AE")] 31 32 public class IHR3 : IHR { 32 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {33 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 33 34 List<double[]> res = new List<double[]>(); 34 35 for (int i = 0; i <= 500; i++) { … … 42 43 43 44 protected override double GetBestKnownHypervolume(int objectives) { 44 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));45 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 45 46 } 46 47 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR4.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 30 31 [StorableType("E83A9E6E-F7B3-4B27-B5CA-A323D89844F5")] 31 32 public class IHR4 : IHR { 32 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {33 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 33 34 List<double[]> res = new List<double[]>(); 34 35 for (int i = 0; i <= 500; i++) { … … 41 42 42 43 protected override double GetBestKnownHypervolume(int objectives) { 43 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));44 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 44 45 } 45 46 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR6.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 30 31 [StorableType("5C0A4163-831B-4507-997F-A70B59E3A445")] 31 32 public class IHR6 : IHR { 32 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {33 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 33 34 List<double[]> res = new List<double[]>(); 34 35 for (int i = 0; i <= 500; i++) { … … 41 42 42 43 protected override double GetBestKnownHypervolume(int objectives) { 43 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));44 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 44 45 } 45 46 … … 47 48 protected IHR6(StorableConstructorFlag _) : base(_) { } 48 49 protected IHR6(IHR6 original, Cloner cloner) : base(original, cloner) { } 49 public IHR6() : base() { 50 } 50 public IHR6() : base() { } 51 51 52 52 public override IDeepCloneable Clone(Cloner cloner) { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/CIGTAB.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 31 32 public class CIGTAB : MultiObjectiveTestFunction { 32 33 protected override double[,] GetBounds(int objectives) { 33 return new double[,] { { -10, 10 }};34 return new double[,] {{-10, 10}}; 34 35 } 35 36 … … 39 40 40 41 protected override double[] GetReferencePoint(int objecitves) { 41 return new double[] { 11, 11};42 return new double[] {11, 11}; 42 43 } 43 44 44 protected override I Enumerable<double[]> GetOptimalParetoFront(int objecitves) {45 protected override IList<double[]> GetOptimalParetoFront(int objecitves) { 45 46 List<double[]> res = new List<double[]>(); 46 47 for (int i = 0; i <= 500; i++) { … … 54 55 55 56 protected override double GetBestKnownHypervolume(int objectives) { 56 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));57 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 57 58 } 58 59 … … 89 90 double f1 = 1 / (a * a * r.Length) * sum; 90 91 91 return new double[] { f0, f1};92 return new double[] {f0, f1}; 92 93 } 93 94 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/ELLI1.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 31 32 public class ELLI : MultiObjectiveTestFunction { 32 33 protected override double[,] GetBounds(int objectives) { 33 return new double[,] { { -10, 10 }};34 return new double[,] {{-10, 10}}; 34 35 } 35 36 … … 39 40 40 41 protected override double[] GetReferencePoint(int objecitves) { 41 return new double[] { 11, 11};42 return new double[] {11, 11}; 42 43 } 43 44 44 protected override I Enumerable<double[]> GetOptimalParetoFront(int objecitves) {45 protected override IList<double[]> GetOptimalParetoFront(int objecitves) { 45 46 List<double[]> res = new List<double[]>(); 46 47 for (int i = 0; i <= 500; i++) { … … 54 55 55 56 protected override double GetBestKnownHypervolume(int objectives) { 56 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));57 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 57 58 } 58 59 … … 84 85 double f1 = 1 / (a * a * r.Length) * sum; 85 86 86 return new double[] { f0, f1};87 return new double[] {f0, f1}; 87 88 } 88 89 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/Fonseca.cs
r16807 r17225 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Encodings.RealVectorEncoding; 29 using HeuristicLab.Optimization; 28 30 29 31 namespace HeuristicLab.Problems.TestFunctions.MultiObjective { … … 32 34 public class Fonseca : MultiObjectiveTestFunction { 33 35 protected override double[,] GetBounds(int objectives) { 34 return new double[,] { { -4, 4 }};36 return new double[,] {{-4, 4}}; 35 37 } 36 38 … … 39 41 } 40 42 41 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {42 return ParetoFrontStore.GetParetoFront("Misc.ParetoFronts." + this.ItemName) ;43 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 44 return ParetoFrontStore.GetParetoFront("Misc.ParetoFronts." + this.ItemName).ToList(); 43 45 } 44 46 45 47 protected override double GetBestKnownHypervolume(int objectives) { 46 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));48 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 47 49 } 48 50 49 51 protected override double[] GetReferencePoint(int objectives) { 50 return new double[] { 11, 11};52 return new double[] {11, 11}; 51 53 } 52 54 … … 79 81 f1 = 1 - Math.Exp(-f1); 80 82 81 double[] res = { f0, f1};83 double[] res = {f0, f1}; 82 84 return res; 83 85 } 84 85 86 } 86 87 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/Kursawe.cs
r16723 r17225 21 21 using System; 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.RealVectorEncoding; 27 using HeuristicLab.Optimization; 26 28 using HEAL.Attic; 27 29 … … 31 33 public class Kursawe : MultiObjectiveTestFunction { 32 34 protected override double[,] GetBounds(int objectives) { 33 return new double[,] { { -5, 5 }};35 return new double[,] {{-5, 5}}; 34 36 } 35 37 … … 38 40 } 39 41 40 protected override I Enumerable<double[]> GetOptimalParetoFront(int objecitves) {42 protected override IList<double[]> GetOptimalParetoFront(int objecitves) { 41 43 return ParetoFrontStore.GetParetoFront("Misc.ParetoFronts." + this.ItemName); 42 44 } 43 45 44 46 protected override double GetBestKnownHypervolume(int objectives) { 45 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));47 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 46 48 } 47 49 48 50 protected override double[] GetReferencePoint(int objectives) { 49 return new double[] { 11, 11};51 return new double[] {11, 11}; 50 52 } 51 53 … … 57 59 } 58 60 public Kursawe() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 3, maximumSolutionLength: int.MaxValue) { } 59 60 61 62 61 63 62 … … 75 74 } 76 75 77 return new double[] { f0, f1};76 return new double[] {f0, f1}; 78 77 } 79 78 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/SchafferN1.cs
r16723 r17225 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Optimization; 26 27 using HEAL.Attic; 27 28 … … 31 32 public class SchafferN1 : MultiObjectiveTestFunction { 32 33 protected override double[,] GetBounds(int objectives) { 33 return new double[,] { { -1e5, 1e5 }};34 return new double[,] {{-1e5, 1e5}}; 34 35 } 35 36 … … 39 40 40 41 protected override double[] GetReferencePoint(int objectives) { 41 return new double[] { 1e5, 1e5};42 return new double[] {1e5, 1e5}; 42 43 } 43 44 44 45 45 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {46 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 46 47 return ParetoFrontStore.GetParetoFront("Misc.ParetoFronts." + "SchafferN1"); 47 48 } 48 49 49 50 protected override double GetBestKnownHypervolume(int objectives) { 50 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));51 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)); 51 52 } 52 53 … … 72 73 f1 *= f1; 73 74 74 return new double[] { f0, f1};75 return new double[] {f0, f1}; 75 76 } 76 77 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/SchafferN2.cs
r16723 r17225 31 31 public class SchafferN2 : MultiObjectiveTestFunction { 32 32 protected override double[,] GetBounds(int objectives) { 33 return new double[,] { { -5, 10 }};33 return new double[,] {{-5, 10}}; 34 34 } 35 35 … … 39 39 40 40 protected override double[] GetReferencePoint(int objecitves) { 41 return new double[] { 100, 100};41 return new double[] {100, 100}; 42 42 } 43 43 44 44 45 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {45 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 46 46 return null; 47 47 } … … 72 72 f1 *= f1; 73 73 74 return new double[] { f0, f1};74 return new double[] {f0, f1}; 75 75 } 76 76 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/MultiObjectiveTestFunction.cs
r16950 r17225 87 87 /// retrieves the optimal pareto front (if known from a file) 88 88 /// </summary> 89 public I Enumerable<double[]> OptimalParetoFront(int objectives) {89 public IList<double[]> OptimalParetoFront(int objectives) { 90 90 ThrowIfObjectivesOutOfRange(objectives); 91 91 return GetOptimalParetoFront(objectives); 92 92 } 93 protected abstract I Enumerable<double[]> GetOptimalParetoFront(int objectives);93 protected abstract IList<double[]> GetOptimalParetoFront(int objectives); 94 94 95 95 /// <summary> … … 132 132 Parameters.Add(new FixedValueParameter<IntValue>("Minimum Objectives", 133 133 "The dimensionality of the problem instance (number of variables in the function).", 134 (IntValue)new IntValue(minimumObjectives).AsReadOnly()) { GetsCollected = false});135 Parameters.Add(new FixedValueParameter<IntValue>("Maximum Objectives", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumObjectives).AsReadOnly()) { GetsCollected = false});136 Parameters.Add(new FixedValueParameter<IntValue>("Minimum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(minimumSolutionLength).AsReadOnly()) { GetsCollected = false});137 Parameters.Add(new FixedValueParameter<IntValue>("Maximum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumSolutionLength).AsReadOnly()) { GetsCollected = false});134 (IntValue)new IntValue(minimumObjectives).AsReadOnly()) {GetsCollected = false}); 135 Parameters.Add(new FixedValueParameter<IntValue>("Maximum Objectives", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumObjectives).AsReadOnly()) {GetsCollected = false}); 136 Parameters.Add(new FixedValueParameter<IntValue>("Minimum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(minimumSolutionLength).AsReadOnly()) {GetsCollected = false}); 137 Parameters.Add(new FixedValueParameter<IntValue>("Maximum SolutionLength", "The dimensionality of the problem instance (number of variables in the function).", (IntValue)new IntValue(maximumSolutionLength).AsReadOnly()) {GetsCollected = false}); 138 138 139 139 MinimumObjectives = minimumObjectives; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/ParetoFrontStore.cs
r16723 r17225 28 28 namespace HeuristicLab.Problems.TestFunctions.MultiObjective { 29 29 internal class ParetoFrontStore { 30 internal static I Enumerable<double[]> GetParetoFront(String filename) {30 internal static IList<double[]> GetParetoFront(String filename) { 31 31 List<double[]> data = new List<double[]>(); 32 32 var assembly = Assembly.GetExecutingAssembly(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/ZDT/ZDT.cs
r16723 r17225 28 28 [StorableType("A8192C08-A1DA-479A-9381-9B634761B521")] 29 29 public abstract class ZDT : MultiObjectiveTestFunction { 30 protected override I Enumerable<double[]> GetOptimalParetoFront(int objectives) {30 protected override IList<double[]> GetOptimalParetoFront(int objectives) { 31 31 return ParetoFrontStore.GetParetoFront("ZDT.ParetoFronts." + this.ItemName); 32 32 } 33 33 34 34 protected override double[,] GetBounds(int objectives) { 35 return new double[,] { { 0, 1 }};35 return new double[,] {{0, 1}}; 36 36 } 37 37 … … 41 41 42 42 protected override double[] GetReferencePoint(int objecitives) { 43 return new double[] { 11.0, 11.0};43 return new double[] {11.0, 11.0}; 44 44 } 45 45 … … 51 51 protected ZDT(StorableConstructorFlag _) : base(_) { } 52 52 protected ZDT(MultiObjectiveTestFunction original, Cloner cloner) 53 : base(original, cloner) { 54 } 53 : base(original, cloner) { } 55 54 protected ZDT() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { } 56 55
Note: See TracChangeset
for help on using the changeset viewer.