- Timestamp:
- 06/02/10 21:34:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs
r3797 r3894 69 69 get { return (IValueLookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>)Parameters["Evaluator"]; } 70 70 } 71 public ILookupParameter<DoubleMatrix> BoundsParameter { 72 get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 73 } 71 74 75 protected BestSingleObjectiveTestFunctionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 72 76 public BestSingleObjectiveTestFunctionSolutionAnalyzer() 73 77 : base() { … … 80 84 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the SingleObjectiveTestFunction solution should be stored.")); 81 85 Parameters.Add(new ValueLookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>("Evaluator", "The evaluator with which the solution is evaluated.")); 86 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function.")); 87 } 88 89 /// <summary> 90 /// This method can simply be removed when the plugin version is > 3.3 91 /// </summary> 92 [StorableHook(HookType.AfterDeserialization)] 93 private void CompatibilityMethod() { 94 // Bounds are introduced in 3.3.0.3894 95 if (!Parameters.ContainsKey("Bounds")) 96 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function.")); 82 97 } 83 98 … … 85 100 ItemArray<RealVector> realVectors = RealVectorParameter.ActualValue; 86 101 ItemArray<DoubleValue> qualities = QualityParameter.ActualValue; 87 ResultCollection results = ResultsParameter.ActualValue;88 ISingleObjectiveTestFunctionProblemEvaluator evaluator = EvaluatorParameter.ActualValue;89 102 bool max = MaximizationParameter.ActualValue.Value; 90 103 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; 104 SingleObjectiveTestFunctionSolution solution = BestSolutionParameter.ActualValue; 91 105 92 106 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; … … 97 111 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 98 112 BestKnownSolutionParameter.ActualValue = (RealVector)realVectors[i].Clone(); 113 if (solution != null) 114 solution.BestKnownRealVector = BestKnownSolutionParameter.ActualValue; 99 115 } 100 116 101 SingleObjectiveTestFunctionSolution solution = BestSolutionParameter.ActualValue;102 117 if (solution == null) { 103 solution = new SingleObjectiveTestFunctionSolution(realVectors[i], qualities[i], evaluator); 118 ResultCollection results = ResultsParameter.ActualValue; 119 solution = new SingleObjectiveTestFunctionSolution(realVectors[i], qualities[i], EvaluatorParameter.ActualValue); 104 120 solution.Population = realVectors; 105 121 solution.BestKnownRealVector = BestKnownSolutionParameter.ActualValue; 122 solution.Bounds = BoundsParameter.ActualValue; 106 123 BestSolutionParameter.ActualValue = solution; 107 124 results.Add(new Result("Best Solution", solution));
Note: See TracChangeset
for help on using the changeset viewer.