Changeset 7957


Ignore:
Timestamp:
06/05/12 04:08:16 (9 years ago)
Author:
abeham
Message:

#1851:

  • Used a TreeView instead of a ListView to display the instances
  • Fixed the bug regarding algorithms without a defined problem
  • Improved the UI speed
  • Added a warning sign if the number of variations is greater than 1000
  • Stated for every parameter if it was an int, double, or bool parameter
  • The .resx contains the warning icon for the error provider and should not be removed
Location:
trunk/sources/HeuristicLab.Optimizer/3.3
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.Designer.cs

    r7908 r7957  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
     48      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreateExperimentDialog));
    4849      this.okButton = new System.Windows.Forms.Button();
    4950      this.cancelButton = new System.Windows.Forms.Button();
     
    5354      this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    5455      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    55       this.instancesListView = new System.Windows.Forms.ListView();
    56       this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5756      this.experimentCreationBackgroundWorker = new System.ComponentModel.BackgroundWorker();
    5857      this.instanceDiscoveryProgressBar = new System.Windows.Forms.ProgressBar();
     
    6665      this.parametersListView = new System.Windows.Forms.ListView();
    6766      this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    68       this.choicesLabel = new System.Windows.Forms.Label();
    69       this.choicesListView = new System.Windows.Forms.ListView();
    70       this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     67      this.detailsTypeLabel = new System.Windows.Forms.Label();
    7168      this.stepSizeTextBox = new System.Windows.Forms.TextBox();
    7269      this.maximumTextBox = new System.Windows.Forms.TextBox();
     
    7572      this.maximumLabel = new System.Windows.Forms.Label();
    7673      this.minimumLabel = new System.Windows.Forms.Label();
     74      this.choicesListView = new System.Windows.Forms.ListView();
     75      this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    7776      this.instancesTabPage = new System.Windows.Forms.TabPage();
    7877      this.label1 = new System.Windows.Forms.Label();
     78      this.instancesTreeView = new System.Windows.Forms.TreeView();
    7979      this.experimentsToCreateDescriptionLabel = new System.Windows.Forms.Label();
    80       this.experimentsLabel = new System.Windows.Forms.Label();
     80      this.variationsLabel = new System.Windows.Forms.Label();
    8181      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    8282      this.experimentCreationProgressBar = new System.Windows.Forms.ProgressBar();
     83      this.warningProvider = new System.Windows.Forms.ErrorProvider(this.components);
    8384      ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit();
    8485      this.tabControl.SuspendLayout();
     
    9091      this.instancesTabPage.SuspendLayout();
    9192      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     93      ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).BeginInit();
    9294      this.SuspendLayout();
    9395      //
     
    149151      // repetitionsNumericUpDown
    150152      //
    151       this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    152             | System.Windows.Forms.AnchorStyles.Right)));
     153      this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     154                  | System.Windows.Forms.AnchorStyles.Right)));
    153155      this.repetitionsNumericUpDown.Location = new System.Drawing.Point(113, 28);
    154156      this.repetitionsNumericUpDown.Maximum = new decimal(new int[] {
     
    174176      this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated);
    175177      //
    176       // instancesListView
    177       //
    178       this.instancesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    179             | System.Windows.Forms.AnchorStyles.Left)
    180             | System.Windows.Forms.AnchorStyles.Right)));
    181       this.instancesListView.CheckBoxes = true;
    182       this.instancesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    183             this.columnHeader});
    184       this.instancesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
    185       this.instancesListView.Location = new System.Drawing.Point(6, 35);
    186       this.instancesListView.Name = "instancesListView";
    187       this.instancesListView.Size = new System.Drawing.Size(308, 225);
    188       this.instancesListView.TabIndex = 3;
    189       this.instancesListView.UseCompatibleStateImageBehavior = false;
    190       this.instancesListView.View = System.Windows.Forms.View.Details;
    191       this.instancesListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.instancesListView_ItemChecked);
    192       //
    193       // columnHeader
    194       //
    195       this.columnHeader.Width = 150;
    196       //
    197178      // experimentCreationBackgroundWorker
    198179      //
     
    257238      // tabControl
    258239      //
    259       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    260             | System.Windows.Forms.AnchorStyles.Left)
    261             | System.Windows.Forms.AnchorStyles.Right)));
     240      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     241                  | System.Windows.Forms.AnchorStyles.Left)
     242                  | System.Windows.Forms.AnchorStyles.Right)));
    262243      this.tabControl.Controls.Add(this.parametersTabPage);
    263244      this.tabControl.Controls.Add(this.instancesTabPage);
     
    292273      // parametersSplitContainer.Panel2
    293274      //
    294       this.parametersSplitContainer.Panel2.Controls.Add(this.choicesLabel);
    295       this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView);
     275      this.parametersSplitContainer.Panel2.Controls.Add(this.detailsTypeLabel);
    296276      this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeTextBox);
    297277      this.parametersSplitContainer.Panel2.Controls.Add(this.maximumTextBox);
     
    300280      this.parametersSplitContainer.Panel2.Controls.Add(this.maximumLabel);
    301281      this.parametersSplitContainer.Panel2.Controls.Add(this.minimumLabel);
     282      this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView);
    302283      this.parametersSplitContainer.Size = new System.Drawing.Size(314, 267);
    303284      this.parametersSplitContainer.SplitterDistance = 124;
     
    325306      this.columnHeader1.Width = 150;
    326307      //
    327       // choicesLabel
    328       //
    329       this.choicesLabel.AutoSize = true;
    330       this.choicesLabel.Location = new System.Drawing.Point(13, 15);
    331       this.choicesLabel.Name = "choicesLabel";
    332       this.choicesLabel.Size = new System.Drawing.Size(48, 13);
    333       this.choicesLabel.TabIndex = 0;
    334       this.choicesLabel.Text = "Choices:";
     308      // detailsTypeLabel
     309      //
     310      this.detailsTypeLabel.AutoSize = true;
     311      this.detailsTypeLabel.Location = new System.Drawing.Point(13, 15);
     312      this.detailsTypeLabel.Name = "detailsTypeLabel";
     313      this.detailsTypeLabel.Size = new System.Drawing.Size(48, 13);
     314      this.detailsTypeLabel.TabIndex = 0;
     315      this.detailsTypeLabel.Text = "Choices:";
     316      //
     317      // stepSizeTextBox
     318      //
     319      this.stepSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     320                  | System.Windows.Forms.AnchorStyles.Right)));
     321      this.stepSizeTextBox.Location = new System.Drawing.Point(73, 86);
     322      this.stepSizeTextBox.Name = "stepSizeTextBox";
     323      this.stepSizeTextBox.Size = new System.Drawing.Size(98, 20);
     324      this.stepSizeTextBox.TabIndex = 5;
     325      this.stepSizeTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
     326      //
     327      // maximumTextBox
     328      //
     329      this.maximumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     330                  | System.Windows.Forms.AnchorStyles.Right)));
     331      this.maximumTextBox.Location = new System.Drawing.Point(73, 60);
     332      this.maximumTextBox.Name = "maximumTextBox";
     333      this.maximumTextBox.Size = new System.Drawing.Size(98, 20);
     334      this.maximumTextBox.TabIndex = 3;
     335      this.maximumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
     336      //
     337      // minimumTextBox
     338      //
     339      this.minimumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     340                  | System.Windows.Forms.AnchorStyles.Right)));
     341      this.minimumTextBox.Location = new System.Drawing.Point(73, 34);
     342      this.minimumTextBox.Name = "minimumTextBox";
     343      this.minimumTextBox.Size = new System.Drawing.Size(98, 20);
     344      this.minimumTextBox.TabIndex = 1;
     345      this.minimumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
     346      //
     347      // stepSizeLabel
     348      //
     349      this.stepSizeLabel.AutoSize = true;
     350      this.stepSizeLabel.Location = new System.Drawing.Point(13, 89);
     351      this.stepSizeLabel.Name = "stepSizeLabel";
     352      this.stepSizeLabel.Size = new System.Drawing.Size(53, 13);
     353      this.stepSizeLabel.TabIndex = 4;
     354      this.stepSizeLabel.Text = "Step size:";
     355      //
     356      // maximumLabel
     357      //
     358      this.maximumLabel.AutoSize = true;
     359      this.maximumLabel.Location = new System.Drawing.Point(13, 63);
     360      this.maximumLabel.Name = "maximumLabel";
     361      this.maximumLabel.Size = new System.Drawing.Size(54, 13);
     362      this.maximumLabel.TabIndex = 2;
     363      this.maximumLabel.Text = "Maximum:";
     364      //
     365      // minimumLabel
     366      //
     367      this.minimumLabel.AutoSize = true;
     368      this.minimumLabel.Location = new System.Drawing.Point(13, 37);
     369      this.minimumLabel.Name = "minimumLabel";
     370      this.minimumLabel.Size = new System.Drawing.Size(51, 13);
     371      this.minimumLabel.TabIndex = 0;
     372      this.minimumLabel.Text = "Minimum:";
    335373      //
    336374      // choicesListView
    337375      //
    338       this.choicesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    339             | System.Windows.Forms.AnchorStyles.Left)
    340             | System.Windows.Forms.AnchorStyles.Right)));
     376      this.choicesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     377                  | System.Windows.Forms.AnchorStyles.Left)
     378                  | System.Windows.Forms.AnchorStyles.Right)));
    341379      this.choicesListView.CheckBoxes = true;
    342380      this.choicesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     
    355393      this.columnHeader2.Width = 150;
    356394      //
    357       // stepSizeTextBox
    358       //
    359       this.stepSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    360             | System.Windows.Forms.AnchorStyles.Right)));
    361       this.stepSizeTextBox.Location = new System.Drawing.Point(73, 64);
    362       this.stepSizeTextBox.Name = "stepSizeTextBox";
    363       this.stepSizeTextBox.Size = new System.Drawing.Size(83, 20);
    364       this.stepSizeTextBox.TabIndex = 5;
    365       this.stepSizeTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
    366       //
    367       // maximumTextBox
    368       //
    369       this.maximumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    370             | System.Windows.Forms.AnchorStyles.Right)));
    371       this.maximumTextBox.Location = new System.Drawing.Point(73, 38);
    372       this.maximumTextBox.Name = "maximumTextBox";
    373       this.maximumTextBox.Size = new System.Drawing.Size(83, 20);
    374       this.maximumTextBox.TabIndex = 3;
    375       this.maximumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
    376       //
    377       // minimumTextBox
    378       //
    379       this.minimumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    380             | System.Windows.Forms.AnchorStyles.Right)));
    381       this.minimumTextBox.Location = new System.Drawing.Point(73, 12);
    382       this.minimumTextBox.Name = "minimumTextBox";
    383       this.minimumTextBox.Size = new System.Drawing.Size(83, 20);
    384       this.minimumTextBox.TabIndex = 1;
    385       this.minimumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);
    386       //
    387       // stepSizeLabel
    388       //
    389       this.stepSizeLabel.AutoSize = true;
    390       this.stepSizeLabel.Location = new System.Drawing.Point(13, 67);
    391       this.stepSizeLabel.Name = "stepSizeLabel";
    392       this.stepSizeLabel.Size = new System.Drawing.Size(53, 13);
    393       this.stepSizeLabel.TabIndex = 4;
    394       this.stepSizeLabel.Text = "Step size:";
    395       //
    396       // maximumLabel
    397       //
    398       this.maximumLabel.AutoSize = true;
    399       this.maximumLabel.Location = new System.Drawing.Point(13, 41);
    400       this.maximumLabel.Name = "maximumLabel";
    401       this.maximumLabel.Size = new System.Drawing.Size(54, 13);
    402       this.maximumLabel.TabIndex = 2;
    403       this.maximumLabel.Text = "Maximum:";
    404       //
    405       // minimumLabel
    406       //
    407       this.minimumLabel.AutoSize = true;
    408       this.minimumLabel.Location = new System.Drawing.Point(13, 15);
    409       this.minimumLabel.Name = "minimumLabel";
    410       this.minimumLabel.Size = new System.Drawing.Size(51, 13);
    411       this.minimumLabel.TabIndex = 0;
    412       this.minimumLabel.Text = "Minimum:";
    413       //
    414395      // instancesTabPage
    415396      //
     
    419400      this.instancesTabPage.Controls.Add(this.instanceDiscoveryProgressLabel);
    420401      this.instancesTabPage.Controls.Add(this.selectAllCheckBox);
    421       this.instancesTabPage.Controls.Add(this.instancesListView);
     402      this.instancesTabPage.Controls.Add(this.instancesTreeView);
    422403      this.instancesTabPage.Location = new System.Drawing.Point(4, 22);
    423404      this.instancesTabPage.Name = "instancesTabPage";
     
    437418      this.label1.Text = "Select:";
    438419      //
     420      // instancesTreeView
     421      //
     422      this.instancesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     423                  | System.Windows.Forms.AnchorStyles.Left)
     424                  | System.Windows.Forms.AnchorStyles.Right)));
     425      this.instancesTreeView.CheckBoxes = true;
     426      this.instancesTreeView.Location = new System.Drawing.Point(6, 35);
     427      this.instancesTreeView.Name = "instancesTreeView";
     428      this.instancesTreeView.Size = new System.Drawing.Size(308, 232);
     429      this.instancesTreeView.TabIndex = 6;
     430      this.instancesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.instancesTreeView_AfterCheck);
     431      //
    439432      // experimentsToCreateDescriptionLabel
    440433      //
     
    443436      this.experimentsToCreateDescriptionLabel.Location = new System.Drawing.Point(12, 364);
    444437      this.experimentsToCreateDescriptionLabel.Name = "experimentsToCreateDescriptionLabel";
    445       this.experimentsToCreateDescriptionLabel.Size = new System.Drawing.Size(112, 13);
     438      this.experimentsToCreateDescriptionLabel.Size = new System.Drawing.Size(56, 13);
    446439      this.experimentsToCreateDescriptionLabel.TabIndex = 5;
    447       this.experimentsToCreateDescriptionLabel.Text = "Experiments to create:";
    448       //
    449       // experimentsLabel
    450       //
    451       this.experimentsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    452       this.experimentsLabel.AutoSize = true;
    453       this.experimentsLabel.Location = new System.Drawing.Point(130, 364);
    454       this.experimentsLabel.Name = "experimentsLabel";
    455       this.experimentsLabel.Size = new System.Drawing.Size(13, 13);
    456       this.experimentsLabel.TabIndex = 6;
    457       this.experimentsLabel.Text = "1";
     440      this.experimentsToCreateDescriptionLabel.Text = "Variations:";
     441      //
     442      // variationsLabel
     443      //
     444      this.variationsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     445      this.variationsLabel.AutoSize = true;
     446      this.variationsLabel.Location = new System.Drawing.Point(74, 364);
     447      this.variationsLabel.Name = "variationsLabel";
     448      this.variationsLabel.Size = new System.Drawing.Size(13, 13);
     449      this.variationsLabel.TabIndex = 6;
     450      this.variationsLabel.Text = "1";
     451      this.variationsLabel.TextChanged += new System.EventHandler(this.experimentsLabel_TextChanged);
    458452      //
    459453      // errorProvider
    460454      //
     455      this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
    461456      this.errorProvider.ContainerControl = this;
    462457      //
    463458      // experimentCreationProgressBar
    464459      //
    465       this.experimentCreationProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
    466             | System.Windows.Forms.AnchorStyles.Right)));
     460      this.experimentCreationProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     461                  | System.Windows.Forms.AnchorStyles.Right)));
    467462      this.experimentCreationProgressBar.Location = new System.Drawing.Point(187, 359);
    468463      this.experimentCreationProgressBar.Name = "experimentCreationProgressBar";
     
    470465      this.experimentCreationProgressBar.TabIndex = 9;
    471466      this.experimentCreationProgressBar.Visible = false;
     467      //
     468      // warningProvider
     469      //
     470      this.warningProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     471      this.warningProvider.ContainerControl = this;
     472      this.warningProvider.Icon = ((System.Drawing.Icon)(resources.GetObject("warningProvider.Icon")));
    472473      //
    473474      // CreateExperimentDialog
     
    479480      this.ClientSize = new System.Drawing.Size(355, 394);
    480481      this.Controls.Add(this.experimentCreationProgressBar);
    481       this.Controls.Add(this.experimentsLabel);
     482      this.Controls.Add(this.variationsLabel);
    482483      this.Controls.Add(this.experimentsToCreateDescriptionLabel);
    483484      this.Controls.Add(this.tabControl);
     
    509510      this.instancesTabPage.PerformLayout();
    510511      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     512      ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).EndInit();
    511513      this.ResumeLayout(false);
    512514      this.PerformLayout();
     
    523525    private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown;
    524526    private System.Windows.Forms.ToolTip toolTip;
    525     private System.Windows.Forms.ListView instancesListView;
    526     private System.Windows.Forms.ColumnHeader columnHeader;
    527527    private System.ComponentModel.BackgroundWorker experimentCreationBackgroundWorker;
    528528    private System.Windows.Forms.ProgressBar instanceDiscoveryProgressBar;
     
    538538    private System.Windows.Forms.ColumnHeader columnHeader1;
    539539    private System.Windows.Forms.Label experimentsToCreateDescriptionLabel;
    540     private System.Windows.Forms.Label experimentsLabel;
    541     private System.Windows.Forms.Label choicesLabel;
     540    private System.Windows.Forms.Label variationsLabel;
     541    private System.Windows.Forms.Label detailsTypeLabel;
    542542    private System.Windows.Forms.ListView choicesListView;
    543543    private System.Windows.Forms.ColumnHeader columnHeader2;
     
    551551    private System.Windows.Forms.ErrorProvider errorProvider;
    552552    private System.Windows.Forms.ProgressBar experimentCreationProgressBar;
     553    private System.Windows.Forms.ErrorProvider warningProvider;
     554    private System.Windows.Forms.TreeView instancesTreeView;
    553555
    554556  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs

    r7908 r7957  
    4646        okButton.Enabled = optimizer != null;
    4747        SetTabControlVisibility();
    48         FillInstanceListViewAsync();
     48        FillInstanceTreeViewAsync();
    4949        FillParametersListView();
    5050      }
     
    6363    private StringBuilder failedInstances;
    6464    private EventWaitHandle backgroundWorkerWaitHandle = new ManualResetEvent(false);
    65     private bool suppressListViewEventHandling;
     65    private bool suppressTreeViewEventHandling, suppressCheckAllNoneEventHandling;
    6666
    6767    public CreateExperimentDialog() : this(null) { }
    6868    public CreateExperimentDialog(IOptimizer optimizer) {
    6969      InitializeComponent();
     70      instanceDiscoveryProgressLabel.BackColor = instancesTabPage.BackColor;
    7071      createBatchRun = createBatchRunCheckBox.Checked;
    7172      repetitions = (int)repetitionsNumericUpDown.Value;
     
    8586    private void CreateExperimentDialog_Load(object sender, EventArgs e) {
    8687      SetTabControlVisibility();
    87       FillInstanceListViewAsync();
     88      FillInstanceTreeViewAsync();
    8889      FillParametersListView();
    8990    }
     
    119120        if (e.Item.Checked) {
    120121          multipleChoiceParameters.Add(parameter, new HashSet<INamedItem>());
    121         } else multipleChoiceParameters.Remove(parameter);
     122        } else {
     123          multipleChoiceParameters.Remove(parameter);
     124        }
    122125      }
    123126
     
    148151      }
    149152
     153      UpdateVariationsLabel();
    150154      if (e.Item.Selected) UpdateDetailsView(parameter);
    151155      else e.Item.Selected = true;
     
    169173
    170174      if (isConstrainedValueParameter) {
    171         choicesLabel.Visible = true;
     175        detailsTypeLabel.Text = "Choices:";
    172176        choicesListView.Enabled = true;
    173177        choicesListView.Visible = true;
     
    186190      }
    187191
    188       minimumLabel.Visible = true; minimumTextBox.Visible = true;
    189       maximumLabel.Visible = true; maximumTextBox.Visible = true;
    190       stepSizeLabel.Visible = true; stepSizeTextBox.Visible = true;
     192      if (!(parameter.Value is ValueTypeValue<bool>)) {
     193        minimumLabel.Visible = true; minimumTextBox.Visible = true;
     194        maximumLabel.Visible = true; maximumTextBox.Visible = true;
     195        stepSizeLabel.Visible = true; stepSizeTextBox.Visible = true;
     196      } else detailsTypeLabel.Text = "Boolean parameter: True / False";
    191197
    192198      var intValue = parameter.Value as ValueTypeValue<int>;
    193199      if (intValue != null) {
     200        detailsTypeLabel.Text = "Integer parameter:";
    194201        if (!intParameters.ContainsKey(parameter)) return;
    195202        string min = intParameters[parameter].Item1.ToString();
     
    202209      var doubleValue = parameter.Value as ValueTypeValue<double>;
    203210      if (doubleValue != null) {
     211        detailsTypeLabel.Text = "Double parameter:";
    204212        if (!doubleParameters.ContainsKey(parameter)) return;
    205213        string min = doubleParameters[parameter].Item1.ToString();
     
    218226      } else multipleChoiceParameters[parameter].Remove((INamedItem)e.Item.Tag);
    219227
    220       experimentsLabel.Text = GetNumberOfVariations().ToString();
     228      UpdateVariationsLabel();
    221229    }
    222230
     
    257265      }
    258266
    259       experimentsLabel.Text = GetNumberOfVariations().ToString();
     267      UpdateVariationsLabel();
    260268    }
    261269    #endregion
     
    263271
    264272    #region Instances
    265     private void instancesListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
    266       if (!suppressListViewEventHandling) {
    267         selectAllCheckBox.Checked = instancesListView.Items.Count == instancesListView.CheckedItems.Count;
    268         selectNoneCheckBox.Checked = instancesListView.CheckedItems.Count == 0;
    269       }
    270       var provider = (IProblemInstanceProvider)e.Item.Group.Tag;
    271       var descriptor = (IDataDescriptor)e.Item.Tag;
    272       if (e.Item.Checked) {
     273    private void instancesTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
     274      if (!suppressTreeViewEventHandling) {
     275        if (e.Node.Nodes.Count > 0) { // provider node was (un)checked
     276          SyncProviderNode(e.Node);
     277        } else { // descriptor node was (un)checked
     278          SyncInstanceNode(e.Node);
     279        }
     280
     281        suppressCheckAllNoneEventHandling = true;
     282        try {
     283          var treeViewNodes = instancesTreeView.Nodes.OfType<TreeNode>().SelectMany(x => x.Nodes.OfType<TreeNode>());
     284          selectAllCheckBox.Checked = treeViewNodes.Count() == instances.SelectMany(x => x.Value).Count();
     285          selectNoneCheckBox.Checked = !treeViewNodes.Any(x => x.Checked);
     286        } finally { suppressCheckAllNoneEventHandling = false; }
     287        UpdateVariationsLabel();
     288      }
     289    }
     290
     291    private void SyncProviderNode(TreeNode node) {
     292      suppressTreeViewEventHandling = true;
     293      try {
     294        foreach (TreeNode n in node.Nodes) {
     295          if (n.Checked != node.Checked) {
     296            n.Checked = node.Checked;
     297            SyncInstanceNode(n, false);
     298          }
     299        }
     300      } finally { suppressTreeViewEventHandling = false; }
     301    }
     302
     303    private void SyncInstanceNode(TreeNode node, bool providerCheck = true) {
     304      var provider = (IProblemInstanceProvider)node.Parent.Tag;
     305      var descriptor = (IDataDescriptor)node.Tag;
     306      if (node.Checked) {
    273307        if (!instances.ContainsKey(provider))
    274308          instances.Add(provider, new HashSet<IDataDescriptor>());
     
    281315        }
    282316      }
    283       experimentsLabel.Text = GetNumberOfVariations().ToString();
     317      if (providerCheck) {
     318        bool allChecked = node.Parent.Nodes.OfType<TreeNode>().All(x => x.Checked);
     319        suppressTreeViewEventHandling = true;
     320        try {
     321          node.Parent.Checked = allChecked;
     322        } finally { suppressTreeViewEventHandling = false; }
     323      }
    284324    }
    285325
    286326    private void selectAllCheckBox_CheckedChanged(object sender, EventArgs e) {
    287       if (selectAllCheckBox.Checked) {
    288         selectNoneCheckBox.Checked = false;
    289         if (instancesListView.CheckedItems.Count == instancesListView.Items.Count) return;
    290         try {
    291           suppressListViewEventHandling = true;
    292           foreach (var item in instancesListView.Items.OfType<ListViewItem>()) {
    293             item.Checked = true;
    294           }
    295         } finally { suppressListViewEventHandling = false; }
     327      if (!suppressCheckAllNoneEventHandling) {
     328        if (selectAllCheckBox.Checked) {
     329          suppressCheckAllNoneEventHandling = true;
     330          try { selectNoneCheckBox.Checked = false; } finally { suppressCheckAllNoneEventHandling = false; }
     331          try {
     332            suppressTreeViewEventHandling = true;
     333            foreach (TreeNode node in instancesTreeView.Nodes) {
     334              if (!node.Checked) {
     335                node.Checked = true;
     336                SyncProviderNode(node);
     337              }
     338            }
     339          } finally { suppressTreeViewEventHandling = false; }
     340        }
    296341      }
    297342    }
    298343
    299344    private void selectNoneCheckBox_CheckedChanged(object sender, EventArgs e) {
    300       if (selectNoneCheckBox.Checked) {
    301         selectAllCheckBox.Checked = false;
    302         if (instancesListView.CheckedItems.Count == 0) return;
    303         try {
    304           suppressListViewEventHandling = true;
    305           foreach (var item in instancesListView.Items.OfType<ListViewItem>()) {
    306             item.Checked = false;
    307           }
    308         } finally { suppressListViewEventHandling = false; }
     345      if (!suppressCheckAllNoneEventHandling) {
     346        if (selectNoneCheckBox.Checked) {
     347          suppressCheckAllNoneEventHandling = true;
     348          try { selectAllCheckBox.Checked = false; } finally { suppressCheckAllNoneEventHandling = false; }
     349          try {
     350            suppressTreeViewEventHandling = true;
     351            foreach (TreeNode node in instancesTreeView.Nodes) {
     352              if (node.Checked) {
     353                node.Checked = false;
     354                SyncProviderNode(node);
     355              }
     356            }
     357          } finally { suppressTreeViewEventHandling = false; }
     358        }
    309359      }
    310360    }
     
    320370        repetitionsNumericUpDown.Text = repetitionsNumericUpDown.Value.ToString();
    321371      repetitions = (int)repetitionsNumericUpDown.Value;
     372    }
     373
     374    private void experimentsLabel_TextChanged(object sender, EventArgs e) {
     375      long number;
     376      if (long.TryParse(variationsLabel.Text, NumberStyles.AllowThousands, CultureInfo.CurrentCulture.NumberFormat, out number)) {
     377        if (number > 1000) warningProvider.SetError(variationsLabel, "Consider reducing the number of variations!");
     378        else warningProvider.SetError(variationsLabel, null);
     379      }
    322380    }
    323381    #endregion
     
    335393      tabControl.Visible = isAlgorithm;
    336394      if (isAlgorithm) {
    337         experimentsLabel.Visible = true;
     395        variationsLabel.Visible = true;
    338396        experimentsToCreateDescriptionLabel.Visible = true;
    339397        Height = 430;
    340398      } else {
    341         experimentsLabel.Visible = false;
     399        variationsLabel.Visible = false;
    342400        experimentsToCreateDescriptionLabel.Visible = false;
    343401        Height = 130;
     
    366424    }
    367425
    368     private void FillInstanceListViewAsync() {
     426    private void FillInstanceTreeViewAsync() {
    369427      instances.Clear();
    370       instancesListView.Items.Clear();
    371       instancesListView.Groups.Clear();
    372 
    373       if (Optimizer is IAlgorithm) {
     428      instancesTreeView.Nodes.Clear();
     429
     430      if (Optimizer is IAlgorithm && ((IAlgorithm)Optimizer).Problem != null) {
    374431        SetMode(DialogMode.DiscoveringInstances);
    375         var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem);
    376         instanceDiscoveryBackgroundWorker.RunWorkerAsync(instanceProviders);
     432        instanceDiscoveryBackgroundWorker.RunWorkerAsync();
    377433      }
    378434    }
     
    421477      selectAllCheckBox.Enabled = mode == DialogMode.Normal;
    422478      selectNoneCheckBox.Enabled = mode == DialogMode.Normal;
    423       instancesListView.Enabled = mode == DialogMode.Normal;
    424       instancesListView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment;
     479      instancesTreeView.Enabled = mode == DialogMode.Normal;
     480      instancesTreeView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment;
    425481      okButton.Enabled = mode == DialogMode.Normal;
    426       okButton.Visible = mode == DialogMode.Normal;
     482      okButton.Visible = mode != DialogMode.CreatingExperiment;
    427483      instanceDiscoveryProgressLabel.Visible = mode == DialogMode.DiscoveringInstances;
    428484      instanceDiscoveryProgressBar.Visible = mode == DialogMode.DiscoveringInstances;
     
    443499      stepSizeTextBox.Enabled = false;
    444500      stepSizeTextBox.Visible = false;
    445       choicesLabel.Visible = false;
    446501      choicesListView.Items.Clear();
    447502      choicesListView.Enabled = false;
     
    467522    }
    468523
     524    private void UpdateVariationsLabel() {
     525      variationsLabel.Text = GetNumberOfVariations().ToString("#,#", CultureInfo.CurrentCulture);
     526    }
     527
    469528    #region Retrieve parameter combinations
    470529    private IEnumerable<Dictionary<IValueParameter, int>> GetIntParameterConfigurations() {
     
    575634    #region Instance discovery
    576635    private void instanceDiscoveryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
    577       var instanceProviders = ((IEnumerable<IProblemInstanceProvider>)e.Argument).ToArray();
    578       var groups = new ListViewGroup[instanceProviders.Length];
     636      var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem).ToArray();
     637      var nodes = new TreeNode[instanceProviders.Length];
    579638      for (int i = 0; i < instanceProviders.Length; i++) {
    580639        var provider = instanceProviders[i];
    581         groups[i] = new ListViewGroup(provider.Name, provider.Name) { Tag = provider };
    582       }
    583       e.Result = groups;
    584       for (int i = 0; i < groups.Length; i++) {
    585         var group = groups[i];
    586         var provider = group.Tag as IProblemInstanceProvider;
    587         double progress = (100.0 * i) / groups.Length;
    588         instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, provider.Name);
     640        nodes[i] = new TreeNode(provider.Name) { Tag = provider };
     641      }
     642      e.Result = nodes;
     643      for (int i = 0; i < nodes.Length; i++) {
     644        var providerNode = nodes[i];
     645        var provider = providerNode.Tag as IProblemInstanceProvider;
     646        double progress = i / (double)nodes.Length;
     647        instanceDiscoveryBackgroundWorker.ReportProgress((int)(100 * progress), provider.Name);
    589648        var descriptors = ProblemInstanceManager.GetDataDescriptors(provider).ToArray();
    590649        for (int j = 0; j < descriptors.Length; j++) {
     
    595654          }
    596655          #endregion
    597           var d = descriptors[j];
    598           progress += 1.0 / (descriptors.Length * groups.Length);
    599           instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, d.Name);
    600           var item = new ListViewItem(d.Name, group) { Tag = d };
     656          var node = new TreeNode(descriptors[j].Name) { Tag = descriptors[j] };
     657          providerNode.Nodes.Add(node);
    601658        }
    602659      }
     
    605662
    606663    private void instanceDiscoveryBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
    607       instanceDiscoveryProgressBar.Value = e.ProgressPercentage;
     664      if (instanceDiscoveryProgressBar.Value != e.ProgressPercentage)
     665        instanceDiscoveryProgressBar.Value = e.ProgressPercentage;
    608666      instanceDiscoveryProgressLabel.Text = (string)e.UserState;
     667      Application.DoEvents();
    609668    }
    610669
    611670    private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    612671      try {
    613         // unfortunately it's not enough to just add the groups, the items need to be added separately
    614         foreach (var group in (ListViewGroup[])e.Result) {
    615           instancesListView.Groups.Add(group);
    616           instancesListView.Items.AddRange(group.Items);
    617         }
    618         instancesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     672        instancesTreeView.Nodes.AddRange((TreeNode[])e.Result);
     673        foreach (TreeNode node in instancesTreeView.Nodes)
     674          node.Collapse();
    619675        selectNoneCheckBox.Checked = true;
    620676      } catch { }
     
    639695
    640696      } else {
    641         int counter = 0, totalInstances = instances.SelectMany(x => x.Value).Count(), totalVariations = GetNumberOfVariations();
     697        int counter = 0, totalVariations = GetNumberOfVariations();
    642698        foreach (var provider in instances.Keys) {
    643699          foreach (var descriptor in instances[provider]) {
     
    662718                AddOptimizer(v, localExperiment);
    663719                counter++;
     720                experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / totalVariations), descriptor.Name);
    664721              }
    665               experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / (totalInstances * totalVariations)), descriptor.Name);
    666             } else experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / (totalInstances * totalVariations)), "Loading failed (" + descriptor.Name + ")");
     722            } else experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / totalVariations), "Loading failed (" + descriptor.Name + ")");
    667723          }
    668724        }
     
    761817    private void experimentCreationBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
    762818      experimentCreationProgressBar.Value = e.ProgressPercentage;
     819      Application.DoEvents();
    763820    }
    764821
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r7908 r7957  
    116116  </ItemGroup>
    117117  <ItemGroup>
     118    <EmbeddedResource Include="CreateExperimentDialog.resx">
     119      <DependentUpon>CreateExperimentDialog.cs</DependentUpon>
     120    </EmbeddedResource>
    118121    <EmbeddedResource Include="Documents\GA_VRP.hl" />
    119122    <EmbeddedResource Include="Documents\SGP_SymbClass.hl" />
Note: See TracChangeset for help on using the changeset viewer.