- Timestamp:
- 06/24/12 19:25:47 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimizer/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.Designer.cs
r8014 r8095 183 183 // 184 184 this.instanceDiscoveryProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 185 this.instanceDiscoveryProgressBar.Location = new System.Drawing.Point(6, 1 32);185 this.instanceDiscoveryProgressBar.Location = new System.Drawing.Point(6, 141); 186 186 this.instanceDiscoveryProgressBar.Name = "instanceDiscoveryProgressBar"; 187 this.instanceDiscoveryProgressBar.Size = new System.Drawing.Size(3 08, 23);187 this.instanceDiscoveryProgressBar.Size = new System.Drawing.Size(367, 23); 188 188 this.instanceDiscoveryProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 189 189 this.instanceDiscoveryProgressBar.TabIndex = 4; … … 194 194 this.instanceDiscoveryProgressLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 195 195 this.instanceDiscoveryProgressLabel.BackColor = System.Drawing.SystemColors.Control; 196 this.instanceDiscoveryProgressLabel.Location = new System.Drawing.Point(6, 1 58);196 this.instanceDiscoveryProgressLabel.Location = new System.Drawing.Point(6, 167); 197 197 this.instanceDiscoveryProgressLabel.Name = "instanceDiscoveryProgressLabel"; 198 this.instanceDiscoveryProgressLabel.Size = new System.Drawing.Size(3 08, 23);198 this.instanceDiscoveryProgressLabel.Size = new System.Drawing.Size(367, 23); 199 199 this.instanceDiscoveryProgressLabel.TabIndex = 5; 200 200 this.instanceDiscoveryProgressLabel.Text = "label1"; … … 362 362 this.instancesTabPage.Name = "instancesTabPage"; 363 363 this.instancesTabPage.Padding = new System.Windows.Forms.Padding(3); 364 this.instancesTabPage.Size = new System.Drawing.Size(3 20, 273);364 this.instancesTabPage.Size = new System.Drawing.Size(379, 291); 365 365 this.instancesTabPage.TabIndex = 0; 366 366 this.instancesTabPage.Text = "Problem Instances"; … … 384 384 this.instancesTreeView.Location = new System.Drawing.Point(6, 35); 385 385 this.instancesTreeView.Name = "instancesTreeView"; 386 this.instancesTreeView.Size = new System.Drawing.Size(3 08, 232);386 this.instancesTreeView.Size = new System.Drawing.Size(367, 250); 387 387 this.instancesTreeView.TabIndex = 6; 388 388 this.instancesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.instancesTreeView_AfterCheck); … … 453 453 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 454 454 this.Text = "Create Experiment"; 455 this.TopMost = true;456 455 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreateExperimentDialog_FormClosing); 457 456 this.Load += new System.EventHandler(this.CreateExperimentDialog_Load); -
trunk/sources/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r8014 r8095 126 126 if (intValue != null) { 127 127 if (e.Item.Checked) { 128 intParameters.Add(parameter, new IntArray()); 128 IntArray initialValues; 129 if (intValue.Value == int.MinValue) 130 initialValues = new IntArray(new int[] { -100, -50, 5 }); 131 else if (intValue.Value == int.MaxValue) 132 initialValues = new IntArray(new int[] { 5, 50, 100 }); 133 else if (intValue.Value == 0) 134 initialValues = new IntArray(new int[] { 0, 1, 2 }); 135 else if (Math.Abs(intValue.Value) < 10) 136 initialValues = new IntArray(new int[] { intValue.Value - 1, intValue.Value, intValue.Value + 1 }); 137 else initialValues = new IntArray(new int[] { intValue.Value / 2, intValue.Value, intValue.Value * 2 }); 138 intParameters.Add(parameter, initialValues); 129 139 intParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 130 140 } else intParameters.Remove(parameter); … … 134 144 if (doubleValue != null) { 135 145 if (e.Item.Checked) { 136 doubleParameters.Add(parameter, new DoubleArray()); 146 DoubleArray initialValues; 147 if (doubleValue.Value == double.MinValue) 148 initialValues = new DoubleArray(new double[] { -1, -0.5, 0 }); 149 else if (doubleValue.Value == double.MaxValue) 150 initialValues = new DoubleArray(new double[] { 0, 0.5, 1 }); 151 else if (doubleValue.Value == 0.0) 152 initialValues = new DoubleArray(new double[] { 0, 0.1, 0.2 }); 153 else if (Math.Abs(doubleValue.Value) <= 1.0) { 154 if (doubleValue.Value > 0.9 || (doubleValue.Value < 0.0 && doubleValue.Value > -0.1)) 155 initialValues = new DoubleArray(new double[] { doubleValue.Value - 0.2, doubleValue.Value - 0.1, doubleValue.Value }); 156 else if (doubleValue.Value < -0.9 || (doubleValue.Value > 0 && doubleValue.Value < 0.1)) 157 initialValues = new DoubleArray(new double[] { doubleValue.Value, doubleValue.Value + 0.1, doubleValue.Value + 0.2 }); 158 else initialValues = new DoubleArray(new double[] { doubleValue.Value - 0.1, doubleValue.Value, doubleValue.Value + 0.1 }); 159 } else initialValues = new DoubleArray(new double[] { doubleValue.Value / 2.0, doubleValue.Value, doubleValue.Value * 2.0 }); 160 doubleParameters.Add(parameter, initialValues); 137 161 doubleParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 138 162 } else doubleParameters.Remove(parameter); … … 355 379 finally { suppressTreeViewEventHandling = false; } 356 380 } 381 UpdateVariationsLabel(); 357 382 } 358 383 } … … 375 400 finally { suppressTreeViewEventHandling = false; } 376 401 } 402 UpdateVariationsLabel(); 377 403 } 378 404 } … … 633 659 #region Instance discovery 634 660 private void instanceDiscoveryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { 661 instanceDiscoveryBackgroundWorker.ReportProgress(0, "Finding instance providers..."); 635 662 var instanceProviders = ProblemInstanceManager.GetProviders(((IAlgorithm)Optimizer).Problem).ToArray(); 636 var nodes = new TreeNode[instanceProviders.Length];663 var nodes = new List<TreeNode>(instanceProviders.Length); 637 664 for (int i = 0; i < instanceProviders.Length; i++) { 638 665 var provider = instanceProviders[i]; 639 nodes[i] = new TreeNode(provider.Name) { Tag = provider }; 640 } 641 e.Result = nodes; 642 for (int i = 0; i < nodes.Length; i++) { 643 var providerNode = nodes[i]; 644 var provider = providerNode.Tag as IProblemInstanceProvider; 645 double progress = i / (double)nodes.Length; 646 instanceDiscoveryBackgroundWorker.ReportProgress((int)(100 * progress), provider.Name); 647 var descriptors = ProblemInstanceManager.GetDataDescriptors(provider).ToArray(); 648 for (int j = 0; j < descriptors.Length; j++) { 666 var providerNode = new TreeNode(provider.Name) { Tag = provider }; 667 var descriptors = ProblemInstanceManager.GetDataDescriptors(provider); 668 foreach (var desc in descriptors) { 649 669 #region Check cancellation request 650 670 if (instanceDiscoveryBackgroundWorker.CancellationPending) { 651 671 e.Cancel = true; 672 e.Result = nodes.ToArray(); 652 673 return; 653 674 } 654 675 #endregion 655 var node = new TreeNode(desc riptors[j].Name) { Tag = descriptors[j]};676 var node = new TreeNode(desc.Name) { Tag = desc }; 656 677 providerNode.Nodes.Add(node); 657 } 658 } 678 if (providerNode.Nodes.Count == 1) 679 nodes.Add(providerNode); 680 } 681 double progress = nodes.Count > 0 ? i / (double)nodes.Count : 0.0; 682 instanceDiscoveryBackgroundWorker.ReportProgress((int)(100 * progress), provider.Name); 683 } 684 e.Result = nodes.ToArray(); 659 685 instanceDiscoveryBackgroundWorker.ReportProgress(100, string.Empty); 660 686 } … … 669 695 private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 670 696 try { 671 instancesTreeView.Nodes.AddRange((TreeNode[])e.Result); 672 foreach (TreeNode node in instancesTreeView.Nodes) 673 node.Collapse(); 697 if (((TreeNode[])e.Result).Length > 0) { 698 instancesTreeView.Nodes.AddRange((TreeNode[])e.Result); 699 foreach (TreeNode node in instancesTreeView.Nodes) 700 node.Collapse(); 701 } 674 702 selectNoneCheckBox.Checked = true; 675 } 676 catch { } 703 } catch { } 677 704 try { 678 705 SetMode(DialogMode.Normal); 679 706 if (e.Error != null) MessageBox.Show(e.Error.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error); 680 } 681 catch { } 707 } catch { } 682 708 } 683 709 #endregion
Note: See TracChangeset
for help on using the changeset viewer.