Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/19 05:21:34 (5 years ago)
Author:
swagner
Message:

#2989: Moving Peaks Benchmark

  • added calculation of offline error
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs

    r16609 r16611  
    4040    [Storable]
    4141    long executions;
     42    [Storable]
     43    double currentBest;
     44    [Storable]
     45    double offlineErrorSum;
    4246
    4347    public IValueLookupParameter<DoubleMatrix> PeakLocationsParameter {
     
    143147          BestKnownSolutionParameter.ActualValue = new RealVector(peak);
    144148          BestKnownQualityParameter.ActualValue.Value = heights.Max();
     149          currentBest = -1;
    145150        }
    146151        executions++;
     
    150155      double quality = Apply(peaks, widths, heights, point);
    151156      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      }
    152171      return base.InstrumentedApply();
    153172    }
     
    156175      base.InitializeState();
    157176      executions = 0;
     177      currentBest = -1;
     178      offlineErrorSum = 0;
    158179    }
    159180
Note: See TracChangeset for help on using the changeset viewer.