Changeset 16171 for branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc
- Timestamp:
- 09/21/18 09:18:49 (6 years ago)
- Location:
- branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/CIGTAB.cs
r15583 r16171 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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 … … 43 45 44 46 protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) { 45 List<double[]>res = new List<double[]>();46 for ( inti = 0; i <= 500; i++) {47 RealVector r = new RealVector(2);47 var res = new List<double[]>(); 48 for (var i = 0; i <= 500; i++) { 49 var r = new RealVector(2); 48 50 r[0] = 2 / 500.0 * i; 49 51 r[1] = 2 / 500.0 * i; … … 54 56 55 57 protected override double GetBestKnownHypervolume(int objectives) { 56 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));58 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives)); 57 59 } 58 60 … … 68 70 public override double[] Evaluate(RealVector r, int objectives) { 69 71 if (objectives != 2) throw new ArgumentException("The CIGTAB problem must always have 2 objectives"); 70 doublex = r[0];72 var x = r[0]; 71 73 double a = 1000; 72 doublesum = x * x;73 for ( inti = 1; i < r.Length - 1; i++) {74 var sum = x * x; 75 for (var i = 1; i < r.Length - 1; i++) { 74 76 sum += a * r[i] * r[i]; 75 77 } … … 77 79 78 80 //objective1 79 doublef0 = 1 / (a * a * r.Length) * sum;81 var f0 = 1 / (a * a * r.Length) * sum; 80 82 81 83 x = x - 2; 82 84 sum = x * x; 83 for ( inti = 1; i < r.Length - 1; i++) {85 for (var i = 1; i < r.Length - 1; i++) { 84 86 sum += a * (r[i] - 2) * (r[i] - 2); 85 87 } … … 87 89 sum += a * a * (r[r.Length - 1] - 2) * (r[r.Length - 1] - 2); 88 90 //objective0 89 doublef1 = 1 / (a * a * r.Length) * sum;91 var f1 = 1 / (a * a * r.Length) * sum; 90 92 91 93 return new double[] { f0, f1 }; -
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/ELLI1.cs
r15583 r16171 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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 … … 43 45 44 46 protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) { 45 List<double[]>res = new List<double[]>();46 for ( inti = 0; i <= 500; i++) {47 RealVector r = new RealVector(2);47 var res = new List<double[]>(); 48 for (var i = 0; i <= 500; i++) { 49 var r = new RealVector(2); 48 50 r[0] = 2 / 500.0 * i; 49 51 r[1] = 2 / 500.0 * i; … … 54 56 55 57 protected override double GetBestKnownHypervolume(int objectives) { 56 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));58 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives)); 57 59 } 58 60 … … 69 71 if (objectives != 2) throw new ArgumentException("The ELLI problem must always have 2 objectives"); 70 72 double a = 1000; 71 doublesum = 0.0;72 for ( inti = 0; i < r.Length; i++) {73 var sum = 0.0; 74 for (var i = 0; i < r.Length; i++) { 73 75 sum += Math.Pow(a, 2 * i / (r.Length - 1)) * r[i] * r[i]; 74 76 } 75 77 76 78 //objective1 77 doublef0 = 1 / (a * a * r.Length) * sum;79 var f0 = 1 / (a * a * r.Length) * sum; 78 80 79 81 sum = 0.0; 80 for ( inti = 0; i < r.Length; i++) {82 for (var i = 0; i < r.Length; i++) { 81 83 sum += Math.Pow(a, 2 * i / (r.Length - 1)) * (r[i] - 2) * (r[i] - 2); 82 84 } 83 85 //objective0 84 doublef1 = 1 / (a * a * r.Length) * sum;86 var f1 = 1 / (a * a * r.Length) * sum; 85 87 86 88 return new double[] { f0, f1 }; -
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/Fonseca.cs
r15583 r16171 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Encodings.RealVectorEncoding; 28 using HeuristicLab.Optimization; 27 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 … … 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).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives)); 47 49 } 48 50 … … 65 67 66 68 //objective1 67 for ( inti = 0; i < r.Length; i++) {68 doubled = r[i] - aux;69 for (var i = 0; i < r.Length; i++) { 70 var d = r[i] - aux; 69 71 f0 += d * d; 70 72 } … … 72 74 73 75 //objective2 74 doublef1 = 0.0;75 for ( inti = 0; i < r.Length; i++) {76 doubled = r[i] + aux;76 var f1 = 0.0; 77 for (var i = 0; i < r.Length; i++) { 78 var d = r[i] + aux; 77 79 f1 += d * d; 78 80 } -
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/Kursawe.cs
r15583 r16171 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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 … … 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).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives)); 46 48 } 47 49 … … 65 67 if (objectives != 2) throw new ArgumentException("The Kursawe problem must always have 2 objectives"); 66 68 //objective 1 67 doublef0 = 0.0;68 for ( inti = 0; i < r.Length - 1; i++) {69 var f0 = 0.0; 70 for (var i = 0; i < r.Length - 1; i++) { 69 71 f0 += -10 * Math.Exp(-0.2 * Math.Sqrt(r[i] * r[i] + r[i + 1] * r[i + 1])); 70 72 } 71 73 //objective2 72 doublef1 = 0.0;73 for ( inti = 0; i < r.Length; i++) {74 var f1 = 0.0; 75 for (var i = 0; i < r.Length; i++) { 74 76 f1 += Math.Pow(Math.Abs(r[i]), 0.8) + 5 * Math.Sin(Math.Pow(r[i], 3)); 75 77 } -
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/SchafferN1.cs
r15583 r16171 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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 … … 48 50 49 51 protected override double GetBestKnownHypervolume(int objectives) { 50 return Hypervolume .Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));52 return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives)); 51 53 } 52 54 … … 63 65 if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives"); 64 66 if (r.Length != 1) return null; 65 doublex = r[0];67 var x = r[0]; 66 68 67 69 //objective1 68 doublef0 = x * x;70 var f0 = x * x; 69 71 70 72 //objective0 71 doublef1 = x - 2;73 var f1 = x - 2; 72 74 f1 *= f1; 73 75 -
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/SchafferN2.cs
r15583 r16171 59 59 public override double[] Evaluate(RealVector r, int objectives) { 60 60 if (objectives != 2) throw new ArgumentException("The Schaffer N1 problem must always have 2 objectives"); 61 doublex = r[0];61 var x = r[0]; 62 62 63 63 //objective1 … … 69 69 70 70 //objective0 71 doublef1 = x - 5;71 var f1 = x - 5; 72 72 f1 *= f1; 73 73
Note: See TracChangeset
for help on using the changeset viewer.