Changeset 2198
- Timestamp:
- 07/28/09 17:51:48 (15 years ago)
- Location:
- branches/HeuristicLab.Modeling Database Backend/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs
r2195 r2198 65 65 public DispatcherBase(IModelingDatabase database, Problem problem) { 66 66 this.problem = problem; 67 this.database = database; 68 allowedTargetVariables = new List<int>(); 69 activeInputVariables = new Dictionary<int, List<int>>(); 70 } 71 72 public HeuristicLab.Modeling.IAlgorithm GetNextJob() { 73 if (problem == null) { 67 problem.Changed += (sender, args) => { 68 allowedTargetVariables = new List<int>(problem.AllowedTargetVariables); 69 activeInputVariables = new Dictionary<int, List<int>>(); 74 70 foreach (int targetVar in problem.AllowedTargetVariables) { 75 71 activeInputVariables.Add(targetVar, new List<int>()); … … 77 73 } 78 74 OnChanged(); 79 } 75 }; 76 this.database = database; 77 } 78 79 public HeuristicLab.Modeling.IAlgorithm GetNextJob() { 80 80 if (allowedTargetVariables.Count > 0) { 81 81 int[] targetVariables, inputVariables; -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/Problem.cs
r2195 r2198 39 39 /// </summary> 40 40 public class Problem { 41 internal event EventHandler Changed; 42 41 43 private HeuristicLab.DataAnalysis.Dataset dataset; 42 44 public HeuristicLab.DataAnalysis.Dataset Dataset { 43 45 get { return dataset; } 44 set { dataset = value; } 46 set { 47 if (value != dataset) { 48 dataset = value; 49 } 50 } 45 51 } 46 52 … … 129 135 return new ProblemView(this); 130 136 } 137 138 internal void FireChanged() { 139 if (Changed != null) Changed(this, new EventArgs()); 140 } 131 141 } 132 142 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ProblemView.Designer.cs
r2193 r2198 19 19 */ 20 20 #endregion 21 using HeuristicLab.Core; 22 using System.Windows.Forms; 21 23 namespace HeuristicLab.CEDMA.Server { 22 24 partial class ProblemView { … … 54 56 this.testSamplesStartTextBox = new System.Windows.Forms.TextBox(); 55 57 this.testLabel = new System.Windows.Forms.Label(); 56 this.targetsListBox = new System.Windows.Forms.CheckedListBox();57 this.inputsListBox = new System.Windows.Forms.CheckedListBox();58 58 this.autoregressiveCheckBox = new System.Windows.Forms.CheckBox(); 59 this.targetsGroupBox = new System.Windows.Forms.GroupBox();60 this.inputsGroupBox = new System.Windows.Forms.GroupBox();61 59 this.partitioningGroupBox = new System.Windows.Forms.GroupBox(); 62 60 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); … … 70 68 this.maxTimeOffsetLabel = new System.Windows.Forms.Label(); 71 69 this.maxTimeOffsetTextBox = new System.Windows.Forms.TextBox(); 72 this.datasetView = new HeuristicLab.DataAnalysis.DatasetView(); 73 this.targetsGroupBox.SuspendLayout(); 74 this.inputsGroupBox.SuspendLayout(); 70 this.datasetView1 = new HeuristicLab.DataAnalysis.DatasetView(); 75 71 this.partitioningGroupBox.SuspendLayout(); 76 72 this.learningTaskGroupBox.SuspendLayout(); … … 167 163 this.testLabel.TabIndex = 14; 168 164 this.testLabel.Text = "Test samples:"; 169 //170 // targetsListBox171 //172 this.targetsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)173 | System.Windows.Forms.AnchorStyles.Left)174 | System.Windows.Forms.AnchorStyles.Right)));175 this.targetsListBox.FormattingEnabled = true;176 this.targetsListBox.Location = new System.Drawing.Point(8, 15);177 this.targetsListBox.Name = "targetsListBox";178 this.targetsListBox.Size = new System.Drawing.Size(153, 79);179 this.targetsListBox.TabIndex = 19;180 this.targetsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.targetsListBox_ItemCheck);181 //182 // inputsListBox183 //184 this.inputsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)185 | System.Windows.Forms.AnchorStyles.Left)186 | System.Windows.Forms.AnchorStyles.Right)));187 this.inputsListBox.FormattingEnabled = true;188 this.inputsListBox.Location = new System.Drawing.Point(6, 15);189 this.inputsListBox.Name = "inputsListBox";190 this.inputsListBox.Size = new System.Drawing.Size(141, 79);191 this.inputsListBox.TabIndex = 21;192 this.inputsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.inputsListBox_ItemCheck);193 165 // 194 166 // autoregressiveCheckBox … … 203 175 this.autoregressiveCheckBox.UseVisualStyleBackColor = true; 204 176 this.autoregressiveCheckBox.CheckedChanged += new System.EventHandler(this.autoregressiveCheckBox_CheckedChanged); 205 //206 // targetsGroupBox207 //208 this.targetsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));209 this.targetsGroupBox.Controls.Add(this.targetsListBox);210 this.targetsGroupBox.Location = new System.Drawing.Point(29, 515);211 this.targetsGroupBox.Name = "targetsGroupBox";212 this.targetsGroupBox.Size = new System.Drawing.Size(167, 100);213 this.targetsGroupBox.TabIndex = 23;214 this.targetsGroupBox.TabStop = false;215 this.targetsGroupBox.Text = "Target variables";216 //217 // inputsGroupBox218 //219 this.inputsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));220 this.inputsGroupBox.Controls.Add(this.inputsListBox);221 this.inputsGroupBox.Location = new System.Drawing.Point(202, 515);222 this.inputsGroupBox.Name = "inputsGroupBox";223 this.inputsGroupBox.Size = new System.Drawing.Size(153, 100);224 this.inputsGroupBox.TabIndex = 24;225 this.inputsGroupBox.TabStop = false;226 this.inputsGroupBox.Text = "Input variables:";227 177 // 228 178 // partitioningGroupBox … … 238 188 this.partitioningGroupBox.Controls.Add(this.testSamplesStartTextBox); 239 189 this.partitioningGroupBox.Controls.Add(this.testLabel); 240 this.partitioningGroupBox.Location = new System.Drawing.Point( 29, 409);190 this.partitioningGroupBox.Location = new System.Drawing.Point(3, 452); 241 191 this.partitioningGroupBox.Name = "partitioningGroupBox"; 242 192 this.partitioningGroupBox.Size = new System.Drawing.Size(326, 100); … … 319 269 this.learningTaskGroupBox.Controls.Add(this.timeSeriesRadioButton); 320 270 this.learningTaskGroupBox.Controls.Add(this.autoregressiveCheckBox); 321 this.learningTaskGroupBox.Location = new System.Drawing.Point( 29, 621);271 this.learningTaskGroupBox.Location = new System.Drawing.Point(335, 452); 322 272 this.learningTaskGroupBox.Name = "learningTaskGroupBox"; 323 273 this.learningTaskGroupBox.Size = new System.Drawing.Size(326, 163); … … 356 306 this.maxTimeOffsetTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeOffsetTextBox_Validating); 357 307 // 358 // datasetView 359 // 360 this.datasetView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 361 | System.Windows.Forms.AnchorStyles.Left) 362 | System.Windows.Forms.AnchorStyles.Right))); 363 this.datasetView.Caption = "Editor"; 364 this.datasetView.Dataset = null; 365 this.datasetView.Filename = null; 366 this.datasetView.Location = new System.Drawing.Point(3, 32); 367 this.datasetView.Name = "datasetView"; 368 this.datasetView.Size = new System.Drawing.Size(395, 371); 369 this.datasetView.TabIndex = 17; 308 // datasetView1 309 // 310 this.datasetView1.Location = new System.Drawing.Point(3, 32); 311 this.datasetView1.Name = "datasetView1"; 312 this.datasetView1.Size = new System.Drawing.Size(770, 414); 313 this.datasetView1.TabIndex = 36; 370 314 // 371 315 // ProblemView … … 373 317 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 374 318 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 319 this.Controls.Add(this.datasetView1); 375 320 this.Controls.Add(this.learningTaskGroupBox); 376 321 this.Controls.Add(this.partitioningGroupBox); 377 this.Controls.Add(this.inputsGroupBox);378 this.Controls.Add(this.targetsGroupBox);379 this.Controls.Add(this.datasetView);380 322 this.Controls.Add(this.importButton); 381 323 this.Name = "ProblemView"; 382 this.Size = new System.Drawing.Size(406, 787); 383 this.targetsGroupBox.ResumeLayout(false); 384 this.inputsGroupBox.ResumeLayout(false); 324 this.Size = new System.Drawing.Size(776, 615); 385 325 this.partitioningGroupBox.ResumeLayout(false); 386 326 this.partitioningGroupBox.PerformLayout(); … … 403 343 private System.Windows.Forms.TextBox testSamplesStartTextBox; 404 344 private System.Windows.Forms.Label testLabel; 405 private HeuristicLab.DataAnalysis.DatasetView datasetView;406 private System.Windows.Forms.CheckedListBox targetsListBox;407 private System.Windows.Forms.CheckedListBox inputsListBox;408 345 private System.Windows.Forms.CheckBox autoregressiveCheckBox; 409 private System.Windows.Forms.GroupBox targetsGroupBox;410 private System.Windows.Forms.GroupBox inputsGroupBox;411 346 private System.Windows.Forms.GroupBox partitioningGroupBox; 412 347 private System.Windows.Forms.OpenFileDialog openFileDialog; … … 420 355 private System.Windows.Forms.TextBox maxTimeOffsetTextBox; 421 356 private System.Windows.Forms.Label autoregressiveLabel; 357 private HeuristicLab.DataAnalysis.DatasetView datasetView1; 422 358 } 423 359 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ProblemView.cs
r2195 r2198 39 39 public ProblemView(Problem problem) { 40 40 this.problem = problem; 41 problem.Changed += (sender, args) => UpdateControls(); 41 42 InitializeComponent(); 42 43 UpdateControls(); … … 45 46 protected override void UpdateControls() { 46 47 base.UpdateControls(); 47 datasetView.Dataset = problem.Dataset;48 48 trainingSamplesStartTextBox.Text = problem.TrainingSamplesStart.ToString(); 49 49 trainingSamplesEndTextBox.Text = problem.TrainingSamplesEnd.ToString(); … … 60 60 case LearningTask.TimeSeries: timeSeriesRadioButton.Checked = true; break; 61 61 } 62 targetsListBox.Items.Clear();63 inputsListBox.Items.Clear();64 for (int i = 0; i < problem.Dataset.Columns; i++) {65 targetsListBox.Items.Add(problem.Dataset.GetVariableName(i), problem.AllowedTargetVariables.Contains(i));66 inputsListBox.Items.Add(problem.Dataset.GetVariableName(i), problem.AllowedInputVariables.Contains(i));67 }68 62 } 69 63 … … 99 93 dataset.Samples = new double[dataset.Rows * dataset.Columns]; 100 94 Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows); 101 datasetView .Dataset = problem.Dataset;95 datasetView1.Dataset = problem.Dataset; 102 96 103 97 problem.TrainingSamplesStart = parser.TrainingSamplesStart; … … 109 103 problem.TestSamplesEnd = parser.TestSamplesEnd; 110 104 problem.AllowedTargetVariables.Add(parser.TargetVariable); 111 105 problem.FireChanged(); 112 106 List<int> nonInputVariables = parser.NonInputVariables; 113 107 for (int i = 0; i < dataset.Columns; i++) { … … 119 113 } 120 114 121 private void targetsListBox_ItemCheck(object sender, ItemCheckEventArgs e) {122 if (e.NewValue == CheckState.Checked && !problem.AllowedTargetVariables.Contains(e.Index))123 problem.AllowedTargetVariables.Add(e.Index);124 else if (e.NewValue == CheckState.Unchecked && problem.AllowedTargetVariables.Contains(e.Index))125 problem.AllowedTargetVariables.Remove(e.Index);126 }127 128 private void inputsListBox_ItemCheck(object sender, ItemCheckEventArgs e) {129 if (e.NewValue == CheckState.Checked && !problem.AllowedInputVariables.Contains(e.Index))130 problem.AllowedInputVariables.Add(e.Index);131 else if (e.NewValue == CheckState.Unchecked && problem.AllowedInputVariables.Contains(e.Index))132 problem.AllowedInputVariables.Remove(e.Index);133 }115 //private void targetsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { 116 // if (e.NewValue == CheckState.Checked && !problem.AllowedTargetVariables.Contains(e.Index)) 117 // problem.AllowedTargetVariables.Add(e.Index); 118 // else if (e.NewValue == CheckState.Unchecked && problem.AllowedTargetVariables.Contains(e.Index)) 119 // problem.AllowedTargetVariables.Remove(e.Index); 120 //} 121 122 //private void inputsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { 123 // if (e.NewValue == CheckState.Checked && !problem.AllowedInputVariables.Contains(e.Index)) 124 // problem.AllowedInputVariables.Add(e.Index); 125 // else if (e.NewValue == CheckState.Unchecked && problem.AllowedInputVariables.Contains(e.Index)) 126 // problem.AllowedInputVariables.Remove(e.Index); 127 //} 134 128 135 129 private void autoregressiveCheckBox_CheckedChanged(object sender, EventArgs e) { -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ServerApplication.cs
r2195 r2198 27 27 28 28 namespace HeuristicLab.CEDMA.Server { 29 [ClassInfo(Name = "CEDMA Server", Description = "Server to execute CEDMA agents.", AutoRestart=true)]29 [ClassInfo(Name = "CEDMA", Description = "Cooperative Evolutionary Data Mining.", AutoRestart=true)] 30 30 class ServerApplication : ApplicationBase { 31 31 public override void Run() { … … 35 35 serverControl.Dock = DockStyle.Fill; 36 36 mainForm.Controls.Add(serverControl); 37 mainForm.Name = "CEDMA Server";37 mainForm.Name = "CEDMA"; 38 38 Application.Run(mainForm); 39 39 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.cs
r2124 r2198 37 37 : base() { 38 38 InitializeComponent(); 39 DiscoveryService discovery = new DiscoveryService();40 IDatasetManipulator[] manipuators = discovery.GetInstances<IDatasetManipulator>();41 contextMenuStrip.Items.Add(new ToolStripSeparator());42 foreach(IDatasetManipulator manipulator in manipuators) {43 contextMenuStrip.Items.Add(new ToolStripButton(manipulator.Action,null , delegate(object source, EventArgs args)44 {45 manipulator.Execute(Dataset);46 Refresh();47 }));48 }49 50 39 // format all cells with the round-trip formatter to make sure that values that are exported and imported to 51 40 // another C# app (HL2) have the same numeric value … … 60 49 : this() { 61 50 this.Dataset = dataset; 51 DiscoveryService discovery = new DiscoveryService(); 52 IDatasetManipulator[] manipuators = discovery.GetInstances<IDatasetManipulator>(); 53 contextMenuStrip.Items.Add(new ToolStripSeparator()); 54 foreach (IDatasetManipulator manipulator in manipuators) { 55 contextMenuStrip.Items.Add(new ToolStripButton(manipulator.Action, null, delegate(object source, EventArgs args) { 56 manipulator.Execute(Dataset); 57 Refresh(); 58 })); 59 } 62 60 } 63 61 -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Problem.cs
r2194 r2198 6 6 7 7 using HeuristicLab.DataAnalysis; 8 using HeuristicLab.Core; 8 9 9 10 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 10 11 [Table(Name = "Problem")] 11 public class Problem {12 public class Problem : IProblem { 12 13 public Problem() { 13 14 } … … 15 16 public Problem(Dataset dataset) 16 17 : this() { 17 this. dataset = dataset;18 this.Dataset = dataset; 18 19 } 19 20 … … 25 26 } 26 27 27 private Dataset dataset; 28 [Column(Storage = "dataset", DbType = "image", CanBeNull = false)] 28 private byte[] data; 29 [Column(Storage = "data", DbType = "image", CanBeNull = false)] 30 public byte[] Data { 31 get { return this.data; } 32 private set { this.data = value; } 33 } 34 29 35 public Dataset Dataset { 30 get { return this.dataset; }31 private set { this.dataset = value; }36 get { return (Dataset)PersistenceManager.RestoreFromGZip(this.Data); } 37 set { this.Data = PersistenceManager.SaveToGZip(value); } 32 38 } 33 39 }
Note: See TracChangeset
for help on using the changeset viewer.