Changeset 13451 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ3.cs
- Timestamp:
- 12/11/15 15:19:24 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ3.cs
r13448 r13451 17 17 public class DTLZ3 : MultiObjectiveTestFunction { 18 18 19 private int actualSolutionSize = 2; 20 public override int ActualSolutionSize { 21 get { 22 return actualSolutionSize; 23 } 24 25 set { 26 actualSolutionSize = value; 27 } 28 } 29 19 30 public override DoubleMatrix Bounds { 20 31 get { … … 25 36 public override bool[] Maximization { 26 37 get { 27 bool[] res = new bool[((ValueParameter<IntValue>)Parameters["SolutionSize"]).Value.Value]; 28 for(int i =0; i < res.Length; i++) res[i] = false; //TODO: diligent initialzation 29 return res; 38 return new bool[actualSolutionSize]; 30 39 } 31 40 } … … 37 46 } 38 47 39 public override int MaximumSolutionSize { //TODO ask Michael48 public override int MaximumSolutionSize { 40 49 get { 41 return ((ValueParameter<IntValue>)Parameters["ProblemSize"]).Value.Value; 50 51 return int.MaxValue; 42 52 } 43 53 } … … 45 55 public override int MinimumProblemSize { 46 56 get { 47 return 2;57 return Math.Max(2, ActualSolutionSize); 48 58 } 49 59 } … … 52 62 get { 53 63 return 2; 54 }55 }56 57 public override int ActualSolutionSize {58 get {59 throw new NotImplementedException();60 }61 62 set {63 throw new NotImplementedException();64 64 } 65 65 } … … 77 77 78 78 public override double[] Evaluate(RealVector r) { 79 return Evaluate(r, ((ValueParameter<IntValue>)Parameters["SolutionSize"]).Value.Value);79 return Evaluate(r, ActualSolutionSize); 80 80 } 81 81 82 82 private double[] Evaluate(RealVector r, int objectives) { 83 if (r.Length < objectives) { 84 throw new Exception("The dimensionality of the problem(ProblemSize) must be larger or equal than the dimensionality of the solution(SolutionSize) "); 85 } 83 86 double[] res = new double[objectives]; 84 87
Note: See TracChangeset
for help on using the changeset viewer.