Changeset 1003 for branches/CEDMA-Refactoring-Ticket419
- Timestamp:
- 12/17/08 14:29:53 (16 years ago)
- Location:
- branches/CEDMA-Refactoring-Ticket419
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.cs
r988 r1003 51 51 base.UpdateControls(); 52 52 editorGroupBox.Controls.Clear(); 53 editorGroupBox.Enabled = false;54 53 Control problemControl = (Control)DataSet.Problem.CreateView(); 55 54 problemControl.Dock = DockStyle.Fill; -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Problem.cs
r992 r1003 49 49 public int TrainingSamplesStart { 50 50 get { return trainingSamplesStart; } 51 set { trainingSamplesStart = value; } 51 52 } 52 53 … … 54 55 public int TrainingSamplesEnd { 55 56 get { return trainingSamplesEnd; } 57 set { trainingSamplesEnd = value; } 56 58 } 57 59 … … 83 85 84 86 private List<int> allowedInputVariables; 87 public List<int> AllowedInputVariables { 88 get { return allowedInputVariables; } 89 } 90 85 91 private List<int> allowedTargetVariables; 86 87 private List<int> minTimeOffsets;88 private List<int> maxTimeOffsets;92 public List<int> AllowedTargetVariables { 93 get { return allowedTargetVariables; } 94 } 89 95 90 96 private bool autoRegressive; … … 104 110 public Problem() 105 111 : base() { 112 dataset = new DataAnalysis.Dataset(); 113 allowedInputVariables = new List<int>(); 114 allowedTargetVariables = new List<int>(); 115 } 116 117 public override IView CreateView() { 118 return new ProblemView(this); 106 119 } 107 120 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.Designer.cs
r992 r1003 61 61 this.inputsGroupBox = new System.Windows.Forms.GroupBox(); 62 62 this.partitioningGroupBox = new System.Windows.Forms.GroupBox(); 63 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 63 64 this.targetsGroupBox.SuspendLayout(); 64 65 this.inputsGroupBox.SuspendLayout(); … … 74 75 this.importButton.Text = "Import"; 75 76 this.importButton.UseVisualStyleBackColor = true; 77 this.importButton.Click += new System.EventHandler(this.importButton_Click); 76 78 // 77 79 // textBox1 … … 154 156 this.datasetView.Location = new System.Drawing.Point(3, 32); 155 157 this.datasetView.Name = "datasetView"; 156 this.datasetView.Size = new System.Drawing.Size(326, 2 21);158 this.datasetView.Size = new System.Drawing.Size(326, 230); 157 159 this.datasetView.TabIndex = 17; 158 160 // … … 181 183 // autoregressiveCheckBox 182 184 // 185 this.autoregressiveCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 183 186 this.autoregressiveCheckBox.AutoSize = true; 184 187 this.autoregressiveCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; 185 this.autoregressiveCheckBox.Location = new System.Drawing.Point(3, 4 71);188 this.autoregressiveCheckBox.Location = new System.Drawing.Point(3, 480); 186 189 this.autoregressiveCheckBox.Name = "autoregressiveCheckBox"; 187 190 this.autoregressiveCheckBox.Size = new System.Drawing.Size(102, 17); … … 192 195 // targetsGroupBox 193 196 // 197 this.targetsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 194 198 this.targetsGroupBox.Controls.Add(this.targetsListBox); 195 this.targetsGroupBox.Location = new System.Drawing.Point(3, 3 65);199 this.targetsGroupBox.Location = new System.Drawing.Point(3, 374); 196 200 this.targetsGroupBox.Name = "targetsGroupBox"; 197 201 this.targetsGroupBox.Size = new System.Drawing.Size(167, 100); … … 202 206 // inputsGroupBox 203 207 // 208 this.inputsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 204 209 this.inputsGroupBox.Controls.Add(this.inputsListBox); 205 this.inputsGroupBox.Location = new System.Drawing.Point(176, 3 65);210 this.inputsGroupBox.Location = new System.Drawing.Point(176, 374); 206 211 this.inputsGroupBox.Name = "inputsGroupBox"; 207 212 this.inputsGroupBox.Size = new System.Drawing.Size(153, 100); … … 212 217 // partitioningGroupBox 213 218 // 219 this.partitioningGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 214 220 this.partitioningGroupBox.Controls.Add(this.textBox2); 215 221 this.partitioningGroupBox.Controls.Add(this.trainingLabel); … … 221 227 this.partitioningGroupBox.Controls.Add(this.textBox6); 222 228 this.partitioningGroupBox.Controls.Add(this.testLabel); 223 this.partitioningGroupBox.Location = new System.Drawing.Point(3, 2 59);229 this.partitioningGroupBox.Location = new System.Drawing.Point(3, 268); 224 230 this.partitioningGroupBox.Name = "partitioningGroupBox"; 225 231 this.partitioningGroupBox.Size = new System.Drawing.Size(326, 100); … … 227 233 this.partitioningGroupBox.TabStop = false; 228 234 this.partitioningGroupBox.Text = "Data set partitions:"; 235 // 236 // openFileDialog 237 // 238 this.openFileDialog.DefaultExt = "txt"; 239 this.openFileDialog.FileName = "txt"; 240 this.openFileDialog.Filter = "Text files|*.txt|All files|*.*"; 241 this.openFileDialog.Title = "Import data set from file"; 229 242 // 230 243 // ProblemView … … 239 252 this.Controls.Add(this.importButton); 240 253 this.Name = "ProblemView"; 241 this.Size = new System.Drawing.Size(337, 5 69);254 this.Size = new System.Drawing.Size(337, 500); 242 255 this.targetsGroupBox.ResumeLayout(false); 243 256 this.inputsGroupBox.ResumeLayout(false); … … 268 281 private System.Windows.Forms.GroupBox inputsGroupBox; 269 282 private System.Windows.Forms.GroupBox partitioningGroupBox; 283 private System.Windows.Forms.OpenFileDialog openFileDialog; 270 284 } 271 285 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.cs
r992 r1003 29 29 using System.Windows.Forms; 30 30 using HeuristicLab.Core; 31 using HeuristicLab.DataAnalysis; 31 32 32 33 namespace HeuristicLab.CEDMA.Core { … … 38 39 InitializeComponent(); 39 40 } 41 42 protected override void UpdateControls() { 43 base.UpdateControls(); 44 // TASK update text-boxes and datasetview 45 } 46 47 private void importButton_Click(object sender, EventArgs e) { 48 if(openFileDialog.ShowDialog(this) == DialogResult.OK) { 49 DatasetParser parser = new DatasetParser(); 50 bool success = false; 51 try { 52 try { 53 parser.Import(openFileDialog.FileName, true); 54 success = true; 55 } catch(DataFormatException ex) { 56 ShowWarningMessageBox(ex); 57 // not possible to parse strictly => clear and try to parse non-strict 58 parser.Reset(); 59 parser.Import(openFileDialog.FileName, false); 60 success = true; 61 } 62 } catch(DataFormatException ex) { 63 // if the non-strict parsing also failed then show the exception 64 ShowErrorMessageBox(ex); 65 } 66 if(success) { 67 Dataset dataset = (Dataset)problem.DataSet; 68 dataset.Rows = parser.Rows; 69 dataset.Columns = parser.Columns; 70 dataset.VariableNames = parser.VariableNames; 71 dataset.Name = parser.ProblemName; 72 dataset.Samples = new double[dataset.Rows * dataset.Columns]; 73 Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows); 74 problem.TrainingSamplesStart = parser.TrainingSamplesStart; 75 problem.ValidationSamplesEnd = parser.TrainingSamplesStart; 76 problem.TrainingSamplesEnd = parser.TrainingSamplesEnd; 77 problem.ValidationSamplesStart = parser.ValidationSamplesStart; 78 problem.ValidationSamplesEnd = parser.ValidationSamplesEnd; 79 problem.TestSamplesStart = parser.TestSamplesStart; 80 problem.TestSamplesEnd = parser.TestSamplesEnd; 81 problem.AllowedTargetVariables.Add(parser.TargetVariable); 82 83 List<int> nonInputVariables = parser.NonInputVariables; 84 for(int i = 0; i < dataset.Columns; i++) { 85 if(!nonInputVariables.Contains(i)) problem.AllowedInputVariables.Add(i); 86 } 87 Refresh(); 88 } 89 } 90 91 } 92 private void ShowWarningMessageBox(Exception ex) { 93 MessageBox.Show(ex.Message, 94 "Warning - " + ex.GetType().Name, 95 MessageBoxButtons.OK, 96 MessageBoxIcon.Warning); 97 } 98 private void ShowErrorMessageBox(Exception ex) { 99 MessageBox.Show(BuildErrorMessage(ex), 100 "Error - " + ex.GetType().Name, 101 MessageBoxButtons.OK, 102 MessageBoxIcon.Error); 103 } 104 private string BuildErrorMessage(Exception ex) { 105 StringBuilder sb = new StringBuilder(); 106 sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace); 107 108 while(ex.InnerException != null) { 109 ex = ex.InnerException; 110 sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace); 111 } 112 return sb.ToString(); 113 } 40 114 } 41 115 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.resx
r992 r1003 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/ServerForm.designer.cs
r378 r1003 47 47 this.addressTextBox = new System.Windows.Forms.TextBox(); 48 48 this.externalAddressLabel = new System.Windows.Forms.Label(); 49 this.activeAgentsLabel = new System.Windows.Forms.Label();50 this.activeAgentsTextBox = new System.Windows.Forms.TextBox();51 49 this.gridAddressLabel = new System.Windows.Forms.Label(); 52 50 this.gridAddress = new System.Windows.Forms.TextBox(); … … 70 68 this.externalAddressLabel.TabIndex = 3; 71 69 this.externalAddressLabel.Text = "&Address:"; 72 //73 // activeAgentsLabel74 //75 this.activeAgentsLabel.AutoSize = true;76 this.activeAgentsLabel.Location = new System.Drawing.Point(12, 61);77 this.activeAgentsLabel.Name = "activeAgentsLabel";78 this.activeAgentsLabel.Size = new System.Drawing.Size(75, 13);79 this.activeAgentsLabel.TabIndex = 7;80 this.activeAgentsLabel.Text = "A&ctive agents:";81 //82 // activeAgentsTextBox83 //84 this.activeAgentsTextBox.Location = new System.Drawing.Point(106, 58);85 this.activeAgentsTextBox.Name = "activeAgentsTextBox";86 this.activeAgentsTextBox.ReadOnly = true;87 this.activeAgentsTextBox.Size = new System.Drawing.Size(90, 20);88 this.activeAgentsTextBox.TabIndex = 6;89 this.activeAgentsTextBox.Text = "0";90 this.activeAgentsTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;91 70 // 92 71 // gridAddressLabel … … 124 103 this.Controls.Add(this.gridAddressLabel); 125 104 this.Controls.Add(this.gridAddress); 126 this.Controls.Add(this.activeAgentsLabel);127 this.Controls.Add(this.activeAgentsTextBox);128 105 this.Controls.Add(this.externalAddressLabel); 129 106 this.Controls.Add(this.addressTextBox); 130 107 this.Name = "ServerForm"; 131 this.Text = " AgentServer";108 this.Text = "CEDMA Server"; 132 109 this.ResumeLayout(false); 133 110 this.PerformLayout(); … … 139 116 private System.Windows.Forms.TextBox addressTextBox; 140 117 private System.Windows.Forms.Label externalAddressLabel; 141 private System.Windows.Forms.Label activeAgentsLabel;142 private System.Windows.Forms.TextBox activeAgentsTextBox;143 118 private System.Windows.Forms.Label gridAddressLabel; 144 119 private System.Windows.Forms.TextBox gridAddress;
Note: See TracChangeset
for help on using the changeset viewer.