Changeset 7985
- Timestamp:
- 06/12/12 01:47:25 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimizer/3.3
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.Designer.cs
r7967 r7985 65 65 this.parametersListView = new System.Windows.Forms.ListView(); 66 66 this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 67 this.generateButton = new System.Windows.Forms.Button(); 68 this.stringConvertibleArrayView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 67 69 this.detailsTypeLabel = new System.Windows.Forms.Label(); 68 this.stepSizeTextBox = new System.Windows.Forms.TextBox();69 this.maximumTextBox = new System.Windows.Forms.TextBox();70 this.minimumTextBox = new System.Windows.Forms.TextBox();71 this.stepSizeLabel = new System.Windows.Forms.Label();72 this.maximumLabel = new System.Windows.Forms.Label();73 this.minimumLabel = new System.Windows.Forms.Label();74 70 this.choicesListView = new System.Windows.Forms.ListView(); 75 71 this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); … … 80 76 this.variationsLabel = new System.Windows.Forms.Label(); 81 77 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 78 this.warningProvider = new System.Windows.Forms.ErrorProvider(this.components); 82 79 this.experimentCreationProgressBar = new System.Windows.Forms.ProgressBar(); 83 this.warningProvider = new System.Windows.Forms.ErrorProvider(this.components);84 80 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 85 81 this.tabControl.SuspendLayout(); … … 273 269 // parametersSplitContainer.Panel2 274 270 // 271 this.parametersSplitContainer.Panel2.Controls.Add(this.generateButton); 272 this.parametersSplitContainer.Panel2.Controls.Add(this.stringConvertibleArrayView); 275 273 this.parametersSplitContainer.Panel2.Controls.Add(this.detailsTypeLabel); 276 this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeTextBox);277 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumTextBox);278 this.parametersSplitContainer.Panel2.Controls.Add(this.minimumTextBox);279 this.parametersSplitContainer.Panel2.Controls.Add(this.stepSizeLabel);280 this.parametersSplitContainer.Panel2.Controls.Add(this.maximumLabel);281 this.parametersSplitContainer.Panel2.Controls.Add(this.minimumLabel);282 274 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView); 283 275 this.parametersSplitContainer.Size = new System.Drawing.Size(314, 267); … … 306 298 this.columnHeader1.Width = 150; 307 299 // 300 // generateButton 301 // 302 this.generateButton.Location = new System.Drawing.Point(16, 10); 303 this.generateButton.Name = "generateButton"; 304 this.generateButton.Size = new System.Drawing.Size(75, 23); 305 this.generateButton.TabIndex = 8; 306 this.generateButton.Text = "Generate..."; 307 this.generateButton.UseVisualStyleBackColor = true; 308 this.generateButton.Click += new System.EventHandler(this.generateButton_Click); 309 // 310 // stringConvertibleArrayView 311 // 312 this.stringConvertibleArrayView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 313 | System.Windows.Forms.AnchorStyles.Left) 314 | System.Windows.Forms.AnchorStyles.Right))); 315 this.stringConvertibleArrayView.Caption = "StringConvertibleArray View"; 316 this.stringConvertibleArrayView.Content = null; 317 this.stringConvertibleArrayView.Location = new System.Drawing.Point(16, 39); 318 this.stringConvertibleArrayView.Name = "stringConvertibleArrayView"; 319 this.stringConvertibleArrayView.ReadOnly = false; 320 this.stringConvertibleArrayView.Size = new System.Drawing.Size(155, 215); 321 this.stringConvertibleArrayView.TabIndex = 7; 322 // 308 323 // detailsTypeLabel 309 324 // … … 314 329 this.detailsTypeLabel.TabIndex = 0; 315 330 this.detailsTypeLabel.Text = "Choices:"; 316 //317 // stepSizeTextBox318 //319 this.stepSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)320 | System.Windows.Forms.AnchorStyles.Right)));321 this.stepSizeTextBox.Location = new System.Drawing.Point(73, 86);322 this.stepSizeTextBox.Name = "stepSizeTextBox";323 this.stepSizeTextBox.Size = new System.Drawing.Size(98, 20);324 this.stepSizeTextBox.TabIndex = 5;325 this.stepSizeTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);326 //327 // maximumTextBox328 //329 this.maximumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)330 | System.Windows.Forms.AnchorStyles.Right)));331 this.maximumTextBox.Location = new System.Drawing.Point(73, 60);332 this.maximumTextBox.Name = "maximumTextBox";333 this.maximumTextBox.Size = new System.Drawing.Size(98, 20);334 this.maximumTextBox.TabIndex = 3;335 this.maximumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);336 //337 // minimumTextBox338 //339 this.minimumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)340 | System.Windows.Forms.AnchorStyles.Right)));341 this.minimumTextBox.Location = new System.Drawing.Point(73, 34);342 this.minimumTextBox.Name = "minimumTextBox";343 this.minimumTextBox.Size = new System.Drawing.Size(98, 20);344 this.minimumTextBox.TabIndex = 1;345 this.minimumTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.detailsTextBox_Validating);346 //347 // stepSizeLabel348 //349 this.stepSizeLabel.AutoSize = true;350 this.stepSizeLabel.Location = new System.Drawing.Point(13, 89);351 this.stepSizeLabel.Name = "stepSizeLabel";352 this.stepSizeLabel.Size = new System.Drawing.Size(53, 13);353 this.stepSizeLabel.TabIndex = 4;354 this.stepSizeLabel.Text = "Step size:";355 //356 // maximumLabel357 //358 this.maximumLabel.AutoSize = true;359 this.maximumLabel.Location = new System.Drawing.Point(13, 63);360 this.maximumLabel.Name = "maximumLabel";361 this.maximumLabel.Size = new System.Drawing.Size(54, 13);362 this.maximumLabel.TabIndex = 2;363 this.maximumLabel.Text = "Maximum:";364 //365 // minimumLabel366 //367 this.minimumLabel.AutoSize = true;368 this.minimumLabel.Location = new System.Drawing.Point(13, 37);369 this.minimumLabel.Name = "minimumLabel";370 this.minimumLabel.Size = new System.Drawing.Size(51, 13);371 this.minimumLabel.TabIndex = 0;372 this.minimumLabel.Text = "Minimum:";373 331 // 374 332 // choicesListView … … 456 414 this.errorProvider.ContainerControl = this; 457 415 // 416 // warningProvider 417 // 418 this.warningProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; 419 this.warningProvider.ContainerControl = this; 420 this.warningProvider.Icon = ((System.Drawing.Icon)(resources.GetObject("warningProvider.Icon"))); 421 // 458 422 // experimentCreationProgressBar 459 423 // … … 466 430 this.experimentCreationProgressBar.Visible = false; 467 431 // 468 // warningProvider469 //470 this.warningProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;471 this.warningProvider.ContainerControl = this;472 this.warningProvider.Icon = ((System.Drawing.Icon)(resources.GetObject("warningProvider.Icon")));473 //474 432 // CreateExperimentDialog 475 433 // 476 434 this.AcceptButton = this.okButton; 477 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);478 435 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 479 436 this.CancelButton = this.cancelButton; … … 542 499 private System.Windows.Forms.ListView choicesListView; 543 500 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 501 private System.Windows.Forms.Label label1; 551 502 private System.Windows.Forms.ErrorProvider errorProvider; 552 private System.Windows.Forms.ProgressBar experimentCreationProgressBar;553 503 private System.Windows.Forms.ErrorProvider warningProvider; 554 504 private System.Windows.Forms.TreeView instancesTreeView; 505 private Data.Views.StringConvertibleArrayView stringConvertibleArrayView; 506 private System.Windows.Forms.ProgressBar experimentCreationProgressBar; 507 private System.Windows.Forms.Button generateButton; 555 508 556 509 } -
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r7976 r7985 56 56 private int repetitions; 57 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;58 private Dictionary<IValueParameter, IntArray> intParameters; 59 private Dictionary<IValueParameter, DoubleArray> doubleParameters; 60 60 private HashSet<IValueParameter> boolParameters; 61 61 private Dictionary<IValueParameter, HashSet<IItem>> multipleChoiceParameters; … … 77 77 78 78 instances = new Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>>(); 79 intParameters = new Dictionary<IValueParameter, Tuple<int, int, int>>();80 doubleParameters = new Dictionary<IValueParameter, Tuple<double, double, double>>();79 intParameters = new Dictionary<IValueParameter, IntArray>(); 80 doubleParameters = new Dictionary<IValueParameter, DoubleArray>(); 81 81 boolParameters = new HashSet<IValueParameter>(); 82 82 multipleChoiceParameters = new Dictionary<IValueParameter, HashSet<IItem>>(); … … 118 118 119 119 if (isConstrainedValueParameter) { 120 if (e.Item.Checked) { 121 multipleChoiceParameters.Add(parameter, new HashSet<IItem>()); 122 } else { 123 multipleChoiceParameters.Remove(parameter); 124 } 120 if (e.Item.Checked) multipleChoiceParameters.Add(parameter, new HashSet<IItem>()); 121 else multipleChoiceParameters.Remove(parameter); 125 122 } 126 123 … … 128 125 if (intValue != null) { 129 126 if (e.Item.Checked) { 130 int minimum = intValue.Value; 131 int maximum = intValue.Value; 132 int step = 1; 133 intParameters.Add(parameter, new Tuple<int, int, int>(minimum, maximum, step)); 127 intParameters.Add(parameter, new IntArray()); 128 intParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 134 129 } else intParameters.Remove(parameter); 135 130 } … … 138 133 if (doubleValue != null) { 139 134 if (e.Item.Checked) { 140 double minimum = doubleValue.Value; 141 double maximum = doubleValue.Value; 142 double step = 1; 143 doubleParameters.Add(parameter, new Tuple<double, double, double>(minimum, maximum, step)); 135 doubleParameters.Add(parameter, new DoubleArray()); 136 doubleParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 144 137 } else doubleParameters.Remove(parameter); 145 138 } … … 174 167 if (isConstrainedValueParameter) { 175 168 detailsTypeLabel.Text = "Choices:"; 176 choicesListView.Enabled = true;177 choicesListView.Visible = true;178 169 choicesListView.Tag = parameter; 179 170 180 if (!multipleChoiceParameters.ContainsKey(parameter)) return;181 171 dynamic constrainedValuedParameter = parameter; 182 172 dynamic validValues = constrainedValuedParameter.ValidValues; … … 184 174 choicesListView.Items.Add(new ListViewItem(choice.ToString()) { 185 175 Tag = choice, 186 Checked = multipleChoiceParameters[parameter].Contains(choice) 176 Checked = multipleChoiceParameters.ContainsKey(parameter) 177 && multipleChoiceParameters[parameter].Contains(choice) 187 178 }); 188 179 } 180 choicesListView.Enabled = multipleChoiceParameters.ContainsKey(parameter); 181 detailsTypeLabel.Visible = true; 182 choicesListView.Visible = true; 189 183 return; 190 184 } 191 185 192 if (!(parameter.Value is ValueTypeValue<bool>)) { 193 minimumLabel.Visible = true; minimumTextBox.Visible = true; 194 maximumLabel.Visible = true; maximumTextBox.Visible = true; 195 stepSizeLabel.Visible = true; stepSizeTextBox.Visible = true; 196 } else detailsTypeLabel.Text = "Boolean parameter: True / False"; 186 if (parameter.Value is ValueTypeValue<bool>) { 187 detailsTypeLabel.Text = "Boolean parameter: True / False"; 188 detailsTypeLabel.Visible = true; 189 } 197 190 198 191 var intValue = parameter.Value as ValueTypeValue<int>; 199 192 if (intValue != null) { 200 detailsTypeLabel.Text = "Integer parameter:"; 201 if (!intParameters.ContainsKey(parameter)) return; 202 string min = intParameters[parameter].Item1.ToString(); 203 string max = intParameters[parameter].Item2.ToString(); 204 string step = intParameters[parameter].Item3.ToString(); 205 UpdateMinMaxStepSize(parameter, min, max, step); 193 if (intParameters.ContainsKey(parameter)) 194 stringConvertibleArrayView.Content = intParameters[parameter]; 195 stringConvertibleArrayView.Visible = true; 196 stringConvertibleArrayView.ReadOnly = !intParameters.ContainsKey(parameter); 197 generateButton.Tag = parameter; 198 generateButton.Enabled = intParameters.ContainsKey(parameter); 199 generateButton.Visible = true; 206 200 return; 207 201 } … … 209 203 var doubleValue = parameter.Value as ValueTypeValue<double>; 210 204 if (doubleValue != null) { 211 detailsTypeLabel.Text = "Double parameter:"; 212 if (!doubleParameters.ContainsKey(parameter)) return; 213 string min = doubleParameters[parameter].Item1.ToString(); 214 string max = doubleParameters[parameter].Item2.ToString(); 215 string step = doubleParameters[parameter].Item3.ToString(); 216 UpdateMinMaxStepSize(parameter, min, max, step); 205 if (doubleParameters.ContainsKey(parameter)) 206 stringConvertibleArrayView.Content = doubleParameters[parameter]; 207 stringConvertibleArrayView.Visible = true; 208 stringConvertibleArrayView.ReadOnly = !doubleParameters.ContainsKey(parameter); 209 generateButton.Tag = parameter; 210 generateButton.Enabled = doubleParameters.ContainsKey(parameter); 211 generateButton.Visible = true; 217 212 return; 218 213 } … … 222 217 private void choiceListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 223 218 var parameter = (IValueParameter)choicesListView.Tag; 224 if (e.Item.Checked) { 225 multipleChoiceParameters[parameter].Add((IItem)e.Item.Tag); 226 } else multipleChoiceParameters[parameter].Remove((IItem)e.Item.Tag); 227 228 UpdateVariationsLabel(); 229 } 230 231 private void detailsTextBox_Validating(object sender, CancelEventArgs e) { 232 var parameter = (IValueParameter)((TextBox)sender).Tag; 233 errorProvider.Clear(); 234 235 var intValue = parameter.Value as ValueTypeValue<int>; 236 if (intValue != null) { 237 int value; 238 if (!int.TryParse(((TextBox)sender).Text, out value)) { 239 errorProvider.SetError(((TextBox)sender), "Please enter a valid integer number."); 240 e.Cancel = true; 241 } else { 242 var before = intParameters[parameter]; 243 var after = default(Tuple<int, int, int>); 244 if (sender == minimumTextBox) after = new Tuple<int, int, int>(value, before.Item2, before.Item3); 245 else if (sender == maximumTextBox) after = new Tuple<int, int, int>(before.Item1, value, before.Item3); 246 else if (sender == stepSizeTextBox) after = new Tuple<int, int, int>(before.Item1, before.Item2, value); 247 intParameters[parameter] = after; 248 } 249 } 250 251 var doubleValue = parameter.Value as ValueTypeValue<double>; 252 if (doubleValue != null) { 253 double value; 254 if (!double.TryParse(((TextBox)sender).Text, NumberStyles.Float, CultureInfo.CurrentCulture.NumberFormat, out value)) { 255 errorProvider.SetError(((TextBox)sender), "Please enter a valid number."); 256 e.Cancel = true; 257 } else { 258 var before = doubleParameters[parameter]; 259 var after = default(Tuple<double, double, double>); 260 if (sender == minimumTextBox) after = new Tuple<double, double, double>(value, before.Item2, before.Item3); 261 else if (sender == maximumTextBox) after = new Tuple<double, double, double>(before.Item1, value, before.Item3); 262 else if (sender == stepSizeTextBox) after = new Tuple<double, double, double>(before.Item1, before.Item2, value); 263 doubleParameters[parameter] = after; 264 } 265 } 266 219 if (multipleChoiceParameters.ContainsKey(parameter)) { 220 if (e.Item.Checked) { 221 multipleChoiceParameters[parameter].Add((IItem)e.Item.Tag); 222 } else multipleChoiceParameters[parameter].Remove((IItem)e.Item.Tag); 223 224 UpdateVariationsLabel(); 225 } 226 } 227 228 private void generateButton_Click(object sender, EventArgs e) { 229 var parameter = (IValueParameter)generateButton.Tag; 230 bool integerOnly = intParameters.ContainsKey(parameter); 231 double min = 0, max = 1, step = 1; 232 #region Try to calculate some meaningful values 233 if (integerOnly) { 234 int len = intParameters[parameter].Length; 235 if (len > 0) { 236 min = intParameters[parameter].Min(); 237 max = intParameters[parameter].Max(); 238 step = len >= 2 ? Math.Abs((intParameters[parameter][len - 1] - intParameters[parameter][len - 2])) : 1; 239 } 240 } else { 241 int len = doubleParameters[parameter].Length; 242 if (len > 0) { 243 min = doubleParameters[parameter].Min(); 244 max = doubleParameters[parameter].Max(); 245 step = len >= 2 ? Math.Abs((doubleParameters[parameter][len - 1] - doubleParameters[parameter][len - 2])) : 1; 246 } 247 } 248 #endregion 249 using (var dialog = new DefineArithmeticProgressionDialog(integerOnly, min, max, step)) { 250 if (dialog.ShowDialog() == DialogResult.OK) { 251 var values = dialog.Values; 252 if (integerOnly) { 253 intParameters[parameter].Reset -= new EventHandler(ValuesArray_Reset); 254 intParameters[parameter] = new IntArray(values.Select(x => (int)x).ToArray()); 255 intParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 256 stringConvertibleArrayView.Content = intParameters[parameter]; 257 } else { 258 doubleParameters[parameter].Reset -= new EventHandler(ValuesArray_Reset); 259 doubleParameters[parameter] = new DoubleArray(values.ToArray()); 260 doubleParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 261 stringConvertibleArrayView.Content = doubleParameters[parameter]; 262 } 263 UpdateVariationsLabel(); 264 } 265 } 266 } 267 268 private void ValuesArray_Reset(object sender, EventArgs e) { 267 269 UpdateVariationsLabel(); 268 270 } … … 459 461 int intParameterVariations = 1; 460 462 foreach (var intParam in intParameters.Values) { 461 if (intParam.Item3 == 0) continue; 462 intParameterVariations *= (intParam.Item2 - intParam.Item1) / intParam.Item3 + 1; 463 intParameterVariations *= Math.Max(intParam.Length, 1); 463 464 } 464 465 int doubleParameterVariations = 1; 465 466 foreach (var doubleParam in doubleParameters.Values) { 466 if (doubleParam.Item3 == 0) continue; 467 doubleParameterVariations *= (int)Math.Floor((doubleParam.Item2 - doubleParam.Item1) / doubleParam.Item3) + 1; 467 doubleParameterVariations *= Math.Max(doubleParam.Length, 1); 468 468 } 469 469 int boolParameterVariations = 1; … … 480 480 481 481 private void SetMode(DialogMode mode) { 482 createBatchRunCheckBox.Enabled = mode == DialogMode.Normal; 483 repetitionsNumericUpDown.Enabled = mode == DialogMode.Normal; 484 parametersSplitContainer.Enabled = mode == DialogMode.Normal || mode == DialogMode.DiscoveringInstances; 485 selectAllCheckBox.Enabled = mode == DialogMode.Normal; 486 selectNoneCheckBox.Enabled = mode == DialogMode.Normal; 487 instancesTreeView.Enabled = mode == DialogMode.Normal; 488 instancesTreeView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment || mode == DialogMode.PreparingExperiment; 489 okButton.Enabled = mode == DialogMode.Normal; 490 okButton.Visible = mode != DialogMode.CreatingExperiment && mode != DialogMode.PreparingExperiment; 491 cancelButton.Enabled = mode != DialogMode.PreparingExperiment; 492 instanceDiscoveryProgressLabel.Visible = mode == DialogMode.DiscoveringInstances; 493 instanceDiscoveryProgressBar.Visible = mode == DialogMode.DiscoveringInstances; 494 experimentCreationProgressBar.Visible = mode == DialogMode.CreatingExperiment || mode == DialogMode.PreparingExperiment; 482 if (InvokeRequired) Invoke((Action<DialogMode>)SetMode, mode); 483 else { 484 createBatchRunCheckBox.Enabled = mode == DialogMode.Normal; 485 repetitionsNumericUpDown.Enabled = mode == DialogMode.Normal; 486 parametersSplitContainer.Enabled = mode == DialogMode.Normal || mode == DialogMode.DiscoveringInstances; 487 selectAllCheckBox.Enabled = mode == DialogMode.Normal; 488 selectNoneCheckBox.Enabled = mode == DialogMode.Normal; 489 instancesTreeView.Enabled = mode == DialogMode.Normal; 490 instancesTreeView.Visible = mode == DialogMode.Normal || mode == DialogMode.CreatingExperiment || mode == DialogMode.PreparingExperiment; 491 okButton.Enabled = mode == DialogMode.Normal; 492 okButton.Visible = mode != DialogMode.CreatingExperiment && mode != DialogMode.PreparingExperiment; 493 cancelButton.Enabled = mode != DialogMode.PreparingExperiment; 494 instanceDiscoveryProgressLabel.Visible = mode == DialogMode.DiscoveringInstances; 495 instanceDiscoveryProgressBar.Visible = mode == DialogMode.DiscoveringInstances; 496 experimentCreationProgressBar.Visible = mode == DialogMode.CreatingExperiment || mode == DialogMode.PreparingExperiment; 497 } 495 498 } 496 499 497 500 private void ClearDetailsView() { 498 minimumLabel.Visible = false; 499 minimumTextBox.Text = string.Empty; 500 minimumTextBox.Enabled = false; 501 minimumTextBox.Visible = false; 502 maximumLabel.Visible = false; 503 maximumTextBox.Text = string.Empty; 504 maximumTextBox.Enabled = false; 505 maximumTextBox.Visible = false; 506 stepSizeLabel.Visible = false; 507 stepSizeTextBox.Text = string.Empty; 508 stepSizeTextBox.Enabled = false; 509 stepSizeTextBox.Visible = false; 501 stringConvertibleArrayView.Visible = false; 502 stringConvertibleArrayView.Content = null; 503 stringConvertibleArrayView.ReadOnly = true; 504 generateButton.Visible = false; 505 detailsTypeLabel.Visible = false; 510 506 choicesListView.Items.Clear(); 511 507 choicesListView.Enabled = false; … … 513 509 } 514 510 515 private void UpdateMinMaxStepSize(IValueParameter parameter, string min, string max, string step) {516 minimumLabel.Visible = true;517 minimumTextBox.Text = min;518 minimumTextBox.Enabled = true;519 minimumTextBox.Visible = true;520 minimumTextBox.Tag = parameter;521 maximumLabel.Visible = true;522 maximumTextBox.Text = max;523 maximumTextBox.Enabled = true;524 maximumTextBox.Visible = true;525 maximumTextBox.Tag = parameter;526 stepSizeLabel.Visible = true;527 stepSizeTextBox.Text = step;528 stepSizeTextBox.Enabled = true;529 stepSizeTextBox.Visible = true;530 stepSizeTextBox.Tag = parameter;531 }532 533 511 private void UpdateVariationsLabel() { 534 512 variationsLabel.Text = GetNumberOfVariations().ToString("#,#", CultureInfo.CurrentCulture); … … 538 516 private IEnumerable<Dictionary<IValueParameter, int>> GetIntParameterConfigurations() { 539 517 var configuration = new Dictionary<IValueParameter, int>(); 540 var indices = new Dictionary<IValueParameter, int>();518 var enumerators = new Dictionary<IValueParameter, IEnumerator<int>>(); 541 519 bool finished; 542 520 do { 543 521 foreach (var p in intParameters) { 544 if (!indices.ContainsKey(p.Key)) indices.Add(p.Key, 0); 545 var value = p.Value.Item1 + p.Value.Item3 * indices[p.Key]; 546 configuration[p.Key] = value; 522 if (!enumerators.ContainsKey(p.Key)) { 523 enumerators[p.Key] = p.Value.GetEnumerator(); 524 enumerators[p.Key].MoveNext(); 525 } 526 configuration[p.Key] = enumerators[p.Key].Current; 547 527 } 548 528 yield return configuration; 549 529 550 530 finished = true; 551 foreach (var p in intParameters.Keys) { 552 var newValue = intParameters[p].Item1 + intParameters[p].Item3 * (indices[p] + 1); 553 if (newValue > intParameters[p].Item2 || intParameters[p].Item3 == 0) 554 indices[p] = 0; 555 else { 556 indices[p]++; 531 foreach (var p in intParameters) { 532 if (!enumerators[p.Key].MoveNext()) { 533 enumerators[p.Key] = p.Value.GetEnumerator(); 534 enumerators[p.Key].MoveNext(); 535 } else { 557 536 finished = false; 558 537 break; … … 564 543 private IEnumerable<Dictionary<IValueParameter, double>> GetDoubleParameterConfigurations() { 565 544 var configuration = new Dictionary<IValueParameter, double>(); 566 var indices = new Dictionary<IValueParameter, int>();545 var enumerators = new Dictionary<IValueParameter, IEnumerator<double>>(); 567 546 bool finished; 568 547 do { 569 548 foreach (var p in doubleParameters) { 570 if (!indices.ContainsKey(p.Key)) indices.Add(p.Key, 0); 571 var value = p.Value.Item1 + p.Value.Item3 * indices[p.Key]; 572 configuration[p.Key] = value; 549 if (!enumerators.ContainsKey(p.Key)) { 550 enumerators[p.Key] = p.Value.GetEnumerator(); 551 enumerators[p.Key].MoveNext(); 552 } 553 configuration[p.Key] = enumerators[p.Key].Current; 573 554 } 574 555 yield return configuration; 575 556 576 557 finished = true; 577 foreach (var p in doubleParameters.Keys) { 578 var newValue = doubleParameters[p].Item1 + doubleParameters[p].Item3 * (indices[p] + 1); 579 if (newValue > doubleParameters[p].Item2 || doubleParameters[p].Item3 == 0) 580 indices[p] = 0; 581 else { 582 indices[p]++; 558 foreach (var p in doubleParameters) { 559 if (!enumerators[p.Key].MoveNext()) { 560 enumerators[p.Key] = p.Value.GetEnumerator(); 561 enumerators[p.Key].MoveNext(); 562 } else { 583 563 finished = false; 584 564 break; … … 732 712 } 733 713 if (localExperiment != null) { 734 // don't do GUI stuff in do_work735 714 // this step can take some time 715 SetMode(DialogMode.PreparingExperiment); 736 716 experimentCreationBackgroundWorker.ReportProgress(-1); 737 717 localExperiment.Prepare(true); … … 844 824 experimentCreationProgressBar.Value = e.ProgressPercentage; 845 825 } else { 846 SetMode(DialogMode.PreparingExperiment);847 848 826 experimentCreationProgressBar.Style = ProgressBarStyle.Marquee; 849 827 } -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r7957 r7985 125 125 <EmbeddedResource Include="Documents\PSO_Schwefel.hl" /> 126 126 <None Include="Plugin.cs.frame" /> 127 <Compile Include="DefineArithmeticProgressionDialog.cs"> 128 <SubType>Form</SubType> 129 </Compile> 130 <Compile Include="DefineArithmeticProgressionDialog.Designer.cs"> 131 <DependentUpon>DefineArithmeticProgressionDialog.cs</DependentUpon> 132 </Compile> 127 133 <Compile Include="OptimizerSingleDocumentMainForm.cs"> 128 134 <SubType>Form</SubType> … … 238 244 <Name>HeuristicLab.Core-3.3</Name> 239 245 <Private>False</Private> 246 </ProjectReference> 247 <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj"> 248 <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project> 249 <Name>HeuristicLab.Data.Views-3.3</Name> 240 250 </ProjectReference> 241 251 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> -
trunk/sources/HeuristicLab.Optimizer/3.3/Plugin.cs.frame
r7908 r7985 34 34 [PluginDependency("HeuristicLab.Core.Views", "3.3")] 35 35 [PluginDependency("HeuristicLab.Data", "3.3")] 36 [PluginDependency("HeuristicLab.Data.Views", "3.3")] 36 37 [PluginDependency("HeuristicLab.MainForm", "3.3")] 37 38 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.