- Timestamp:
- 08/17/15 09:32:01 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs
r12864 r12865 526 526 var lineStyleCount = 0; 527 527 528 var maximization = IsMaximization(); 529 var targetsPerProblem = (from r in Content 530 let pd = new ProblemDescription(r).ToString() 531 let target = r.Parameters.ContainsKey("BestKnownQuality") 532 && r.Parameters["BestKnownQuality"] is DoubleValue 533 ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value 534 : ((IndexedDataTable<double>)r.Results[(string)dataTableComboBox.SelectedItem]).Rows.First().Values.Last().Item2 535 group target by pd into g 536 select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() }) 537 .ToDictionary(x => x.Problem, x => x.Target); 538 528 539 foreach (var group in groupedRuns) { 529 540 var hits = new Dictionary<string, SortedList<double, double>>(); … … 534 545 535 546 if (eachOrAllBudgetsCheckBox.Checked) { 536 CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), group.Value.Count, group.Key, problem.Value.Item2.Count);547 CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), maximization, group.Value.Count, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]); 537 548 } else { 538 CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), group.Value.Count, group.Key, problem.Value.Item2.Count);549 CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), maximization, group.Value.Count, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]); 539 550 } 540 551 } … … 563 574 } 564 575 565 byCostDataTable.VisualProperties.XAxisTitle = "Targets ";576 byCostDataTable.VisualProperties.XAxisTitle = "Targets to Best-Known Ratio"; 566 577 byCostDataTable.VisualProperties.XAxisLogScale = byCostDataTable.Rows.Count > 0 && budgetLogScalingCheckBox.Checked; 567 578 } … … 588 599 } 589 600 590 private void CalculateHitsForEachBudget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, int groupCount, string groupName, int problemCount) {601 private void CalculateHitsForEachBudget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, int groupCount, string groupName, int problemCount, double bestTarget) { 591 602 foreach (var b in budgets) { 592 603 var key = groupName + "-" + b; … … 597 608 // the budget may be too low to achieve any target 598 609 if (prev == null && v.Item1 != b) break; 599 var tgt = (prev == null || v.Item1 == b) ? v.Item2 : prev.Item2; 610 var tgt = ((prev == null || v.Item1 == b) ? v.Item2 : prev.Item2); 611 tgt = maximization ? bestTarget / tgt : tgt / bestTarget; 600 612 if (hits[key].ContainsKey(tgt)) 601 613 hits[key][tgt] += 1.0 / (groupCount * problemCount); … … 609 621 } 610 622 611 private void CalculateHitsForAllBudgets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, int groupCount, string groupName, int problemCount) {623 private void CalculateHitsForAllBudgets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, int groupCount, string groupName, int problemCount, double bestTarget) { 612 624 var values = row.Values; 613 625 if (!hits.ContainsKey(groupName)) hits.Add(groupName, new SortedList<double, double>()); … … 621 633 if (prev != null || current.Item1 == budgets[i]) { 622 634 var tgt = (prev == null || current.Item1 == budgets[i]) ? current.Item2 : prev.Item2; 635 tgt = maximization ? bestTarget / tgt : tgt / bestTarget; 623 636 if (!hits[groupName].ContainsKey(tgt)) hits[groupName][tgt] = 0; 624 637 hits[groupName][tgt] += 1.0 / (groupCount * problemCount * budgets.Length); … … 631 644 } 632 645 var lastTgt = values.Last().Item2; 646 lastTgt = maximization ? bestTarget / lastTgt : lastTgt / bestTarget; 633 647 if (i < budgets.Length && !hits[groupName].ContainsKey(lastTgt)) hits[groupName][lastTgt] = 0; 634 648 while (i < budgets.Length) {
Note: See TracChangeset
for help on using the changeset viewer.