Changeset 14085 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs
- Timestamp:
- 07/15/16 14:14:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs
r14073 r14085 65 65 public override bool[] Maximization { 66 66 get { 67 //necessary because of virtual member call in base ctor to this property 68 if (!Parameters.ContainsKey("TestFunction")) return new bool[2]; 69 return TestFunction.Maximization(Objectives); 67 if (!Parameters.ContainsKey("Maximization")) return new bool[2]; 68 return MaximizationParameter.Value.ToArray(); 70 69 } 71 70 } … … 87 86 set { TestFunctionParameter.Value = value; } 88 87 } 89 public IEnumerable<double[]> BestKnownFront { 90 get { return Parameters.ContainsKey("BestKnownFront") ? TestFunction.OptimalParetoFront(Objectives) : null; } 88 public DoubleArray ReferencePoint { 89 get { return ReferencePointParameter.Value; } 90 set { ReferencePointParameter.Value = value; } 91 } 92 public DoubleMatrix BestKnownFront { 93 get { return BestKnownFrontParameter.Value; } 94 set { BestKnownFrontParameter.Value = value; } 91 95 } 92 96 #endregion … … 112 116 Parameters.Add(new FixedValueParameter<IntValue>("Objectives", "The dimensionality of the solution vector (number of objectives).", new IntValue(2))); 113 117 Parameters.Add(new ValueParameter<DoubleMatrix>("Bounds", "The bounds of the solution given as either one line for all variables or a line for each variable. The first column specifies lower bound, the second upper bound.", new DoubleMatrix(new double[,] { { -4, 4 } }))); 118 Parameters.Add(new ValueParameter<DoubleArray>("ReferencePoint", "The reference point used for hypervolume calculation.")); 114 119 Parameters.Add(new ValueParameter<IMultiObjectiveTestFunction>("TestFunction", "The function that is to be optimized.", new Fonseca())); 115 120 Parameters.Add(new ValueParameter<DoubleMatrix>("BestKnownFront", "The currently best known Pareto front")); … … 165 170 #region Events 166 171 private void UpdateParameterValues() { 167 MaximizationParameter.ActualValue = (BoolArray)new BoolArray(Maximization).AsReadOnly(); 168 var front = BestKnownFront; 169 if (front != null) { BestKnownFrontParameter.Value = (DoubleMatrix)new DoubleMatrix(To2D(front.ToArray())).AsReadOnly(); } 170 172 MaximizationParameter.Value = (BoolArray)new BoolArray(TestFunction.Maximization(Objectives)).AsReadOnly(); 173 174 var front = TestFunction.OptimalParetoFront(Objectives); 175 if (front != null) { 176 BestKnownFrontParameter.Value = (DoubleMatrix)new DoubleMatrix(To2D(front.ToArray())).AsReadOnly(); 177 } else BestKnownFrontParameter.Value = null; 178 179 180 BoundsParameter.Value = new DoubleMatrix(TestFunction.Bounds(Objectives)); 181 ReferencePointParameter.Value = new DoubleArray(TestFunction.ReferencePoint(Objectives)); 171 182 } 172 183 … … 186 197 Objectives = Math.Max(TestFunction.MinimumObjectives, Math.Min(Objectives, TestFunction.MaximumObjectives)); 187 198 188 Bounds = (DoubleMatrix)new DoubleMatrix(TestFunction.Bounds(Objectives)).Clone();189 199 ParameterizeAnalyzers(); 190 200 UpdateParameterValues(); … … 228 238 analyzer.BestKnownFrontParameter.ActualName = BestKnownFrontParameter.Name; 229 239 240 var crowdingAnalyzer = analyzer as CrowdingAnalyzer; 241 if (crowdingAnalyzer != null) { 242 crowdingAnalyzer.BoundsParameter.ActualName = BoundsParameter.Name; 243 } 244 230 245 var hyperVolumeAnalyzer = analyzer as HypervolumeAnalyzer; 231 246 if (hyperVolumeAnalyzer != null) { 232 hyperVolumeAnalyzer.ReferencePointParameter. Value = new DoubleArray(TestFunction.ReferencePoint(Objectives));233 hyperVolumeAnalyzer.BestKnownHyperVolume = TestFunction. BestKnownHypervolume(Objectives);247 hyperVolumeAnalyzer.ReferencePointParameter.ActualName = ReferencePointParameter.Name; 248 hyperVolumeAnalyzer.BestKnownHyperVolume = TestFunction.OptimalHypervolume(Objectives); 234 249 } 235 250
Note: See TracChangeset
for help on using the changeset viewer.