- Timestamp:
- 04/07/16 14:24:44 (9 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingSolutionsView.Designer.cs
r13743 r13745 69 69 this.solutionsFdcViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 70 70 this.solutionsNetworkTabPage = new System.Windows.Forms.TabPage(); 71 this.solutionsNetworkChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 72 this.linesCheckBox = new System.Windows.Forms.CheckBox(); 71 73 this.solutionNetworkProjectionLabel = new System.Windows.Forms.Label(); 72 74 this.solutionNetworkProjectionComboBox = new System.Windows.Forms.ComboBox(); 73 this.solutionsNetworkChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 75 this.contrastTrackBar = new System.Windows.Forms.TrackBar(); 76 this.minimumTrackBar = new System.Windows.Forms.TrackBar(); 77 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 74 78 this.solutionsTabControl.SuspendLayout(); 75 79 this.solutionsQualityTabPage.SuspendLayout(); … … 79 83 this.solutionsNetworkTabPage.SuspendLayout(); 80 84 ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).BeginInit(); 85 ((System.ComponentModel.ISupportInitialize)(this.contrastTrackBar)).BeginInit(); 86 ((System.ComponentModel.ISupportInitialize)(this.minimumTrackBar)).BeginInit(); 81 87 this.SuspendLayout(); 82 88 // … … 294 300 // solutionsNetworkTabPage 295 301 // 302 this.solutionsNetworkTabPage.Controls.Add(this.solutionsNetworkChart); 303 this.solutionsNetworkTabPage.Controls.Add(this.linesCheckBox); 296 304 this.solutionsNetworkTabPage.Controls.Add(this.solutionNetworkProjectionLabel); 297 305 this.solutionsNetworkTabPage.Controls.Add(this.solutionNetworkProjectionComboBox); 298 this.solutionsNetworkTabPage.Controls.Add(this.solutionsNetworkChart); 306 this.solutionsNetworkTabPage.Controls.Add(this.contrastTrackBar); 307 this.solutionsNetworkTabPage.Controls.Add(this.minimumTrackBar); 299 308 this.solutionsNetworkTabPage.Location = new System.Drawing.Point(4, 22); 300 309 this.solutionsNetworkTabPage.Name = "solutionsNetworkTabPage"; … … 304 313 this.solutionsNetworkTabPage.Text = "Network Analysis"; 305 314 this.solutionsNetworkTabPage.UseVisualStyleBackColor = true; 306 //307 // solutionNetworkProjectionLabel308 //309 this.solutionNetworkProjectionLabel.AutoSize = true;310 this.solutionNetworkProjectionLabel.Location = new System.Drawing.Point(6, 9);311 this.solutionNetworkProjectionLabel.Name = "solutionNetworkProjectionLabel";312 this.solutionNetworkProjectionLabel.Size = new System.Drawing.Size(57, 13);313 this.solutionNetworkProjectionLabel.TabIndex = 4;314 this.solutionNetworkProjectionLabel.Text = "Projection:";315 //316 // solutionNetworkProjectionComboBox317 //318 this.solutionNetworkProjectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;319 this.solutionNetworkProjectionComboBox.FormattingEnabled = true;320 this.solutionNetworkProjectionComboBox.Items.AddRange(new object[] {321 "SOM",322 "MDS"});323 this.solutionNetworkProjectionComboBox.Location = new System.Drawing.Point(69, 6);324 this.solutionNetworkProjectionComboBox.Name = "solutionNetworkProjectionComboBox";325 this.solutionNetworkProjectionComboBox.Size = new System.Drawing.Size(180, 21);326 this.solutionNetworkProjectionComboBox.TabIndex = 3;327 this.solutionNetworkProjectionComboBox.SelectedIndexChanged += new System.EventHandler(this.SolutionNetworkProjectionComboBoxOnSelectedIndexChanged);328 315 // 329 316 // solutionsNetworkChart … … 373 360 this.solutionsNetworkChart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SolutionsNetworkChartOnMouseDoubleClick); 374 361 // 362 // linesCheckBox 363 // 364 this.linesCheckBox.AutoSize = true; 365 this.linesCheckBox.Location = new System.Drawing.Point(263, 8); 366 this.linesCheckBox.Name = "linesCheckBox"; 367 this.linesCheckBox.Size = new System.Drawing.Size(54, 17); 368 this.linesCheckBox.TabIndex = 6; 369 this.linesCheckBox.Text = "Lines:"; 370 this.linesCheckBox.UseVisualStyleBackColor = true; 371 this.linesCheckBox.CheckedChanged += new System.EventHandler(this.LinesCheckBoxOnCheckedChanged); 372 // 373 // solutionNetworkProjectionLabel 374 // 375 this.solutionNetworkProjectionLabel.AutoSize = true; 376 this.solutionNetworkProjectionLabel.Location = new System.Drawing.Point(6, 9); 377 this.solutionNetworkProjectionLabel.Name = "solutionNetworkProjectionLabel"; 378 this.solutionNetworkProjectionLabel.Size = new System.Drawing.Size(57, 13); 379 this.solutionNetworkProjectionLabel.TabIndex = 4; 380 this.solutionNetworkProjectionLabel.Text = "Projection:"; 381 // 382 // solutionNetworkProjectionComboBox 383 // 384 this.solutionNetworkProjectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 385 this.solutionNetworkProjectionComboBox.FormattingEnabled = true; 386 this.solutionNetworkProjectionComboBox.Items.AddRange(new object[] { 387 "SOM", 388 "MDS"}); 389 this.solutionNetworkProjectionComboBox.Location = new System.Drawing.Point(69, 6); 390 this.solutionNetworkProjectionComboBox.Name = "solutionNetworkProjectionComboBox"; 391 this.solutionNetworkProjectionComboBox.Size = new System.Drawing.Size(180, 21); 392 this.solutionNetworkProjectionComboBox.TabIndex = 3; 393 this.solutionNetworkProjectionComboBox.SelectedIndexChanged += new System.EventHandler(this.SolutionNetworkProjectionComboBoxOnSelectedIndexChanged); 394 // 395 // contrastTrackBar 396 // 397 this.contrastTrackBar.LargeChange = 3; 398 this.contrastTrackBar.Location = new System.Drawing.Point(323, 6); 399 this.contrastTrackBar.Maximum = 17; 400 this.contrastTrackBar.Minimum = 3; 401 this.contrastTrackBar.Name = "contrastTrackBar"; 402 this.contrastTrackBar.Size = new System.Drawing.Size(148, 45); 403 this.contrastTrackBar.TabIndex = 5; 404 this.contrastTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 405 this.toolTip.SetToolTip(this.contrastTrackBar, "Adjusts the contrast of the lines"); 406 this.contrastTrackBar.Value = 10; 407 this.contrastTrackBar.Scroll += new System.EventHandler(this.ContrastTrackBarOnScroll); 408 // 409 // minimumTrackBar 410 // 411 this.minimumTrackBar.LargeChange = 10; 412 this.minimumTrackBar.Location = new System.Drawing.Point(477, 6); 413 this.minimumTrackBar.Maximum = 100; 414 this.minimumTrackBar.Minimum = 1; 415 this.minimumTrackBar.Name = "minimumTrackBar"; 416 this.minimumTrackBar.Size = new System.Drawing.Size(148, 45); 417 this.minimumTrackBar.TabIndex = 5; 418 this.minimumTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 419 this.toolTip.SetToolTip(this.minimumTrackBar, "Adjusts the minimum"); 420 this.minimumTrackBar.Value = 50; 421 this.minimumTrackBar.Scroll += new System.EventHandler(this.MinimumTrackBarOnScroll); 422 // 375 423 // UnderstandingSolutionsView 376 424 // … … 393 441 this.solutionsNetworkTabPage.PerformLayout(); 394 442 ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).EndInit(); 443 ((System.ComponentModel.ISupportInitialize)(this.contrastTrackBar)).EndInit(); 444 ((System.ComponentModel.ISupportInitialize)(this.minimumTrackBar)).EndInit(); 395 445 this.ResumeLayout(false); 396 446 this.PerformLayout(); … … 422 472 private System.Windows.Forms.Label solutionNetworkProjectionLabel; 423 473 private System.Windows.Forms.ComboBox solutionNetworkProjectionComboBox; 474 private System.Windows.Forms.TrackBar contrastTrackBar; 475 private System.Windows.Forms.CheckBox linesCheckBox; 476 private System.Windows.Forms.TrackBar minimumTrackBar; 477 private System.Windows.Forms.ToolTip toolTip; 424 478 } 425 479 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingSolutionsView.cs
r13743 r13745 31 31 using System; 32 32 using System.Collections.Generic; 33 using System.Drawing; 33 34 using System.Linq; 34 35 using System.Windows.Forms; … … 68 69 protected override void OnSolutionSeedingPoolChanged() { 69 70 base.OnSolutionSeedingPoolChanged(); 70 UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem );71 UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 71 72 } 72 73 … … 109 110 UpdateSolutionFdcAnalysis(calculator, fdcBetweenBestCheckBox.Checked); 110 111 UpdateSolutionLengthScaleAnalysis(calculator); 111 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem );112 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 112 113 } else { 113 114 solutionsDiversityViewHost.Content = null; … … 223 224 } 224 225 225 private void UpdateSolutionNetworkAnalysis(ISolutionSimilarityCalculator calculator, string projection ) {226 private void UpdateSolutionNetworkAnalysis(ISolutionSimilarityCalculator calculator, string projection, bool lines, double contrast, double minimum) { 226 227 var series = solutionsNetworkChart.Series["SolutionSeries"]; 227 228 var seedingSeries = solutionsNetworkChart.Series["SeedingSolutionSeries"]; 228 229 try { 230 solutionsNetworkChart.Annotations.Clear(); 229 231 series.Points.Clear(); 230 232 seedingSeries.Points.Clear(); … … 241 243 coords = Som(dissimilarities, new MersenneTwister(42), jittering: true); 242 244 else coords = MultidimensionalScaling.KruskalShepard(dissimilarities); 245 var dataPoints = new List<DataPoint>(); 243 246 for (var i = 0; i < coords.Rows; i++) { 244 247 var quality = GetQuality(solutionScopes[i], calculator.QualityVariableName) ?? double.NaN; … … 250 253 Tag = solutionScopes[i] 251 254 }; 255 dataPoints.Add(dataPoint); 252 256 if (Content.SolutionSeedingPool.Contains(solutionScopes[i]) && Content.SolutionSeedingPool.ItemChecked(solutionScopes[i])) 253 257 seedingSeries.Points.Add(dataPoint); 254 258 else series.Points.Add(dataPoint); 259 } 260 if (lines) { 261 for (var i = 0; i < dataPoints.Count - 1; i++) { 262 for (var j = i + 1; j < dataPoints.Count; j++) { 263 if (dissimilarities[i, j].IsAlmost(1.0)) continue; 264 // s-shaped curve for mapping dissimilarities to alpha values 265 var alpha = (int)Math.Round(255.0 / (1.0 + Math.Exp(-contrast * ((1.0 - dissimilarities[i, j]) - (minimum / 100.0))))); 266 var lw = (int)Math.Round((1 - dissimilarities[i, j]) * 3.0 + 1.0); // linewidth of 1 to 4 267 var an = new LineAnnotation(); 268 an.SetAnchor(dataPoints[i], dataPoints[j]); 269 an.LineColor = Color.FromArgb(alpha, Color.DarkGray); 270 an.LineWidth = lw; 271 solutionsNetworkChart.Annotations.Add(an); 272 } 273 } 255 274 } 256 275 } catch { … … 271 290 UpdateSolutionFdcAnalysis(calculator, fdcBetweenBestCheckBox.Checked); 272 291 UpdateSolutionLengthScaleAnalysis(calculator); 273 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem );292 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 274 293 } 275 294 … … 284 303 UpdateSolutionFdcAnalysis(calculator, fdcBetweenBestCheckBox.Checked); 285 304 UpdateSolutionLengthScaleAnalysis(calculator); 286 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem );305 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 287 306 } 288 307 … … 299 318 calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 300 319 } 301 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem); 320 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 321 } 322 323 private void LinesCheckBoxOnCheckedChanged(object sender, EventArgs e) { 324 if (InvokeRequired) { Invoke((Action<object, EventArgs>)LinesCheckBoxOnCheckedChanged, sender, e); return; } 325 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 326 if (calculator != null) { 327 calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 328 calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 329 } 330 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 331 } 332 333 private void ContrastTrackBarOnScroll(object sender, EventArgs e) { 334 if (InvokeRequired) { Invoke((Action<object, EventArgs>)ContrastTrackBarOnScroll, sender, e); return; } 335 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 336 if (calculator != null) { 337 calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 338 calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 339 } 340 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 341 } 342 343 private void MinimumTrackBarOnScroll(object sender, EventArgs e) { 344 if (InvokeRequired) { Invoke((Action<object, EventArgs>)MinimumTrackBarOnScroll, sender, e); return; } 345 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 346 if (calculator != null) { 347 calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 348 calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 349 } 350 UpdateSolutionNetworkAnalysis(calculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 302 351 } 303 352 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingSolutionsView.resx
r13722 r13745 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root>
Note: See TracChangeset
for help on using the changeset viewer.