Changeset 16171 for branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/Misc/ELLI1.cs
- Timestamp:
- 09/21/18 09:18:49 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 };
Note: See TracChangeset
for help on using the changeset viewer.