Changeset 8524
- Timestamp:
- 08/27/12 10:39:03 (12 years ago)
- Location:
- branches/ParameterConfigurationEncoding
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/CreateExperimentDialogV2.Designer.cs
r8517 r8524 1 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 2 23 partial class CreateExperimentDialogV2 { 3 24 /// <summary> … … 39 60 this.combinationsLabel = new System.Windows.Forms.Label(); 40 61 this.combinationsTextBox = new System.Windows.Forms.TextBox(); 62 this.configurationTabControl = new System.Windows.Forms.TabControl(); 63 this.parameterConfigurationTabPage = new System.Windows.Forms.TabPage(); 64 this.problemInstancesTabPage = new System.Windows.Forms.TabPage(); 65 this.instanceTreeView = new System.Windows.Forms.TreeView(); 66 this.libraryLabel = new System.Windows.Forms.Label(); 67 this.libraryComboBox = new System.Windows.Forms.ComboBox(); 68 this.instanceDiscoveryBackgroundWorker = new System.ComponentModel.BackgroundWorker(); 41 69 this.parameterConfigurationTreeView = new HeuristicLab.Encodings.ParameterConfigurationEncoding.Views.ParameterConfigurationTreeView(); 42 70 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 43 71 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 44 72 ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).BeginInit(); 73 this.configurationTabControl.SuspendLayout(); 74 this.parameterConfigurationTabPage.SuspendLayout(); 75 this.problemInstancesTabPage.SuspendLayout(); 45 76 this.SuspendLayout(); 46 77 // … … 188 219 this.combinationsTextBox.TabIndex = 11; 189 220 // 221 // configurationTabControl 222 // 223 this.configurationTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 224 | System.Windows.Forms.AnchorStyles.Left) 225 | System.Windows.Forms.AnchorStyles.Right))); 226 this.configurationTabControl.Controls.Add(this.parameterConfigurationTabPage); 227 this.configurationTabControl.Controls.Add(this.problemInstancesTabPage); 228 this.configurationTabControl.Location = new System.Drawing.Point(12, 81); 229 this.configurationTabControl.Name = "configurationTabControl"; 230 this.configurationTabControl.SelectedIndex = 0; 231 this.configurationTabControl.Size = new System.Drawing.Size(960, 470); 232 this.configurationTabControl.TabIndex = 12; 233 this.configurationTabControl.SelectedIndexChanged += new System.EventHandler(this.configurationTabControl_SelectedIndexChanged); 234 // 235 // parameterConfigurationTabPage 236 // 237 this.parameterConfigurationTabPage.Controls.Add(this.parameterConfigurationTreeView); 238 this.parameterConfigurationTabPage.Location = new System.Drawing.Point(4, 22); 239 this.parameterConfigurationTabPage.Name = "parameterConfigurationTabPage"; 240 this.parameterConfigurationTabPage.Padding = new System.Windows.Forms.Padding(3); 241 this.parameterConfigurationTabPage.Size = new System.Drawing.Size(952, 444); 242 this.parameterConfigurationTabPage.TabIndex = 0; 243 this.parameterConfigurationTabPage.Text = "Parameter Configuration"; 244 this.parameterConfigurationTabPage.UseVisualStyleBackColor = true; 245 // 246 // problemInstancesTabPage 247 // 248 this.problemInstancesTabPage.Controls.Add(this.instanceTreeView); 249 this.problemInstancesTabPage.Controls.Add(this.libraryLabel); 250 this.problemInstancesTabPage.Controls.Add(this.libraryComboBox); 251 this.problemInstancesTabPage.Location = new System.Drawing.Point(4, 22); 252 this.problemInstancesTabPage.Name = "problemInstancesTabPage"; 253 this.problemInstancesTabPage.Padding = new System.Windows.Forms.Padding(3); 254 this.problemInstancesTabPage.Size = new System.Drawing.Size(952, 444); 255 this.problemInstancesTabPage.TabIndex = 1; 256 this.problemInstancesTabPage.Text = "Problem Instances"; 257 this.problemInstancesTabPage.UseVisualStyleBackColor = true; 258 // 259 // instanceTreeView 260 // 261 this.instanceTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 262 | System.Windows.Forms.AnchorStyles.Left) 263 | System.Windows.Forms.AnchorStyles.Right))); 264 this.instanceTreeView.CheckBoxes = true; 265 this.instanceTreeView.Location = new System.Drawing.Point(6, 33); 266 this.instanceTreeView.Name = "instanceTreeView"; 267 this.instanceTreeView.Size = new System.Drawing.Size(940, 405); 268 this.instanceTreeView.TabIndex = 2; 269 this.instanceTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.instanceTreeView_AfterCheck); 270 // 271 // libraryLabel 272 // 273 this.libraryLabel.AutoSize = true; 274 this.libraryLabel.Location = new System.Drawing.Point(6, 9); 275 this.libraryLabel.Name = "libraryLabel"; 276 this.libraryLabel.Size = new System.Drawing.Size(41, 13); 277 this.libraryLabel.TabIndex = 1; 278 this.libraryLabel.Text = "Library:"; 279 // 280 // libraryComboBox 281 // 282 this.libraryComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 283 | System.Windows.Forms.AnchorStyles.Right))); 284 this.libraryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 285 this.libraryComboBox.FormattingEnabled = true; 286 this.libraryComboBox.Location = new System.Drawing.Point(53, 6); 287 this.libraryComboBox.Name = "libraryComboBox"; 288 this.libraryComboBox.Size = new System.Drawing.Size(893, 21); 289 this.libraryComboBox.TabIndex = 0; 290 this.libraryComboBox.SelectedIndexChanged += new System.EventHandler(this.libraryComboBox_SelectedIndexChanged); 291 // 292 // instanceDiscoveryBackgroundWorker 293 // 294 this.instanceDiscoveryBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.instanceDiscoveryBackgroundWorker_DoWork); 295 this.instanceDiscoveryBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.instanceDiscoveryBackgroundWorker_RunWorkerCompleted); 296 // 190 297 // parameterConfigurationTreeView 191 298 // … … 195 302 this.parameterConfigurationTreeView.Caption = "ParameterConfiguration View"; 196 303 this.parameterConfigurationTreeView.Content = null; 197 this.parameterConfigurationTreeView.Location = new System.Drawing.Point( 12, 81);304 this.parameterConfigurationTreeView.Location = new System.Drawing.Point(6, 6); 198 305 this.parameterConfigurationTreeView.Name = "parameterConfigurationTreeView"; 199 306 this.parameterConfigurationTreeView.ReadOnly = false; 200 this.parameterConfigurationTreeView.Size = new System.Drawing.Size(9 60, 470);307 this.parameterConfigurationTreeView.Size = new System.Drawing.Size(940, 432); 201 308 this.parameterConfigurationTreeView.TabIndex = 6; 202 309 // … … 205 312 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 206 313 this.ClientSize = new System.Drawing.Size(984, 592); 314 this.Controls.Add(this.configurationTabControl); 207 315 this.Controls.Add(this.combinationsTextBox); 208 316 this.Controls.Add(this.combinationsLabel); … … 210 318 this.Controls.Add(this.cancelButton); 211 319 this.Controls.Add(this.okButton); 212 this.Controls.Add(this.parameterConfigurationTreeView);213 320 this.Controls.Add(this.engineLabel); 214 321 this.Controls.Add(this.engineComboBox); … … 229 336 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 230 337 ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).EndInit(); 338 this.configurationTabControl.ResumeLayout(false); 339 this.parameterConfigurationTabPage.ResumeLayout(false); 340 this.problemInstancesTabPage.ResumeLayout(false); 341 this.problemInstancesTabPage.PerformLayout(); 231 342 this.ResumeLayout(false); 232 343 this.PerformLayout(); … … 251 362 private System.Windows.Forms.Label combinationsLabel; 252 363 private System.Windows.Forms.Button calculateCombinationsButton; 364 private System.Windows.Forms.TabControl configurationTabControl; 365 private System.Windows.Forms.TabPage parameterConfigurationTabPage; 366 private System.Windows.Forms.TabPage problemInstancesTabPage; 367 private System.Windows.Forms.TreeView instanceTreeView; 368 private System.Windows.Forms.Label libraryLabel; 369 private System.Windows.Forms.ComboBox libraryComboBox; 370 private System.ComponentModel.BackgroundWorker instanceDiscoveryBackgroundWorker; 253 371 } 254 372 } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/CreateExperimentDialogV2.cs
r8519 r8524 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel; 25 using System.Linq; 24 26 using System.Threading; 25 27 using System.Threading.Tasks; … … 30 32 using HeuristicLab.Optimization; 31 33 using HeuristicLab.PluginInfrastructure; 34 using HeuristicLab.Problems.Instances; 32 35 33 36 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { … … 41 44 private Task generation; 42 45 private CancellationTokenSource cts; 46 private Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> problemInstanceProviders; 47 private Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> selectedProblemInstanceProviders; 43 48 44 49 public Experiment Experiment { get; private set; } … … 57 62 createBatchRun = createBatchRunCheckBox.Checked; 58 63 repetitions = (int)repetitionsNumericUpDown.Value; 64 selectedProblemInstanceProviders = new Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>>(); 59 65 progress = new Progress { 60 66 CanBeCanceled = true, … … 66 72 } 67 73 68 private void SetEnabledStateOfControls(bool state) { 69 createBatchRunCheckBox.Enabled = state; 70 repetitionsNumericUpDown.Enabled = state; 71 engineComboBox.Enabled = state; 72 okButton.Enabled = state; 73 cancelButton.Enabled = state; 74 } 75 76 private void StartProgressView() { 77 if (InvokeRequired) { 78 Invoke(new Action(StartProgressView)); 79 } else { 80 SetEnabledStateOfControls(false); 81 progress.ProgressValue = 0; 82 progress.ProgressState = ProgressState.Started; 83 } 84 } 85 86 private void FinishProgressView() { 87 if (InvokeRequired) { 88 Invoke(new Action(FinishProgressView)); 89 } else { 90 progress.Finish(); 91 SetEnabledStateOfControls(true); 92 } 93 } 94 95 private void CloseDialog() { 96 if (InvokeRequired) { 97 Invoke(new Action(CloseDialog)); 98 } else { 99 this.DialogResult = DialogResult.OK; 100 this.Close(); 101 } 102 } 103 104 private void ReportError(Exception e) { 105 if (InvokeRequired) { 106 Invoke(new Action<Exception>(ReportError), e); 107 } else { 108 ErrorHandling.ShowErrorDialog(this, "An error occurred generating the experiment.", e); 109 } 110 } 111 74 #region Background worker 75 private void instanceDiscoveryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { 76 var instanceProviders = new Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>>(); 77 foreach (var provider in ProblemInstanceManager.GetProviders(algorithm.Problem)) 78 instanceProviders[provider] = new HashSet<IDataDescriptor>(ProblemInstanceManager.GetDataDescriptors(provider)); 79 e.Result = instanceProviders; 80 } 81 82 private void instanceDiscoveryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 83 problemInstanceProviders = (Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>>)e.Result; 84 libraryComboBox.DisplayMember = "Name"; 85 libraryComboBox.DataSource = problemInstanceProviders.Keys.ToList(); 86 libraryComboBox.Enabled = true; 87 } 88 #endregion 89 90 #region Events 112 91 private void CreateExperimentDialogV2_Load(object sender, System.EventArgs e) { 113 92 if (algorithm.Problem != null) { … … 115 94 parameterConfigurationTree.ExperimentGenerationProgressChanged += (o, args) => progress.ProgressValue = parameterConfigurationTree.ExperimentGenerationProgress; 116 95 new ProgressView(parameterConfigurationTreeView, progress) { CancelTimeoutMs = 10000 }; 96 } else { 97 configurationTabControl.TabPages.Remove(problemInstancesTabPage); 98 SetEnabledStateOfControls(false); 117 99 } 118 100 } … … 136 118 } 137 119 120 private void configurationTabControl_SelectedIndexChanged(object sender, EventArgs e) { 121 if (configurationTabControl.SelectedTab == problemInstancesTabPage && problemInstanceProviders == null) { 122 libraryComboBox.Enabled = false; 123 instanceDiscoveryBackgroundWorker.RunWorkerAsync(); 124 } 125 } 126 127 private void libraryComboBox_SelectedIndexChanged(object sender, EventArgs e) { 128 UpdateTreeView((IProblemInstanceProvider)libraryComboBox.SelectedItem); 129 } 130 131 private void instanceTreeView_AfterCheck(object sender, TreeViewEventArgs e) { 132 if (e.Action != TreeViewAction.Unknown) { 133 var provider = e.Node.Tag as IProblemInstanceProvider; 134 if (provider != null) { 135 if (e.Node.Checked) { 136 if (!selectedProblemInstanceProviders.ContainsKey(provider)) 137 selectedProblemInstanceProviders[provider] = new HashSet<IDataDescriptor>(); 138 foreach (TreeNode node in e.Node.Nodes) { 139 selectedProblemInstanceProviders[provider].Add((IDataDescriptor)node.Tag); 140 node.Checked = e.Node.Checked; 141 } 142 } else { 143 selectedProblemInstanceProviders[provider].Clear(); 144 foreach (TreeNode node in e.Node.Nodes) { 145 node.Checked = e.Node.Checked; 146 } 147 } 148 } else { 149 provider = (IProblemInstanceProvider)e.Node.Parent.Tag; 150 if (!selectedProblemInstanceProviders.ContainsKey(provider)) 151 selectedProblemInstanceProviders[provider] = new HashSet<IDataDescriptor>(); 152 if (e.Node.Checked) { 153 selectedProblemInstanceProviders[provider].Add((IDataDescriptor)e.Node.Tag); 154 var instances = new TreeNode[e.Node.Parent.Nodes.Count]; 155 e.Node.Parent.Nodes.CopyTo(instances, 0); 156 e.Node.Parent.Checked = instances.All(x => x.Checked); 157 } else { 158 selectedProblemInstanceProviders[provider].Remove((IDataDescriptor)e.Node.Tag); 159 e.Node.Parent.Checked = e.Node.Checked; 160 } 161 } 162 } 163 } 164 138 165 private void calculateCombinationsButton_Click(object sender, EventArgs e) { 139 combinationsTextBox.Text = parameterConfigurationTree.GetCombinationCount(0).ToString(); 166 long parameterConfigurationsCnt = parameterConfigurationTree.GetCombinationCount(0); 167 int problemInstanceCnt = 1 + selectedProblemInstanceProviders.Values.Sum(x => x.Count); 168 combinationsTextBox.Text = (parameterConfigurationsCnt * problemInstanceCnt).ToString(); 140 169 } 141 170 142 171 private void okButton_Click(object sender, System.EventArgs e) { 172 configurationTabControl.SelectedTab = parameterConfigurationTabPage; 143 173 generation = Task.Factory.StartNew(() => { 144 174 StartProgressView(); … … 146 176 if (engineAlgorithm != null) engineAlgorithm.Engine = engine; 147 177 try { 148 Experiment = createBatchRun ? parameterConfigurationTree.GenerateExperiment(engineAlgorithm, true, repetitions, cts.Token)149 : parameterConfigurationTree.GenerateExperiment(engineAlgorithm, false, 0, cts.Token);178 Experiment = createBatchRun ? parameterConfigurationTree.GenerateExperiment(engineAlgorithm, true, repetitions, selectedProblemInstanceProviders, cts.Token) 179 : parameterConfigurationTree.GenerateExperiment(engineAlgorithm, false, 0, selectedProblemInstanceProviders, cts.Token); 150 180 } 151 181 finally { FinishProgressView(); } … … 164 194 }, TaskContinuationOptions.NotOnRanToCompletion); 165 195 } 196 #endregion 197 198 #region Helpers 199 private void SetEnabledStateOfControls(bool state) { 200 createBatchRunCheckBox.Enabled = state; 201 repetitionsNumericUpDown.Enabled = state; 202 engineComboBox.Enabled = state; 203 calculateCombinationsButton.Enabled = state; 204 okButton.Enabled = state; 205 cancelButton.Enabled = state; 206 } 207 208 private void UpdateTreeView(IProblemInstanceProvider provider) { 209 instanceTreeView.Nodes.Clear(); 210 var rootNode = new TreeNode("All") { Tag = provider }; 211 TreeNode[] instances = problemInstanceProviders[provider] 212 .Select(x => new TreeNode(x.Name) { 213 Tag = x, 214 Checked = selectedProblemInstanceProviders.ContainsKey(provider) 215 && selectedProblemInstanceProviders[provider].Contains(x) 216 }) 217 .ToArray(); 218 rootNode.Checked = instances.All(x => x.Checked); 219 rootNode.Nodes.AddRange(instances); 220 rootNode.ExpandAll(); 221 instanceTreeView.Nodes.Add(rootNode); 222 } 223 224 private void StartProgressView() { 225 if (InvokeRequired) { 226 Invoke(new Action(StartProgressView)); 227 } else { 228 SetEnabledStateOfControls(false); 229 problemInstancesTabPage.Enabled = false; 230 progress.ProgressValue = 0; 231 progress.ProgressState = ProgressState.Started; 232 } 233 } 234 235 private void FinishProgressView() { 236 if (InvokeRequired) { 237 Invoke(new Action(FinishProgressView)); 238 } else { 239 progress.Finish(); 240 problemInstancesTabPage.Enabled = true; 241 SetEnabledStateOfControls(true); 242 } 243 } 244 245 private void ReportError(Exception e) { 246 if (InvokeRequired) { 247 Invoke(new Action<Exception>(ReportError), e); 248 } else { 249 ErrorHandling.ShowErrorDialog(this, "An error occurred generating the experiment.", e); 250 } 251 } 252 253 private void CloseDialog() { 254 if (InvokeRequired) { 255 Invoke(new Action(CloseDialog)); 256 } else { 257 this.DialogResult = DialogResult.OK; 258 this.Close(); 259 } 260 } 261 #endregion 166 262 } 167 263 } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views-3.3.csproj
r8519 r8524 84 84 <Private>False</Private> 85 85 </Reference> 86 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 87 <Private>False</Private> 88 </Reference> 86 89 <Reference Include="System" /> 87 90 <Reference Include="System.Core" /> … … 106 109 <SubType>Form</SubType> 107 110 </Compile> 108 <Compile Include="ObjectSelectorDialog. designer.cs">111 <Compile Include="ObjectSelectorDialog.Designer.cs"> 109 112 <DependentUpon>ObjectSelectorDialog.cs</DependentUpon> 110 113 </Compile> … … 112 115 <SubType>UserControl</SubType> 113 116 </Compile> 114 <Compile Include="OptimizableView. designer.cs">117 <Compile Include="OptimizableView.Designer.cs"> 115 118 <DependentUpon>OptimizableView.cs</DependentUpon> 116 119 </Compile> … … 118 121 <SubType>UserControl</SubType> 119 122 </Compile> 120 <Compile Include="ParameterConfigurationTreeView. designer.cs">123 <Compile Include="ParameterConfigurationTreeView.Designer.cs"> 121 124 <DependentUpon>ParameterConfigurationTreeView.cs</DependentUpon> 122 125 </Compile> … … 127 130 <SubType>UserControl</SubType> 128 131 </Compile> 129 <Compile Include="ValueConfigurationViews\RangeView. designer.cs">132 <Compile Include="ValueConfigurationViews\RangeView.Designer.cs"> 130 133 <DependentUpon>RangeView.cs</DependentUpon> 131 134 </Compile> … … 133 136 <SubType>UserControl</SubType> 134 137 </Compile> 135 <Compile Include="ValueConfigurationViews\ValueView. designer.cs">138 <Compile Include="ValueConfigurationViews\ValueView.Designer.cs"> 136 139 <DependentUpon>ValueView.cs</DependentUpon> 137 140 </Compile> … … 157 160 </PreBuildEvent> 158 161 </PropertyGroup> 159 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 162 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 160 163 Other similar extension points exist, see Microsoft.Common.targets. 161 164 <Target Name="BeforeBuild"> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ObjectSelectorDialog.Designer.cs
r8517 r8524 1 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 2 23 partial class ObjectSelectorDialog<T> { 3 24 /// <summary> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/OptimizableView.Designer.cs
r8517 r8524 1 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 2 23 partial class OptimizableView { 3 24 /// <summary> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ParameterConfigurationTreeView.Designer.cs
r8517 r8524 1 using HeuristicLab.Core.Views; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using HeuristicLab.Core.Views; 2 23 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 3 24 partial class ParameterConfigurationTreeView { -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/Plugin.cs.frame
r8517 r8524 43 43 [PluginDependency("HeuristicLab.Parameters", "3.3")] 44 44 [PluginDependency("HeuristicLab.Parameters.Views", "3.3")] 45 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 45 46 public class HeuristicLabEncodingsParameterConfigurationEncodingViewsPlugin : PluginBase { 46 47 } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ValueConfigurationViews/RangeView.Designer.cs
r8517 r8524 1 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 2 23 partial class RangeView { 3 24 /// <summary> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ValueConfigurationViews/ValueView.Designer.cs
r8518 r8524 1 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views { 2 23 partial class ValueView { 3 24 /// <summary> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/HeuristicLab.Encodings.ParameterConfigurationEncoding-3.3.csproj
r8519 r8524 82 82 <Private>False</Private> 83 83 </Reference> 84 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 85 <Private>False</Private> 86 </Reference> 84 87 <Reference Include="System" /> 85 88 <Reference Include="System.Core" /> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurationTree.cs
r8517 r8524 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Problems.Instances; 33 34 34 35 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding { 35 // todo: storable, name, descr, ...36 [Item("ParameterConfigurationTree", "Represents a parameter configuration.")] 36 37 [StorableClass] 37 38 public class ParameterConfigurationTree : ParameterizedValueConfiguration, IEnumerable { 38 39 39 [Storable] 40 40 private DoubleValue quality; … … 180 180 } 181 181 182 #region constructors and cloning 183 public ParameterConfigurationTree(IAlgorithm algorithm, IProblem problem) 184 : base(null, algorithm.GetType(), false) { 185 this.Optimize = false; 186 this.IsOptimizable = false; 187 this.parameters = new Dictionary<string, IItem>(); 188 this.Name = algorithm.ItemName; 189 190 var algproblemitem = new AlgorithmProblemItem(); 191 algproblemitem.AlgorithmParameter.Value = algorithm; 192 algproblemitem.ProblemParameter.Value = problem; 193 this.discoverValidValues = false; 194 195 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Algorithm", algproblemitem.AlgorithmParameter)); 196 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Problem", algproblemitem.ProblemParameter)); 197 198 // problems can be modified in the list of problem instances, so the parameters which are not Optimize=true, 199 // must not be modifiable in the parameter configuration tree. otherwise the parameter values would be ambiguous 200 ProblemConfiguration.ValuesReadOnly = true; 201 } 202 public ParameterConfigurationTree() { } 182 #region Constructors and Cloning 203 183 [StorableConstructor] 204 184 protected ParameterConfigurationTree(bool deserializing) : base(deserializing) { } … … 225 205 } 226 206 } 207 public ParameterConfigurationTree() : base() { } 208 public ParameterConfigurationTree(IAlgorithm algorithm, IProblem problem) 209 : base(null, algorithm.GetType(), false) { 210 this.Optimize = false; 211 this.IsOptimizable = false; 212 this.parameters = new Dictionary<string, IItem>(); 213 this.Name = algorithm.ItemName; 214 215 var algproblemitem = new AlgorithmProblemItem(); 216 algproblemitem.AlgorithmParameter.Value = algorithm; 217 algproblemitem.ProblemParameter.Value = problem; 218 this.discoverValidValues = false; 219 220 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Algorithm", algproblemitem.AlgorithmParameter)); 221 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Problem", algproblemitem.ProblemParameter)); 222 223 // problems can be modified in the list of problem instances, so the parameters which are not Optimize=true, 224 // must not be modifiable in the parameter configuration tree. otherwise the parameter values would be ambiguous 225 ProblemConfiguration.ValuesReadOnly = true; 226 } 227 227 228 public override IDeepCloneable Clone(Cloner cloner) { 228 229 return new ParameterConfigurationTree(this, cloner); 229 230 } 231 230 232 [StorableHook(HookType.AfterDeserialization)] 231 233 private void AfterDeserialization() { … … 274 276 public override void Parameterize(IParameterizedItem item) { 275 277 this.parameters.Clear(); 276 var algorithm = item as IAlgorithm;278 var algorithm = (IAlgorithm)item; 277 279 var problem = algorithm.Problem; 278 280 … … 283 285 } 284 286 285 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions, CancellationToken ct) {287 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions, Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> problemInstances, CancellationToken ct) { 286 288 Experiment experiment = new Experiment(); 289 var algorithms = new List<IAlgorithm>(1 + problemInstances.Values.Count) { (IAlgorithm)algorithm.Clone() }; 290 foreach (var provider in problemInstances) { 291 foreach (var descriptor in provider.Value) { 292 var alg = (IAlgorithm)algorithm.Clone(); 293 ProblemInstanceManager.LoadData(provider.Key, descriptor, (IProblemInstanceConsumer)alg.Problem); 294 algorithms.Add(alg); 295 } 296 } 287 297 ExperimentGenerationProgress = 0; 288 foreach (ParameterizedValueConfiguration combination in this) { 289 ct.ThrowIfCancellationRequested(); 290 IAlgorithm clonedAlg = (IAlgorithm)algorithm.Clone(); 291 clonedAlg.Name = combination.ParameterInfoString; 292 combination.Parameterize(clonedAlg); 293 clonedAlg.StoreAlgorithmInEachRun = false; 294 if (createBatchRuns) { 295 BatchRun batchRun = new BatchRun(string.Format("BatchRun: {0}", combination.ParameterInfoString)); 296 batchRun.Optimizer = clonedAlg; 297 batchRun.Repetitions = repetitions; 298 experiment.Optimizers.Add(batchRun); 299 } else { 300 experiment.Optimizers.Add(clonedAlg); 301 } 302 ExperimentGenerationProgress = (double)experiment.Optimizers.Count / this.GetCombinationCount(0); 298 foreach (var alg in algorithms) { 299 foreach (ParameterizedValueConfiguration combination in this) { 300 ct.ThrowIfCancellationRequested(); 301 var clonedAlg = (IAlgorithm)alg.Clone(); 302 clonedAlg.Name = combination.ParameterInfoString; 303 combination.Parameterize(clonedAlg); 304 clonedAlg.StoreAlgorithmInEachRun = false; 305 if (createBatchRuns) { 306 BatchRun batchRun = new BatchRun(string.Format("BatchRun: {0}", combination.ParameterInfoString)); 307 batchRun.Optimizer = clonedAlg; 308 batchRun.Repetitions = repetitions; 309 experiment.Optimizers.Add(batchRun); 310 } else { 311 experiment.Optimizers.Add(clonedAlg); 312 } 313 ExperimentGenerationProgress = (double)experiment.Optimizers.Count / (this.GetCombinationCount(0) * algorithms.Count); 314 } 303 315 } 304 316 return experiment; … … 306 318 307 319 public Experiment GenerateExperiment(IAlgorithm algorithm) { 308 return GenerateExperiment(algorithm, false, 0, CancellationToken.None);320 return GenerateExperiment(algorithm, false, 0, null, CancellationToken.None); 309 321 } 310 322 311 323 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) { 312 return GenerateExperiment(algorithm, createBatchRuns, repetitions, CancellationToken.None);324 return GenerateExperiment(algorithm, createBatchRuns, repetitions, null, CancellationToken.None); 313 325 } 314 326 -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Plugin.cs.frame
r8517 r8524 38 38 [PluginDependency("HeuristicLab.Persistence", "3.3")] 39 39 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 40 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 40 41 public class HeuristicLabEncodingsParameterConfigurationEncodingPlugin : PluginBase { 41 42 } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ValueConfigurations/ValueConfiguration.cs
r8517 r8524 28 28 29 29 namespace HeuristicLab.Encodings.ParameterConfigurationEncoding { 30 // TODO: ItemName/Descr, storability30 [Item("ValueConfiguration", "Represents a value configuration.")] 31 31 [StorableClass] 32 32 public abstract class ValueConfiguration : NamedItem, IValueConfiguration { … … 59 59 if (value == true && !this.IsOptimizable) 60 60 throw new NotSupportedException("This value is not optimizable."); 61 62 61 optimize = value; 63 62 OnOptimizeChanged(); … … 106 105 107 106 #region Constructors and Cloning 108 public ValueConfiguration(IItem value, Type valueDataType) {109 this.ActualValue = new ConstrainedValue(value, valueDataType, new ItemSet<IItem> { value }, false);110 this.IsOptimizable = true;111 }112 113 public ValueConfiguration() { }114 107 [StorableConstructor] 115 protected ValueConfiguration(bool deserializing) { }108 protected ValueConfiguration(bool deserializing) : base(deserializing) { } 116 109 protected ValueConfiguration(ValueConfiguration original, Cloner cloner) 117 110 : base(original, cloner) { … … 122 115 this.valuesReadOnly = original.valuesReadOnly; 123 116 RegisterActualValueEvents(); 117 } 118 protected ValueConfiguration() : base() { } 119 protected ValueConfiguration(IItem value, Type valueDataType) { 120 this.ActualValue = new ConstrainedValue(value, valueDataType, new ItemSet<IItem> { value }, false); 121 this.IsOptimizable = true; 124 122 } 125 123 #endregion
Note: See TracChangeset
for help on using the changeset viewer.