Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2198


Ignore:
Timestamp:
07/28/09 17:51:48 (15 years ago)
Author:
gkronber
Message:

Fixed a few bugs in CEDMA dispatching. #712

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  
    6565    public DispatcherBase(IModelingDatabase database, Problem problem) {
    6666      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>>();
    7470        foreach (int targetVar in problem.AllowedTargetVariables) {
    7571          activeInputVariables.Add(targetVar, new List<int>());
     
    7773        }
    7874        OnChanged();
    79       }
     75      };
     76      this.database = database;
     77    }
     78
     79    public HeuristicLab.Modeling.IAlgorithm GetNextJob() {
    8080      if (allowedTargetVariables.Count > 0) {
    8181        int[] targetVariables, inputVariables;
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/Problem.cs

    r2195 r2198  
    3939  /// </summary>
    4040  public class Problem {
     41    internal event EventHandler Changed;
     42
    4143    private HeuristicLab.DataAnalysis.Dataset dataset;
    4244    public HeuristicLab.DataAnalysis.Dataset Dataset {
    4345      get { return dataset; }
    44       set { dataset = value; }
     46      set {
     47        if (value != dataset) {
     48          dataset = value;
     49        }
     50      }
    4551    }
    4652
     
    129135      return new ProblemView(this);
    130136    }
     137
     138    internal void FireChanged() {
     139      if (Changed != null) Changed(this, new EventArgs());
     140    }
    131141  }
    132142}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ProblemView.Designer.cs

    r2193 r2198  
    1919 */
    2020#endregion
     21using HeuristicLab.Core;
     22using System.Windows.Forms;
    2123namespace HeuristicLab.CEDMA.Server {
    2224  partial class ProblemView {
     
    5456      this.testSamplesStartTextBox = new System.Windows.Forms.TextBox();
    5557      this.testLabel = new System.Windows.Forms.Label();
    56       this.targetsListBox = new System.Windows.Forms.CheckedListBox();
    57       this.inputsListBox = new System.Windows.Forms.CheckedListBox();
    5858      this.autoregressiveCheckBox = new System.Windows.Forms.CheckBox();
    59       this.targetsGroupBox = new System.Windows.Forms.GroupBox();
    60       this.inputsGroupBox = new System.Windows.Forms.GroupBox();
    6159      this.partitioningGroupBox = new System.Windows.Forms.GroupBox();
    6260      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
     
    7068      this.maxTimeOffsetLabel = new System.Windows.Forms.Label();
    7169      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();
    7571      this.partitioningGroupBox.SuspendLayout();
    7672      this.learningTaskGroupBox.SuspendLayout();
     
    167163      this.testLabel.TabIndex = 14;
    168164      this.testLabel.Text = "Test samples:";
    169       //
    170       // targetsListBox
    171       //
    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       // inputsListBox
    183       //
    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);
    193165      //
    194166      // autoregressiveCheckBox
     
    203175      this.autoregressiveCheckBox.UseVisualStyleBackColor = true;
    204176      this.autoregressiveCheckBox.CheckedChanged += new System.EventHandler(this.autoregressiveCheckBox_CheckedChanged);
    205       //
    206       // targetsGroupBox
    207       //
    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       // inputsGroupBox
    218       //
    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:";
    227177      //
    228178      // partitioningGroupBox
     
    238188      this.partitioningGroupBox.Controls.Add(this.testSamplesStartTextBox);
    239189      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);
    241191      this.partitioningGroupBox.Name = "partitioningGroupBox";
    242192      this.partitioningGroupBox.Size = new System.Drawing.Size(326, 100);
     
    319269      this.learningTaskGroupBox.Controls.Add(this.timeSeriesRadioButton);
    320270      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);
    322272      this.learningTaskGroupBox.Name = "learningTaskGroupBox";
    323273      this.learningTaskGroupBox.Size = new System.Drawing.Size(326, 163);
     
    356306      this.maxTimeOffsetTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeOffsetTextBox_Validating);
    357307      //
    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;
    370314      //
    371315      // ProblemView
     
    373317      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    374318      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     319      this.Controls.Add(this.datasetView1);
    375320      this.Controls.Add(this.learningTaskGroupBox);
    376321      this.Controls.Add(this.partitioningGroupBox);
    377       this.Controls.Add(this.inputsGroupBox);
    378       this.Controls.Add(this.targetsGroupBox);
    379       this.Controls.Add(this.datasetView);
    380322      this.Controls.Add(this.importButton);
    381323      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);
    385325      this.partitioningGroupBox.ResumeLayout(false);
    386326      this.partitioningGroupBox.PerformLayout();
     
    403343    private System.Windows.Forms.TextBox testSamplesStartTextBox;
    404344    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;
    408345    private System.Windows.Forms.CheckBox autoregressiveCheckBox;
    409     private System.Windows.Forms.GroupBox targetsGroupBox;
    410     private System.Windows.Forms.GroupBox inputsGroupBox;
    411346    private System.Windows.Forms.GroupBox partitioningGroupBox;
    412347    private System.Windows.Forms.OpenFileDialog openFileDialog;
     
    420355    private System.Windows.Forms.TextBox maxTimeOffsetTextBox;
    421356    private System.Windows.Forms.Label autoregressiveLabel;
     357    private HeuristicLab.DataAnalysis.DatasetView datasetView1;
    422358  }
    423359}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ProblemView.cs

    r2195 r2198  
    3939    public ProblemView(Problem problem) {
    4040      this.problem = problem;
     41      problem.Changed += (sender, args) => UpdateControls();
    4142      InitializeComponent();
    4243      UpdateControls();
     
    4546    protected override void UpdateControls() {
    4647      base.UpdateControls();
    47       datasetView.Dataset = problem.Dataset;
    4848      trainingSamplesStartTextBox.Text = problem.TrainingSamplesStart.ToString();
    4949      trainingSamplesEndTextBox.Text = problem.TrainingSamplesEnd.ToString();
     
    6060        case LearningTask.TimeSeries: timeSeriesRadioButton.Checked = true; break;
    6161      }
    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       }
    6862    }
    6963
     
    9993          dataset.Samples = new double[dataset.Rows * dataset.Columns];
    10094          Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows);
    101           datasetView.Dataset = problem.Dataset;
     95          datasetView1.Dataset = problem.Dataset;
    10296
    10397          problem.TrainingSamplesStart = parser.TrainingSamplesStart;
     
    109103          problem.TestSamplesEnd = parser.TestSamplesEnd;
    110104          problem.AllowedTargetVariables.Add(parser.TargetVariable);
    111 
     105          problem.FireChanged();
    112106          List<int> nonInputVariables = parser.NonInputVariables;
    113107          for (int i = 0; i < dataset.Columns; i++) {
     
    119113    }
    120114
    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    //}
    134128
    135129    private void autoregressiveCheckBox_CheckedChanged(object sender, EventArgs e) {
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ServerApplication.cs

    r2195 r2198  
    2727
    2828namespace 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)]
    3030  class ServerApplication : ApplicationBase {
    3131    public override void Run() {
     
    3535      serverControl.Dock = DockStyle.Fill;
    3636      mainForm.Controls.Add(serverControl);
    37       mainForm.Name = "CEDMA Server";
     37      mainForm.Name = "CEDMA";
    3838      Application.Run(mainForm);
    3939    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.cs

    r2124 r2198  
    3737      : base() {
    3838      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      
    5039      // format all cells with the round-trip formatter to make sure that values that are exported and imported to
    5140      // another C# app (HL2) have the same numeric value
     
    6049      : this() {
    6150      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      }     
    6260    }
    6361
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Problem.cs

    r2194 r2198  
    66
    77using HeuristicLab.DataAnalysis;
     8using HeuristicLab.Core;
    89
    910namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    1011  [Table(Name = "Problem")]
    11   public class Problem {
     12  public class Problem : IProblem {
    1213    public Problem() {
    1314    }
     
    1516    public Problem(Dataset dataset)
    1617      : this() {
    17       this.dataset = dataset;
     18      this.Dataset = dataset;
    1819    }
    1920
     
    2526    }
    2627
    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
    2935    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); }
    3238    }
    3339  }
Note: See TracChangeset for help on using the changeset viewer.