Changeset 13448 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs
- Timestamp:
- 12/11/15 11:21:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs
r13421 r13448 21 21 get { 22 22 return Parameters.ContainsKey("TestFunction") ? TestFunction.Maximization : new bool[2]; 23 } //TODO shady23 } 24 24 } 25 25 26 26 #region Parameter Properties 27 28 27 29 private IFixedValueParameter<IntValue> ProblemSizeParameter { 28 30 get { return (IFixedValueParameter<IntValue>)Parameters["ProblemSize"]; } … … 73 75 Parameters.Add(new FixedValueParameter<IntValue>("ProblemSize", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(2))); 74 76 Parameters.Add(new FixedValueParameter<IntValue>("SolutionSize", "The dimensionality of the solution vector (number of objectives).", new IntValue(2))); 75 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[,] { { - 100, 100} })));77 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 } }))); 76 78 Parameters.Add(new ValueParameter<IMultiObjectiveTestFunction>("TestFunction", "The function that is to be optimized.", new Fonseca())); 77 79 … … 97 99 TestFunctionParameter.ValueChanged += TestFunctionParameterOnValueChanged; 98 100 ProblemSizeParameter.Value.ValueChanged += ProblemSizeOnValueChanged; 101 SolutionSizeParameter.Value.ValueChanged += SolutionSizeOnValueChanged; 99 102 BoundsParameter.ValueChanged += BoundsParameterOnValueChanged; 100 103 } 101 104 102 public double[] Evaluate(RealVector vector, IRandom random) {103 return TestFunction.Evaluate( vector);105 public double[] Evaluate(RealVector individual, IRandom random) { 106 return TestFunction.Evaluate(individual); 104 107 } 105 public sealed override double[] Evaluate(Individual individual, IRandom random) { 108 109 public override double[] Evaluate(Individual individual, IRandom random) { 106 110 return Evaluate(individual.RealVector(), random); 107 111 } 112 108 113 109 114 #region Events … … 114 119 protected override void OnEvaluatorChanged() { 115 120 base.OnEvaluatorChanged(); 116 // Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;121 // Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged; 117 122 Parameterize(); 118 123 } 124 119 125 //private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 120 126 // Parameterize(); … … 134 140 ProblemSize = Math.Max(TestFunction.MinimumSolutionSize, Math.Min(SolutionSize, TestFunction.MaximumSolutionSize)); 135 141 } 136 137 142 Bounds = (DoubleMatrix)TestFunction.Bounds.Clone(); 138 143 OnReset(); … … 143 148 || ProblemSize > TestFunction.MaximumProblemSize) 144 149 ProblemSize = Math.Min(TestFunction.MaximumProblemSize, Math.Max(TestFunction.MinimumProblemSize, ProblemSize)); 150 //TODO problemsize dominates solutionSize 151 SolutionSizeOnValueChanged(sender, eventArgs); 145 152 } 146 153 147 154 private void SolutionSizeOnValueChanged(object sender, EventArgs eventArgs) { 148 155 if (SolutionSize < TestFunction.MinimumSolutionSize 149 || ProblemSize > TestFunction.MaximumSolutionSize) 150 ProblemSize = Math.Min(TestFunction.MaximumSolutionSize, Math.Max(TestFunction.MinimumSolutionSize, SolutionSize)); 156 || SolutionSize > TestFunction.MaximumSolutionSize) 157 SolutionSize = Math.Min(TestFunction.MaximumSolutionSize, Math.Max(TestFunction.MinimumSolutionSize, SolutionSize)); 158 TestFunction.ActualSolutionSize = SolutionSize; 159 OnReset(); 151 160 } 152 161 … … 163 172 164 173 private void Parameterize() { 165 //empty for now166 174 } 175 176 167 177 #endregion 168 169 170 178 } 171 179 }
Note: See TracChangeset
for help on using the changeset viewer.