Changeset 16611
- Timestamp:
- 02/17/19 05:21:34 (6 years ago)
- 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 136 136 DataTable table = new DataTable("Distance to Optimum"); 137 137 table.Rows.Add(new DataRow("Distance to Optimum")); 138 table.Rows["Distance to Optimum"].VisualProperties.StartIndexZero = true; 138 139 distanceTable = new Result("Distance to Optimum", table); 139 140 results.Add(distanceTable); … … 141 142 (distanceTable.Value as DataTable).Rows["Distance to Optimum"].Values.Add(distanceToOptimum); 142 143 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 143 154 return base.Apply(); 144 155 } -
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.