Changeset 13540
- Timestamp:
- 01/18/16 15:03:52 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs
r13534 r13540 51 51 this.tabControl = new System.Windows.Forms.TabControl(); 52 52 this.parametersTabPage = new System.Windows.Forms.TabPage(); 53 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 53 54 this.characteristicsTabPage = new System.Windows.Forms.TabPage(); 54 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 55 this.characteristicSplitContainer = new System.Windows.Forms.SplitContainer(); 56 this.calculatorListView = new System.Windows.Forms.ListView(); 57 this.characteristicColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 58 this.calculateButton = new System.Windows.Forms.Button(); 59 this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 60 this.uploadCharacteristicsButton = new System.Windows.Forms.Button(); 55 61 this.downloadCharacteristicsButton = new System.Windows.Forms.Button(); 56 this.uploadCharacteristicsButton = new System.Windows.Forms.Button();57 this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();58 62 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 59 63 this.tabControl.SuspendLayout(); 60 64 this.parametersTabPage.SuspendLayout(); 61 65 this.characteristicsTabPage.SuspendLayout(); 66 ((System.ComponentModel.ISupportInitialize)(this.characteristicSplitContainer)).BeginInit(); 67 this.characteristicSplitContainer.Panel1.SuspendLayout(); 68 this.characteristicSplitContainer.Panel2.SuspendLayout(); 69 this.characteristicSplitContainer.SuspendLayout(); 62 70 this.SuspendLayout(); 63 71 // … … 82 90 // problemComboBox 83 91 // 84 this.problemComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 92 this.problemComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 85 93 | System.Windows.Forms.AnchorStyles.Right))); 86 94 this.problemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 104 112 // 105 113 this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 106 this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;107 114 this.refreshButton.Location = new System.Drawing.Point(682, -1); 108 115 this.refreshButton.Name = "refreshButton"; … … 116 123 // 117 124 this.cloneProblemButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 118 this.cloneProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Clone;119 125 this.cloneProblemButton.Location = new System.Drawing.Point(652, -1); 120 126 this.cloneProblemButton.Name = "cloneProblemButton"; … … 127 133 // tabControl 128 134 // 129 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 130 | System.Windows.Forms.AnchorStyles.Left) 135 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 136 | System.Windows.Forms.AnchorStyles.Left) 131 137 | System.Windows.Forms.AnchorStyles.Right))); 132 138 this.tabControl.Controls.Add(this.parametersTabPage); … … 148 154 this.parametersTabPage.Text = "Parameters"; 149 155 this.parametersTabPage.UseVisualStyleBackColor = true; 150 //151 // characteristicsTabPage152 //153 this.characteristicsTabPage.Controls.Add(this.characteristicsMatrixView);154 this.characteristicsTabPage.Controls.Add(this.uploadCharacteristicsButton);155 this.characteristicsTabPage.Controls.Add(this.downloadCharacteristicsButton);156 this.characteristicsTabPage.Location = new System.Drawing.Point(4, 22);157 this.characteristicsTabPage.Name = "characteristicsTabPage";158 this.characteristicsTabPage.Padding = new System.Windows.Forms.Padding(3);159 this.characteristicsTabPage.Size = new System.Drawing.Size(692, 314);160 this.characteristicsTabPage.TabIndex = 1;161 this.characteristicsTabPage.Text = "Characteristics";162 this.characteristicsTabPage.UseVisualStyleBackColor = true;163 156 // 164 157 // parameterCollectionView … … 175 168 this.parameterCollectionView.TabIndex = 8; 176 169 // 170 // characteristicsTabPage 171 // 172 this.characteristicsTabPage.Controls.Add(this.characteristicSplitContainer); 173 this.characteristicsTabPage.Controls.Add(this.uploadCharacteristicsButton); 174 this.characteristicsTabPage.Controls.Add(this.downloadCharacteristicsButton); 175 this.characteristicsTabPage.Location = new System.Drawing.Point(4, 22); 176 this.characteristicsTabPage.Name = "characteristicsTabPage"; 177 this.characteristicsTabPage.Padding = new System.Windows.Forms.Padding(3); 178 this.characteristicsTabPage.Size = new System.Drawing.Size(692, 314); 179 this.characteristicsTabPage.TabIndex = 1; 180 this.characteristicsTabPage.Text = "Characteristics"; 181 this.characteristicsTabPage.UseVisualStyleBackColor = true; 182 // 183 // characteristicSplitContainer 184 // 185 this.characteristicSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 186 | System.Windows.Forms.AnchorStyles.Left) 187 | System.Windows.Forms.AnchorStyles.Right))); 188 this.characteristicSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; 189 this.characteristicSplitContainer.Location = new System.Drawing.Point(0, 35); 190 this.characteristicSplitContainer.Name = "characteristicSplitContainer"; 191 // 192 // characteristicSplitContainer.Panel1 193 // 194 this.characteristicSplitContainer.Panel1.Controls.Add(this.calculatorListView); 195 this.characteristicSplitContainer.Panel1.Controls.Add(this.calculateButton); 196 // 197 // characteristicSplitContainer.Panel2 198 // 199 this.characteristicSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView); 200 this.characteristicSplitContainer.Size = new System.Drawing.Size(692, 279); 201 this.characteristicSplitContainer.SplitterDistance = 221; 202 this.characteristicSplitContainer.TabIndex = 2; 203 // 204 // calculatorListView 205 // 206 this.calculatorListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 207 | System.Windows.Forms.AnchorStyles.Left) 208 | System.Windows.Forms.AnchorStyles.Right))); 209 this.calculatorListView.CheckBoxes = true; 210 this.calculatorListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 211 this.characteristicColumnHeader}); 212 this.calculatorListView.Location = new System.Drawing.Point(3, 0); 213 this.calculatorListView.Name = "calculatorListView"; 214 this.calculatorListView.Size = new System.Drawing.Size(215, 244); 215 this.calculatorListView.TabIndex = 0; 216 this.calculatorListView.UseCompatibleStateImageBehavior = false; 217 this.calculatorListView.View = System.Windows.Forms.View.Details; 218 // 219 // characteristicColumnHeader 220 // 221 this.characteristicColumnHeader.Text = "Characteristic"; 222 this.characteristicColumnHeader.Width = 211; 223 // 224 // calculateButton 225 // 226 this.calculateButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 227 | System.Windows.Forms.AnchorStyles.Right))); 228 this.calculateButton.Location = new System.Drawing.Point(6, 250); 229 this.calculateButton.Name = "calculateButton"; 230 this.calculateButton.Size = new System.Drawing.Size(212, 23); 231 this.calculateButton.TabIndex = 0; 232 this.calculateButton.Text = "Calculate"; 233 this.calculateButton.UseVisualStyleBackColor = true; 234 this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click); 235 // 236 // characteristicsMatrixView 237 // 238 this.characteristicsMatrixView.Caption = "StringConvertibleMatrix View"; 239 this.characteristicsMatrixView.Content = null; 240 this.characteristicsMatrixView.Dock = System.Windows.Forms.DockStyle.Fill; 241 this.characteristicsMatrixView.Location = new System.Drawing.Point(0, 0); 242 this.characteristicsMatrixView.Name = "characteristicsMatrixView"; 243 this.characteristicsMatrixView.ReadOnly = false; 244 this.characteristicsMatrixView.ShowRowsAndColumnsTextBox = false; 245 this.characteristicsMatrixView.ShowStatisticalInformation = false; 246 this.characteristicsMatrixView.Size = new System.Drawing.Size(467, 279); 247 this.characteristicsMatrixView.TabIndex = 1; 248 // 249 // uploadCharacteristicsButton 250 // 251 this.uploadCharacteristicsButton.Location = new System.Drawing.Point(38, 6); 252 this.uploadCharacteristicsButton.Name = "uploadCharacteristicsButton"; 253 this.uploadCharacteristicsButton.Size = new System.Drawing.Size(26, 23); 254 this.uploadCharacteristicsButton.TabIndex = 0; 255 this.uploadCharacteristicsButton.Text = "Upload"; 256 this.uploadCharacteristicsButton.UseVisualStyleBackColor = true; 257 this.uploadCharacteristicsButton.Click += new System.EventHandler(this.uploadCharacteristicsButton_Click); 258 // 177 259 // downloadCharacteristicsButton 178 260 // … … 184 266 this.downloadCharacteristicsButton.UseVisualStyleBackColor = true; 185 267 this.downloadCharacteristicsButton.Click += new System.EventHandler(this.downloadCharacteristicsButton_Click); 186 //187 // uploadCharacteristicsButton188 //189 this.uploadCharacteristicsButton.Location = new System.Drawing.Point(38, 6);190 this.uploadCharacteristicsButton.Name = "uploadCharacteristicsButton";191 this.uploadCharacteristicsButton.Size = new System.Drawing.Size(26, 23);192 this.uploadCharacteristicsButton.TabIndex = 0;193 this.uploadCharacteristicsButton.Text = "Upload";194 this.uploadCharacteristicsButton.UseVisualStyleBackColor = true;195 this.uploadCharacteristicsButton.Click += new System.EventHandler(this.uploadCharacteristicsButton_Click);196 //197 // characteristicsMatrixView198 //199 this.characteristicsMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)200 | System.Windows.Forms.AnchorStyles.Left)201 | System.Windows.Forms.AnchorStyles.Right)));202 this.characteristicsMatrixView.Caption = "StringConvertibleMatrix View";203 this.characteristicsMatrixView.Content = null;204 this.characteristicsMatrixView.Location = new System.Drawing.Point(6, 35);205 this.characteristicsMatrixView.Name = "characteristicsMatrixView";206 this.characteristicsMatrixView.ReadOnly = false;207 this.characteristicsMatrixView.ShowRowsAndColumnsTextBox = false;208 this.characteristicsMatrixView.ShowStatisticalInformation = false;209 this.characteristicsMatrixView.Size = new System.Drawing.Size(680, 273);210 this.characteristicsMatrixView.TabIndex = 1;211 268 // 212 269 // OKBProblemView … … 233 290 this.parametersTabPage.ResumeLayout(false); 234 291 this.characteristicsTabPage.ResumeLayout(false); 292 this.characteristicSplitContainer.Panel1.ResumeLayout(false); 293 this.characteristicSplitContainer.Panel2.ResumeLayout(false); 294 ((System.ComponentModel.ISupportInitialize)(this.characteristicSplitContainer)).EndInit(); 295 this.characteristicSplitContainer.ResumeLayout(false); 235 296 this.ResumeLayout(false); 236 297 this.PerformLayout(); … … 251 312 private System.Windows.Forms.Button uploadCharacteristicsButton; 252 313 private System.Windows.Forms.Button downloadCharacteristicsButton; 314 private System.Windows.Forms.SplitContainer characteristicSplitContainer; 315 private System.Windows.Forms.ListView calculatorListView; 316 private System.Windows.Forms.ColumnHeader characteristicColumnHeader; 317 private System.Windows.Forms.Button calculateButton; 253 318 254 319 -
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r13534 r13540 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Globalization; 24 25 using System.Linq; 25 26 using System.Windows.Forms; … … 28 29 using HeuristicLab.Data; 29 30 using HeuristicLab.MainForm; 31 using HeuristicLab.Optimization; 32 using HeuristicLab.PluginInfrastructure; 30 33 31 34 namespace HeuristicLab.Clients.OKB.RunCreation { … … 41 44 public OKBProblemView() { 42 45 InitializeComponent(); 46 refreshButton.Text = string.Empty; 47 refreshButton.Image = VSImageLibrary.Refresh; 48 cloneProblemButton.Text = string.Empty; 49 cloneProblemButton.Image = VSImageLibrary.Clone; 43 50 downloadCharacteristicsButton.Text = string.Empty; 44 51 downloadCharacteristicsButton.Image = VSImageLibrary.Refresh; … … 72 79 parameterCollectionView.Content = Content.Parameters; 73 80 } 81 UpdateCharacteristicCalculators(); 74 82 } 75 83 … … 92 100 } 93 101 102 private void UpdateCharacteristicCalculators() { 103 calculatorListView.Items.Clear(); 104 calculatorListView.Groups.Clear(); 105 if (Content == null || Content.ProblemId == -1) return; 106 var problem = Content.CloneProblem(); 107 var calculators = ApplicationManager.Manager.GetInstances<ICharacteristicCalculator>().Where(x => x.CanCalculate(problem)).ToList(); 108 try { 109 calculatorListView.BeginUpdate(); 110 foreach (var calc in calculators) { 111 var group = calculatorListView.Groups.Add(calc.Name, calc.Name); 112 group.Tag = calc; 113 foreach (var c in calc.Characteristics) { 114 var item = calculatorListView.Items.Add(c, c); 115 item.Group = group; 116 } 117 } 118 } finally { calculatorListView.EndUpdate(); } 119 } 120 94 121 private void RunCreationClient_Refreshing(object sender, EventArgs e) { 95 122 if (InvokeRequired) { … … 161 188 } catch (Exception ex) { PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); } 162 189 } 190 private void calculateButton_Click(object sender, EventArgs e) { 191 var problem = Content.CloneProblem(); 192 var characteristics = calculatorListView.CheckedItems.OfType<ListViewItem>().GroupBy(x => x.Group); 193 var results = new Dictionary<string, double>(); 194 foreach (var c in characteristics) { 195 var calc = (ICharacteristicCalculator)c.Key.Tag; 196 foreach (var result in calc.Calculate(problem, c.Select(x => x.Text).ToArray())) 197 results[result.Key] = result.Value; 198 } 199 var matrix = characteristicsMatrixView.Content as StringMatrix; 200 if (matrix == null) matrix = new StringMatrix(results.Count, 3); 201 for (var i = 0; i < matrix.Rows; i++) { 202 double r; 203 if (results.TryGetValue(matrix[i, 0], out r)) { 204 matrix[i, 1] = r.ToString(CultureInfo.CurrentCulture.NumberFormat); 205 matrix[i, 2] = "DoubleValue"; 206 results.Remove(matrix[i, 0]); 207 } 208 } 209 if (results.Count == 0) return; 210 var resultsList = results.ToList(); 211 var counter = resultsList.Count - 1; 212 for (var i = 0; i < matrix.Rows; i++) { 213 if (string.IsNullOrEmpty(matrix[i, 0])) { 214 matrix[i, 0] = resultsList[counter].Key; 215 matrix[i, 1] = resultsList[counter].Value.ToString(CultureInfo.CurrentCulture.NumberFormat); 216 matrix[i, 2] = "DoubleValue"; 217 resultsList.RemoveAt(counter); 218 counter--; 219 if (counter < 0) return; 220 } 221 } 222 if (counter >= 0) { 223 ((IStringConvertibleMatrix)matrix).Rows += counter + 1; 224 for (var i = matrix.Rows - 1; counter >= 0; i--) { 225 matrix[i, 0] = resultsList[0].Key; 226 matrix[i, 1] = resultsList[0].Value.ToString(CultureInfo.CurrentCulture.NumberFormat); 227 matrix[i, 2] = "DoubleValue"; 228 counter--; 229 } 230 } 231 } 163 232 #endregion 164 233 -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r12975 r13540 153 153 <Compile Include="BasicProblems\Operators\SingleObjectiveMoveMaker.cs" /> 154 154 <Compile Include="BasicProblems\SingleObjectiveBasicProblem.cs" /> 155 <Compile Include="Interfaces\ICharacteristicCalculator.cs" /> 155 156 <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" /> 156 157 <Compile Include="Interfaces\IMultiObjectiveOperator.cs" />
Note: See TracChangeset
for help on using the changeset viewer.