Changeset 12865
- Timestamp:
- 08/17/15 09:32:01 (9 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs
r12826 r12865 36 36 protected List<Series> invisibleSeries; 37 37 protected Dictionary<IObservableList<Tuple<T, double>>, IndexedDataRow<T>> valuesRowsTable; 38 /// <summary> 39 /// Gets or sets the variable to represent visually. 40 /// </summary> 41 /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>. 42 /// No own data storage present.</remarks> 38 43 39 public new IndexedDataTable<T> Content { 44 40 get { return (IndexedDataTable<T>)base.Content; } … … 46 42 } 47 43 48 /// <summary>49 /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".50 /// </summary>51 44 public IndexedDataTableView() { 52 45 InitializeComponent(); … … 59 52 60 53 #region Event Handler Registration 61 /// <summary>62 /// Removes the eventhandlers from the underlying <see cref="Variable"/>.63 /// </summary>64 /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>65 54 protected override void DeregisterContentEvents() { 66 55 foreach (var row in Content.Rows) … … 74 63 } 75 64 76 /// <summary>77 /// Adds eventhandlers to the underlying <see cref="Variable"/>.78 /// </summary>79 /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>80 65 protected override void RegisterContentEvents() { 81 66 base.RegisterContentEvents(); … … 177 162 else series.Color = Color.Empty; 178 163 series.IsVisibleInLegend = row.VisualProperties.IsVisibleInLegend; 164 165 series.SmartLabelStyle.Enabled = true; 166 series.SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes; 167 series.SmartLabelStyle.CalloutLineAnchorCapStyle = LineAnchorCapStyle.None; 168 series.SmartLabelStyle.CalloutLineColor = series.Color; 169 series.SmartLabelStyle.CalloutLineWidth = 2; 170 series.SmartLabelStyle.CalloutStyle = LabelCalloutStyle.Underlined; 171 series.SmartLabelStyle.IsOverlappedHidden = false; 172 series.SmartLabelStyle.MaxMovingDistance = 200; 179 173 180 174 switch (row.VisualProperties.ChartType) { … … 564 558 for (int i = 0; i < row.Values.Count; i++) { 565 559 var value = row.Values[i]; 566 DataPointpoint = new DataPoint();560 var point = new DataPoint(); 567 561 point.SetValueXY(value.Item1, value.Item2); 562 if (i == row.Values.Count - 1) { 563 point.Label = series.Name; 564 point.MarkerStyle = MarkerStyle.Cross; 565 point.MarkerSize = 15; 566 point.MarkerBorderWidth = 1; 567 } 568 568 series.Points.Add(point); 569 569 } -
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.