Changeset 7908 for trunk/sources/HeuristicLab.Optimizer
- Timestamp:
- 05/25/12 13:22:01 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimizer/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.Designer.cs
r7885 r7908 53 53 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 54 54 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 55 this.instancesLabel = new System.Windows.Forms.Label();56 55 this.instancesListView = new System.Windows.Forms.ListView(); 57 56 this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 58 57 this.experimentCreationBackgroundWorker = new System.ComponentModel.BackgroundWorker(); 59 this. experimentCreationProgressBar = new System.Windows.Forms.ProgressBar();60 this. progressLabel = new System.Windows.Forms.Label();58 this.instanceDiscoveryProgressBar = new System.Windows.Forms.ProgressBar(); 59 this.instanceDiscoveryProgressLabel = new System.Windows.Forms.Label(); 61 60 this.selectAllCheckBox = new System.Windows.Forms.CheckBox(); 62 61 this.selectNoneCheckBox = new System.Windows.Forms.CheckBox(); 63 62 this.instanceDiscoveryBackgroundWorker = new System.ComponentModel.BackgroundWorker(); 63 this.tabControl = new System.Windows.Forms.TabControl(); 64 this.parametersTabPage = new System.Windows.Forms.TabPage(); 65 this.parametersSplitContainer = new System.Windows.Forms.SplitContainer(); 66 this.parametersListView = new System.Windows.Forms.ListView(); 67 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())); 71 this.stepSizeTextBox = new System.Windows.Forms.TextBox(); 72 this.maximumTextBox = new System.Windows.Forms.TextBox(); 73 this.minimumTextBox = new System.Windows.Forms.TextBox(); 74 this.stepSizeLabel = new System.Windows.Forms.Label(); 75 this.maximumLabel = new System.Windows.Forms.Label(); 76 this.minimumLabel = new System.Windows.Forms.Label(); 77 this.instancesTabPage = new System.Windows.Forms.TabPage(); 78 this.label1 = new System.Windows.Forms.Label(); 79 this.experimentsToCreateDescriptionLabel = new System.Windows.Forms.Label(); 80 this.experimentsLabel = new System.Windows.Forms.Label(); 81 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 82 this.experimentCreationProgressBar = new System.Windows.Forms.ProgressBar(); 64 83 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 84 this.tabControl.SuspendLayout(); 85 this.parametersTabPage.SuspendLayout(); 86 ((System.ComponentModel.ISupportInitialize)(this.parametersSplitContainer)).BeginInit(); 87 this.parametersSplitContainer.Panel1.SuspendLayout(); 88 this.parametersSplitContainer.Panel2.SuspendLayout(); 89 this.parametersSplitContainer.SuspendLayout(); 90 this.instancesTabPage.SuspendLayout(); 91 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 65 92 this.SuspendLayout(); 66 93 // … … 70 97 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 71 98 this.okButton.Enabled = false; 72 this.okButton.Location = new System.Drawing.Point(1 13, 259);99 this.okButton.Location = new System.Drawing.Point(187, 359); 73 100 this.okButton.Name = "okButton"; 74 101 this.okButton.Size = new System.Drawing.Size(75, 23); 75 this.okButton.TabIndex = 4;102 this.okButton.TabIndex = 7; 76 103 this.okButton.Text = "&OK"; 77 104 this.okButton.UseVisualStyleBackColor = true; … … 82 109 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 83 110 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 84 this.cancelButton.Location = new System.Drawing.Point( 194, 259);111 this.cancelButton.Location = new System.Drawing.Point(268, 359); 85 112 this.cancelButton.Name = "cancelButton"; 86 113 this.cancelButton.Size = new System.Drawing.Size(75, 23); 87 this.cancelButton.TabIndex = 5;114 this.cancelButton.TabIndex = 8; 88 115 this.cancelButton.Text = "&Cancel"; 89 116 this.cancelButton.UseVisualStyleBackColor = true; … … 136 163 0}); 137 164 this.repetitionsNumericUpDown.Name = "repetitionsNumericUpDown"; 138 this.repetitionsNumericUpDown.Size = new System.Drawing.Size( 156, 20);165 this.repetitionsNumericUpDown.Size = new System.Drawing.Size(230, 20); 139 166 this.repetitionsNumericUpDown.TabIndex = 3; 140 167 this.repetitionsNumericUpDown.ThousandsSeparator = true; … … 147 174 this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated); 148 175 // 149 // instancesLabel150 //151 this.instancesLabel.AutoSize = true;152 this.instancesLabel.Location = new System.Drawing.Point(12, 54);153 this.instancesLabel.Name = "instancesLabel";154 this.instancesLabel.Size = new System.Drawing.Size(56, 13);155 this.instancesLabel.TabIndex = 2;156 this.instancesLabel.Text = "&Instances:";157 //158 176 // instancesListView 159 177 // … … 165 183 this.columnHeader}); 166 184 this.instancesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; 167 this.instancesListView.Location = new System.Drawing.Point( 113, 77);185 this.instancesListView.Location = new System.Drawing.Point(6, 35); 168 186 this.instancesListView.Name = "instancesListView"; 169 this.instancesListView.Size = new System.Drawing.Size( 156, 176);170 this.instancesListView.TabIndex = 6;187 this.instancesListView.Size = new System.Drawing.Size(308, 225); 188 this.instancesListView.TabIndex = 3; 171 189 this.instancesListView.UseCompatibleStateImageBehavior = false; 172 190 this.instancesListView.View = System.Windows.Forms.View.Details; … … 182 200 this.experimentCreationBackgroundWorker.WorkerSupportsCancellation = true; 183 201 this.experimentCreationBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.experimentCreationBackgroundWorker_DoWork); 184 this.experimentCreationBackgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this. backgroundWorker_ProgressChanged);202 this.experimentCreationBackgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.experimentCreationBackgroundWorker_ProgressChanged); 185 203 this.experimentCreationBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.experimentCreationBackgroundWorker_RunWorkerCompleted); 186 204 // 187 // experimentCreationProgressBar188 // 189 this. experimentCreationProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));190 this. experimentCreationProgressBar.Location = new System.Drawing.Point(128, 142);191 this. experimentCreationProgressBar.Name = "experimentCreationProgressBar";192 this. experimentCreationProgressBar.Size = new System.Drawing.Size(128, 23);193 this. experimentCreationProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;194 this. experimentCreationProgressBar.TabIndex = 7;195 this. experimentCreationProgressBar.Visible = false;196 // 197 // progressLabel198 // 199 this. progressLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));200 this. progressLabel.BackColor = System.Drawing.SystemColors.Control;201 this. progressLabel.Location = new System.Drawing.Point(128, 168);202 this. progressLabel.Name = "progressLabel";203 this. progressLabel.Size = new System.Drawing.Size(128, 23);204 this. progressLabel.TabIndex = 8;205 this. progressLabel.Text = "label1";206 this. progressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;207 this. progressLabel.Visible = false;205 // instanceDiscoveryProgressBar 206 // 207 this.instanceDiscoveryProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 208 this.instanceDiscoveryProgressBar.Location = new System.Drawing.Point(6, 132); 209 this.instanceDiscoveryProgressBar.Name = "instanceDiscoveryProgressBar"; 210 this.instanceDiscoveryProgressBar.Size = new System.Drawing.Size(308, 23); 211 this.instanceDiscoveryProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 212 this.instanceDiscoveryProgressBar.TabIndex = 4; 213 this.instanceDiscoveryProgressBar.Visible = false; 214 // 215 // instanceDiscoveryProgressLabel 216 // 217 this.instanceDiscoveryProgressLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 218 this.instanceDiscoveryProgressLabel.BackColor = System.Drawing.SystemColors.Control; 219 this.instanceDiscoveryProgressLabel.Location = new System.Drawing.Point(6, 158); 220 this.instanceDiscoveryProgressLabel.Name = "instanceDiscoveryProgressLabel"; 221 this.instanceDiscoveryProgressLabel.Size = new System.Drawing.Size(308, 23); 222 this.instanceDiscoveryProgressLabel.TabIndex = 5; 223 this.instanceDiscoveryProgressLabel.Text = "label1"; 224 this.instanceDiscoveryProgressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 225 this.instanceDiscoveryProgressLabel.Visible = false; 208 226 // 209 227 // selectAllCheckBox 210 228 // 211 229 this.selectAllCheckBox.AutoSize = true; 212 this.selectAllCheckBox.Location = new System.Drawing.Point( 113, 54);230 this.selectAllCheckBox.Location = new System.Drawing.Point(52, 12); 213 231 this.selectAllCheckBox.Name = "selectAllCheckBox"; 214 this.selectAllCheckBox.Size = new System.Drawing.Size( 67, 17);215 this.selectAllCheckBox.TabIndex = 9;216 this.selectAllCheckBox.Text = " selectall";232 this.selectAllCheckBox.Size = new System.Drawing.Size(36, 17); 233 this.selectAllCheckBox.TabIndex = 1; 234 this.selectAllCheckBox.Text = "all"; 217 235 this.selectAllCheckBox.UseVisualStyleBackColor = true; 218 236 this.selectAllCheckBox.CheckedChanged += new System.EventHandler(this.selectAllCheckBox_CheckedChanged); … … 221 239 // 222 240 this.selectNoneCheckBox.AutoSize = true; 223 this.selectNoneCheckBox.Location = new System.Drawing.Point( 186, 54);241 this.selectNoneCheckBox.Location = new System.Drawing.Point(94, 12); 224 242 this.selectNoneCheckBox.Name = "selectNoneCheckBox"; 225 this.selectNoneCheckBox.Size = new System.Drawing.Size( 81, 17);226 this.selectNoneCheckBox.TabIndex = 9;227 this.selectNoneCheckBox.Text = " selectnone";243 this.selectNoneCheckBox.Size = new System.Drawing.Size(50, 17); 244 this.selectNoneCheckBox.TabIndex = 2; 245 this.selectNoneCheckBox.Text = "none"; 228 246 this.selectNoneCheckBox.UseVisualStyleBackColor = true; 229 247 this.selectNoneCheckBox.CheckedChanged += new System.EventHandler(this.selectNoneCheckBox_CheckedChanged); … … 234 252 this.instanceDiscoveryBackgroundWorker.WorkerSupportsCancellation = true; 235 253 this.instanceDiscoveryBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.instanceDiscoveryBackgroundWorker_DoWork); 236 this.instanceDiscoveryBackgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this. backgroundWorker_ProgressChanged);254 this.instanceDiscoveryBackgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.instanceDiscoveryBackgroundWorker_ProgressChanged); 237 255 this.instanceDiscoveryBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.instanceDiscoveryBackgroundWorker_RunWorkerCompleted); 256 // 257 // tabControl 258 // 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))); 262 this.tabControl.Controls.Add(this.parametersTabPage); 263 this.tabControl.Controls.Add(this.instancesTabPage); 264 this.tabControl.Location = new System.Drawing.Point(15, 54); 265 this.tabControl.Name = "tabControl"; 266 this.tabControl.SelectedIndex = 0; 267 this.tabControl.Size = new System.Drawing.Size(328, 299); 268 this.tabControl.TabIndex = 4; 269 // 270 // parametersTabPage 271 // 272 this.parametersTabPage.Controls.Add(this.parametersSplitContainer); 273 this.parametersTabPage.Location = new System.Drawing.Point(4, 22); 274 this.parametersTabPage.Name = "parametersTabPage"; 275 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 276 this.parametersTabPage.Size = new System.Drawing.Size(320, 273); 277 this.parametersTabPage.TabIndex = 1; 278 this.parametersTabPage.Text = "Parameters Variation"; 279 this.parametersTabPage.UseVisualStyleBackColor = true; 280 // 281 // parametersSplitContainer 282 // 283 this.parametersSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 284 this.parametersSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; 285 this.parametersSplitContainer.Location = new System.Drawing.Point(3, 3); 286 this.parametersSplitContainer.Name = "parametersSplitContainer"; 287 // 288 // parametersSplitContainer.Panel1 289 // 290 this.parametersSplitContainer.Panel1.Controls.Add(this.parametersListView); 291 // 292 // parametersSplitContainer.Panel2 293 // 294 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesLabel); 295 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView); 296 this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeTextBox); 297 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumTextBox); 298 this.parametersSplitContainer.Panel2.Controls.Add(this.minimumTextBox); 299 this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeLabel); 300 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumLabel); 301 this.parametersSplitContainer.Panel2.Controls.Add(this.minimumLabel); 302 this.parametersSplitContainer.Size = new System.Drawing.Size(314, 267); 303 this.parametersSplitContainer.SplitterDistance = 124; 304 this.parametersSplitContainer.TabIndex = 1; 305 // 306 // parametersListView 307 // 308 this.parametersListView.CheckBoxes = true; 309 this.parametersListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 310 this.columnHeader1}); 311 this.parametersListView.Dock = System.Windows.Forms.DockStyle.Fill; 312 this.parametersListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; 313 this.parametersListView.Location = new System.Drawing.Point(0, 0); 314 this.parametersListView.MultiSelect = false; 315 this.parametersListView.Name = "parametersListView"; 316 this.parametersListView.Size = new System.Drawing.Size(124, 267); 317 this.parametersListView.TabIndex = 0; 318 this.parametersListView.UseCompatibleStateImageBehavior = false; 319 this.parametersListView.View = System.Windows.Forms.View.Details; 320 this.parametersListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.parametersListView_ItemChecked); 321 this.parametersListView.SelectedIndexChanged += new System.EventHandler(this.parametersListView_SelectedIndexChanged); 322 // 323 // columnHeader1 324 // 325 this.columnHeader1.Width = 150; 326 // 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:"; 335 // 336 // choicesListView 337 // 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))); 341 this.choicesListView.CheckBoxes = true; 342 this.choicesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 343 this.columnHeader2}); 344 this.choicesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; 345 this.choicesListView.Location = new System.Drawing.Point(16, 34); 346 this.choicesListView.Name = "choicesListView"; 347 this.choicesListView.Size = new System.Drawing.Size(155, 220); 348 this.choicesListView.TabIndex = 6; 349 this.choicesListView.UseCompatibleStateImageBehavior = false; 350 this.choicesListView.View = System.Windows.Forms.View.Details; 351 this.choicesListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.choiceListView_ItemChecked); 352 // 353 // columnHeader2 354 // 355 this.columnHeader2.Width = 150; 356 // 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 // 414 // instancesTabPage 415 // 416 this.instancesTabPage.Controls.Add(this.label1); 417 this.instancesTabPage.Controls.Add(this.instanceDiscoveryProgressBar); 418 this.instancesTabPage.Controls.Add(this.selectNoneCheckBox); 419 this.instancesTabPage.Controls.Add(this.instanceDiscoveryProgressLabel); 420 this.instancesTabPage.Controls.Add(this.selectAllCheckBox); 421 this.instancesTabPage.Controls.Add(this.instancesListView); 422 this.instancesTabPage.Location = new System.Drawing.Point(4, 22); 423 this.instancesTabPage.Name = "instancesTabPage"; 424 this.instancesTabPage.Padding = new System.Windows.Forms.Padding(3); 425 this.instancesTabPage.Size = new System.Drawing.Size(320, 273); 426 this.instancesTabPage.TabIndex = 0; 427 this.instancesTabPage.Text = "Problem Instances"; 428 this.instancesTabPage.UseVisualStyleBackColor = true; 429 // 430 // label1 431 // 432 this.label1.AutoSize = true; 433 this.label1.Location = new System.Drawing.Point(6, 13); 434 this.label1.Name = "label1"; 435 this.label1.Size = new System.Drawing.Size(40, 13); 436 this.label1.TabIndex = 0; 437 this.label1.Text = "Select:"; 438 // 439 // experimentsToCreateDescriptionLabel 440 // 441 this.experimentsToCreateDescriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 442 this.experimentsToCreateDescriptionLabel.AutoSize = true; 443 this.experimentsToCreateDescriptionLabel.Location = new System.Drawing.Point(12, 364); 444 this.experimentsToCreateDescriptionLabel.Name = "experimentsToCreateDescriptionLabel"; 445 this.experimentsToCreateDescriptionLabel.Size = new System.Drawing.Size(112, 13); 446 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"; 458 // 459 // errorProvider 460 // 461 this.errorProvider.ContainerControl = this; 462 // 463 // experimentCreationProgressBar 464 // 465 this.experimentCreationProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 466 | System.Windows.Forms.AnchorStyles.Right))); 467 this.experimentCreationProgressBar.Location = new System.Drawing.Point(187, 359); 468 this.experimentCreationProgressBar.Name = "experimentCreationProgressBar"; 469 this.experimentCreationProgressBar.Size = new System.Drawing.Size(75, 23); 470 this.experimentCreationProgressBar.TabIndex = 9; 471 this.experimentCreationProgressBar.Visible = false; 238 472 // 239 473 // CreateExperimentDialog … … 243 477 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 244 478 this.CancelButton = this.cancelButton; 245 this.ClientSize = new System.Drawing.Size(281, 294); 246 this.Controls.Add(this.progressLabel); 479 this.ClientSize = new System.Drawing.Size(355, 394); 247 480 this.Controls.Add(this.experimentCreationProgressBar); 248 this.Controls.Add(this. selectNoneCheckBox);249 this.Controls.Add(this. selectAllCheckBox);250 this.Controls.Add(this. instancesListView);481 this.Controls.Add(this.experimentsLabel); 482 this.Controls.Add(this.experimentsToCreateDescriptionLabel); 483 this.Controls.Add(this.tabControl); 251 484 this.Controls.Add(this.repetitionsNumericUpDown); 252 this.Controls.Add(this.instancesLabel);253 485 this.Controls.Add(this.repetitionsLabel); 254 486 this.Controls.Add(this.createBatchRunLabel); … … 267 499 this.Load += new System.EventHandler(this.CreateExperimentDialog_Load); 268 500 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit(); 501 this.tabControl.ResumeLayout(false); 502 this.parametersTabPage.ResumeLayout(false); 503 this.parametersSplitContainer.Panel1.ResumeLayout(false); 504 this.parametersSplitContainer.Panel2.ResumeLayout(false); 505 this.parametersSplitContainer.Panel2.PerformLayout(); 506 ((System.ComponentModel.ISupportInitialize)(this.parametersSplitContainer)).EndInit(); 507 this.parametersSplitContainer.ResumeLayout(false); 508 this.instancesTabPage.ResumeLayout(false); 509 this.instancesTabPage.PerformLayout(); 510 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 269 511 this.ResumeLayout(false); 270 512 this.PerformLayout(); … … 281 523 private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown; 282 524 private System.Windows.Forms.ToolTip toolTip; 283 private System.Windows.Forms.Label instancesLabel;284 525 private System.Windows.Forms.ListView instancesListView; 285 526 private System.Windows.Forms.ColumnHeader columnHeader; 286 527 private System.ComponentModel.BackgroundWorker experimentCreationBackgroundWorker; 287 private System.Windows.Forms.ProgressBar experimentCreationProgressBar;288 private System.Windows.Forms.Label progressLabel;528 private System.Windows.Forms.ProgressBar instanceDiscoveryProgressBar; 529 private System.Windows.Forms.Label instanceDiscoveryProgressLabel; 289 530 private System.Windows.Forms.CheckBox selectAllCheckBox; 290 531 private System.Windows.Forms.CheckBox selectNoneCheckBox; 291 532 private System.ComponentModel.BackgroundWorker instanceDiscoveryBackgroundWorker; 533 private System.Windows.Forms.TabControl tabControl; 534 private System.Windows.Forms.TabPage parametersTabPage; 535 private System.Windows.Forms.TabPage instancesTabPage; 536 private System.Windows.Forms.SplitContainer parametersSplitContainer; 537 private System.Windows.Forms.ListView parametersListView; 538 private System.Windows.Forms.ColumnHeader columnHeader1; 539 private System.Windows.Forms.Label experimentsToCreateDescriptionLabel; 540 private System.Windows.Forms.Label experimentsLabel; 541 private System.Windows.Forms.Label choicesLabel; 542 private System.Windows.Forms.ListView choicesListView; 543 private System.Windows.Forms.ColumnHeader columnHeader2; 544 private System.Windows.Forms.TextBox stepSizeTextBox; 545 private System.Windows.Forms.TextBox maximumTextBox; 546 private System.Windows.Forms.TextBox minimumTextBox; 547 private System.Windows.Forms.Label stepSizeLabel; 548 private System.Windows.Forms.Label maximumLabel; 549 private System.Windows.Forms.Label minimumLabel; 550 private System.Windows.Forms.Label label1; 551 private System.Windows.Forms.ErrorProvider errorProvider; 552 private System.Windows.Forms.ProgressBar experimentCreationProgressBar; 292 553 293 554 } -
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r7885 r7908 23 23 using System.Collections.Generic; 24 24 using System.ComponentModel; 25 using System.Globalization; 25 26 using System.Linq; 26 27 using System.Text; 27 28 using System.Threading; 28 29 using System.Windows.Forms; 30 using HeuristicLab.Core; 31 using HeuristicLab.Data; 29 32 using HeuristicLab.Optimization; 33 using HeuristicLab.Parameters; 30 34 using HeuristicLab.Problems.Instances; 31 35 32 36 namespace HeuristicLab.Optimizer { 33 37 public partial class CreateExperimentDialog : Form { 38 private enum DialogMode { Normal = 1, DiscoveringInstances = 2, CreatingExperiment = 3 }; 39 34 40 private IOptimizer optimizer; 35 41 public IOptimizer Optimizer { … … 37 43 set { 38 44 optimizer = value; 39 experiment = null;45 Experiment = null; 40 46 okButton.Enabled = optimizer != null; 41 SetInstanceListViewVisibility(); 42 } 43 } 44 45 private Experiment experiment; 46 public Experiment Experiment { 47 get { return experiment; } 48 } 47 SetTabControlVisibility(); 48 FillInstanceListViewAsync(); 49 FillParametersListView(); 50 } 51 } 52 53 public Experiment Experiment { get; private set; } 49 54 50 55 private bool createBatchRun; 51 56 private int repetitions; 57 private Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> instances; 58 private Dictionary<IValueParameter, Tuple<int, int, int>> intParameters; 59 private Dictionary<IValueParameter, Tuple<double, double, double>> doubleParameters; 60 private HashSet<IValueParameter> boolParameters; 61 private Dictionary<IValueParameter, HashSet<INamedItem>> multipleChoiceParameters; 62 63 private StringBuilder failedInstances; 52 64 private EventWaitHandle backgroundWorkerWaitHandle = new ManualResetEvent(false); 53 65 private bool suppressListViewEventHandling; … … 60 72 // do not set the Optimizer property here, because we want to delay instance discovery to the time when the form loads 61 73 this.optimizer = optimizer; 62 this.experiment = null;74 Experiment = null; 63 75 okButton.Enabled = optimizer != null; 76 77 instances = new Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>>(); 78 intParameters = new Dictionary<IValueParameter, Tuple<int, int, int>>(); 79 doubleParameters = new Dictionary<IValueParameter, Tuple<double, double, double>>(); 80 boolParameters = new HashSet<IValueParameter>(); 81 multipleChoiceParameters = new Dictionary<IValueParameter, HashSet<INamedItem>>(); 64 82 } 65 83 66 84 #region Event handlers 67 85 private void CreateExperimentDialog_Load(object sender, EventArgs e) { 68 SetInstanceListViewVisibility(); 86 SetTabControlVisibility(); 87 FillInstanceListViewAsync(); 88 FillParametersListView(); 69 89 } 70 90 … … 80 100 81 101 private void okButton_Click(object sender, EventArgs e) { 82 SetMode( locked: true);83 experimentCreationBackgroundWorker.RunWorkerAsync( GetSelectedInstances());102 SetMode(DialogMode.CreatingExperiment); 103 experimentCreationBackgroundWorker.RunWorkerAsync(); 84 104 backgroundWorkerWaitHandle.WaitOne(); // make sure the background worker has started before exiting 85 105 } 86 106 107 #region Parameters variation 108 private void parametersListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 109 var parameter = (IValueParameter)e.Item.Tag; 110 var isConstrainedValueParameter = typeof(OptionalConstrainedValueParameter<>).Equals(parameter.GetType().GetGenericTypeDefinition()) 111 || typeof(ConstrainedValueParameter<>).Equals(parameter.GetType().GetGenericTypeDefinition()); 112 113 if (!isConstrainedValueParameter && parameter.Value == null) { 114 if (e.Item.Checked) e.Item.Checked = false; 115 return; 116 } 117 118 if (isConstrainedValueParameter) { 119 if (e.Item.Checked) { 120 multipleChoiceParameters.Add(parameter, new HashSet<INamedItem>()); 121 } else multipleChoiceParameters.Remove(parameter); 122 } 123 124 var intValue = parameter.Value as ValueTypeValue<int>; 125 if (intValue != null) { 126 if (e.Item.Checked) { 127 int minimum = intValue.Value; 128 int maximum = intValue.Value; 129 int step = 1; 130 intParameters.Add(parameter, new Tuple<int, int, int>(minimum, maximum, step)); 131 } else intParameters.Remove(parameter); 132 } 133 134 var doubleValue = parameter.Value as ValueTypeValue<double>; 135 if (doubleValue != null) { 136 if (e.Item.Checked) { 137 double minimum = doubleValue.Value; 138 double maximum = doubleValue.Value; 139 double step = 1; 140 doubleParameters.Add(parameter, new Tuple<double, double, double>(minimum, maximum, step)); 141 } else doubleParameters.Remove(parameter); 142 } 143 144 var boolValue = parameter.Value as ValueTypeValue<bool>; 145 if (boolValue != null) { 146 if (e.Item.Checked) boolParameters.Add(parameter); 147 else boolParameters.Remove(parameter); 148 } 149 150 if (e.Item.Selected) UpdateDetailsView(parameter); 151 else e.Item.Selected = true; 152 } 153 154 private void parametersListView_SelectedIndexChanged(object sender, EventArgs e) { 155 if (parametersListView.SelectedItems.Count == 0) { 156 ClearDetailsView(); 157 } else { 158 var parameter = parametersListView.SelectedItems[0].Tag as IValueParameter; 159 UpdateDetailsView(parameter); 160 } 161 } 162 163 private void UpdateDetailsView(IValueParameter parameter) { 164 ClearDetailsView(); 165 166 var isConstrainedValueParameter = 167 typeof(OptionalConstrainedValueParameter<>).IsAssignableFrom(parameter.GetType().GetGenericTypeDefinition()) 168 || typeof(ConstrainedValueParameter<>).Equals(parameter.GetType().GetGenericTypeDefinition()); 169 170 if (isConstrainedValueParameter) { 171 choicesLabel.Visible = true; 172 choicesListView.Enabled = true; 173 choicesListView.Visible = true; 174 choicesListView.Tag = parameter; 175 176 if (!multipleChoiceParameters.ContainsKey(parameter)) return; 177 dynamic constrainedValuedParameter = parameter; 178 dynamic validValues = constrainedValuedParameter.ValidValues; 179 foreach (var choice in validValues) { 180 choicesListView.Items.Add(new ListViewItem(choice.ToString()) { 181 Tag = choice, 182 Checked = multipleChoiceParameters[parameter].Contains((INamedItem)choice) 183 }); 184 } 185 return; 186 } 187 188 minimumLabel.Visible = true; minimumTextBox.Visible = true; 189 maximumLabel.Visible = true; maximumTextBox.Visible = true; 190 stepSizeLabel.Visible = true; stepSizeTextBox.Visible = true; 191 192 var intValue = parameter.Value as ValueTypeValue<int>; 193 if (intValue != null) { 194 if (!intParameters.ContainsKey(parameter)) return; 195 string min = intParameters[parameter].Item1.ToString(); 196 string max = intParameters[parameter].Item2.ToString(); 197 string step = intParameters[parameter].Item3.ToString(); 198 UpdateMinMaxStepSize(parameter, min, max, step); 199 return; 200 } 201 202 var doubleValue = parameter.Value as ValueTypeValue<double>; 203 if (doubleValue != null) { 204 if (!doubleParameters.ContainsKey(parameter)) return; 205 string min = doubleParameters[parameter].Item1.ToString(); 206 string max = doubleParameters[parameter].Item2.ToString(); 207 string step = doubleParameters[parameter].Item3.ToString(); 208 UpdateMinMaxStepSize(parameter, min, max, step); 209 return; 210 } 211 } 212 213 #region Detail controls 214 private void choiceListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 215 var parameter = (IValueParameter)choicesListView.Tag; 216 if (e.Item.Checked) { 217 multipleChoiceParameters[parameter].Add((INamedItem)e.Item.Tag); 218 } else multipleChoiceParameters[parameter].Remove((INamedItem)e.Item.Tag); 219 220 experimentsLabel.Text = GetNumberOfVariations().ToString(); 221 } 222 223 private void detailsTextBox_Validating(object sender, CancelEventArgs e) { 224 var parameter = (IValueParameter)((TextBox)sender).Tag; 225 errorProvider.Clear(); 226 227 var intValue = parameter.Value as ValueTypeValue<int>; 228 if (intValue != null) { 229 int value; 230 if (!int.TryParse(((TextBox)sender).Text, out value)) { 231 errorProvider.SetError(((TextBox)sender), "Please enter a valid integer number."); 232 e.Cancel = true; 233 } else { 234 var before = intParameters[parameter]; 235 var after = default(Tuple<int, int, int>); 236 if (sender == minimumTextBox) after = new Tuple<int, int, int>(value, before.Item2, before.Item3); 237 else if (sender == maximumTextBox) after = new Tuple<int, int, int>(before.Item1, value, before.Item3); 238 else if (sender == stepSizeTextBox) after = new Tuple<int, int, int>(before.Item1, before.Item2, value); 239 intParameters[parameter] = after; 240 } 241 } 242 243 var doubleValue = parameter.Value as ValueTypeValue<double>; 244 if (doubleValue != null) { 245 double value; 246 if (!double.TryParse(((TextBox)sender).Text, NumberStyles.Float, CultureInfo.CurrentCulture.NumberFormat, out value)) { 247 errorProvider.SetError(((TextBox)sender), "Please enter a valid number."); 248 e.Cancel = true; 249 } else { 250 var before = doubleParameters[parameter]; 251 var after = default(Tuple<double, double, double>); 252 if (sender == minimumTextBox) after = new Tuple<double, double, double>(value, before.Item2, before.Item3); 253 else if (sender == maximumTextBox) after = new Tuple<double, double, double>(before.Item1, value, before.Item3); 254 else if (sender == stepSizeTextBox) after = new Tuple<double, double, double>(before.Item1, before.Item2, value); 255 doubleParameters[parameter] = after; 256 } 257 } 258 259 experimentsLabel.Text = GetNumberOfVariations().ToString(); 260 } 261 #endregion 262 #endregion 263 264 #region Instances 87 265 private void instancesListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 88 266 if (!suppressListViewEventHandling) { … … 90 268 selectNoneCheckBox.Checked = instancesListView.CheckedItems.Count == 0; 91 269 } 270 var provider = (IProblemInstanceProvider)e.Item.Group.Tag; 271 var descriptor = (IDataDescriptor)e.Item.Tag; 272 if (e.Item.Checked) { 273 if (!instances.ContainsKey(provider)) 274 instances.Add(provider, new HashSet<IDataDescriptor>()); 275 instances[provider].Add(descriptor); 276 } else { 277 if (instances.ContainsKey(provider)) { 278 instances[provider].Remove(descriptor); 279 if (instances[provider].Count == 0) 280 instances.Remove(provider); 281 } 282 } 283 experimentsLabel.Text = GetNumberOfVariations().ToString(); 92 284 } 93 285 … … 117 309 } 118 310 } 311 #endregion 119 312 120 313 private void createBatchRunCheckBox_CheckedChanged(object sender, EventArgs e) { … … 131 324 132 325 #region Helpers 133 private void Set InstanceListViewVisibility() {134 bool i nstancesAvailable = optimizer != null135 && optimizer is IAlgorithm326 private void SetTabControlVisibility() { 327 bool isAlgorithm = optimizer != null && optimizer is IAlgorithm; 328 bool instancesAvailable = isAlgorithm 136 329 && ((IAlgorithm)optimizer).Problem != null 137 330 && ProblemInstanceManager.GetProviders(((IAlgorithm)optimizer).Problem).Any(); 138 selectAllCheckBox.Visible = instancesAvailable; 139 selectNoneCheckBox.Visible = instancesAvailable; 140 instancesLabel.Visible = instancesAvailable; 141 instancesListView.Visible = instancesAvailable; 142 if (instancesAvailable) { 143 Height = 330; 144 FillInstanceListViewAsync(); 145 } else Height = 130; 331 if (instancesAvailable && tabControl.TabCount == 1) 332 tabControl.TabPages.Add(instancesTabPage); 333 else if (!instancesAvailable && tabControl.TabCount == 2) 334 tabControl.TabPages.Remove(instancesTabPage); 335 tabControl.Visible = isAlgorithm; 336 if (isAlgorithm) { 337 experimentsLabel.Visible = true; 338 experimentsToCreateDescriptionLabel.Visible = true; 339 Height = 430; 340 } else { 341 experimentsLabel.Visible = false; 342 experimentsToCreateDescriptionLabel.Visible = false; 343 Height = 130; 344 } 345 } 346 347 private void FillParametersListView() { 348 parametersListView.Items.Clear(); 349 intParameters.Clear(); 350 doubleParameters.Clear(); 351 boolParameters.Clear(); 352 multipleChoiceParameters.Clear(); 353 354 if (Optimizer is IAlgorithm) { 355 var parameters = ((IAlgorithm)optimizer).Parameters; 356 foreach (var param in parameters) { 357 var valueParam = param as IValueParameter; 358 if (valueParam != null && (valueParam.Value is ValueTypeValue<bool> 359 || valueParam.Value is ValueTypeValue<int> 360 || valueParam.Value is ValueTypeValue<double>) 361 || typeof(OptionalConstrainedValueParameter<>).IsAssignableFrom(param.GetType().GetGenericTypeDefinition()) 362 || typeof(ConstrainedValueParameter<>).IsAssignableFrom(param.GetType().GetGenericTypeDefinition())) 363 parametersListView.Items.Add(new ListViewItem(param.Name) { Tag = param }); 364 } 365 } 146 366 } 147 367 148 368 private void FillInstanceListViewAsync() { 149 SetMode(locked: true); 150 var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem); 151 instanceDiscoveryBackgroundWorker.RunWorkerAsync(instanceProviders); 369 instances.Clear(); 370 instancesListView.Items.Clear(); 371 instancesListView.Groups.Clear(); 372 373 if (Optimizer is IAlgorithm) { 374 SetMode(DialogMode.DiscoveringInstances); 375 var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem); 376 instanceDiscoveryBackgroundWorker.RunWorkerAsync(instanceProviders); 377 } 152 378 } 153 379 … … 163 389 } 164 390 165 private void SetMode(bool locked) { 166 createBatchRunCheckBox.Enabled = !locked; 167 repetitionsNumericUpDown.Enabled = !locked; 168 selectAllCheckBox.Enabled = !locked; 169 selectNoneCheckBox.Enabled = !locked; 170 instancesListView.Enabled = !locked; 171 instancesListView.Visible = !locked; 172 okButton.Enabled = !locked; 173 okButton.Visible = !locked; 174 progressLabel.Visible = locked; 175 experimentCreationProgressBar.Visible = locked; 176 } 177 178 private Dictionary<IProblemInstanceProvider, List<IDataDescriptor>> GetSelectedInstances() { 179 var selectedInstances = new Dictionary<IProblemInstanceProvider, List<IDataDescriptor>>(); 180 foreach (var checkedItem in instancesListView.CheckedItems.OfType<ListViewItem>()) { 181 if (!selectedInstances.ContainsKey((IProblemInstanceProvider)checkedItem.Group.Tag)) 182 selectedInstances.Add((IProblemInstanceProvider)checkedItem.Group.Tag, new List<IDataDescriptor>()); 183 selectedInstances[(IProblemInstanceProvider)checkedItem.Group.Tag].Add((IDataDescriptor)checkedItem.Tag); 184 } 185 return selectedInstances; 186 } 391 private int GetNumberOfVariations() { 392 int instancesCount = 1; 393 if (instances.Values.Any()) 394 instancesCount = Math.Max(instances.Values.SelectMany(x => x).Count(), 1); 395 396 int intParameterVariations = 1; 397 foreach (var intParam in intParameters.Values) { 398 if (intParam.Item3 == 0) continue; 399 intParameterVariations *= (intParam.Item2 - intParam.Item1) / intParam.Item3 + 1; 400 } 401 int doubleParameterVariations = 1; 402 foreach (var doubleParam in doubleParameters.Values) { 403 if (doubleParam.Item3 == 0) continue; 404 doubleParameterVariations *= (int)Math.Floor((doubleParam.Item2 - doubleParam.Item1) / doubleParam.Item3) + 1; 405 } 406 int boolParameterVariations = 1; 407 foreach (var boolParam in boolParameters) { 408 boolParameterVariations *= 2; 409 } 410 int choiceParameterVariations = 1; 411 foreach (var choiceParam in multipleChoiceParameters.Values) { 412 choiceParameterVariations *= Math.Max(choiceParam.Count, 1); 413 } 414 415 return (instancesCount * intParameterVariations * doubleParameterVariations * boolParameterVariations * choiceParameterVariations); 416 } 417 418 private void SetMode(DialogMode mode) { 419 createBatchRunCheckBox.Enabled = mode == DialogMode.Normal; 420 repetitionsNumericUpDown.Enabled = mode == DialogMode.Normal; 421 selectAllCheckBox.Enabled = mode == DialogMode.Normal; 422 selectNoneCheckBox.Enabled = mode == DialogMode.Normal; 423 instancesListView.Enabled = mode == DialogMode.Normal; 424 instancesListView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment; 425 okButton.Enabled = mode == DialogMode.Normal; 426 okButton.Visible = mode == DialogMode.Normal; 427 instanceDiscoveryProgressLabel.Visible = mode == DialogMode.DiscoveringInstances; 428 instanceDiscoveryProgressBar.Visible = mode == DialogMode.DiscoveringInstances; 429 experimentCreationProgressBar.Visible = mode == DialogMode.CreatingExperiment; 430 } 431 432 private void ClearDetailsView() { 433 minimumLabel.Visible = false; 434 minimumTextBox.Text = string.Empty; 435 minimumTextBox.Enabled = false; 436 minimumTextBox.Visible = false; 437 maximumLabel.Visible = false; 438 maximumTextBox.Text = string.Empty; 439 maximumTextBox.Enabled = false; 440 maximumTextBox.Visible = false; 441 stepSizeLabel.Visible = false; 442 stepSizeTextBox.Text = string.Empty; 443 stepSizeTextBox.Enabled = false; 444 stepSizeTextBox.Visible = false; 445 choicesLabel.Visible = false; 446 choicesListView.Items.Clear(); 447 choicesListView.Enabled = false; 448 choicesListView.Visible = false; 449 } 450 451 private void UpdateMinMaxStepSize(IValueParameter parameter, string min, string max, string step) { 452 minimumLabel.Visible = true; 453 minimumTextBox.Text = min; 454 minimumTextBox.Enabled = true; 455 minimumTextBox.Visible = true; 456 minimumTextBox.Tag = parameter; 457 maximumLabel.Visible = true; 458 maximumTextBox.Text = max; 459 maximumTextBox.Enabled = true; 460 maximumTextBox.Visible = true; 461 maximumTextBox.Tag = parameter; 462 stepSizeLabel.Visible = true; 463 stepSizeTextBox.Text = step; 464 stepSizeTextBox.Enabled = true; 465 stepSizeTextBox.Visible = true; 466 stepSizeTextBox.Tag = parameter; 467 } 468 469 #region Retrieve parameter combinations 470 private IEnumerable<Dictionary<IValueParameter, int>> GetIntParameterConfigurations() { 471 var configuration = new Dictionary<IValueParameter, int>(); 472 var indices = new Dictionary<IValueParameter, int>(); 473 bool finished; 474 do { 475 foreach (var p in intParameters) { 476 if (!indices.ContainsKey(p.Key)) indices.Add(p.Key, 0); 477 var value = p.Value.Item1 + p.Value.Item3 * indices[p.Key]; 478 configuration[p.Key] = value; 479 } 480 yield return configuration; 481 482 finished = true; 483 foreach (var p in intParameters.Keys) { 484 var newValue = intParameters[p].Item1 + intParameters[p].Item3 * (indices[p] + 1); 485 if (newValue > intParameters[p].Item2 || intParameters[p].Item3 == 0) 486 indices[p] = 0; 487 else { 488 indices[p]++; 489 finished = false; 490 break; 491 } 492 } 493 } while (!finished); 494 } 495 496 private IEnumerable<Dictionary<IValueParameter, double>> GetDoubleParameterConfigurations() { 497 var configuration = new Dictionary<IValueParameter, double>(); 498 var indices = new Dictionary<IValueParameter, int>(); 499 bool finished; 500 do { 501 foreach (var p in doubleParameters) { 502 if (!indices.ContainsKey(p.Key)) indices.Add(p.Key, 0); 503 var value = p.Value.Item1 + p.Value.Item3 * indices[p.Key]; 504 configuration[p.Key] = value; 505 } 506 yield return configuration; 507 508 finished = true; 509 foreach (var p in doubleParameters.Keys) { 510 var newValue = doubleParameters[p].Item1 + doubleParameters[p].Item3 * (indices[p] + 1); 511 if (newValue > doubleParameters[p].Item2 || doubleParameters[p].Item3 == 0) 512 indices[p] = 0; 513 else { 514 indices[p]++; 515 finished = false; 516 break; 517 } 518 } 519 } while (!finished); 520 } 521 522 private IEnumerable<Dictionary<IValueParameter, bool>> GetBoolParameterConfigurations() { 523 var configuration = new Dictionary<IValueParameter, bool>(); 524 bool finished; 525 do { 526 finished = true; 527 foreach (var p in boolParameters) { 528 if (!configuration.ContainsKey(p)) configuration.Add(p, false); 529 else { 530 if (configuration[p]) { 531 configuration[p] = false; 532 } else { 533 configuration[p] = true; 534 finished = false; 535 break; 536 } 537 } 538 } 539 yield return configuration; 540 } while (!finished); 541 } 542 543 private IEnumerable<Dictionary<IValueParameter, INamedItem>> GetMultipleChoiceConfigurations() { 544 var configuration = new Dictionary<IValueParameter, INamedItem>(); 545 var enumerators = new Dictionary<IValueParameter, IEnumerator<INamedItem>>(); 546 bool finished; 547 do { 548 foreach (var p in multipleChoiceParameters.Keys.ToArray()) { 549 if (!enumerators.ContainsKey(p)) { 550 enumerators.Add(p, multipleChoiceParameters[p].GetEnumerator()); 551 if (!enumerators[p].MoveNext()) { 552 multipleChoiceParameters.Remove(p); 553 continue; 554 } 555 } 556 configuration[p] = enumerators[p].Current; 557 } 558 559 finished = true; 560 foreach (var p in multipleChoiceParameters.Keys) { 561 if (!enumerators[p].MoveNext()) { 562 enumerators[p] = multipleChoiceParameters[p].GetEnumerator(); 563 } else { 564 finished = false; 565 break; 566 } 567 } 568 yield return configuration; 569 } while (!finished); 570 } 571 #endregion 187 572 #endregion 188 573 189 574 #region Background workers 190 private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 191 experimentCreationProgressBar.Value = e.ProgressPercentage; 192 progressLabel.Text = (string)e.UserState; 193 } 194 575 #region Instance discovery 195 576 private void instanceDiscoveryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { 196 double progress = 0;197 instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, string.Empty);198 577 var instanceProviders = ((IEnumerable<IProblemInstanceProvider>)e.Argument).ToArray(); 199 ListViewGroup[]groups = new ListViewGroup[instanceProviders.Length];578 var groups = new ListViewGroup[instanceProviders.Length]; 200 579 for (int i = 0; i < instanceProviders.Length; i++) { 201 580 var provider = instanceProviders[i]; … … 206 585 var group = groups[i]; 207 586 var provider = group.Tag as IProblemInstanceProvider; 208 progress = (100.0 * i) / groups.Length;587 double progress = (100.0 * i) / groups.Length; 209 588 instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, provider.Name); 210 589 var descriptors = ProblemInstanceManager.GetDataDescriptors(provider).ToArray(); … … 225 604 } 226 605 606 private void instanceDiscoveryBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 607 instanceDiscoveryProgressBar.Value = e.ProgressPercentage; 608 instanceDiscoveryProgressLabel.Text = (string)e.UserState; 609 } 610 227 611 private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 228 612 try { … … 233 617 } 234 618 instancesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 235 select AllCheckBox.Checked = true;619 selectNoneCheckBox.Checked = true; 236 620 } catch { } 237 621 try { 238 SetMode( locked: false);622 SetMode(DialogMode.Normal); 239 623 if (e.Error != null) MessageBox.Show(e.Error.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error); 240 624 } catch { } 241 625 } 242 243 private StringBuilder failedInstances; 626 #endregion 627 628 #region Experiment creation 244 629 private void experimentCreationBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { 245 backgroundWorkerWaitHandle.Set(); 246 experimentCreationBackgroundWorker.ReportProgress(0, string.Empty); 630 backgroundWorkerWaitHandle.Set(); // notify the ok button that we're busy now 247 631 failedInstances = new StringBuilder(); 248 var items = (Dictionary<IProblemInstanceProvider, List<IDataDescriptor>>)e.Argument;249 632 var localExperiment = new Experiment(); 250 if (items.Count == 0) { 251 AddOptimizer((IOptimizer)Optimizer.Clone(), localExperiment); 633 634 if (instances.Count == 0) { 635 var variations = experimentCreationBackgroundWorker_CalculateParameterVariations(optimizer); 636 foreach (var v in variations) 637 AddOptimizer(v, localExperiment); 252 638 experimentCreationBackgroundWorker.ReportProgress(100, string.Empty); 639 253 640 } else { 254 int counter = 0, total = items.SelectMany(x => x.Value).Count();255 foreach (var provider in i tems.Keys) {256 foreach (var descriptor in i tems[provider]) {641 int counter = 0, totalInstances = instances.SelectMany(x => x.Value).Count(), totalVariations = GetNumberOfVariations(); 642 foreach (var provider in instances.Keys) { 643 foreach (var descriptor in instances[provider]) { 257 644 #region Check cancellation request 258 645 if (experimentCreationBackgroundWorker.CancellationPending) { … … 271 658 } 272 659 if (!failed) { 273 AddOptimizer(algorithm, localExperiment); 274 counter++; 275 experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / total), descriptor.Name); 276 } else experimentCreationBackgroundWorker.ReportProgress((int)Math.Round(100.0 * counter / total), "Loading failed (" + descriptor.Name + ")"); 660 var variations = experimentCreationBackgroundWorker_CalculateParameterVariations(algorithm); 661 foreach (var v in variations) { 662 AddOptimizer(v, localExperiment); 663 counter++; 664 } 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 + ")"); 277 667 } 278 668 } 279 669 } 280 670 if (localExperiment != null) localExperiment.Prepare(true); 281 e.Result = localExperiment; 671 Experiment = localExperiment; 672 } 673 674 private IEnumerable<IOptimizer> experimentCreationBackgroundWorker_CalculateParameterVariations(IOptimizer optimizer) { 675 if (!boolParameters.Any() && !intParameters.Any() && !doubleParameters.Any() && !multipleChoiceParameters.Any()) { 676 yield return (IOptimizer)optimizer.Clone(); 677 yield break; 678 } 679 bool finished; 680 var mcEnumerator = GetMultipleChoiceConfigurations().GetEnumerator(); 681 var boolEnumerator = GetBoolParameterConfigurations().GetEnumerator(); 682 var intEnumerator = GetIntParameterConfigurations().GetEnumerator(); 683 var doubleEnumerator = GetDoubleParameterConfigurations().GetEnumerator(); 684 mcEnumerator.MoveNext(); boolEnumerator.MoveNext(); intEnumerator.MoveNext(); doubleEnumerator.MoveNext(); 685 do { 686 var variant = (IAlgorithm)optimizer.Clone(); 687 variant.Name += " {"; 688 finished = true; 689 if (doubleParameters.Any()) { 690 foreach (var d in doubleEnumerator.Current) { 691 var value = (ValueTypeValue<double>)((IValueParameter)variant.Parameters[d.Key.Name]).Value; 692 value.Value = d.Value; 693 variant.Name += d.Key.Name + "=" + d.Value.ToString() + ", "; 694 } 695 if (finished) { 696 if (doubleEnumerator.MoveNext()) { 697 finished = false; 698 } else { 699 doubleEnumerator = GetDoubleParameterConfigurations().GetEnumerator(); 700 doubleEnumerator.MoveNext(); 701 } 702 } 703 } 704 if (intParameters.Any()) { 705 foreach (var i in intEnumerator.Current) { 706 var value = (ValueTypeValue<int>)((IValueParameter)variant.Parameters[i.Key.Name]).Value; 707 value.Value = i.Value; 708 variant.Name += i.Key.Name + "=" + i.Value.ToString() + ", "; 709 } 710 if (finished) { 711 if (intEnumerator.MoveNext()) { 712 finished = false; 713 } else { 714 intEnumerator = GetIntParameterConfigurations().GetEnumerator(); 715 intEnumerator.MoveNext(); 716 } 717 } 718 } 719 if (boolParameters.Any()) { 720 foreach (var b in boolEnumerator.Current) { 721 var value = (ValueTypeValue<bool>)((IValueParameter)variant.Parameters[b.Key.Name]).Value; 722 value.Value = b.Value; 723 variant.Name += b.Key.Name + "=" + b.Value.ToString() + ", "; 724 } 725 if (finished) { 726 if (boolEnumerator.MoveNext()) { 727 finished = false; 728 } else { 729 boolEnumerator = GetBoolParameterConfigurations().GetEnumerator(); 730 boolEnumerator.MoveNext(); 731 } 732 } 733 } 734 if (multipleChoiceParameters.Any()) { 735 foreach (var m in mcEnumerator.Current) { 736 dynamic variantParam = variant.Parameters[m.Key.Name]; 737 var variantEnumerator = ((IEnumerable<object>)variantParam.ValidValues).GetEnumerator(); 738 var originalEnumerator = ((IEnumerable<object>)((dynamic)m.Key).ValidValues).GetEnumerator(); 739 while (variantEnumerator.MoveNext() && originalEnumerator.MoveNext()) { 740 if (m.Value == (INamedItem)originalEnumerator.Current) { 741 variantParam.Value = (dynamic)variantEnumerator.Current; 742 variant.Name += m.Key.Name + "=" + m.Value.Name + ", "; 743 break; 744 } 745 } 746 } 747 if (finished) { 748 if (mcEnumerator.MoveNext()) { 749 finished = false; 750 } else { 751 mcEnumerator = GetMultipleChoiceConfigurations().GetEnumerator(); 752 mcEnumerator.MoveNext(); 753 } 754 } 755 } 756 variant.Name = variant.Name.Substring(0, variant.Name.Length - 2) + "}"; 757 yield return variant; 758 } while (!finished); 759 } 760 761 private void experimentCreationBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 762 experimentCreationProgressBar.Value = e.ProgressPercentage; 282 763 } 283 764 284 765 private void experimentCreationBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 285 766 try { 286 SetMode( locked: false);767 SetMode(DialogMode.Normal); 287 768 if (e.Error != null) MessageBox.Show(e.Error.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error); 288 769 if (failedInstances.Length > 0) MessageBox.Show("Some instances could not be loaded: " + Environment.NewLine + failedInstances.ToString(), "Some instances failed to load", MessageBoxButtons.OK, MessageBoxIcon.Error); 289 770 if (!e.Cancelled && e.Error == null) { 290 experiment = (Experiment)e.Result;291 771 DialogResult = System.Windows.Forms.DialogResult.OK; 292 772 Close(); … … 295 775 } 296 776 #endregion 777 #endregion 297 778 } 298 779 } -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r7841 r7908 236 236 <Private>False</Private> 237 237 </ProjectReference> 238 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 239 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 240 <Name>HeuristicLab.Data-3.3</Name> 241 </ProjectReference> 238 242 <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj"> 239 243 <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project> … … 250 254 <Name>HeuristicLab.Optimization-3.3</Name> 251 255 <Private>False</Private> 256 </ProjectReference> 257 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 258 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 259 <Name>HeuristicLab.Parameters-3.3</Name> 252 260 </ProjectReference> 253 261 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> -
trunk/sources/HeuristicLab.Optimizer/3.3/Plugin.cs.frame
r7841 r7908 33 33 [PluginDependency("HeuristicLab.Core", "3.3")] 34 34 [PluginDependency("HeuristicLab.Core.Views", "3.3")] 35 [PluginDependency("HeuristicLab.Data", "3.3")] 35 36 [PluginDependency("HeuristicLab.MainForm", "3.3")] 36 37 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 37 38 [PluginDependency("HeuristicLab.Optimization", "3.3")] 39 [PluginDependency("HeuristicLab.Parameters", "3.3")] 38 40 [PluginDependency("HeuristicLab.Persistence", "3.3")] 39 41 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.