Changeset 13757 for branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs
- Timestamp:
- 04/13/16 16:25:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs
r13752 r13757 28 28 using System; 29 29 using System.Collections.Generic; 30 using System.Drawing; 30 31 using System.Linq; 31 32 using System.Text.RegularExpressions; … … 62 63 UpdateProjectionComboBox(); 63 64 UpdateSizeComboBox(); 65 UpdateColorComboBox(); 64 66 } 65 67 } … … 76 78 UpdateProjectionComboBox(); 77 79 UpdateSizeComboBox(); 80 UpdateColorComboBox(); 78 81 UpdateProjection(); 79 82 } … … 108 111 } finally { SuppressEvents = false; } 109 112 } 113 114 private void UpdateColorComboBox() { 115 try { 116 SuppressEvents = true; 117 var selected = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : null; 118 colorComboBox.Items.Clear(); 119 colorComboBox.Items.Add(string.Empty); 120 foreach (var str in Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Rank."))) { 121 colorComboBox.Items.Add(str); 122 if (selected == str) colorComboBox.SelectedItem = str; 123 } 124 if (selected == null && colorComboBox.Items.Count > 0) 125 colorComboBox.SelectedIndex = 0; 126 } finally { SuppressEvents = false; } 127 } 110 128 111 129 private IEnumerable<string> GetProjections() { … … 130 148 var projection = (string)projectionComboBox.SelectedItem; 131 149 var size = sizeComboBox.SelectedIndex >= 0 ? (string)sizeComboBox.SelectedItem : string.Empty; 132 133 DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, size, invPropCheckBox.Checked); 134 } 135 136 private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, bool invProp) { 150 var color = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : string.Empty; 151 152 DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, 153 size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked); 154 } 155 156 private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp, bool fromZero) { 137 157 instancesSeries.Points.Clear(); 138 158 currentInstanceSeries.Points.Clear(); … … 143 163 if (sizes.Count > 0) { 144 164 maxSize = sizes.Max(x => x.Value); 145 minSize = sizes.Min(x => x.Value); 165 if (maxSize < 0 && fromZero) { 166 maxSize = 0; 167 minSize = sizes.Min(x => x.Value); 168 } else if (fromZero) { 169 minSize = 0; 170 } else { 171 minSize = sizes.Min(x => x.Value); 172 } 146 173 } 147 174 } … … 159 186 if (maxSize > minSize && run.Results.TryGetValue(size, out item)) { 160 187 var dItem = item as Data.DoubleValue; 188 if (dItem == null && item is IntValue) dItem = new DoubleValue(((IntValue)item).Value); 161 189 if (dItem != null) { 162 190 if (double.IsNaN(dItem.Value)) … … 171 199 } else dataPoint.MarkerSize = 1; 172 200 201 if (!string.IsNullOrEmpty(color)) { 202 if (run.Results.TryGetValue(color, out item)) { 203 var v = (int)(item is DoubleValue ? ((DoubleValue)item).Value : (item is IntValue ? ((IntValue)item).Value : int.MaxValue)); 204 switch (v) { 205 case 0: dataPoint.MarkerColor = Color.Green; break; 206 case 1: dataPoint.MarkerColor = Color.LightSeaGreen; break; 207 case 2: dataPoint.MarkerColor = Color.CornflowerBlue; break; 208 case 3: dataPoint.MarkerColor = Color.PaleVioletRed; break; 209 case 4: dataPoint.MarkerColor = Color.IndianRed; break; 210 default: dataPoint.MarkerColor = Color.LightGray; break; 211 } 212 } 213 } 173 214 if (Content.IsCurrentInstance(run)) currentInstanceSeries.Points.Add(dataPoint); 174 215 else instancesSeries.Points.Add(dataPoint); … … 185 226 } 186 227 228 private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) { 229 UpdateProjection(); 230 } 231 187 232 private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) { 233 UpdateProjection(); 234 } 235 236 private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) { 188 237 UpdateProjection(); 189 238 }
Note: See TracChangeset
for help on using the changeset viewer.