Changeset 12956 for branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
- Timestamp:
- 09/19/15 21:20:01 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs
r12939 r12956 423 423 var maximization = IsMaximization(); 424 424 425 var targetsPerProblem = CalculateBestTargetPerProblemInstance((string)dataTableComboBox.SelectedItem, maximization); 425 var tableName = (string)dataTableComboBox.SelectedItem; 426 if (string.IsNullOrEmpty(tableName)) return; 427 428 var targetsPerProblem = CalculateBestTargetPerProblemInstance(tableName, maximization); 426 429 427 430 var colNames = new string[columns]; … … 448 451 } 449 452 var runs = group.Value[problem].Item2; 450 var bestSucc = string.Empty;453 ErtCalculationResult result = default(ErtCalculationResult); 451 454 for (var i = 0; i < targets.Length; i++) { 452 string succ; 453 matrix[rowCount, i + 1] = CalculateExpectedRunTime(runs, (maximization ? (1 - targets[i]) : (1 + targets[i])) * group.Value[problem].Item1, maximization, out succ); 454 if (i == targets.Length - 1) bestSucc = succ; 455 } 456 matrix[rowCount, columns - 1] = bestSucc; 455 result = ExpectedRuntimeHelper.CalculateErt(runs, tableName, (maximization ? (1 - targets[i]) : (1 + targets[i])) * group.Value[problem].Item1, maximization); 456 matrix[rowCount, i + 1] = result.ToString(); 457 } 458 matrix[rowCount, columns - 1] = targets.Length > 0 ? result.SuccessfulRuns + "/" + result.TotalRuns : "-"; 457 459 rowCount++; 458 460 } … … 462 464 } 463 465 464 private string CalculateExpectedRunTime(List<IRun> group, double target, bool maximization, out string successProb) { 465 var table = (string)dataTableComboBox.SelectedItem; 466 successProb = "-"; 467 if (string.IsNullOrEmpty(table)) return "N/A"; 468 var successful = new List<double>(); 469 var unsuccessful = new List<double>(); 470 foreach (var r in group) { 471 var targetAchieved = false; 472 var row = ((IndexedDataTable<double>)r.Results[table]).Rows.First(); 473 foreach (var v in row.Values) { 474 if (maximization && v.Item2 >= target || !maximization && v.Item2 <= target) { 475 successful.Add(v.Item1); 476 targetAchieved = true; 477 break; 478 } 479 } 480 if (!targetAchieved) unsuccessful.Add(row.Values.Last().Item1); 481 } 482 successProb = successful.Count + "/" + (successful.Count + unsuccessful.Count); 483 if (successful.Count == 0) return "\u221e"; // infinity symbol 484 if (unsuccessful.Count == 0) return successful.Average().ToString("##,0.0", CultureInfo.CurrentCulture.NumberFormat); 485 486 var ps = successful.Count / (double)(successful.Count + unsuccessful.Count); 487 return (successful.Average() + ((1.0 - ps) / ps) * unsuccessful.Average()).ToString("##,0.0", CultureInfo.CurrentCulture.NumberFormat); 488 } 466 489 467 #endregion 490 468
Note: See TracChangeset
for help on using the changeset viewer.