Changeset 7957 for trunk/sources/HeuristicLab.Optimizer
- Timestamp:
- 06/05/12 04:08:16 (13 years ago)
- 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 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreateExperimentDialog)); 48 49 this.okButton = new System.Windows.Forms.Button(); 49 50 this.cancelButton = new System.Windows.Forms.Button(); … … 53 54 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 54 55 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()));57 56 this.experimentCreationBackgroundWorker = new System.ComponentModel.BackgroundWorker(); 58 57 this.instanceDiscoveryProgressBar = new System.Windows.Forms.ProgressBar(); … … 66 65 this.parametersListView = new System.Windows.Forms.ListView(); 67 66 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(); 71 68 this.stepSizeTextBox = new System.Windows.Forms.TextBox(); 72 69 this.maximumTextBox = new System.Windows.Forms.TextBox(); … … 75 72 this.maximumLabel = new System.Windows.Forms.Label(); 76 73 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())); 77 76 this.instancesTabPage = new System.Windows.Forms.TabPage(); 78 77 this.label1 = new System.Windows.Forms.Label(); 78 this.instancesTreeView = new System.Windows.Forms.TreeView(); 79 79 this.experimentsToCreateDescriptionLabel = new System.Windows.Forms.Label(); 80 this. experimentsLabel = new System.Windows.Forms.Label();80 this.variationsLabel = new System.Windows.Forms.Label(); 81 81 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 82 82 this.experimentCreationProgressBar = new System.Windows.Forms.ProgressBar(); 83 this.warningProvider = new System.Windows.Forms.ErrorProvider(this.components); 83 84 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 84 85 this.tabControl.SuspendLayout(); … … 90 91 this.instancesTabPage.SuspendLayout(); 91 92 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 93 ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).BeginInit(); 92 94 this.SuspendLayout(); 93 95 // … … 149 151 // repetitionsNumericUpDown 150 152 // 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))); 153 155 this.repetitionsNumericUpDown.Location = new System.Drawing.Point(113, 28); 154 156 this.repetitionsNumericUpDown.Maximum = new decimal(new int[] { … … 174 176 this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated); 175 177 // 176 // instancesListView177 //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 // columnHeader194 //195 this.columnHeader.Width = 150;196 //197 178 // experimentCreationBackgroundWorker 198 179 // … … 257 238 // tabControl 258 239 // 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))); 262 243 this.tabControl.Controls.Add(this.parametersTabPage); 263 244 this.tabControl.Controls.Add(this.instancesTabPage); … … 292 273 // parametersSplitContainer.Panel2 293 274 // 294 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesLabel); 295 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView); 275 this.parametersSplitContainer.Panel2.Controls.Add(this.detailsTypeLabel); 296 276 this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeTextBox); 297 277 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumTextBox); … … 300 280 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumLabel); 301 281 this.parametersSplitContainer.Panel2.Controls.Add(this.minimumLabel); 282 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView); 302 283 this.parametersSplitContainer.Size = new System.Drawing.Size(314, 267); 303 284 this.parametersSplitContainer.SplitterDistance = 124; … … 325 306 this.columnHeader1.Width = 150; 326 307 // 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:"; 335 373 // 336 374 // choicesListView 337 375 // 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))); 341 379 this.choicesListView.CheckBoxes = true; 342 380 this.choicesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { … … 355 393 this.columnHeader2.Width = 150; 356 394 // 357 // stepSizeTextBox358 //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 // maximumTextBox368 //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 // minimumTextBox378 //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 // stepSizeLabel388 //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 // maximumLabel397 //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 // minimumLabel406 //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 //414 395 // instancesTabPage 415 396 // … … 419 400 this.instancesTabPage.Controls.Add(this.instanceDiscoveryProgressLabel); 420 401 this.instancesTabPage.Controls.Add(this.selectAllCheckBox); 421 this.instancesTabPage.Controls.Add(this.instances ListView);402 this.instancesTabPage.Controls.Add(this.instancesTreeView); 422 403 this.instancesTabPage.Location = new System.Drawing.Point(4, 22); 423 404 this.instancesTabPage.Name = "instancesTabPage"; … … 437 418 this.label1.Text = "Select:"; 438 419 // 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 // 439 432 // experimentsToCreateDescriptionLabel 440 433 // … … 443 436 this.experimentsToCreateDescriptionLabel.Location = new System.Drawing.Point(12, 364); 444 437 this.experimentsToCreateDescriptionLabel.Name = "experimentsToCreateDescriptionLabel"; 445 this.experimentsToCreateDescriptionLabel.Size = new System.Drawing.Size( 112, 13);438 this.experimentsToCreateDescriptionLabel.Size = new System.Drawing.Size(56, 13); 446 439 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); 458 452 // 459 453 // errorProvider 460 454 // 455 this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; 461 456 this.errorProvider.ContainerControl = this; 462 457 // 463 458 // experimentCreationProgressBar 464 459 // 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))); 467 462 this.experimentCreationProgressBar.Location = new System.Drawing.Point(187, 359); 468 463 this.experimentCreationProgressBar.Name = "experimentCreationProgressBar"; … … 470 465 this.experimentCreationProgressBar.TabIndex = 9; 471 466 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"))); 472 473 // 473 474 // CreateExperimentDialog … … 479 480 this.ClientSize = new System.Drawing.Size(355, 394); 480 481 this.Controls.Add(this.experimentCreationProgressBar); 481 this.Controls.Add(this. experimentsLabel);482 this.Controls.Add(this.variationsLabel); 482 483 this.Controls.Add(this.experimentsToCreateDescriptionLabel); 483 484 this.Controls.Add(this.tabControl); … … 509 510 this.instancesTabPage.PerformLayout(); 510 511 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 512 ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).EndInit(); 511 513 this.ResumeLayout(false); 512 514 this.PerformLayout(); … … 523 525 private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown; 524 526 private System.Windows.Forms.ToolTip toolTip; 525 private System.Windows.Forms.ListView instancesListView;526 private System.Windows.Forms.ColumnHeader columnHeader;527 527 private System.ComponentModel.BackgroundWorker experimentCreationBackgroundWorker; 528 528 private System.Windows.Forms.ProgressBar instanceDiscoveryProgressBar; … … 538 538 private System.Windows.Forms.ColumnHeader columnHeader1; 539 539 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; 542 542 private System.Windows.Forms.ListView choicesListView; 543 543 private System.Windows.Forms.ColumnHeader columnHeader2; … … 551 551 private System.Windows.Forms.ErrorProvider errorProvider; 552 552 private System.Windows.Forms.ProgressBar experimentCreationProgressBar; 553 private System.Windows.Forms.ErrorProvider warningProvider; 554 private System.Windows.Forms.TreeView instancesTreeView; 553 555 554 556 } -
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r7908 r7957 46 46 okButton.Enabled = optimizer != null; 47 47 SetTabControlVisibility(); 48 FillInstance ListViewAsync();48 FillInstanceTreeViewAsync(); 49 49 FillParametersListView(); 50 50 } … … 63 63 private StringBuilder failedInstances; 64 64 private EventWaitHandle backgroundWorkerWaitHandle = new ManualResetEvent(false); 65 private bool suppress ListViewEventHandling;65 private bool suppressTreeViewEventHandling, suppressCheckAllNoneEventHandling; 66 66 67 67 public CreateExperimentDialog() : this(null) { } 68 68 public CreateExperimentDialog(IOptimizer optimizer) { 69 69 InitializeComponent(); 70 instanceDiscoveryProgressLabel.BackColor = instancesTabPage.BackColor; 70 71 createBatchRun = createBatchRunCheckBox.Checked; 71 72 repetitions = (int)repetitionsNumericUpDown.Value; … … 85 86 private void CreateExperimentDialog_Load(object sender, EventArgs e) { 86 87 SetTabControlVisibility(); 87 FillInstance ListViewAsync();88 FillInstanceTreeViewAsync(); 88 89 FillParametersListView(); 89 90 } … … 119 120 if (e.Item.Checked) { 120 121 multipleChoiceParameters.Add(parameter, new HashSet<INamedItem>()); 121 } else multipleChoiceParameters.Remove(parameter); 122 } else { 123 multipleChoiceParameters.Remove(parameter); 124 } 122 125 } 123 126 … … 148 151 } 149 152 153 UpdateVariationsLabel(); 150 154 if (e.Item.Selected) UpdateDetailsView(parameter); 151 155 else e.Item.Selected = true; … … 169 173 170 174 if (isConstrainedValueParameter) { 171 choicesLabel.Visible = true;175 detailsTypeLabel.Text = "Choices:"; 172 176 choicesListView.Enabled = true; 173 177 choicesListView.Visible = true; … … 186 190 } 187 191 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"; 191 197 192 198 var intValue = parameter.Value as ValueTypeValue<int>; 193 199 if (intValue != null) { 200 detailsTypeLabel.Text = "Integer parameter:"; 194 201 if (!intParameters.ContainsKey(parameter)) return; 195 202 string min = intParameters[parameter].Item1.ToString(); … … 202 209 var doubleValue = parameter.Value as ValueTypeValue<double>; 203 210 if (doubleValue != null) { 211 detailsTypeLabel.Text = "Double parameter:"; 204 212 if (!doubleParameters.ContainsKey(parameter)) return; 205 213 string min = doubleParameters[parameter].Item1.ToString(); … … 218 226 } else multipleChoiceParameters[parameter].Remove((INamedItem)e.Item.Tag); 219 227 220 experimentsLabel.Text = GetNumberOfVariations().ToString();228 UpdateVariationsLabel(); 221 229 } 222 230 … … 257 265 } 258 266 259 experimentsLabel.Text = GetNumberOfVariations().ToString();267 UpdateVariationsLabel(); 260 268 } 261 269 #endregion … … 263 271 264 272 #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) { 273 307 if (!instances.ContainsKey(provider)) 274 308 instances.Add(provider, new HashSet<IDataDescriptor>()); … … 281 315 } 282 316 } 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 } 284 324 } 285 325 286 326 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 } 296 341 } 297 342 } 298 343 299 344 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 } 309 359 } 310 360 } … … 320 370 repetitionsNumericUpDown.Text = repetitionsNumericUpDown.Value.ToString(); 321 371 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 } 322 380 } 323 381 #endregion … … 335 393 tabControl.Visible = isAlgorithm; 336 394 if (isAlgorithm) { 337 experimentsLabel.Visible = true;395 variationsLabel.Visible = true; 338 396 experimentsToCreateDescriptionLabel.Visible = true; 339 397 Height = 430; 340 398 } else { 341 experimentsLabel.Visible = false;399 variationsLabel.Visible = false; 342 400 experimentsToCreateDescriptionLabel.Visible = false; 343 401 Height = 130; … … 366 424 } 367 425 368 private void FillInstance ListViewAsync() {426 private void FillInstanceTreeViewAsync() { 369 427 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) { 374 431 SetMode(DialogMode.DiscoveringInstances); 375 var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem); 376 instanceDiscoveryBackgroundWorker.RunWorkerAsync(instanceProviders); 432 instanceDiscoveryBackgroundWorker.RunWorkerAsync(); 377 433 } 378 434 } … … 421 477 selectAllCheckBox.Enabled = mode == DialogMode.Normal; 422 478 selectNoneCheckBox.Enabled = mode == DialogMode.Normal; 423 instances ListView.Enabled = mode == DialogMode.Normal;424 instances ListView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment;479 instancesTreeView.Enabled = mode == DialogMode.Normal; 480 instancesTreeView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment; 425 481 okButton.Enabled = mode == DialogMode.Normal; 426 okButton.Visible = mode == DialogMode.Normal;482 okButton.Visible = mode != DialogMode.CreatingExperiment; 427 483 instanceDiscoveryProgressLabel.Visible = mode == DialogMode.DiscoveringInstances; 428 484 instanceDiscoveryProgressBar.Visible = mode == DialogMode.DiscoveringInstances; … … 443 499 stepSizeTextBox.Enabled = false; 444 500 stepSizeTextBox.Visible = false; 445 choicesLabel.Visible = false;446 501 choicesListView.Items.Clear(); 447 502 choicesListView.Enabled = false; … … 467 522 } 468 523 524 private void UpdateVariationsLabel() { 525 variationsLabel.Text = GetNumberOfVariations().ToString("#,#", CultureInfo.CurrentCulture); 526 } 527 469 528 #region Retrieve parameter combinations 470 529 private IEnumerable<Dictionary<IValueParameter, int>> GetIntParameterConfigurations() { … … 575 634 #region Instance discovery 576 635 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]; 579 638 for (int i = 0; i < instanceProviders.Length; i++) { 580 639 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); 589 648 var descriptors = ProblemInstanceManager.GetDataDescriptors(provider).ToArray(); 590 649 for (int j = 0; j < descriptors.Length; j++) { … … 595 654 } 596 655 #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); 601 658 } 602 659 } … … 605 662 606 663 private void instanceDiscoveryBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 607 instanceDiscoveryProgressBar.Value = e.ProgressPercentage; 664 if (instanceDiscoveryProgressBar.Value != e.ProgressPercentage) 665 instanceDiscoveryProgressBar.Value = e.ProgressPercentage; 608 666 instanceDiscoveryProgressLabel.Text = (string)e.UserState; 667 Application.DoEvents(); 609 668 } 610 669 611 670 private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 612 671 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(); 619 675 selectNoneCheckBox.Checked = true; 620 676 } catch { } … … 639 695 640 696 } else { 641 int counter = 0, total Instances = instances.SelectMany(x => x.Value).Count(), totalVariations = GetNumberOfVariations();697 int counter = 0, totalVariations = GetNumberOfVariations(); 642 698 foreach (var provider in instances.Keys) { 643 699 foreach (var descriptor in instances[provider]) { … … 662 718 AddOptimizer(v, localExperiment); 663 719 counter++; 720 experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / totalVariations), descriptor.Name); 664 721 } 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 + ")"); 667 723 } 668 724 } … … 761 817 private void experimentCreationBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 762 818 experimentCreationProgressBar.Value = e.ProgressPercentage; 819 Application.DoEvents(); 763 820 } 764 821 -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r7908 r7957 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <EmbeddedResource Include="CreateExperimentDialog.resx"> 119 <DependentUpon>CreateExperimentDialog.cs</DependentUpon> 120 </EmbeddedResource> 118 121 <EmbeddedResource Include="Documents\GA_VRP.hl" /> 119 122 <EmbeddedResource Include="Documents\SGP_SymbClass.hl" />
Note: See TracChangeset
for help on using the changeset viewer.