Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16611


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

#2989: Moving Peaks Benchmark

  • added calculation of offline error
Location:
branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3
Files:
2 edited

Legend:

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

    r16609 r16611  
    136136        DataTable table = new DataTable("Distance to Optimum");
    137137        table.Rows.Add(new DataRow("Distance to Optimum"));
     138        table.Rows["Distance to Optimum"].VisualProperties.StartIndexZero = true;
    138139        distanceTable = new Result("Distance to Optimum", table);
    139140        results.Add(distanceTable);
     
    141142      (distanceTable.Value as DataTable).Rows["Distance to Optimum"].Values.Add(distanceToOptimum);
    142143
     144      IResult offlineErrorTable;
     145      if (!results.TryGetValue("Offline Error Chart", out offlineErrorTable)) {
     146        DataTable table = new DataTable("Offline Error");
     147        table.Rows.Add(new DataRow("Offline Error"));
     148        table.Rows["Offline Error"].VisualProperties.StartIndexZero = true;
     149        offlineErrorTable = new Result("Offline Error Chart", table);
     150        results.Add(offlineErrorTable);
     151      }
     152      (offlineErrorTable.Value as DataTable).Rows["Offline Error"].Values.Add((results["Offline Error"].Value as DoubleValue).Value);
     153
    143154      return base.Apply();
    144155    }
  • 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.