Changeset 13757 for branches/PerformanceComparison/HeuristicLab.Analysis
- Timestamp:
- 04/13/16 16:25:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/ExpectedRuntimeHelper.cs
r12956 r13757 1 using System.Collections.Generic; 1 using HeuristicLab.Optimization; 2 using System; 3 using System.Collections.Generic; 2 4 using System.Globalization; 3 5 using System.Linq; 4 using HeuristicLab.Optimization;5 6 6 7 namespace HeuristicLab.Analysis { 7 8 public static class ExpectedRuntimeHelper { 8 public static ErtCalculationResult CalculateErt( List<IRun> runs, string indexedDataTableName, double target, bool maximization) {9 public static ErtCalculationResult CalculateErt(IEnumerable<IEnumerable<Tuple<double, double>>> convGraphs, double target, bool maximization) { 9 10 var successful = new List<double>(); 10 11 var unsuccessful = new List<double>(); 11 foreach (var r in runs) {12 foreach (var graph in convGraphs) { 12 13 var targetAchieved = false; 13 var row = ((IndexedDataTable<double>)r.Results[indexedDataTableName]).Rows.First();14 foreach (var v in row.Values) {14 var lastEffort = double.MaxValue; 15 foreach (var v in graph) { 15 16 if (maximization && v.Item2 >= target || !maximization && v.Item2 <= target) { 16 17 successful.Add(v.Item1); … … 18 19 break; 19 20 } 21 lastEffort = v.Item1; 20 22 } 21 if (!targetAchieved) unsuccessful.Add( row.Values.Last().Item1);23 if (!targetAchieved) unsuccessful.Add(lastEffort); 22 24 } 23 25 … … 32 34 } 33 35 return new ErtCalculationResult(successful.Count, (successful.Count + unsuccessful.Count), ert); 36 } 37 38 public static ErtCalculationResult CalculateErt(List<IRun> runs, string indexedDataTableName, double target, bool maximization) { 39 return CalculateErt(runs.Select(r => ((IndexedDataTable<double>)r.Results[indexedDataTableName]).Rows.First().Values), target, maximization); 34 40 } 35 41 }
Note: See TracChangeset
for help on using the changeset viewer.