Changeset 12771


Ignore:
Timestamp:
07/17/15 09:25:44 (6 years ago)
Author:
abeham
Message:

#2431:

  • Added run collection view
  • Changed name of analyzers
  • Modified algorithms to include Execution Time as a result
Location:
branches/PerformanceComparison
Files:
6 edited
3 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs

    r12764 r12771  
    165165      series.BorderDashStyle = ChartDashStyle.Solid;
    166166      series.BorderColor = Color.Empty;
    167       if (!typeof(T).Equals(typeof(DateTime)))
    168         series.IsXValueIndexed = true;
    169167
    170168      if (row.VisualProperties.Color != Color.Empty)
     
    236234        area.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
    237235      }
     236
     237      area.AxisX.IsLogarithmic = Content.VisualProperties.XAxisLogScale;
     238      area.AxisX2.IsLogarithmic = Content.VisualProperties.SecondXAxisLogScale;
     239      area.AxisY.IsLogarithmic = Content.VisualProperties.YAxisLogScale;
     240      area.AxisY2.IsLogarithmic = Content.VisualProperties.SecondYAxisLogScale;
    238241    }
    239242
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r12764 r12771  
    211211    <Compile Include="Properties\AssemblyInfo.cs" />
    212212    <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" />
    213     <Compile Include="QualityAnalysis\QualityVsEvaluationsAnalyzer.cs" />
     213    <Compile Include="QualityAnalysis\QualityPerClockAnalyzer.cs" />
     214    <Compile Include="QualityAnalysis\QualityPerEvaluationsAnalyzer.cs" />
    214215    <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" />
    215216    <Compile Include="Statistics\BonferroniHolm.cs" />
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerClockAnalyzer.cs

    r12764 r12771  
    3030
    3131namespace HeuristicLab.Analysis {
    32   [Item("QualityVsEvaluationsAnalyzer", @"Creates a plot of the solution quality with respect to the number of evaluated solutions.")]
     32  [Item("QualityPerClockAnalyzer", @"Creates a plot of the solution quality with respect to the elapsed wall-clock time.")]
    3333  [StorableClass]
    34   public class QualityVsEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
     34  public class QualityPerClockAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
    3535    public virtual bool EnabledByDefault {
    3636      get { return false; }
     
    4040      get { return (ILookupParameter<DoubleValue>)Parameters["BestQuality"]; }
    4141    }
    42     public ILookupParameter<IntValue> EvaluatedSolutionsParameter {
    43       get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
     42
     43    public IResultParameter<TimeSpanValue> ExecutionTimeParameter {
     44      get { return (IResultParameter<TimeSpanValue>)Parameters["Execution Time"]; }
    4445    }
    45     public IResultParameter<IndexedDataTable<int>> QualityVsEvaluationsParameter {
    46       get { return (IResultParameter<IndexedDataTable<int>>)Parameters["QualityVsEvaluations"]; }
     46
     47    public IResultParameter<IndexedDataTable<double>> QualityPerClockParameter {
     48      get { return (IResultParameter<IndexedDataTable<double>>)Parameters["QualityPerClock"]; }
    4749    }
    4850
    4951    [StorableConstructor]
    50     protected QualityVsEvaluationsAnalyzer(bool deserializing) : base(deserializing) { }
    51     protected QualityVsEvaluationsAnalyzer(QualityVsEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { }
    52     public QualityVsEvaluationsAnalyzer()
     52    protected QualityPerClockAnalyzer(bool deserializing) : base(deserializing) { }
     53    protected QualityPerClockAnalyzer(QualityPerClockAnalyzer original, Cloner cloner) : base(original, cloner) { }
     54    public QualityPerClockAnalyzer()
    5355      : base() {
    5456      Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The quality value that should be compared."));
    55       Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The quality value that should be compared."));
    56       Parameters.Add(new ResultParameter<IndexedDataTable<int>>("QualityVsEvaluations", "Data table containing the first hitting graph with evaluations as the x-axis."));
    57       QualityVsEvaluationsParameter.DefaultValue = new IndexedDataTable<int>("Quality vs Evaluations") {
    58         Rows = { new IndexedDataRow<int>("First-hit Graph") { VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.StepLine } } }
     57      Parameters.Add(new ResultParameter<TimeSpanValue>("Execution Time", "The execution time."));
     58      Parameters.Add(new ResultParameter<IndexedDataTable<double>>("QualityPerClock", "Data table containing the first hitting graph with elapsed wall clock time (in seconds) as the x-axis."));
     59      QualityPerClockParameter.DefaultValue = new IndexedDataTable<double>("Quality per Clock") {
     60        VisualProperties = {
     61          XAxisTitle = "Elapsed time [s]",
     62          YAxisTitle = "Quality"
     63        },
     64        Rows = { new IndexedDataRow<double>("First-hit Graph") { VisualProperties = {
     65          ChartType = DataRowVisualProperties.DataRowChartType.StepLine,
     66          LineWidth = 3
     67        } } }
    5968      };
    6069    }
    6170
    6271    public override IDeepCloneable Clone(Cloner cloner) {
    63       return new QualityVsEvaluationsAnalyzer(this, cloner);
     72      return new QualityPerClockAnalyzer(this, cloner);
    6473    }
    6574
    6675    public override IOperation Apply() {
     76      var executionTime = Math.Max(ExecutionTimeParameter.ResultValue.Value.TotalSeconds, 0.001);
    6777      var bestQuality = BestQualityParameter.ActualValue.Value;
    68       var evaluations = EvaluatedSolutionsParameter.ActualValue.Value;
    6978
    70       var dataTable = QualityVsEvaluationsParameter.ResultValue;
    71       dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(evaluations, bestQuality));
     79      var dataTable = QualityPerClockParameter.ResultValue;
     80      dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(executionTime, bestQuality));
    7281
    7382      return base.Apply();
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerEvaluationsAnalyzer.cs

    r12764 r12771  
    3030
    3131namespace HeuristicLab.Analysis {
    32   [Item("QualityVsEvaluationsAnalyzer", @"Creates a plot of the solution quality with respect to the number of evaluated solutions.")]
     32  [Item("QualityPerEvaluationsAnalyzer", @"Creates a plot of the solution quality with respect to the number of evaluated solutions.")]
    3333  [StorableClass]
    34   public class QualityVsEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
     34  public class QualityPerEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
    3535    public virtual bool EnabledByDefault {
    3636      get { return false; }
     
    4343      get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
    4444    }
    45     public IResultParameter<IndexedDataTable<int>> QualityVsEvaluationsParameter {
    46       get { return (IResultParameter<IndexedDataTable<int>>)Parameters["QualityVsEvaluations"]; }
     45    public IResultParameter<IndexedDataTable<double>> QualityPerEvaluationsParameter {
     46      get { return (IResultParameter<IndexedDataTable<double>>)Parameters["QualityPerEvaluations"]; }
    4747    }
    4848
    4949    [StorableConstructor]
    50     protected QualityVsEvaluationsAnalyzer(bool deserializing) : base(deserializing) { }
    51     protected QualityVsEvaluationsAnalyzer(QualityVsEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { }
    52     public QualityVsEvaluationsAnalyzer()
     50    protected QualityPerEvaluationsAnalyzer(bool deserializing) : base(deserializing) { }
     51    protected QualityPerEvaluationsAnalyzer(QualityPerEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { }
     52    public QualityPerEvaluationsAnalyzer()
    5353      : base() {
    5454      Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The quality value that should be compared."));
    5555      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The quality value that should be compared."));
    56       Parameters.Add(new ResultParameter<IndexedDataTable<int>>("QualityVsEvaluations", "Data table containing the first hitting graph with evaluations as the x-axis."));
    57       QualityVsEvaluationsParameter.DefaultValue = new IndexedDataTable<int>("Quality vs Evaluations") {
    58         Rows = { new IndexedDataRow<int>("First-hit Graph") { VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.StepLine } } }
     56      Parameters.Add(new ResultParameter<IndexedDataTable<double>>("QualityPerEvaluations", "Data table containing the first hitting graph with evaluations as the x-axis."));
     57      QualityPerEvaluationsParameter.DefaultValue = new IndexedDataTable<double>("Quality per Evaluations") {
     58        VisualProperties = {
     59          XAxisTitle = "Evaluations",
     60          YAxisTitle = "Quality"
     61        },
     62        Rows = { new IndexedDataRow<double>("First-hit Graph") { VisualProperties = {
     63          ChartType = DataRowVisualProperties.DataRowChartType.StepLine,
     64          LineWidth = 3
     65        } } }
    5966      };
    6067    }
    6168
    6269    public override IDeepCloneable Clone(Cloner cloner) {
    63       return new QualityVsEvaluationsAnalyzer(this, cloner);
     70      return new QualityPerEvaluationsAnalyzer(this, cloner);
    6471    }
    6572
    6673    public override IOperation Apply() {
    6774      var bestQuality = BestQualityParameter.ActualValue.Value;
    68       var evaluations = EvaluatedSolutionsParameter.ActualValue.Value;
     75      var evaluations = Math.Max(EvaluatedSolutionsParameter.ActualValue.Value, 1);
    6976
    70       var dataTable = QualityVsEvaluationsParameter.ResultValue;
    71       dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(evaluations, bestQuality));
     77      var dataTable = QualityPerEvaluationsParameter.ResultValue;
     78      dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create((double)evaluations, bestQuality));
    7279
    7380      return base.Apply();
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj

    r12764 r12771  
    338338      <DependentUpon>RunCollectionEqualityConstraintView.cs</DependentUpon>
    339339    </Compile>
     340    <Compile Include="RunCollectionViews\RunCollectionECDFView.cs">
     341      <SubType>UserControl</SubType>
     342    </Compile>
     343    <Compile Include="RunCollectionViews\RunCollectionECDFView.Designer.cs">
     344      <DependentUpon>RunCollectionECDFView.cs</DependentUpon>
     345    </Compile>
    340346    <Compile Include="RunCollectionViews\RunCollectionTableView.cs">
    341347      <SubType>UserControl</SubType>
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionECDFView.Designer.cs

    r12764 r12771  
    2020#endregion
    2121namespace HeuristicLab.Optimization.Views {
    22   partial class RunCollectionChartAggregationView {
     22  partial class RunCollectionECDFView {
    2323    /// <summary>
    2424    /// Required designer variable.
     
    4848      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    4949      this.label2 = new System.Windows.Forms.Label();
    50       this.dataRowComboBox = new System.Windows.Forms.ComboBox();
     50      this.groupComboBox = new System.Windows.Forms.ComboBox();
     51      this.logScalingCheckBox = new System.Windows.Forms.CheckBox();
    5152      this.SuspendLayout();
    5253      //
    5354      // dataTableComboBox
    5455      //
    55       this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     56      this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    5657            | System.Windows.Forms.AnchorStyles.Right)));
    5758      this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    5859      this.dataTableComboBox.FormattingEnabled = true;
    59       this.dataTableComboBox.Location = new System.Drawing.Point(69, 3);
     60      this.dataTableComboBox.Location = new System.Drawing.Point(69, 30);
    6061      this.dataTableComboBox.Name = "dataTableComboBox";
    6162      this.dataTableComboBox.Size = new System.Drawing.Size(455, 21);
     
    6667      //
    6768      this.label1.AutoSize = true;
    68       this.label1.Location = new System.Drawing.Point(3, 6);
     69      this.label1.Location = new System.Drawing.Point(3, 33);
    6970      this.label1.Name = "label1";
    7071      this.label1.Size = new System.Drawing.Size(60, 13);
     
    7475      // viewHost
    7576      //
    76       this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    77             | System.Windows.Forms.AnchorStyles.Left)
     77      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     78            | System.Windows.Forms.AnchorStyles.Left) 
    7879            | System.Windows.Forms.AnchorStyles.Right)));
    7980      this.viewHost.Caption = "View";
     
    8384      this.viewHost.Name = "viewHost";
    8485      this.viewHost.ReadOnly = false;
    85       this.viewHost.Size = new System.Drawing.Size(520, 314);
     86      this.viewHost.Size = new System.Drawing.Size(520, 291);
    8687      this.viewHost.TabIndex = 2;
    8788      this.viewHost.ViewsLabelVisible = true;
     
    9192      //
    9293      this.label2.AutoSize = true;
    93       this.label2.Location = new System.Drawing.Point(3, 33);
     94      this.label2.Location = new System.Drawing.Point(3, 6);
    9495      this.label2.Name = "label2";
    95       this.label2.Size = new System.Drawing.Size(55, 13);
     96      this.label2.Size = new System.Drawing.Size(39, 13);
    9697      this.label2.TabIndex = 3;
    97       this.label2.Text = "DataRow:";
     98      this.label2.Text = "Group:";
    9899      //
    99       // dataRowComboBox
     100      // groupComboBox
    100101      //
    101       this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     102      this.groupComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    102103            | System.Windows.Forms.AnchorStyles.Right)));
    103       this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    104       this.dataRowComboBox.FormattingEnabled = true;
    105       this.dataRowComboBox.Location = new System.Drawing.Point(69, 30);
    106       this.dataRowComboBox.Name = "dataRowComboBox";
    107       this.dataRowComboBox.Size = new System.Drawing.Size(455, 21);
    108       this.dataRowComboBox.TabIndex = 4;
    109       this.dataRowComboBox.SelectedIndexChanged += new System.EventHandler(this.dataRowComboBox_SelectedIndexChanged);
     104      this.groupComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     105      this.groupComboBox.FormattingEnabled = true;
     106      this.groupComboBox.Location = new System.Drawing.Point(69, 3);
     107      this.groupComboBox.Name = "groupComboBox";
     108      this.groupComboBox.Size = new System.Drawing.Size(455, 21);
     109      this.groupComboBox.TabIndex = 4;
     110      this.groupComboBox.SelectedIndexChanged += new System.EventHandler(this.groupComboBox_SelectedIndexChanged);
    110111      //
    111       // RunCollectionChartAggregationView
     112      // logScalingCheckBox
    112113      //
    113       this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
     114      this.logScalingCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     115      this.logScalingCheckBox.AutoSize = true;
     116      this.logScalingCheckBox.Location = new System.Drawing.Point(0, 354);
     117      this.logScalingCheckBox.Name = "logScalingCheckBox";
     118      this.logScalingCheckBox.Size = new System.Drawing.Size(112, 17);
     119      this.logScalingCheckBox.TabIndex = 5;
     120      this.logScalingCheckBox.Text = "logarithmic scaling";
     121      this.logScalingCheckBox.UseVisualStyleBackColor = true;
     122      this.logScalingCheckBox.CheckedChanged += new System.EventHandler(this.logScalingCheckBox_CheckedChanged);
     123      //
     124      // RunCollectionECDFView
     125      //
    114126      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    115       this.Controls.Add(this.dataRowComboBox);
     127      this.Controls.Add(this.logScalingCheckBox);
     128      this.Controls.Add(this.groupComboBox);
    116129      this.Controls.Add(this.label2);
    117130      this.Controls.Add(this.viewHost);
    118131      this.Controls.Add(this.label1);
    119132      this.Controls.Add(this.dataTableComboBox);
    120       this.Name = "RunCollectionChartAggregationView";
     133      this.Name = "RunCollectionECDFView";
    121134      this.Size = new System.Drawing.Size(527, 374);
    122135      this.ResumeLayout(false);
     
    131144    private MainForm.WindowsForms.ViewHost viewHost;
    132145    private System.Windows.Forms.Label label2;
    133     private System.Windows.Forms.ComboBox dataRowComboBox;
     146    private System.Windows.Forms.ComboBox groupComboBox;
     147    private System.Windows.Forms.CheckBox logScalingCheckBox;
    134148  }
    135149}
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionECDFView.cs

    r12764 r12771  
    2424using System.ComponentModel;
    2525using System.Linq;
     26using System.Windows.Forms;
    2627using HeuristicLab.Analysis;
    2728using HeuristicLab.Collections;
     29using HeuristicLab.Common;
    2830using HeuristicLab.Core.Views;
    2931using HeuristicLab.MainForm;
    3032
    3133namespace HeuristicLab.Optimization.Views {
    32   [View("Chart Aggregation")]
     34  [View("ECDF Performance Comparison")]
    3335  [Content(typeof(RunCollection), false)]
    34   public partial class RunCollectionChartAggregationView : ItemView {
    35     private const string AllDataRows = "All DataRows";
     36  public partial class RunCollectionECDFView : ItemView {
     37    private const string AllRuns = "All Runs";
    3638
    3739    public new RunCollection Content {
     
    4042    }
    4143
    42     private int rowNumber;
    4344    private bool suppressUpdates;
    44     private readonly Dictionary<IRun, IEnumerable<DataRow>> runMapping;
    45     private readonly DataTable combinedDataTable;
    46     public DataTable CombinedDataTable {
     45    private readonly IndexedDataTable<double> combinedDataTable;
     46    public IndexedDataTable<double> CombinedDataTable {
    4747      get { return combinedDataTable; }
    4848    }
    4949
    50     public RunCollectionChartAggregationView() {
     50    public RunCollectionECDFView() {
    5151      InitializeComponent();
    52       runMapping = new Dictionary<IRun, IEnumerable<DataRow>>();
    53       combinedDataTable = new DataTable("Combined DataTable", "A data table containing data rows from multiple runs.");
     52      combinedDataTable = new IndexedDataTable<double>("Combined DataTable", "A data table containing the ECDF of each of a number of groups.") {
     53        VisualProperties = { YAxisTitle = "Proportion of reached targets" }
     54      };
    5455      viewHost.Content = combinedDataTable;
    5556      suppressUpdates = false;
     
    8081        return;
    8182      }
     83      UpdateGroupComboBox();
    8284      UpdateDataTableComboBox();
    83       UpdateDataRowComboBox();
    84       AddRuns(e.Items);
     85      foreach (var run in e.Items)
     86        RegisterRunEvents(run);
    8587    }
    8688    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     
    9092        return;
    9193      }
     94      UpdateGroupComboBox();
    9295      UpdateDataTableComboBox();
    93       UpdateDataRowComboBox();
    94       RemoveRuns(e.Items);
     96      foreach (var run in e.Items)
     97        DeregisterRunEvents(run);
    9598    }
    9699    private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     
    100103        return;
    101104      }
     105      UpdateGroupComboBox();
    102106      UpdateDataTableComboBox();
    103       UpdateDataRowComboBox();
    104       RemoveRuns(e.OldItems);
    105       AddRuns(e.Items);
     107      foreach (var run in e.OldItems)
     108        DeregisterRunEvents(run);
    106109    }
    107110    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
     
    118121      if (!suppressUpdates) {
    119122        UpdateDataTableComboBox();
    120         UpdateDataRowComboBox();
    121         UpdateRuns(Content);
     123        UpdateGroupComboBox();
     124        UpdateRuns();
    122125      }
    123126    }
     
    134137        Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e);
    135138      } else {
    136         var run = (IRun)sender;
    137         if (e.PropertyName == "Color" || e.PropertyName == "Visible")
    138           UpdateRuns(new[] { run });
     139        if (e.PropertyName == "Visible")
     140          UpdateRuns();
    139141      }
    140142    }
     
    144146      base.OnContentChanged();
    145147      dataTableComboBox.Items.Clear();
    146       dataRowComboBox.Items.Clear();
     148      groupComboBox.Items.Clear();
    147149      combinedDataTable.Rows.Clear();
    148       runMapping.Clear();
    149150
    150151      UpdateCaption();
    151152      if (Content != null) {
     153        UpdateGroupComboBox();
    152154        UpdateDataTableComboBox();
    153155      }
    154156    }
    155157
    156     private void RebuildCombinedDataTable() {
    157       RemoveRuns(Content);
    158       rowNumber = 0;
    159       AddRuns(Content);
    160     }
    161 
    162     private void AddRuns(IEnumerable<IRun> runs) {
    163       foreach (var run in runs) {
    164         runMapping[run] = ExtractDataRowsFromRun(run).ToList();
    165         RegisterRunEvents(run);
    166       }
    167       var dataRows = runs.Where(r => r.Visible && runMapping.ContainsKey(r)).SelectMany(r => runMapping[r]);
    168       combinedDataTable.Rows.AddRange(dataRows);
    169     }
    170 
    171     private void RemoveRuns(IEnumerable<IRun> runs) {
    172       var dataRows = runs.Where(r => runMapping.ContainsKey(r)).SelectMany(r => runMapping[r]).ToList();
    173       foreach (var run in runs) {
    174         if (!runMapping.ContainsKey(run)) continue;
    175         runMapping.Remove(run);
    176         DeregisterRunEvents(run);
    177       }
    178       combinedDataTable.Rows.RemoveRange(dataRows);
    179     }
    180 
    181     private void UpdateRuns(IEnumerable<IRun> runs) {
    182       foreach (var run in runs) {
    183         //update color
    184         if (!runMapping.ContainsKey(run)) {
    185           runMapping[run] = ExtractDataRowsFromRun(run).ToList();
    186           RegisterRunEvents(run);
    187         } else {
    188           foreach (var dataRow in runMapping[run]) {
    189             dataRow.VisualProperties.Color = run.Color;
     158    private void UpdateRuns() {
     159      if (InvokeRequired) {
     160        Invoke((Action)UpdateRuns);
     161        return;
     162      }
     163      SuspendRepaint();
     164      try {
     165        combinedDataTable.Rows.Clear();
     166        var table = (string)dataTableComboBox.SelectedItem;
     167        if (string.IsNullOrEmpty(table)) return;
     168        var maximum = Content.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Max(y => y.Item2)).Max();
     169        var minimum = Content.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Min(y => y.Item2)).Min();
     170        var levels = Enumerable.Range(0, 51).Select(x => maximum - (x / 50.0) * (maximum - minimum)).ToArray();
     171        var selectedGroup = (string)groupComboBox.SelectedItem;
     172        if (string.IsNullOrEmpty(selectedGroup)) return;
     173        List<Tuple<string, List<IRun>>> groupedRuns;
     174        if (selectedGroup == AllRuns)
     175          groupedRuns = new List<Tuple<string, List<IRun>>> { Tuple.Create(AllRuns, Content.ToList()) };
     176        else groupedRuns = (from r in Content
     177                            group r by r.Parameters[selectedGroup].ToString() into g
     178                            select Tuple.Create(g.Key, g.ToList())).ToList();
     179        var xAxisTitles = new HashSet<string>();
     180        foreach (var group in groupedRuns) {
     181          var hits = new SortedList<double, int>();
     182          foreach (var run in group.Item2) {
     183            var resultsTable = (IndexedDataTable<double>)run.Results[table];
     184            xAxisTitles.Add(resultsTable.VisualProperties.XAxisTitle);
     185            var graph = new LinkedList<Tuple<double, double>>(resultsTable.Rows.First().Values);
     186            var current = graph.First.Next;
     187            // prune convergence graph to obtain first hit times only
     188            while (current != null) {
     189              if (current.Value.Item2.IsAlmost(current.Previous.Value.Item2)) {
     190                var h = current;
     191                current = current.Previous;
     192                graph.Remove(h);
     193              }
     194              current = current.Next;
     195            }
     196            var i = 0;
     197            current = graph.First;
     198            while (i < levels.Length && current != null) {
     199              if (current.Value.Item2 < levels[i]) {
     200                if (hits.ContainsKey(current.Value.Item1))
     201                  hits[current.Value.Item1]++;
     202                else hits[current.Value.Item1] = 1;
     203                i++;
     204              } else {
     205                current = current.Next;
     206              }
     207            }
    190208          }
     209          var row = new IndexedDataRow<double>(group.Item1) { VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.StepLine } };
     210          var total = 0.0;
     211          foreach (var h in hits) {
     212            total += h.Value;
     213            row.Values.Add(Tuple.Create(Math.Max(1, h.Key), total / (group.Item2.Count * levels.Length)));
     214          }
     215          combinedDataTable.Rows.Add(row);
    191216        }
    192       }
    193       //update visibility - remove and add all rows to keep the same order as before
    194       combinedDataTable.Rows.Clear();
    195       combinedDataTable.Rows.AddRange(runMapping.Where(mapping => mapping.Key.Visible).SelectMany(mapping => mapping.Value));
    196     }
    197 
    198     private IEnumerable<DataRow> ExtractDataRowsFromRun(IRun run) {
    199       var resultName = (string)dataTableComboBox.SelectedItem;
    200       if (string.IsNullOrEmpty(resultName)) yield break;
    201 
    202       var rowName = (string)dataRowComboBox.SelectedItem;
    203       if (!run.Results.ContainsKey(resultName)) yield break;
    204 
    205       var dataTable = (DataTable)run.Results[resultName];
    206       foreach (var dataRow in dataTable.Rows) {
    207         if (dataRow.Name != rowName && rowName != AllDataRows) continue;
    208         rowNumber++;
    209         var clonedRow = (DataRow)dataRow.Clone();
    210         //row names must be unique -> add incremented number to the row name
    211         clonedRow.Name = run.Name + "." + dataRow.Name + rowNumber;
    212         clonedRow.VisualProperties.DisplayName = run.Name + "." + dataRow.Name;
    213         clonedRow.VisualProperties.Color = run.Color;
    214         yield return clonedRow;
     217        combinedDataTable.VisualProperties.XAxisTitle = string.Join(" / ", xAxisTitles);
     218      } finally { ResumeRepaint(true); }
     219    }
     220
     221    private void UpdateGroupComboBox() {
     222      string selectedItem = (string)groupComboBox.SelectedItem;
     223
     224      var groupings = Content.ParameterNames.ToArray();
     225      groupComboBox.Items.Clear();
     226      groupComboBox.Items.Add(AllRuns);
     227      groupComboBox.Items.AddRange(groupings);
     228      if (selectedItem != null && groupComboBox.Items.Contains(selectedItem)) {
     229        groupComboBox.SelectedItem = selectedItem;
     230      } else if (groupComboBox.Items.Count > 0) {
     231        groupComboBox.SelectedItem = groupComboBox.Items[0];
    215232      }
    216233    }
     
    222239      var dataTables = (from run in Content
    223240                        from result in run.Results
    224                         where result.Value is DataTable
     241                        where result.Value is IndexedDataTable<double>
    225242                        select result.Key).Distinct().ToArray();
    226243
     
    234251
    235252    private void UpdateCaption() {
    236       Caption = Content != null ? Content.OptimizerName + " Chart Aggregation" : ViewAttribute.GetViewName(GetType());
    237     }
    238 
    239     private void UpdateDataRowComboBox() {
    240       string selectedItem = (string)dataRowComboBox.SelectedItem;
    241 
    242       dataRowComboBox.Items.Clear();
    243       var resultName = (string)dataTableComboBox.SelectedItem;
    244       if (resultName == null) return;
    245 
    246       var dataTables = from run in Content
    247                        where run.Results.ContainsKey(resultName)
    248                        select run.Results[resultName] as DataTable;
    249       var rowNames = (from dataTable in dataTables
    250                       from row in dataTable.Rows
    251                       select row.Name).Distinct().ToArray();
    252 
    253       dataRowComboBox.Items.AddRange(rowNames);
    254       dataRowComboBox.Items.Add(AllDataRows);
    255       if (selectedItem != null && dataRowComboBox.Items.Contains(selectedItem)) {
    256         dataRowComboBox.SelectedItem = selectedItem;
    257       } else if (dataRowComboBox.Items.Count > 0) {
    258         dataRowComboBox.SelectedItem = dataRowComboBox.Items[0];
    259       }
    260     }
    261 
     253      Caption = Content != null ? Content.OptimizerName + " ECDF Comparison" : ViewAttribute.GetViewName(GetType());
     254    }
     255
     256    private void groupComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     257      UpdateRuns();
     258    }
    262259    private void dataTableComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    263       UpdateDataRowComboBox();
    264     }
    265     private void dataRowComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    266       if (suppressUpdates) return;
    267       RebuildCombinedDataTable();
     260      UpdateRuns();
     261    }
     262
     263    private void logScalingCheckBox_CheckedChanged(object sender, EventArgs e) {
     264      combinedDataTable.VisualProperties.XAxisLogScale = logScalingCheckBox.Checked;
    268265    }
    269266  }
  • branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r12012 r12771  
    226226    }
    227227    public virtual void CollectResultValues(IDictionary<string, IItem> values) {
    228       values.Add("Execution Time", new TimeSpanValue(ExecutionTime));
     228      if (!Results.ContainsKey("Execution Time"))
     229        values.Add("Execution Time", new TimeSpanValue(ExecutionTime));
    229230      Results.CollectResultValues(values);
    230231    }
  • branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r11878 r12771  
    2424using System.Threading.Tasks;
    2525using HeuristicLab.Common;
     26using HeuristicLab.Data;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
     
    3536    public override ResultCollection Results {
    3637      get { return results; }
     38    }
     39
     40    protected override void OnExecutionTimeChanged() {
     41      base.OnExecutionTimeChanged();
     42      IResult result;
     43      if (!Results.TryGetValue("Execution Time", out result))
     44        Results.Add(new Result("Execution Time", new TimeSpanValue(ExecutionTime)));
     45      else ((TimeSpanValue)result.Value).Value = ExecutionTime;
    3746    }
    3847
  • branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs

    r12012 r12771  
    2222using System;
    2323using System.Linq;
     24using System.Reflection;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2729using HeuristicLab.PluginInfrastructure;
     
    7173    }
    7274
     75    protected override void OnExecutionTimeChanged() {
     76      base.OnExecutionTimeChanged();
     77      IResult result;
     78      if (!Results.TryGetValue("Execution Time", out result))
     79        Results.Add(new Result("Execution Time", new TimeSpanValue(ExecutionTime)));
     80      else ((TimeSpanValue)result.Value).Value = ExecutionTime;
     81    }
     82
    7383    public override ResultCollection Results {
    7484      get {
Note: See TracChangeset for help on using the changeset viewer.