Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/25/12 13:22:01 (13 years ago)
Author:
abeham
Message:

#1851: Added possibility to create simple parameter variation experiments

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  
    5353      this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    5454      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    55       this.instancesLabel = new System.Windows.Forms.Label();
    5655      this.instancesListView = new System.Windows.Forms.ListView();
    5756      this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5857      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();
    6160      this.selectAllCheckBox = new System.Windows.Forms.CheckBox();
    6261      this.selectNoneCheckBox = new System.Windows.Forms.CheckBox();
    6362      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();
    6483      ((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();
    6592      this.SuspendLayout();
    6693      //
     
    7097      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    7198      this.okButton.Enabled = false;
    72       this.okButton.Location = new System.Drawing.Point(113, 259);
     99      this.okButton.Location = new System.Drawing.Point(187, 359);
    73100      this.okButton.Name = "okButton";
    74101      this.okButton.Size = new System.Drawing.Size(75, 23);
    75       this.okButton.TabIndex = 4;
     102      this.okButton.TabIndex = 7;
    76103      this.okButton.Text = "&OK";
    77104      this.okButton.UseVisualStyleBackColor = true;
     
    82109      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    83110      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);
    85112      this.cancelButton.Name = "cancelButton";
    86113      this.cancelButton.Size = new System.Drawing.Size(75, 23);
    87       this.cancelButton.TabIndex = 5;
     114      this.cancelButton.TabIndex = 8;
    88115      this.cancelButton.Text = "&Cancel";
    89116      this.cancelButton.UseVisualStyleBackColor = true;
     
    136163            0});
    137164      this.repetitionsNumericUpDown.Name = "repetitionsNumericUpDown";
    138       this.repetitionsNumericUpDown.Size = new System.Drawing.Size(156, 20);
     165      this.repetitionsNumericUpDown.Size = new System.Drawing.Size(230, 20);
    139166      this.repetitionsNumericUpDown.TabIndex = 3;
    140167      this.repetitionsNumericUpDown.ThousandsSeparator = true;
     
    147174      this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated);
    148175      //
    149       // instancesLabel
    150       //
    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       //
    158176      // instancesListView
    159177      //
     
    165183            this.columnHeader});
    166184      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);
    168186      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;
    171189      this.instancesListView.UseCompatibleStateImageBehavior = false;
    172190      this.instancesListView.View = System.Windows.Forms.View.Details;
     
    182200      this.experimentCreationBackgroundWorker.WorkerSupportsCancellation = true;
    183201      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);
    185203      this.experimentCreationBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.experimentCreationBackgroundWorker_RunWorkerCompleted);
    186204      //
    187       // experimentCreationProgressBar
    188       //
    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       // progressLabel
    198       //
    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;
    208226      //
    209227      // selectAllCheckBox
    210228      //
    211229      this.selectAllCheckBox.AutoSize = true;
    212       this.selectAllCheckBox.Location = new System.Drawing.Point(113, 54);
     230      this.selectAllCheckBox.Location = new System.Drawing.Point(52, 12);
    213231      this.selectAllCheckBox.Name = "selectAllCheckBox";
    214       this.selectAllCheckBox.Size = new System.Drawing.Size(67, 17);
    215       this.selectAllCheckBox.TabIndex = 9;
    216       this.selectAllCheckBox.Text = "select all";
     232      this.selectAllCheckBox.Size = new System.Drawing.Size(36, 17);
     233      this.selectAllCheckBox.TabIndex = 1;
     234      this.selectAllCheckBox.Text = "all";
    217235      this.selectAllCheckBox.UseVisualStyleBackColor = true;
    218236      this.selectAllCheckBox.CheckedChanged += new System.EventHandler(this.selectAllCheckBox_CheckedChanged);
     
    221239      //
    222240      this.selectNoneCheckBox.AutoSize = true;
    223       this.selectNoneCheckBox.Location = new System.Drawing.Point(186, 54);
     241      this.selectNoneCheckBox.Location = new System.Drawing.Point(94, 12);
    224242      this.selectNoneCheckBox.Name = "selectNoneCheckBox";
    225       this.selectNoneCheckBox.Size = new System.Drawing.Size(81, 17);
    226       this.selectNoneCheckBox.TabIndex = 9;
    227       this.selectNoneCheckBox.Text = "select none";
     243      this.selectNoneCheckBox.Size = new System.Drawing.Size(50, 17);
     244      this.selectNoneCheckBox.TabIndex = 2;
     245      this.selectNoneCheckBox.Text = "none";
    228246      this.selectNoneCheckBox.UseVisualStyleBackColor = true;
    229247      this.selectNoneCheckBox.CheckedChanged += new System.EventHandler(this.selectNoneCheckBox_CheckedChanged);
     
    234252      this.instanceDiscoveryBackgroundWorker.WorkerSupportsCancellation = true;
    235253      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);
    237255      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;
    238472      //
    239473      // CreateExperimentDialog
     
    243477      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    244478      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);
    247480      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);
    251484      this.Controls.Add(this.repetitionsNumericUpDown);
    252       this.Controls.Add(this.instancesLabel);
    253485      this.Controls.Add(this.repetitionsLabel);
    254486      this.Controls.Add(this.createBatchRunLabel);
     
    267499      this.Load += new System.EventHandler(this.CreateExperimentDialog_Load);
    268500      ((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();
    269511      this.ResumeLayout(false);
    270512      this.PerformLayout();
     
    281523    private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown;
    282524    private System.Windows.Forms.ToolTip toolTip;
    283     private System.Windows.Forms.Label instancesLabel;
    284525    private System.Windows.Forms.ListView instancesListView;
    285526    private System.Windows.Forms.ColumnHeader columnHeader;
    286527    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;
    289530    private System.Windows.Forms.CheckBox selectAllCheckBox;
    290531    private System.Windows.Forms.CheckBox selectNoneCheckBox;
    291532    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;
    292553
    293554  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs

    r7885 r7908  
    2323using System.Collections.Generic;
    2424using System.ComponentModel;
     25using System.Globalization;
    2526using System.Linq;
    2627using System.Text;
    2728using System.Threading;
    2829using System.Windows.Forms;
     30using HeuristicLab.Core;
     31using HeuristicLab.Data;
    2932using HeuristicLab.Optimization;
     33using HeuristicLab.Parameters;
    3034using HeuristicLab.Problems.Instances;
    3135
    3236namespace HeuristicLab.Optimizer {
    3337  public partial class CreateExperimentDialog : Form {
     38    private enum DialogMode { Normal = 1, DiscoveringInstances = 2, CreatingExperiment = 3 };
     39
    3440    private IOptimizer optimizer;
    3541    public IOptimizer Optimizer {
     
    3743      set {
    3844        optimizer = value;
    39         experiment = null;
     45        Experiment = null;
    4046        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; }
    4954
    5055    private bool createBatchRun;
    5156    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;
    5264    private EventWaitHandle backgroundWorkerWaitHandle = new ManualResetEvent(false);
    5365    private bool suppressListViewEventHandling;
     
    6072      // do not set the Optimizer property here, because we want to delay instance discovery to the time when the form loads
    6173      this.optimizer = optimizer;
    62       this.experiment = null;
     74      Experiment = null;
    6375      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>>();
    6482    }
    6583
    6684    #region Event handlers
    6785    private void CreateExperimentDialog_Load(object sender, EventArgs e) {
    68       SetInstanceListViewVisibility();
     86      SetTabControlVisibility();
     87      FillInstanceListViewAsync();
     88      FillParametersListView();
    6989    }
    7090
     
    80100
    81101    private void okButton_Click(object sender, EventArgs e) {
    82       SetMode(locked: true);
    83       experimentCreationBackgroundWorker.RunWorkerAsync(GetSelectedInstances());
     102      SetMode(DialogMode.CreatingExperiment);
     103      experimentCreationBackgroundWorker.RunWorkerAsync();
    84104      backgroundWorkerWaitHandle.WaitOne(); // make sure the background worker has started before exiting
    85105    }
    86106
     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
    87265    private void instancesListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
    88266      if (!suppressListViewEventHandling) {
     
    90268        selectNoneCheckBox.Checked = instancesListView.CheckedItems.Count == 0;
    91269      }
     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();
    92284    }
    93285
     
    117309      }
    118310    }
     311    #endregion
    119312
    120313    private void createBatchRunCheckBox_CheckedChanged(object sender, EventArgs e) {
     
    131324
    132325    #region Helpers
    133     private void SetInstanceListViewVisibility() {
    134       bool instancesAvailable = optimizer != null
    135         && optimizer is IAlgorithm
     326    private void SetTabControlVisibility() {
     327      bool isAlgorithm = optimizer != null && optimizer is IAlgorithm;
     328      bool instancesAvailable = isAlgorithm
    136329        && ((IAlgorithm)optimizer).Problem != null
    137330        && 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      }
    146366    }
    147367
    148368    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      }
    152378    }
    153379
     
    163389    }
    164390
    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
    187572    #endregion
    188573
    189574    #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
    195576    private void instanceDiscoveryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
    196       double progress = 0;
    197       instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, string.Empty);
    198577      var instanceProviders = ((IEnumerable<IProblemInstanceProvider>)e.Argument).ToArray();
    199       ListViewGroup[] groups = new ListViewGroup[instanceProviders.Length];
     578      var groups = new ListViewGroup[instanceProviders.Length];
    200579      for (int i = 0; i < instanceProviders.Length; i++) {
    201580        var provider = instanceProviders[i];
     
    206585        var group = groups[i];
    207586        var provider = group.Tag as IProblemInstanceProvider;
    208         progress = (100.0 * i) / groups.Length;
     587        double progress = (100.0 * i) / groups.Length;
    209588        instanceDiscoveryBackgroundWorker.ReportProgress((int)progress, provider.Name);
    210589        var descriptors = ProblemInstanceManager.GetDataDescriptors(provider).ToArray();
     
    225604    }
    226605
     606    private void instanceDiscoveryBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
     607      instanceDiscoveryProgressBar.Value = e.ProgressPercentage;
     608      instanceDiscoveryProgressLabel.Text = (string)e.UserState;
     609    }
     610
    227611    private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    228612      try {
     
    233617        }
    234618        instancesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
    235         selectAllCheckBox.Checked = true;
     619        selectNoneCheckBox.Checked = true;
    236620      } catch { }
    237621      try {
    238         SetMode(locked: false);
     622        SetMode(DialogMode.Normal);
    239623        if (e.Error != null) MessageBox.Show(e.Error.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
    240624      } catch { }
    241625    }
    242 
    243     private StringBuilder failedInstances;
     626    #endregion
     627
     628    #region Experiment creation
    244629    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
    247631      failedInstances = new StringBuilder();
    248       var items = (Dictionary<IProblemInstanceProvider, List<IDataDescriptor>>)e.Argument;
    249632      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);
    252638        experimentCreationBackgroundWorker.ReportProgress(100, string.Empty);
     639
    253640      } else {
    254         int counter = 0, total = items.SelectMany(x => x.Value).Count();
    255         foreach (var provider in items.Keys) {
    256           foreach (var descriptor in items[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]) {
    257644            #region Check cancellation request
    258645            if (experimentCreationBackgroundWorker.CancellationPending) {
     
    271658            }
    272659            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 + ")");
    277667          }
    278668        }
    279669      }
    280670      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;
    282763    }
    283764
    284765    private void experimentCreationBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    285766      try {
    286         SetMode(locked: false);
     767        SetMode(DialogMode.Normal);
    287768        if (e.Error != null) MessageBox.Show(e.Error.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
    288769        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);
    289770        if (!e.Cancelled && e.Error == null) {
    290           experiment = (Experiment)e.Result;
    291771          DialogResult = System.Windows.Forms.DialogResult.OK;
    292772          Close();
     
    295775    }
    296776    #endregion
     777    #endregion
    297778  }
    298779}
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r7841 r7908  
    236236      <Private>False</Private>
    237237    </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>
    238242    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
    239243      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
     
    250254      <Name>HeuristicLab.Optimization-3.3</Name>
    251255      <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>
    252260    </ProjectReference>
    253261    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
  • trunk/sources/HeuristicLab.Optimizer/3.3/Plugin.cs.frame

    r7841 r7908  
    3333  [PluginDependency("HeuristicLab.Core", "3.3")]
    3434  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
     35  [PluginDependency("HeuristicLab.Data", "3.3")]
    3536  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3637  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3738  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     39  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3840  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3941  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
Note: See TracChangeset for help on using the changeset viewer.