Changeset 13403 for branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs
- Timestamp:
- 11/25/15 23:24:01 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs
r12012 r13403 44 44 get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; } 45 45 } 46 public ScopeTreeLookupParameter<RealVector> RealVectorParameter {47 get { return ( ScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }46 public IScopeTreeLookupParameter<RealVector> RealVectorsParameter { 47 get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVectors"]; } 48 48 } 49 ILookupParameter IBestSingleObjectiveTestFunctionSolutionAnalyzer.RealVectorParameter { 50 get { return RealVectorParameter; } 51 } 52 public ScopeTreeLookupParameter<DoubleValue> QualityParameter { 53 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 54 } 55 ILookupParameter IBestSingleObjectiveTestFunctionSolutionAnalyzer.QualityParameter { 56 get { return QualityParameter; } 49 public IScopeTreeLookupParameter<DoubleValue> QualityParameter { 50 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 57 51 } 58 52 public ILookupParameter<SingleObjectiveTestFunctionSolution> BestSolutionParameter { … … 68 62 get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; } 69 63 } 70 public IValueLookupParameter<ISingleObjectiveTestFunction ProblemEvaluator> EvaluatorParameter {71 get { return (IValueLookupParameter<ISingleObjectiveTestFunction ProblemEvaluator>)Parameters["Evaluator"]; }64 public IValueLookupParameter<ISingleObjectiveTestFunction> TestFunctionParameter { 65 get { return (IValueLookupParameter<ISingleObjectiveTestFunction>)Parameters["TestFunction"]; } 72 66 } 73 public I LookupParameter<DoubleMatrix> BoundsParameter {74 get { return (I LookupParameter<DoubleMatrix>)Parameters["Bounds"]; }67 public IValueLookupParameter<DoubleMatrix> BoundsParameter { 68 get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 75 69 } 76 70 … … 81 75 : base() { 82 76 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem.")); 83 Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector ", "The SingleObjectiveTestFunction solutions from which the best solution should be visualized."));77 Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVectors", "The SingleObjectiveTestFunction solutions from which the best solution should be visualized.")); 84 78 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the SingleObjectiveTestFunction solutions which should be visualized.")); 85 79 Parameters.Add(new LookupParameter<SingleObjectiveTestFunctionSolution>("BestSolution", "The best SingleObjectiveTestFunction solution.")); … … 87 81 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution.")); 88 82 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the SingleObjectiveTestFunction solution should be stored.")); 89 Parameters.Add(new ValueLookupParameter<ISingleObjectiveTestFunction ProblemEvaluator>("Evaluator", "The evaluator with which the solution is evaluated."));90 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));83 Parameters.Add(new ValueLookupParameter<ISingleObjectiveTestFunction>("TestFunction", "The evaluator with which the solution is evaluated.")); 84 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The bounds of the function.")); 91 85 92 86 MaximizationParameter.Hidden = true; 93 RealVector Parameter.Hidden = true;87 RealVectorsParameter.Hidden = true; 94 88 QualityParameter.Hidden = true; 95 89 BestSolutionParameter.Hidden = true; … … 97 91 BestKnownQualityParameter.Hidden = true; 98 92 ResultsParameter.Hidden = true; 99 EvaluatorParameter.Hidden = true;93 TestFunctionParameter.Hidden = true; 100 94 BoundsParameter.Hidden = true; 101 }102 103 /// <summary>104 /// This method can simply be removed when the plugin version is > 3.3105 /// </summary>106 [StorableHook(HookType.AfterDeserialization)]107 private void AfterDeserialization() {108 // BackwardsCompatibility3.3109 // Bounds are introduced in 3.3.0.3894110 if (!Parameters.ContainsKey("Bounds"))111 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));112 95 } 113 96 … … 117 100 118 101 public override IOperation Apply() { 119 ItemArray<RealVector> realVectors = RealVector Parameter.ActualValue;102 ItemArray<RealVector> realVectors = RealVectorsParameter.ActualValue; 120 103 ItemArray<DoubleValue> qualities = QualityParameter.ActualValue; 121 104 bool max = MaximizationParameter.ActualValue.Value; … … 140 123 solution = new SingleObjectiveTestFunctionSolution((RealVector)realVectors[i].Clone(), 141 124 (DoubleValue)qualities[i].Clone(), 142 EvaluatorParameter.ActualValue);125 TestFunctionParameter.ActualValue); 143 126 solution.Population = realVectors[i].Length == 2 144 127 ? new ItemArray<RealVector>(realVectors.Select(x => x.Clone()).Cast<RealVector>())
Note: See TracChangeset
for help on using the changeset viewer.