Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/16 16:25:12 (9 years ago)
Author:
abeham
Message:

#2547:

  • worked on problem instance mapping
  • started working on improved suggestion algorithm
Location:
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.Designer.cs

    r13752 r13757  
    5454      this.mapSplitContainer = new System.Windows.Forms.SplitContainer();
    5555      this.showCharacteristicsCheckBox = new System.Windows.Forms.CheckBox();
     56      this.fromZeroCheckBox = new System.Windows.Forms.CheckBox();
    5657      this.invPropCheckBox = new System.Windows.Forms.CheckBox();
    5758      this.sizeLabel = new System.Windows.Forms.Label();
     
    6263      this.instancesTabPage = new System.Windows.Forms.TabPage();
    6364      this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     65      this.colorComboBox = new System.Windows.Forms.ComboBox();
     66      this.colorLabel = new System.Windows.Forms.Label();
    6467      this.problemInstancesTabControl.SuspendLayout();
    6568      this.mapTabPage.SuspendLayout();
     
    8285      this.problemInstancesTabControl.Name = "problemInstancesTabControl";
    8386      this.problemInstancesTabControl.SelectedIndex = 0;
    84       this.problemInstancesTabControl.Size = new System.Drawing.Size(1000, 760);
     87      this.problemInstancesTabControl.Size = new System.Drawing.Size(1108, 760);
    8588      this.problemInstancesTabControl.TabIndex = 8;
    8689      //
     
    9194      this.mapTabPage.Name = "mapTabPage";
    9295      this.mapTabPage.Padding = new System.Windows.Forms.Padding(3);
    93       this.mapTabPage.Size = new System.Drawing.Size(992, 734);
     96      this.mapTabPage.Size = new System.Drawing.Size(1100, 734);
    9497      this.mapTabPage.TabIndex = 1;
    9598      this.mapTabPage.Text = "Map";
     
    106109      //
    107110      this.mapSplitContainer.Panel1.Controls.Add(this.showCharacteristicsCheckBox);
     111      this.mapSplitContainer.Panel1.Controls.Add(this.fromZeroCheckBox);
    108112      this.mapSplitContainer.Panel1.Controls.Add(this.invPropCheckBox);
     113      this.mapSplitContainer.Panel1.Controls.Add(this.colorLabel);
    109114      this.mapSplitContainer.Panel1.Controls.Add(this.sizeLabel);
    110115      this.mapSplitContainer.Panel1.Controls.Add(this.projectionLabel);
    111116      this.mapSplitContainer.Panel1.Controls.Add(this.instanceMapChart);
     117      this.mapSplitContainer.Panel1.Controls.Add(this.colorComboBox);
    112118      this.mapSplitContainer.Panel1.Controls.Add(this.sizeComboBox);
    113119      this.mapSplitContainer.Panel1.Controls.Add(this.projectionComboBox);
    114120      this.mapSplitContainer.Panel1.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0);
    115121      this.mapSplitContainer.Panel2Collapsed = true;
    116       this.mapSplitContainer.Size = new System.Drawing.Size(986, 728);
     122      this.mapSplitContainer.Size = new System.Drawing.Size(1094, 728);
    117123      this.mapSplitContainer.SplitterDistance = 847;
    118124      this.mapSplitContainer.TabIndex = 12;
     
    122128      this.showCharacteristicsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    123129      this.showCharacteristicsCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
    124       this.showCharacteristicsCheckBox.Location = new System.Drawing.Point(957, 4);
     130      this.showCharacteristicsCheckBox.Location = new System.Drawing.Point(1065, 5);
    125131      this.showCharacteristicsCheckBox.Name = "showCharacteristicsCheckBox";
    126132      this.showCharacteristicsCheckBox.Size = new System.Drawing.Size(26, 23);
     
    130136      this.showCharacteristicsCheckBox.CheckedChanged += new System.EventHandler(this.showCharacteristicsCheckBox_CheckedChanged);
    131137      //
     138      // fromZeroCheckBox
     139      //
     140      this.fromZeroCheckBox.AutoSize = true;
     141      this.fromZeroCheckBox.Checked = true;
     142      this.fromZeroCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     143      this.fromZeroCheckBox.Location = new System.Drawing.Point(639, 8);
     144      this.fromZeroCheckBox.Name = "fromZeroCheckBox";
     145      this.fromZeroCheckBox.Size = new System.Drawing.Size(69, 17);
     146      this.fromZeroCheckBox.TabIndex = 17;
     147      this.fromZeroCheckBox.Text = "from zero";
     148      this.fromZeroCheckBox.UseVisualStyleBackColor = true;
     149      this.fromZeroCheckBox.CheckedChanged += new System.EventHandler(this.fromZeroCheckBox_CheckedChanged);
     150      //
    132151      // invPropCheckBox
    133152      //
     
    135154      this.invPropCheckBox.Checked = true;
    136155      this.invPropCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
    137       this.invPropCheckBox.Location = new System.Drawing.Point(579, 12);
     156      this.invPropCheckBox.Location = new System.Drawing.Point(515, 8);
    138157      this.invPropCheckBox.Name = "invPropCheckBox";
    139158      this.invPropCheckBox.Size = new System.Drawing.Size(118, 17);
     
    146165      //
    147166      this.sizeLabel.AutoSize = true;
    148       this.sizeLabel.Location = new System.Drawing.Point(264, 12);
     167      this.sizeLabel.Location = new System.Drawing.Point(251, 12);
    149168      this.sizeLabel.Name = "sizeLabel";
    150169      this.sizeLabel.Size = new System.Drawing.Size(30, 13);
     
    192211      this.instanceMapChart.Series.Add(series1);
    193212      this.instanceMapChart.Series.Add(series2);
    194       this.instanceMapChart.Size = new System.Drawing.Size(980, 692);
     213      this.instanceMapChart.Size = new System.Drawing.Size(974, 692);
    195214      this.instanceMapChart.TabIndex = 12;
    196215      //
     
    199218      this.sizeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    200219      this.sizeComboBox.FormattingEnabled = true;
    201       this.sizeComboBox.Location = new System.Drawing.Point(300, 6);
     220      this.sizeComboBox.Location = new System.Drawing.Point(287, 6);
    202221      this.sizeComboBox.Name = "sizeComboBox";
    203       this.sizeComboBox.Size = new System.Drawing.Size(273, 21);
     222      this.sizeComboBox.Size = new System.Drawing.Size(222, 21);
    204223      this.sizeComboBox.TabIndex = 13;
    205224      this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.SizeComboBoxOnSelectedIndexChanged);
     
    221240      this.instancesTabPage.Name = "instancesTabPage";
    222241      this.instancesTabPage.Padding = new System.Windows.Forms.Padding(3);
    223       this.instancesTabPage.Size = new System.Drawing.Size(992, 734);
     242      this.instancesTabPage.Size = new System.Drawing.Size(1106, 734);
    224243      this.instancesTabPage.TabIndex = 0;
    225244      this.instancesTabPage.Text = "Instances";
     
    235254      this.problemInstancesView.Name = "problemInstancesView";
    236255      this.problemInstancesView.ReadOnly = false;
    237       this.problemInstancesView.Size = new System.Drawing.Size(986, 728);
     256      this.problemInstancesView.Size = new System.Drawing.Size(1100, 728);
    238257      this.problemInstancesView.TabIndex = 0;
    239258      this.problemInstancesView.ViewsLabelVisible = true;
    240259      this.problemInstancesView.ViewType = null;
     260      //
     261      // colorComboBox
     262      //
     263      this.colorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     264      this.colorComboBox.FormattingEnabled = true;
     265      this.colorComboBox.Location = new System.Drawing.Point(768, 6);
     266      this.colorComboBox.Name = "colorComboBox";
     267      this.colorComboBox.Size = new System.Drawing.Size(222, 21);
     268      this.colorComboBox.TabIndex = 13;
     269      this.colorComboBox.SelectedIndexChanged += new System.EventHandler(this.colorComboBox_SelectedIndexChanged);
     270      //
     271      // colorLabel
     272      //
     273      this.colorLabel.AutoSize = true;
     274      this.colorLabel.Location = new System.Drawing.Point(728, 9);
     275      this.colorLabel.Name = "colorLabel";
     276      this.colorLabel.Size = new System.Drawing.Size(34, 13);
     277      this.colorLabel.TabIndex = 15;
     278      this.colorLabel.Text = "Color:";
    241279      //
    242280      // UnderstandingProblemInstanceView
     
    246284      this.Controls.Add(this.problemInstancesTabControl);
    247285      this.Name = "UnderstandingProblemInstanceView";
    248       this.Size = new System.Drawing.Size(1000, 760);
     286      this.Size = new System.Drawing.Size(1108, 760);
    249287      this.problemInstancesTabControl.ResumeLayout(false);
    250288      this.mapTabPage.ResumeLayout(false);
     
    273311    private System.Windows.Forms.ComboBox sizeComboBox;
    274312    private System.Windows.Forms.ComboBox projectionComboBox;
     313    private System.Windows.Forms.CheckBox fromZeroCheckBox;
     314    private System.Windows.Forms.Label colorLabel;
     315    private System.Windows.Forms.ComboBox colorComboBox;
    275316  }
    276317}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs

    r13752 r13757  
    2828using System;
    2929using System.Collections.Generic;
     30using System.Drawing;
    3031using System.Linq;
    3132using System.Text.RegularExpressions;
     
    6263        UpdateProjectionComboBox();
    6364        UpdateSizeComboBox();
     65        UpdateColorComboBox();
    6466      }
    6567    }
     
    7678      UpdateProjectionComboBox();
    7779      UpdateSizeComboBox();
     80      UpdateColorComboBox();
    7881      UpdateProjection();
    7982    }
     
    108111      } finally { SuppressEvents = false; }
    109112    }
     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    }
    110128   
    111129    private IEnumerable<string> GetProjections() {
     
    130148      var projection = (string)projectionComboBox.SelectedItem;
    131149      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) {
    137157      instancesSeries.Points.Clear();
    138158      currentInstanceSeries.Points.Clear();
     
    143163        if (sizes.Count > 0) {
    144164          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          }
    146173        }
    147174      }
     
    159186        if (maxSize > minSize && run.Results.TryGetValue(size, out item)) {
    160187          var dItem = item as Data.DoubleValue;
     188          if (dItem == null && item is IntValue) dItem = new DoubleValue(((IntValue)item).Value);
    161189          if (dItem != null) {
    162190            if (double.IsNaN(dItem.Value))
     
    171199        } else dataPoint.MarkerSize = 1;
    172200
     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        }
    173214        if (Content.IsCurrentInstance(run)) currentInstanceSeries.Points.Add(dataPoint);
    174215        else instancesSeries.Points.Add(dataPoint);
     
    185226    }
    186227
     228    private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     229      UpdateProjection();
     230    }
     231
    187232    private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) {
     233      UpdateProjection();
     234    }
     235
     236    private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {
    188237      UpdateProjection();
    189238    }
Note: See TracChangeset for help on using the changeset viewer.