Changeset 13936 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs
- Timestamp:
- 06/24/16 15:03:51 (8 years ago)
- Location:
- branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/IHR/IHR.cs
r13872 r13936 19 19 */ 20 20 #endregion 21 using System; 21 22 using System.Collections.Generic; 23 using System.Linq; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Encodings.RealVectorEncoding; … … 26 28 namespace HeuristicLab.Problems.MultiObjectiveTestFunctions { 27 29 [StorableClass] 28 public abstract class DTLZ: MultiObjectiveTestFunction {30 public abstract class IHR : MultiObjectiveTestFunction { 29 31 30 32 … … 35 37 36 38 public override double[,] Bounds(int objectives) { 37 return new double[,] { { 0, 1 } };39 return new double[,] { { -1, 1 } }; 38 40 } 39 41 … … 42 44 } 43 45 44 public override int MinimumSolutionLength { 46 public override int MinimumSolutionLength 47 { 45 48 get { return 2; } 46 49 } 47 public override int MaximumSolutionLength { 50 public override int MaximumSolutionLength 51 { 48 52 get { return int.MaxValue; } 49 53 } 50 54 51 55 52 public override int MinimumObjectives { 56 public override int MinimumObjectives 57 { 53 58 get { return 2; } 54 59 } 55 public override int MaximumObjectives { 56 get { return int.MaxValue; } 60 public override int MaximumObjectives 61 { 62 get { return 2; } 57 63 } 58 64 … … 66 72 67 73 [StorableConstructor] 68 protected DTLZ(bool deserializing) : base(deserializing) { }69 protected DTLZ(DTLZoriginal, Cloner cloner) : base(original, cloner) { }70 public DTLZ() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { }74 protected IHR(bool deserializing) : base(deserializing) { } 75 protected IHR(IHR original, Cloner cloner) : base(original, cloner) { } 76 public IHR() : base(minimumObjectives: 2, minimumSolutionLength: 2, maximumSolutionLength: int.MaxValue) { } 71 77 72 public abstract override double[] Evaluate(RealVector r, int objecitves); 78 public override double[] Evaluate(RealVector r, int objectives) { 79 if (r.Length < objectives) { 80 throw new ArgumentException("The dimensionality of the problem(ProblemSize) must be larger than or equal to the number of objectives"); 81 } 82 RealVector y = Y(r); 83 return new double[] { F1(y), F2(r, y) }; 84 } 85 protected abstract double F1(RealVector y); 86 protected abstract double F2(RealVector r, RealVector y); 87 protected abstract double G(RealVector y); 73 88 89 90 protected double H(double x, RealVector r) { 91 return 1.0 / (1 + Math.Exp(-x / Math.Sqrt(r.Length))); 92 } 93 protected double HF(double x, RealVector r) { 94 double ymax = 1; 95 return Math.Abs(r[0]) <= ymax ? x : 1 + Math.Abs(r[0]); //replace with maximum of first column of matrix used in Y(x) 96 } 97 protected double HG(double x) { 98 return (x * x) / (Math.Abs(x) + 0.1); 99 } 100 protected RealVector Y(RealVector x) { 101 return x; //replace with matrix*x 102 } 74 103 } 75 104 }
Note: See TracChangeset
for help on using the changeset viewer.