Changeset 16611 for branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs
- Timestamp:
- 02/17/19 05:21:34 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs
r16609 r16611 40 40 [Storable] 41 41 long executions; 42 [Storable] 43 double currentBest; 44 [Storable] 45 double offlineErrorSum; 42 46 43 47 public IValueLookupParameter<DoubleMatrix> PeakLocationsParameter { … … 143 147 BestKnownSolutionParameter.ActualValue = new RealVector(peak); 144 148 BestKnownQualityParameter.ActualValue.Value = heights.Max(); 149 currentBest = -1; 145 150 } 146 151 executions++; … … 150 155 double quality = Apply(peaks, widths, heights, point); 151 156 QualityParameter.ActualValue = new DoubleValue(quality); 157 158 lock (this) { 159 if (quality > currentBest) { 160 currentBest = quality; 161 } 162 offlineErrorSum += heights.Max() - currentBest; 163 ResultCollection results = ResultsParameter.ActualValue; 164 IResult offlineError; 165 if (results.TryGetValue("Offline Error", out offlineError)) { 166 (offlineError.Value as DoubleValue).Value = offlineErrorSum / executions; 167 } else { 168 results.Add(new Result("Offline Error", new DoubleValue(offlineErrorSum / executions))); 169 } 170 } 152 171 return base.InstrumentedApply(); 153 172 } … … 156 175 base.InitializeState(); 157 176 executions = 0; 177 currentBest = -1; 178 offlineErrorSum = 0; 158 179 } 159 180
Note: See TracChangeset
for help on using the changeset viewer.