Changeset 12771
- Timestamp:
- 07/17/15 09:25:44 (9 years ago)
- 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 165 165 series.BorderDashStyle = ChartDashStyle.Solid; 166 166 series.BorderColor = Color.Empty; 167 if (!typeof(T).Equals(typeof(DateTime)))168 series.IsXValueIndexed = true;169 167 170 168 if (row.VisualProperties.Color != Color.Empty) … … 236 234 area.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount; 237 235 } 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; 238 241 } 239 242 -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
r12764 r12771 211 211 <Compile Include="Properties\AssemblyInfo.cs" /> 212 212 <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" /> 213 <Compile Include="QualityAnalysis\QualityVsEvaluationsAnalyzer.cs" /> 213 <Compile Include="QualityAnalysis\QualityPerClockAnalyzer.cs" /> 214 <Compile Include="QualityAnalysis\QualityPerEvaluationsAnalyzer.cs" /> 214 215 <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" /> 215 216 <Compile Include="Statistics\BonferroniHolm.cs" /> -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerClockAnalyzer.cs
r12764 r12771 30 30 31 31 namespace HeuristicLab.Analysis { 32 [Item("Quality VsEvaluationsAnalyzer", @"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.")] 33 33 [StorableClass] 34 public class Quality VsEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {34 public class QualityPerClockAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator { 35 35 public virtual bool EnabledByDefault { 36 36 get { return false; } … … 40 40 get { return (ILookupParameter<DoubleValue>)Parameters["BestQuality"]; } 41 41 } 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"]; } 44 45 } 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"]; } 47 49 } 48 50 49 51 [StorableConstructor] 50 protected Quality VsEvaluationsAnalyzer(bool deserializing) : base(deserializing) { }51 protected Quality VsEvaluationsAnalyzer(QualityVsEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { }52 public Quality VsEvaluationsAnalyzer()52 protected QualityPerClockAnalyzer(bool deserializing) : base(deserializing) { } 53 protected QualityPerClockAnalyzer(QualityPerClockAnalyzer original, Cloner cloner) : base(original, cloner) { } 54 public QualityPerClockAnalyzer() 53 55 : base() { 54 56 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 } } } 59 68 }; 60 69 } 61 70 62 71 public override IDeepCloneable Clone(Cloner cloner) { 63 return new Quality VsEvaluationsAnalyzer(this, cloner);72 return new QualityPerClockAnalyzer(this, cloner); 64 73 } 65 74 66 75 public override IOperation Apply() { 76 var executionTime = Math.Max(ExecutionTimeParameter.ResultValue.Value.TotalSeconds, 0.001); 67 77 var bestQuality = BestQualityParameter.ActualValue.Value; 68 var evaluations = EvaluatedSolutionsParameter.ActualValue.Value;69 78 70 var dataTable = Quality VsEvaluationsParameter.ResultValue;71 dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(e valuations, bestQuality));79 var dataTable = QualityPerClockParameter.ResultValue; 80 dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(executionTime, bestQuality)); 72 81 73 82 return base.Apply(); -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerEvaluationsAnalyzer.cs
r12764 r12771 30 30 31 31 namespace HeuristicLab.Analysis { 32 [Item("Quality VsEvaluationsAnalyzer", @"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.")] 33 33 [StorableClass] 34 public class Quality VsEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {34 public class QualityPerEvaluationsAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator { 35 35 public virtual bool EnabledByDefault { 36 36 get { return false; } … … 43 43 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 44 44 } 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"]; } 47 47 } 48 48 49 49 [StorableConstructor] 50 protected Quality VsEvaluationsAnalyzer(bool deserializing) : base(deserializing) { }51 protected Quality VsEvaluationsAnalyzer(QualityVsEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { }52 public Quality VsEvaluationsAnalyzer()50 protected QualityPerEvaluationsAnalyzer(bool deserializing) : base(deserializing) { } 51 protected QualityPerEvaluationsAnalyzer(QualityPerEvaluationsAnalyzer original, Cloner cloner) : base(original, cloner) { } 52 public QualityPerEvaluationsAnalyzer() 53 53 : base() { 54 54 Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The quality value that should be compared.")); 55 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 } } } 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 } } } 59 66 }; 60 67 } 61 68 62 69 public override IDeepCloneable Clone(Cloner cloner) { 63 return new Quality VsEvaluationsAnalyzer(this, cloner);70 return new QualityPerEvaluationsAnalyzer(this, cloner); 64 71 } 65 72 66 73 public override IOperation Apply() { 67 74 var bestQuality = BestQualityParameter.ActualValue.Value; 68 var evaluations = EvaluatedSolutionsParameter.ActualValue.Value;75 var evaluations = Math.Max(EvaluatedSolutionsParameter.ActualValue.Value, 1); 69 76 70 var dataTable = Quality VsEvaluationsParameter.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)); 72 79 73 80 return base.Apply(); -
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r12764 r12771 338 338 <DependentUpon>RunCollectionEqualityConstraintView.cs</DependentUpon> 339 339 </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> 340 346 <Compile Include="RunCollectionViews\RunCollectionTableView.cs"> 341 347 <SubType>UserControl</SubType> -
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionECDFView.Designer.cs
r12764 r12771 20 20 #endregion 21 21 namespace HeuristicLab.Optimization.Views { 22 partial class RunCollection ChartAggregationView {22 partial class RunCollectionECDFView { 23 23 /// <summary> 24 24 /// Required designer variable. … … 48 48 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 49 49 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(); 51 52 this.SuspendLayout(); 52 53 // 53 54 // dataTableComboBox 54 55 // 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) 56 57 | System.Windows.Forms.AnchorStyles.Right))); 57 58 this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 58 59 this.dataTableComboBox.FormattingEnabled = true; 59 this.dataTableComboBox.Location = new System.Drawing.Point(69, 3 );60 this.dataTableComboBox.Location = new System.Drawing.Point(69, 30); 60 61 this.dataTableComboBox.Name = "dataTableComboBox"; 61 62 this.dataTableComboBox.Size = new System.Drawing.Size(455, 21); … … 66 67 // 67 68 this.label1.AutoSize = true; 68 this.label1.Location = new System.Drawing.Point(3, 6);69 this.label1.Location = new System.Drawing.Point(3, 33); 69 70 this.label1.Name = "label1"; 70 71 this.label1.Size = new System.Drawing.Size(60, 13); … … 74 75 // viewHost 75 76 // 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) 78 79 | System.Windows.Forms.AnchorStyles.Right))); 79 80 this.viewHost.Caption = "View"; … … 83 84 this.viewHost.Name = "viewHost"; 84 85 this.viewHost.ReadOnly = false; 85 this.viewHost.Size = new System.Drawing.Size(520, 314);86 this.viewHost.Size = new System.Drawing.Size(520, 291); 86 87 this.viewHost.TabIndex = 2; 87 88 this.viewHost.ViewsLabelVisible = true; … … 91 92 // 92 93 this.label2.AutoSize = true; 93 this.label2.Location = new System.Drawing.Point(3, 33);94 this.label2.Location = new System.Drawing.Point(3, 6); 94 95 this.label2.Name = "label2"; 95 this.label2.Size = new System.Drawing.Size( 55, 13);96 this.label2.Size = new System.Drawing.Size(39, 13); 96 97 this.label2.TabIndex = 3; 97 this.label2.Text = " DataRow:";98 this.label2.Text = "Group:"; 98 99 // 99 // dataRowComboBox100 // groupComboBox 100 101 // 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) 102 103 | 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); 110 111 // 111 // RunCollectionChartAggregationView112 // logScalingCheckBox 112 113 // 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 // 114 126 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); 116 129 this.Controls.Add(this.label2); 117 130 this.Controls.Add(this.viewHost); 118 131 this.Controls.Add(this.label1); 119 132 this.Controls.Add(this.dataTableComboBox); 120 this.Name = "RunCollection ChartAggregationView";133 this.Name = "RunCollectionECDFView"; 121 134 this.Size = new System.Drawing.Size(527, 374); 122 135 this.ResumeLayout(false); … … 131 144 private MainForm.WindowsForms.ViewHost viewHost; 132 145 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; 134 148 } 135 149 } -
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionECDFView.cs
r12764 r12771 24 24 using System.ComponentModel; 25 25 using System.Linq; 26 using System.Windows.Forms; 26 27 using HeuristicLab.Analysis; 27 28 using HeuristicLab.Collections; 29 using HeuristicLab.Common; 28 30 using HeuristicLab.Core.Views; 29 31 using HeuristicLab.MainForm; 30 32 31 33 namespace HeuristicLab.Optimization.Views { 32 [View(" Chart Aggregation")]34 [View("ECDF Performance Comparison")] 33 35 [Content(typeof(RunCollection), false)] 34 public partial class RunCollection ChartAggregationView : ItemView {35 private const string All DataRows = "All DataRows";36 public partial class RunCollectionECDFView : ItemView { 37 private const string AllRuns = "All Runs"; 36 38 37 39 public new RunCollection Content { … … 40 42 } 41 43 42 private int rowNumber;43 44 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 { 47 47 get { return combinedDataTable; } 48 48 } 49 49 50 public RunCollection ChartAggregationView() {50 public RunCollectionECDFView() { 51 51 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 }; 54 55 viewHost.Content = combinedDataTable; 55 56 suppressUpdates = false; … … 80 81 return; 81 82 } 83 UpdateGroupComboBox(); 82 84 UpdateDataTableComboBox(); 83 UpdateDataRowComboBox();84 AddRuns(e.Items);85 foreach (var run in e.Items) 86 RegisterRunEvents(run); 85 87 } 86 88 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { … … 90 92 return; 91 93 } 94 UpdateGroupComboBox(); 92 95 UpdateDataTableComboBox(); 93 UpdateDataRowComboBox();94 RemoveRuns(e.Items);96 foreach (var run in e.Items) 97 DeregisterRunEvents(run); 95 98 } 96 99 private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { … … 100 103 return; 101 104 } 105 UpdateGroupComboBox(); 102 106 UpdateDataTableComboBox(); 103 UpdateDataRowComboBox(); 104 RemoveRuns(e.OldItems); 105 AddRuns(e.Items); 107 foreach (var run in e.OldItems) 108 DeregisterRunEvents(run); 106 109 } 107 110 private void Content_AlgorithmNameChanged(object sender, EventArgs e) { … … 118 121 if (!suppressUpdates) { 119 122 UpdateDataTableComboBox(); 120 Update DataRowComboBox();121 UpdateRuns( Content);123 UpdateGroupComboBox(); 124 UpdateRuns(); 122 125 } 123 126 } … … 134 137 Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e); 135 138 } 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(); 139 141 } 140 142 } … … 144 146 base.OnContentChanged(); 145 147 dataTableComboBox.Items.Clear(); 146 dataRowComboBox.Items.Clear();148 groupComboBox.Items.Clear(); 147 149 combinedDataTable.Rows.Clear(); 148 runMapping.Clear();149 150 150 151 UpdateCaption(); 151 152 if (Content != null) { 153 UpdateGroupComboBox(); 152 154 UpdateDataTableComboBox(); 153 155 } 154 156 } 155 157 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 } 190 208 } 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); 191 216 } 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]; 215 232 } 216 233 } … … 222 239 var dataTables = (from run in Content 223 240 from result in run.Results 224 where result.Value is DataTable241 where result.Value is IndexedDataTable<double> 225 242 select result.Key).Distinct().ToArray(); 226 243 … … 234 251 235 252 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 } 262 259 private void dataTableComboBox_SelectedIndexChanged(object sender, EventArgs e) { 263 Update DataRowComboBox();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; 268 265 } 269 266 } -
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r12012 r12771 226 226 } 227 227 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)); 229 230 Results.CollectResultValues(values); 230 231 } -
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs
r11878 r12771 24 24 using System.Threading.Tasks; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 … … 35 36 public override ResultCollection Results { 36 37 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; 37 46 } 38 47 -
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs
r12012 r12771 22 22 using System; 23 23 using System.Linq; 24 using System.Reflection; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 26 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 using HeuristicLab.PluginInfrastructure; … … 71 73 } 72 74 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 73 83 public override ResultCollection Results { 74 84 get {
Note: See TracChangeset
for help on using the changeset viewer.