Changeset 9364
- Timestamp:
- 04/16/13 16:23:59 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/CreateExperimentDialog.Designer.cs
r9361 r9364 80 80 this.combinationsTextBox = new System.Windows.Forms.TextBox(); 81 81 this.label2 = new System.Windows.Forms.Label(); 82 this.label3 = new System.Windows.Forms.Label(); 83 this.repetitionsTextBox = new System.Windows.Forms.TextBox(); 82 84 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 83 85 this.tabControl.SuspendLayout(); … … 97 99 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 98 100 this.okButton.Enabled = false; 99 this.okButton.Location = new System.Drawing.Point( 474, 377);101 this.okButton.Location = new System.Drawing.Point(630, 377); 100 102 this.okButton.Name = "okButton"; 101 103 this.okButton.Size = new System.Drawing.Size(75, 23); … … 109 111 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 110 112 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 111 this.cancelButton.Location = new System.Drawing.Point( 555, 377);113 this.cancelButton.Location = new System.Drawing.Point(711, 377); 112 114 this.cancelButton.Name = "cancelButton"; 113 115 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 163 165 0}); 164 166 this.repetitionsNumericUpDown.Name = "repetitionsNumericUpDown"; 165 this.repetitionsNumericUpDown.Size = new System.Drawing.Size( 517, 20);167 this.repetitionsNumericUpDown.Size = new System.Drawing.Size(673, 20); 166 168 this.repetitionsNumericUpDown.TabIndex = 3; 167 169 this.repetitionsNumericUpDown.ThousandsSeparator = true; … … 244 246 this.tabControl.Name = "tabControl"; 245 247 this.tabControl.SelectedIndex = 0; 246 this.tabControl.Size = new System.Drawing.Size( 615, 317);248 this.tabControl.Size = new System.Drawing.Size(771, 317); 247 249 this.tabControl.TabIndex = 4; 248 250 // … … 253 255 this.parametersTabPage.Name = "parametersTabPage"; 254 256 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 255 this.parametersTabPage.Size = new System.Drawing.Size( 607, 291);257 this.parametersTabPage.Size = new System.Drawing.Size(763, 291); 256 258 this.parametersTabPage.TabIndex = 1; 257 259 this.parametersTabPage.Text = "Parameter Variations"; … … 275 277 this.parametersSplitContainer.Panel2.Controls.Add(this.detailsTypeLabel); 276 278 this.parametersSplitContainer.Panel2.Controls.Add(this.choicesListView); 277 this.parametersSplitContainer.Size = new System.Drawing.Size( 601, 285);279 this.parametersSplitContainer.Size = new System.Drawing.Size(757, 285); 278 280 this.parametersSplitContainer.SplitterDistance = 155; 279 281 this.parametersSplitContainer.TabIndex = 1; … … 320 322 this.stringConvertibleArrayView.Name = "stringConvertibleArrayView"; 321 323 this.stringConvertibleArrayView.ReadOnly = false; 322 this.stringConvertibleArrayView.Size = new System.Drawing.Size( 411, 233);324 this.stringConvertibleArrayView.Size = new System.Drawing.Size(567, 233); 323 325 this.stringConvertibleArrayView.TabIndex = 7; 324 326 // … … 343 345 this.choicesListView.Location = new System.Drawing.Point(16, 34); 344 346 this.choicesListView.Name = "choicesListView"; 345 this.choicesListView.Size = new System.Drawing.Size( 411, 238);347 this.choicesListView.Size = new System.Drawing.Size(567, 238); 346 348 this.choicesListView.TabIndex = 6; 347 349 this.choicesListView.UseCompatibleStateImageBehavior = false; … … 426 428 this.experimentCreationProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 427 429 | System.Windows.Forms.AnchorStyles.Right))); 428 this.experimentCreationProgressBar.Location = new System.Drawing.Point( 371, 377);430 this.experimentCreationProgressBar.Location = new System.Drawing.Point(587, 377); 429 431 this.experimentCreationProgressBar.Name = "experimentCreationProgressBar"; 430 this.experimentCreationProgressBar.Size = new System.Drawing.Size(1 78, 23);432 this.experimentCreationProgressBar.Size = new System.Drawing.Size(118, 23); 431 433 this.experimentCreationProgressBar.TabIndex = 9; 432 434 this.experimentCreationProgressBar.Visible = false; … … 435 437 // 436 438 this.combinationsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 437 this.combinationsTextBox.Location = new System.Drawing.Point( 265, 379);439 this.combinationsTextBox.Location = new System.Drawing.Point(306, 379); 438 440 this.combinationsTextBox.Name = "combinationsTextBox"; 439 441 this.combinationsTextBox.Size = new System.Drawing.Size(100, 20); … … 445 447 this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 446 448 this.label2.AutoSize = true; 447 this.label2.Location = new System.Drawing.Point( 173, 382);449 this.label2.Location = new System.Drawing.Point(214, 382); 448 450 this.label2.Name = "label2"; 449 451 this.label2.Size = new System.Drawing.Size(86, 13); … … 451 453 this.label2.Text = "Var. to generate:"; 452 454 // 455 // label3 456 // 457 this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 458 this.label3.AutoSize = true; 459 this.label3.Location = new System.Drawing.Point(412, 382); 460 this.label3.Name = "label3"; 461 this.label3.Size = new System.Drawing.Size(63, 13); 462 this.label3.TabIndex = 12; 463 this.label3.Text = "Repetitions:"; 464 // 465 // repetitionsTextBox 466 // 467 this.repetitionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 468 this.repetitionsTextBox.Location = new System.Drawing.Point(481, 379); 469 this.repetitionsTextBox.Name = "repetitionsTextBox"; 470 this.repetitionsTextBox.Size = new System.Drawing.Size(100, 20); 471 this.repetitionsTextBox.TabIndex = 13; 472 this.repetitionsTextBox.Text = "1"; 473 // 453 474 // CreateExperimentDialog 454 475 // … … 456 477 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 457 478 this.CancelButton = this.cancelButton; 458 this.ClientSize = new System.Drawing.Size(642, 412); 479 this.ClientSize = new System.Drawing.Size(798, 412); 480 this.Controls.Add(this.repetitionsTextBox); 481 this.Controls.Add(this.label3); 459 482 this.Controls.Add(this.label2); 460 483 this.Controls.Add(this.combinationsTextBox); … … 530 553 private System.Windows.Forms.Label label2; 531 554 private System.Windows.Forms.TextBox combinationsTextBox; 555 private System.Windows.Forms.TextBox repetitionsTextBox; 556 private System.Windows.Forms.Label label3; 532 557 533 558 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/CreateExperimentDialog.cs
r9361 r9364 44 44 set { 45 45 optimizer = value; 46 Experiment = null;46 Experiments = null; 47 47 okButton.Enabled = optimizer != null; 48 48 SetTabControlVisibility(); … … 52 52 } 53 53 54 public Experiment Experiment{ get; private set; }54 public List<Experiment> Experiments { get; private set; } 55 55 56 56 private bool createBatchRun; … … 75 75 // do not set the Optimizer property here, because we want to delay instance discovery to the time when the form loads 76 76 this.optimizer = optimizer; 77 Experiment = null;77 Experiments = null; 78 78 okButton.Enabled = optimizer != null; 79 79 … … 715 715 private void experimentCreationBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { 716 716 backgroundWorkerWaitHandle.Set(); // notify the ok button that we're busy now 717 failedInstances = new StringBuilder(); 718 var localExperiment = new Experiment(); 719 720 int counter = 0, totalVariations = GetNumberOfVariations(); 721 int totalInstances = instances.Values.SelectMany(x => x).Count(); 722 if (totalInstances == 0) { 723 try { 724 AddParameterVariations(Optimizer, localExperiment, ref counter, totalVariations); 725 } 726 catch (OperationCanceledException) { 727 e.Cancel = true; 728 return; 729 } 730 experimentCreationBackgroundWorker.ReportProgress(100, string.Empty); 731 } else { 732 foreach (var provider in instances.Keys) { 733 foreach (var descriptor in instances[provider]) { 734 var algorithm = (IAlgorithm)Optimizer.Clone(); 735 bool failed = false; 736 try { 737 ProblemInstanceManager.LoadData(provider, descriptor, (IProblemInstanceConsumer)algorithm.Problem); 738 } 739 catch (Exception ex) { 740 failedInstances.AppendLine(descriptor.Name + ": " + ex.Message); 741 failed = true; 742 } 743 if (!failed) { 717 718 int b = int.Parse(repetitionsTextBox.Text); 719 for (int i = 0; i < b; i++) { 720 failedInstances = new StringBuilder(); 721 var localExperiment = new Experiment(); 722 723 int counter = 0, totalVariations = GetNumberOfVariations(); 724 int totalInstances = instances.Values.SelectMany(x => x).Count(); 725 if (totalInstances == 0) { 726 try { 727 AddParameterVariations(Optimizer, localExperiment, ref counter, totalVariations); 728 } 729 catch (OperationCanceledException) { 730 e.Cancel = true; 731 return; 732 } 733 experimentCreationBackgroundWorker.ReportProgress(100, string.Empty); 734 } else { 735 foreach (var provider in instances.Keys) { 736 foreach (var descriptor in instances[provider]) { 737 var algorithm = (IAlgorithm)Optimizer.Clone(); 738 bool failed = false; 744 739 try { 745 if (totalInstances > 1 && totalVariations / totalInstances > 1) { 746 var experiment = new Experiment(descriptor.Name); 747 AddParameterVariations(algorithm, experiment, ref counter, totalVariations); 748 localExperiment.Optimizers.Add(experiment); 749 } else { 750 AddParameterVariations(algorithm, localExperiment, ref counter, totalVariations); 740 ProblemInstanceManager.LoadData(provider, descriptor, (IProblemInstanceConsumer)algorithm.Problem); 741 } 742 catch (Exception ex) { 743 failedInstances.AppendLine(descriptor.Name + ": " + ex.Message); 744 failed = true; 745 } 746 if (!failed) { 747 try { 748 if (totalInstances > 1 && totalVariations / totalInstances > 1) { 749 var experiment = new Experiment(descriptor.Name); 750 AddParameterVariations(algorithm, experiment, ref counter, totalVariations); 751 localExperiment.Optimizers.Add(experiment); 752 } else { 753 AddParameterVariations(algorithm, localExperiment, ref counter, totalVariations); 754 } 751 755 } 752 } 753 catch (OperationCanceledException) { 754 e.Cancel = true; 755 return; 756 } 757 } else experimentCreationBackgroundWorker.ReportProgress((int)Math.Round((100.0 * counter) / totalVariations), "Loading failed (" + descriptor.Name + ")"); 758 } 759 } 760 } 761 // this step can take some time 762 SetMode(DialogMode.PreparingExperiment); 763 experimentCreationBackgroundWorker.ReportProgress(-1); 764 localExperiment.Prepare(true); 765 experimentCreationBackgroundWorker.ReportProgress(100); 766 Experiment = localExperiment; 756 catch (OperationCanceledException) { 757 e.Cancel = true; 758 return; 759 } 760 } else experimentCreationBackgroundWorker.ReportProgress((int)Math.Round((100.0 * counter) / totalVariations), "Loading failed (" + descriptor.Name + ")"); 761 } 762 } 763 } 764 // this step can take some time 765 SetMode(DialogMode.PreparingExperiment); 766 experimentCreationBackgroundWorker.ReportProgress(-1); 767 localExperiment.Prepare(true); 768 experimentCreationBackgroundWorker.ReportProgress(100); 769 if (Experiments == null) Experiments = new List<Experiment>(); 770 Experiments.Add(localExperiment); 771 } 767 772 } 768 773 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/CreateExperimentMenuItem.cs
r9361 r9364 54 54 if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked) { 55 55 using (CreateExperimentDialog dialog = new CreateExperimentDialog((IOptimizer)activeView.Content)) { 56 if (dialog.ShowDialog() == DialogResult.OK) MainFormManager.MainForm.ShowContent(dialog.Experiment); 56 if (dialog.ShowDialog() == DialogResult.OK) { 57 foreach (var exp in dialog.Experiments) { 58 MainFormManager.MainForm.ShowContent(exp); 59 } 60 61 } 57 62 } 58 63 }
Note: See TracChangeset
for help on using the changeset viewer.