Free cookie consent management tool by TermsFeed Policy Generator

Changeset 561


Ignore:
Timestamp:
09/13/08 13:36:57 (16 years ago)
Author:
gkronber
Message:
  • asynchronous downloading of agents and results from the CEDMA server
  • created a chart that displays points as bubbles (scatter-plot + optional third dimension for the size of the bubble, larger bubbles are more transparent than smaller bubbles)

ticket #268 (Possibility to open the function-tree of any model (represented as point in the scatter-plot))

Location:
trunk/sources
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj

    r560 r561  
    5050  </ItemGroup>
    5151  <ItemGroup>
     52    <Compile Include="BubbleChart.cs" />
     53    <Compile Include="BubbleChartControl.cs">
     54      <SubType>UserControl</SubType>
     55    </Compile>
     56    <Compile Include="BubbleChartControl.Designer.cs">
     57      <DependentUpon>BubbleChartControl.cs</DependentUpon>
     58    </Compile>
    5259    <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
    5360    <Compile Include="Histogram.cs" />
     
    6572      <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project>
    6673      <Name>HeuristicLab.CEDMA.DB.Interfaces</Name>
    67     </ProjectReference>
    68     <ProjectReference Include="..\HeuristicLab.Charting.Data\HeuristicLab.Charting.Data.csproj">
    69       <Project>{E0740131-AA3E-4A3F-BA03-C9FF8327F4EE}</Project>
    70       <Name>HeuristicLab.Charting.Data</Name>
    7174    </ProjectReference>
    7275    <ProjectReference Include="..\HeuristicLab.Charting\HeuristicLab.Charting.csproj">
     
    8891  </ItemGroup>
    8992  <ItemGroup>
     93    <EmbeddedResource Include="BubbleChartControl.resx">
     94      <DependentUpon>BubbleChartControl.cs</DependentUpon>
     95      <SubType>Designer</SubType>
     96    </EmbeddedResource>
    9097    <EmbeddedResource Include="ResultListView.resx">
    9198      <DependentUpon>ResultListView.cs</DependentUpon>
  • trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLabCedmaChartingPlugin.cs

    r560 r561  
    2929  [PluginFile(Filename = "HeuristicLab.CEDMA.Charting.dll", Filetype = PluginFileType.Assembly)]
    3030  [Dependency(Dependency = "HeuristicLab.Charting")]
    31   [Dependency(Dependency = "HeuristicLab.Charting.Data")]
    3231  [Dependency(Dependency = "HeuristicLab.Core")]
    3332  [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")]
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs

    r560 r561  
    6161      set {
    6262        store = value;
    63         ReloadList();
    64         FireChanged();
     63        Action reloadList = ReloadList;
     64        reloadList.BeginInvoke(null, null);
    6565      }
    6666    }
     67
    6768    private List<string> variableNames = new List<string>() { TARGET_VARIABLE, TREE_SIZE, TREE_HEIGHT,
    6869    MAPE_TRAINING, MAPE_VALIDATION, MAPE_TEST,
     
    7677
    7778    private void ReloadList() {
    78       allVariables.Clear();
    7979      List<double> trainingMAPE = new List<double>();
    8080      List<double> validationMAPE = new List<double>();
     
    8686      List<double> height = new List<double>();
    8787      List<double> targetVariable = new List<double>();
    88       allVariables[MAPE_TRAINING] = trainingMAPE;
    89       allVariables[MAPE_VALIDATION] = validationMAPE;
    90       allVariables[MAPE_TEST] = testMAPE;
    91       allVariables[R2_TRAINING] = trainingR2;
    92       allVariables[R2_VALIDATION] = validationR2;
    93       allVariables[R2_TEST] = testR2;
    94       allVariables[TREE_SIZE] = size;
    95       allVariables[TREE_HEIGHT] = height;
    96       allVariables[TARGET_VARIABLE] = targetVariable;
     88
     89      lock(allVariables) {
     90        allVariables.Clear();
     91        allVariables[MAPE_TRAINING] = trainingMAPE;
     92        allVariables[MAPE_VALIDATION] = validationMAPE;
     93        allVariables[MAPE_TEST] = testMAPE;
     94        allVariables[R2_TRAINING] = trainingR2;
     95        allVariables[R2_VALIDATION] = validationR2;
     96        allVariables[R2_TEST] = testR2;
     97        allVariables[TREE_SIZE] = size;
     98        allVariables[TREE_HEIGHT] = height;
     99        allVariables[TARGET_VARIABLE] = targetVariable;
     100      }
    97101
    98102      var results = store.Select(new Statement(anyEntity, new Entity(cedmaNS + "instanceOf"), new Literal("class:GpFunctionTree")))
     
    106110      Random random = new Random(); // for adding random noise to int values
    107111      foreach(Statement[] ss in results) {
    108         targetVariable.Add(double.NaN);
    109         size.Add(double.NaN);
    110         height.Add(double.NaN);
    111         trainingMAPE.Add(double.NaN);
    112         validationMAPE.Add(double.NaN);
    113         testMAPE.Add(double.NaN);
    114         trainingR2.Add(double.NaN);
    115         validationR2.Add(double.NaN);
    116         testR2.Add(double.NaN);
    117         foreach(Statement s in ss) {
    118           if(s.Predicate.Equals(targetVariablePredicate)) {
    119             ReplaceLastItem(targetVariable, (double)(int)((Literal)s.Property).Value);
    120           } else if(s.Predicate.Equals(treeSizePredicate)) {
    121             ReplaceLastItem(size, (double)(int)((Literal)s.Property).Value);
    122           } else if(s.Predicate.Equals(treeHeightPredicate)) {
    123             ReplaceLastItem(height, (double)(int)((Literal)s.Property).Value);
    124           } else if(s.Predicate.Equals(trainingMAPEPredicate)) {
    125             ReplaceLastItem(trainingMAPE, (double)((Literal)s.Property).Value);
    126           } else if(s.Predicate.Equals(validationMAPEPredicate)) {
    127             ReplaceLastItem(validationMAPE, (double)((Literal)s.Property).Value);
    128           } else if(s.Predicate.Equals(testMAPEPredicate)) {
    129             ReplaceLastItem(testMAPE, (double)((Literal)s.Property).Value);
    130           } else if(s.Predicate.Equals(trainingR2Predicate)) {
    131             ReplaceLastItem(trainingR2, (double)((Literal)s.Property).Value);
    132           } else if(s.Predicate.Equals(validationR2Predicate)) {
    133             ReplaceLastItem(validationR2, (double)((Literal)s.Property).Value);
    134           } else if(s.Predicate.Equals(testR2Predicate)) {
    135             ReplaceLastItem(testR2, (double)((Literal)s.Property).Value);
     112        lock(allVariables) {
     113          targetVariable.Add(double.NaN);
     114          size.Add(double.NaN);
     115          height.Add(double.NaN);
     116          trainingMAPE.Add(double.NaN);
     117          validationMAPE.Add(double.NaN);
     118          testMAPE.Add(double.NaN);
     119          trainingR2.Add(double.NaN);
     120          validationR2.Add(double.NaN);
     121          testR2.Add(double.NaN);
     122          foreach(Statement s in ss) {
     123            if(s.Predicate.Equals(targetVariablePredicate)) {
     124              ReplaceLastItem(targetVariable, (double)(int)((Literal)s.Property).Value);
     125            } else if(s.Predicate.Equals(treeSizePredicate)) {
     126              ReplaceLastItem(size, (double)(int)((Literal)s.Property).Value);
     127            } else if(s.Predicate.Equals(treeHeightPredicate)) {
     128              ReplaceLastItem(height, (double)(int)((Literal)s.Property).Value);
     129            } else if(s.Predicate.Equals(trainingMAPEPredicate)) {
     130              ReplaceLastItem(trainingMAPE, (double)((Literal)s.Property).Value);
     131            } else if(s.Predicate.Equals(validationMAPEPredicate)) {
     132              ReplaceLastItem(validationMAPE, (double)((Literal)s.Property).Value);
     133            } else if(s.Predicate.Equals(testMAPEPredicate)) {
     134              ReplaceLastItem(testMAPE, (double)((Literal)s.Property).Value);
     135            } else if(s.Predicate.Equals(trainingR2Predicate)) {
     136              ReplaceLastItem(trainingR2, (double)((Literal)s.Property).Value);
     137            } else if(s.Predicate.Equals(validationR2Predicate)) {
     138              ReplaceLastItem(validationR2, (double)((Literal)s.Property).Value);
     139            } else if(s.Predicate.Equals(testR2Predicate)) {
     140              ReplaceLastItem(testR2, (double)((Literal)s.Property).Value);
     141            }
    136142          }
    137143        }
     144        FireChanged();
    138145      }
    139146    }
     
    154161    internal Histogram GetHistogram(string variableName) {
    155162      Histogram h = new Histogram(50);
    156       h.AddValues(allVariables[variableName]);
     163      lock(allVariables) {
     164        h.AddValues(allVariables[variableName]);
     165      }
    157166      return h;
    158167    }
    159168
    160169    internal IList<double> GetValues(string variableName) {
    161       return allVariables[variableName];
     170      List<double> result = new List<double>();
     171      lock(allVariables) {
     172        result.AddRange(allVariables[variableName]);
     173      }
     174      return result;
    162175    }
    163176  }
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.Designer.cs

    r560 r561  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.dataChart = new HeuristicLab.Charting.Data.DataChartControl();
     26      this.yJitterLabel = new System.Windows.Forms.Label();
     27      this.xJitterlabel = new System.Windows.Forms.Label();
     28      this.xTrackBar = new System.Windows.Forms.TrackBar();
    2729      this.xAxisLabel = new System.Windows.Forms.Label();
    2830      this.xAxisComboBox = new System.Windows.Forms.ComboBox();
     
    3032      this.yAxisComboBox = new System.Windows.Forms.ComboBox();
    3133      this.yTrackBar = new System.Windows.Forms.TrackBar();
    32       this.xTrackBar = new System.Windows.Forms.TrackBar();
    33       this.xJitterlabel = new System.Windows.Forms.Label();
    34       this.yJitterLabel = new System.Windows.Forms.Label();
     34      this.dataChart = new HeuristicLab.CEDMA.Charting.BubbleChartControl();
     35      this.sizeComboBox = new System.Windows.Forms.ComboBox();
     36      this.sizeLabel = new System.Windows.Forms.Label();
     37      this.invertCheckbox = new System.Windows.Forms.CheckBox();
     38      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    3539      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
    36       ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    3740      this.SuspendLayout();
    3841      //
    39       // dataChart
    40       //
    41       this.dataChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    42                   | System.Windows.Forms.AnchorStyles.Left)
    43                   | System.Windows.Forms.AnchorStyles.Right)));
    44       this.dataChart.BackColor = System.Drawing.SystemColors.Control;
    45       this.dataChart.Chart = null;
    46       this.dataChart.Location = new System.Drawing.Point(3, 30);
    47       this.dataChart.Name = "dataChart";
    48       this.dataChart.ScaleOnResize = true;
    49       this.dataChart.Size = new System.Drawing.Size(447, 390);
    50       this.dataChart.TabIndex = 9;
     42      // yJitterLabel
     43      //
     44      this.yJitterLabel.AutoSize = true;
     45      this.yJitterLabel.Location = new System.Drawing.Point(3, 30);
     46      this.yJitterLabel.Name = "yJitterLabel";
     47      this.yJitterLabel.Size = new System.Drawing.Size(29, 13);
     48      this.yJitterLabel.TabIndex = 13;
     49      this.yJitterLabel.Text = "jitter:";
     50      //
     51      // xJitterlabel
     52      //
     53      this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     54      this.xJitterlabel.AutoSize = true;
     55      this.xJitterlabel.Location = new System.Drawing.Point(291, 418);
     56      this.xJitterlabel.Name = "xJitterlabel";
     57      this.xJitterlabel.Size = new System.Drawing.Size(29, 13);
     58      this.xJitterlabel.TabIndex = 12;
     59      this.xJitterlabel.Text = "jitter:";
     60      //
     61      // xTrackBar
     62      //
     63      this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     64      this.xTrackBar.Location = new System.Drawing.Point(326, 418);
     65      this.xTrackBar.Maximum = 100;
     66      this.xTrackBar.Name = "xTrackBar";
     67      this.xTrackBar.Size = new System.Drawing.Size(121, 45);
     68      this.xTrackBar.TabIndex = 11;
     69      this.xTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     70      this.xTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged);
    5171      //
    5272      // xAxisLabel
     
    5474      this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    5575      this.xAxisLabel.AutoSize = true;
    56       this.xAxisLabel.Location = new System.Drawing.Point(197, 429);
     76      this.xAxisLabel.Location = new System.Drawing.Point(305, 394);
    5777      this.xAxisLabel.Name = "xAxisLabel";
    5878      this.xAxisLabel.Size = new System.Drawing.Size(15, 13);
     
    6484      this.xAxisComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6585      this.xAxisComboBox.FormattingEnabled = true;
    66       this.xAxisComboBox.Location = new System.Drawing.Point(218, 426);
     86      this.xAxisComboBox.Location = new System.Drawing.Point(326, 391);
    6787      this.xAxisComboBox.Name = "xAxisComboBox";
    6888      this.xAxisComboBox.Size = new System.Drawing.Size(121, 21);
     
    90110      // yTrackBar
    91111      //
    92       this.yTrackBar.Location = new System.Drawing.Point(186, 3);
     112      this.yTrackBar.Location = new System.Drawing.Point(38, 30);
    93113      this.yTrackBar.Maximum = 100;
    94114      this.yTrackBar.Name = "yTrackBar";
    95       this.yTrackBar.Size = new System.Drawing.Size(60, 45);
     115      this.yTrackBar.Size = new System.Drawing.Size(107, 45);
    96116      this.yTrackBar.TabIndex = 10;
    97117      this.yTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    98       this.yTrackBar.ValueChanged += new System.EventHandler(this.yTrackBar_ValueChanged);
    99       //
    100       // xTrackBar
    101       //
    102       this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    103       this.xTrackBar.Location = new System.Drawing.Point(387, 426);
    104       this.xTrackBar.Maximum = 100;
    105       this.xTrackBar.Name = "xTrackBar";
    106       this.xTrackBar.Size = new System.Drawing.Size(60, 45);
    107       this.xTrackBar.TabIndex = 11;
    108       this.xTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    109       this.xTrackBar.ValueChanged += new System.EventHandler(this.xTrackBar_ValueChanged);
    110       //
    111       // xJitterlabel
    112       //
    113       this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    114       this.xJitterlabel.AutoSize = true;
    115       this.xJitterlabel.Location = new System.Drawing.Point(352, 429);
    116       this.xJitterlabel.Name = "xJitterlabel";
    117       this.xJitterlabel.Size = new System.Drawing.Size(29, 13);
    118       this.xJitterlabel.TabIndex = 12;
    119       this.xJitterlabel.Text = "jitter:";
    120       //
    121       // yJitterLabel
    122       //
    123       this.yJitterLabel.AutoSize = true;
    124       this.yJitterLabel.Location = new System.Drawing.Point(151, 6);
    125       this.yJitterLabel.Name = "yJitterLabel";
    126       this.yJitterLabel.Size = new System.Drawing.Size(29, 13);
    127       this.yJitterLabel.TabIndex = 13;
    128       this.yJitterLabel.Text = "jitter:";
     118      this.yTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged);
     119      //
     120      // dataChart
     121      //
     122      this.dataChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     123                  | System.Windows.Forms.AnchorStyles.Left)
     124                  | System.Windows.Forms.AnchorStyles.Right)));
     125      this.dataChart.BackColor = System.Drawing.SystemColors.Control;
     126      this.dataChart.Chart = null;
     127      this.dataChart.Location = new System.Drawing.Point(3, 81);
     128      this.dataChart.Name = "dataChart";
     129      this.dataChart.ScaleOnResize = true;
     130      this.dataChart.Size = new System.Drawing.Size(447, 304);
     131      this.dataChart.TabIndex = 9;
     132      //
     133      // sizeComboBox
     134      //
     135      this.sizeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     136      this.sizeComboBox.FormattingEnabled = true;
     137      this.sizeComboBox.Location = new System.Drawing.Point(329, 3);
     138      this.sizeComboBox.Name = "sizeComboBox";
     139      this.sizeComboBox.Size = new System.Drawing.Size(121, 21);
     140      this.sizeComboBox.TabIndex = 14;
     141      this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged);
     142      //
     143      // sizeLabel
     144      //
     145      this.sizeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     146      this.sizeLabel.AutoSize = true;
     147      this.sizeLabel.Location = new System.Drawing.Point(259, 6);
     148      this.sizeLabel.Name = "sizeLabel";
     149      this.sizeLabel.Size = new System.Drawing.Size(64, 13);
     150      this.sizeLabel.TabIndex = 15;
     151      this.sizeLabel.Text = "Bubble size:";
     152      //
     153      // invertCheckbox
     154      //
     155      this.invertCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     156      this.invertCheckbox.AutoSize = true;
     157      this.invertCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     158      this.invertCheckbox.Location = new System.Drawing.Point(326, 30);
     159      this.invertCheckbox.Name = "invertCheckbox";
     160      this.invertCheckbox.Size = new System.Drawing.Size(64, 17);
     161      this.invertCheckbox.TabIndex = 16;
     162      this.invertCheckbox.Text = "Inverse:";
     163      this.invertCheckbox.UseVisualStyleBackColor = true;
     164      this.invertCheckbox.CheckedChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged);
    129165      //
    130166      // ResultListView
     
    132168      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    133169      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     170      this.Controls.Add(this.invertCheckbox);
     171      this.Controls.Add(this.sizeLabel);
     172      this.Controls.Add(this.sizeComboBox);
     173      this.Controls.Add(this.dataChart);
    134174      this.Controls.Add(this.yJitterLabel);
    135175      this.Controls.Add(this.xJitterlabel);
    136176      this.Controls.Add(this.xTrackBar);
    137       this.Controls.Add(this.dataChart);
    138177      this.Controls.Add(this.xAxisLabel);
    139178      this.Controls.Add(this.xAxisComboBox);
     
    142181      this.Controls.Add(this.yTrackBar);
    143182      this.Name = "ResultListView";
    144       this.Size = new System.Drawing.Size(450, 450);
     183      this.Size = new System.Drawing.Size(450, 459);
     184      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();
    145185      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit();
    146       ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();
    147186      this.ResumeLayout(false);
    148187      this.PerformLayout();
     
    152191    #endregion
    153192
    154     private HeuristicLab.Charting.Data.DataChartControl dataChart;
     193    private BubbleChartControl dataChart;
    155194    private System.Windows.Forms.Label xAxisLabel;
    156195    private System.Windows.Forms.ComboBox xAxisComboBox;
     
    161200    private System.Windows.Forms.Label xJitterlabel;
    162201    private System.Windows.Forms.Label yJitterLabel;
     202    private System.Windows.Forms.ComboBox sizeComboBox;
     203    private System.Windows.Forms.Label sizeLabel;
     204    private System.Windows.Forms.CheckBox invertCheckbox;
    163205  }
    164206}
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs

    r560 r561  
    1414    private ResultList results;
    1515    private const string FREQUENCY = "<Frequency>";
     16    private const string CONSTANT_SIZE = "<constant>";
    1617    private double xJitterFactor = 0.0;
    1718    private double yJitterFactor = 0.0;
     
    2122    public ResultListView(ResultList results) {
    2223      this.results = results;
     24      results.Changed += new EventHandler(results_Changed);
    2325      InitializeComponent();
    24       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 1);
    2526      xAxisComboBox.Items.AddRange(results.VariableNames);
    2627      yAxisComboBox.Items.Add(FREQUENCY);
    2728      yAxisComboBox.Items.AddRange(results.VariableNames);
     29      sizeComboBox.Items.Add(CONSTANT_SIZE);
     30      sizeComboBox.Items.AddRange(results.VariableNames);
     31      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
     32      InitChart();
     33    }
     34
     35    private DateTime lastUpdate = DateTime.Now;
     36    void results_Changed(object sender, EventArgs e) {
     37      if(DateTime.Now.Subtract(lastUpdate).TotalSeconds < 3) return;
     38      lastUpdate = DateTime.Now;
     39      InitChart();
     40    }
     41
     42    private void InitChart() {
     43      dataChart.Chart = new BubbleChart(0, 0, 100, 100);
     44      foreach(string dim in results.VariableNames) {
     45        dataChart.Chart.AddDimension(dim);
     46        IList<double> xs = results.GetValues(dim);
     47        for(int i = 0; i < xs.Count; i++) {
     48          double x = xs[i];
     49          if(double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
     50          if(!double.IsNaN(x)) {
     51            dataChart.Chart.AddDataPoint(dim, x);
     52          }
     53        }
     54      }
    2855    }
    2956
     
    4572        CreateHistogramChart();
    4673      } else {
    47         CreateScatterplot();
     74        dataChart.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
    4875      }
    4976    }
    5077
    51     private void CreateScatterplot() {
    52       double minX = double.PositiveInfinity;
    53       double minY = double.PositiveInfinity;
    54       double maxX = double.NegativeInfinity;
    55       double maxY = double.NegativeInfinity;
    56 
    57       xTrackBar.Enabled = true;
    58       yTrackBar.Enabled = true;
    59       Random random = new Random();
    60       Color curCol = Color.FromArgb(30, Color.Blue);
    61       Pen p = new Pen(curCol);
    62       SolidBrush b = new SolidBrush(curCol);
    63       IList<double> xs = results.GetValues((string)xAxisComboBox.SelectedItem);
    64       IList<double> ys = results.GetValues((string)yAxisComboBox.SelectedItem);
    65       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 100);
    66       dataChart.Chart.UpdateEnabled = false;
    67       dataChart.Chart.Group.Add(new Axis(dataChart.Chart, 0, 0, AxisType.Both));
    68       dataChart.Chart.AddDataRow(HeuristicLab.Charting.Data.DataRowType.Points, p, b);
    69       for(int i = 0; i < xs.Count; i++) {
    70         double x = xs[i] + (random.NextDouble() * 2.0 - 1.0) * xJitterFactor;
    71         double y = ys[i] + (random.NextDouble() * 2.0 - 1.0) * yJitterFactor;
    72         if(double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
    73         if(double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
    74         if(!double.IsNaN(x) && !double.IsNaN(y)) {
    75           dataChart.Chart.AddDataPoint(0, x, y);
    76           if(x > maxX) maxX = x;
    77           if(y > maxY) maxY = y;
    78           if(x < minX) minX = x;
    79           if(y < minY) minY = y;
    80         }
    81       }
    82       dataChart.Chart.UpdateEnabled = true;
    83       if(minX<maxX && minY<maxY) dataChart.Chart.ZoomIn(minX, minY, maxX, maxY);
     78    private void CreateHistogramChart() {
     79      // TASK
    8480    }
    85 
    86     private void CreateHistogramChart() {
    87       double minX = double.PositiveInfinity;
    88       double minY = double.PositiveInfinity;
    89       double maxX = double.NegativeInfinity;
    90       double maxY = double.NegativeInfinity;
    91 
    92       xTrackBar.Enabled = false;
    93       yTrackBar.Enabled = false;
    94       Color curCol = Color.Blue;
    95       Pen p = new Pen(curCol);
    96       SolidBrush b = new SolidBrush(curCol);
    97       // frequency
    98       dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 100);
    99       dataChart.Chart.UpdateEnabled = false;
    100       dataChart.Chart.Group.Add(new Axis(dataChart.Chart, 0, 0, AxisType.Both));
    101       Histogram h = results.GetHistogram((string)xAxisComboBox.SelectedItem);
    102       for(int i = 0; i < h.Buckets; i++) {
    103         double lower = h.LowerValue(i);
    104         double upper = h.UpperValue(i);
    105         int freq = h.Frequency(i);
    106         if(lower < minX) minX = lower;
    107         if(upper > maxX) maxX = upper;
    108         if(freq > maxY) maxY = freq;
    109         dataChart.Chart.AddDataRow(HeuristicLab.Charting.Data.DataRowType.Bars, p, b);
    110         dataChart.Chart.AddDataPoint(0, lower, 0);
    111         dataChart.Chart.AddDataPoint(0, upper, freq);
    112       }
    113       minY = 0;
    114       dataChart.Chart.UpdateEnabled = true;
    115       if(minX < maxX && minY < maxY) dataChart.Chart.ZoomIn(minX, minY, maxX, maxY);
    116     }
    117 
    118     private void yTrackBar_ValueChanged(object sender, EventArgs e) {
     81   
     82    private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
    11983      if(dataChart.Chart != null) {
    120         yJitterFactor = yTrackBar.Value / 100.0 * maxYJitterPercent * dataChart.Chart.Size.Height;
     84        double xJitterFactor = xTrackBar.Value / 100.0 ;
     85        double yJitterFactor = yTrackBar.Value / 100.0 ;
     86        dataChart.Chart.SetJitter(xJitterFactor, yJitterFactor);
    12187      }
    12288      UpdateChart();
    12389    }
    12490
    125     private void xTrackBar_ValueChanged(object sender, EventArgs e) {
     91    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    12692      if(dataChart.Chart != null) {
    127         xJitterFactor = xTrackBar.Value / 100.0 * maxXJitterPercent * dataChart.Chart.Size.Width;
     93        dataChart.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
     94        UpdateChart();
    12895      }
    129       UpdateChart();
    13096    }
    13197  }
  • trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs

    r510 r561  
    4040      set {
    4141        database = value;
    42         ReloadList();
    43         FireChanged();
     42        Action reload = ReloadList;
     43        lock(agentList) {
     44          agentList.Clear();
     45        }
     46        reload.BeginInvoke(null, null);
    4447      }
    4548    }
    4649
    4750    private void ReloadList() {
    48       agentList.Clear();
    4951      foreach(AgentEntry a in database.GetAgents()) {
    5052        Agent newAgent = new Agent(Database, a.Id);
    5153        newAgent.Name = a.Name;
    5254        newAgent.Status = a.Status;
    53         agentList.Add(newAgent);
     55        lock(agentList) {
     56          agentList.Add(newAgent);
     57        }
     58        FireChanged();
    5459      }
    5560    }
     
    6772      long id = database.InsertAgent(null, agent.Name, PersistenceManager.SaveToGZip(agent.OperatorGraph));
    6873      agent.Id = id;
    69       agentList.Add(agent);
     74      lock(agentList) {
     75        agentList.Add(agent);
     76      }
    7077      FireChanged();
    7178    }
    7279
    7380    public IEnumerator<IAgent> GetEnumerator() {
    74       ReloadList();
    75       return agentList.GetEnumerator();
     81      List<IAgent> agents = new List<IAgent>();
     82      lock(agentList) {
     83        agents.AddRange(agentList);
     84      }
     85      return agents.GetEnumerator();
    7686    }
    7787
  • trunk/sources/HeuristicLab.CEDMA.Core/ConsoleEditor.cs

    r560 r561  
    3535    private System.Windows.Forms.TextBox uriTextBox;
    3636    private System.Windows.Forms.Label uriLabel;
    37     private System.Windows.Forms.TabControl tabControl;
    38     private System.Windows.Forms.TabPage agentsPage;
    3937    private Button connectButton;
    40     private ComboBox comboBox1;
    41     private Label projectLabel;
    42     private Button newButton;
    43     private Button opLibButton;
     38    private Button openOpLibButton;
    4439    private Label label1;
    45     private TabPage resultsTabPage;
     40    private Label resultsLabel;
     41    private Button openResultsButton;
     42    private Button openAgentsButton;
     43    private Label agentsLabel;
    4644    private Console console;
    4745
     
    5452      this.uriTextBox = new System.Windows.Forms.TextBox();
    5553      this.uriLabel = new System.Windows.Forms.Label();
    56       this.tabControl = new System.Windows.Forms.TabControl();
    57       this.agentsPage = new System.Windows.Forms.TabPage();
    58       this.resultsTabPage = new System.Windows.Forms.TabPage();
    5954      this.connectButton = new System.Windows.Forms.Button();
    60       this.comboBox1 = new System.Windows.Forms.ComboBox();
    61       this.projectLabel = new System.Windows.Forms.Label();
    62       this.newButton = new System.Windows.Forms.Button();
    63       this.opLibButton = new System.Windows.Forms.Button();
     55      this.openOpLibButton = new System.Windows.Forms.Button();
    6456      this.label1 = new System.Windows.Forms.Label();
    65       this.tabControl.SuspendLayout();
     57      this.resultsLabel = new System.Windows.Forms.Label();
     58      this.openResultsButton = new System.Windows.Forms.Button();
     59      this.openAgentsButton = new System.Windows.Forms.Button();
     60      this.agentsLabel = new System.Windows.Forms.Label();
    6661      this.SuspendLayout();
    6762      //
     
    7671      //
    7772      this.uriLabel.AutoSize = true;
    78       this.uriLabel.Location = new System.Drawing.Point(3, 6);
     73      this.uriLabel.Location = new System.Drawing.Point(6, 6);
    7974      this.uriLabel.Name = "uriLabel";
    8075      this.uriLabel.Size = new System.Drawing.Size(82, 13);
    8176      this.uriLabel.TabIndex = 1;
    8277      this.uriLabel.Text = "CEDMA Server:";
    83       //
    84       // tabControl
    85       //
    86       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    87                   | System.Windows.Forms.AnchorStyles.Left)
    88                   | System.Windows.Forms.AnchorStyles.Right)));
    89       this.tabControl.Controls.Add(this.agentsPage);
    90       this.tabControl.Controls.Add(this.resultsTabPage);
    91       this.tabControl.Enabled = false;
    92       this.tabControl.Location = new System.Drawing.Point(6, 85);
    93       this.tabControl.Name = "tabControl";
    94       this.tabControl.SelectedIndex = 0;
    95       this.tabControl.Size = new System.Drawing.Size(506, 378);
    96       this.tabControl.TabIndex = 2;
    97       //
    98       // agentsPage
    99       //
    100       this.agentsPage.Location = new System.Drawing.Point(4, 22);
    101       this.agentsPage.Name = "agentsPage";
    102       this.agentsPage.Padding = new System.Windows.Forms.Padding(3);
    103       this.agentsPage.Size = new System.Drawing.Size(498, 352);
    104       this.agentsPage.TabIndex = 1;
    105       this.agentsPage.Text = "Agents";
    106       this.agentsPage.UseVisualStyleBackColor = true;
    107       //
    108       // resultsTabPage
    109       //
    110       this.resultsTabPage.Location = new System.Drawing.Point(4, 22);
    111       this.resultsTabPage.Name = "resultsTabPage";
    112       this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);
    113       this.resultsTabPage.Size = new System.Drawing.Size(498, 352);
    114       this.resultsTabPage.TabIndex = 2;
    115       this.resultsTabPage.Text = "Results";
    116       this.resultsTabPage.UseVisualStyleBackColor = true;
    11778      //
    11879      // connectButton
     
    12687      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
    12788      //
    128       // comboBox1
     89      // openOpLibButton
    12990      //
    130       this.comboBox1.Enabled = false;
    131       this.comboBox1.FormattingEnabled = true;
    132       this.comboBox1.Location = new System.Drawing.Point(94, 29);
    133       this.comboBox1.Name = "comboBox1";
    134       this.comboBox1.Size = new System.Drawing.Size(121, 21);
    135       this.comboBox1.TabIndex = 4;
    136       //
    137       // projectLabel
    138       //
    139       this.projectLabel.AutoSize = true;
    140       this.projectLabel.Enabled = false;
    141       this.projectLabel.Location = new System.Drawing.Point(42, 32);
    142       this.projectLabel.Name = "projectLabel";
    143       this.projectLabel.Size = new System.Drawing.Size(43, 13);
    144       this.projectLabel.TabIndex = 5;
    145       this.projectLabel.Text = "Project:";
    146       //
    147       // newButton
    148       //
    149       this.newButton.Enabled = false;
    150       this.newButton.Location = new System.Drawing.Point(221, 27);
    151       this.newButton.Name = "newButton";
    152       this.newButton.Size = new System.Drawing.Size(75, 23);
    153       this.newButton.TabIndex = 6;
    154       this.newButton.Text = "New...";
    155       this.newButton.UseVisualStyleBackColor = true;
    156       //
    157       // opLibButton
    158       //
    159       this.opLibButton.Enabled = false;
    160       this.opLibButton.Location = new System.Drawing.Point(94, 56);
    161       this.opLibButton.Name = "opLibButton";
    162       this.opLibButton.Size = new System.Drawing.Size(75, 23);
    163       this.opLibButton.TabIndex = 7;
    164       this.opLibButton.Text = "&Open";
    165       this.opLibButton.UseVisualStyleBackColor = true;
    166       this.opLibButton.Click += new System.EventHandler(this.opLibButton_Click);
     91      this.openOpLibButton.Enabled = false;
     92      this.openOpLibButton.Location = new System.Drawing.Point(94, 85);
     93      this.openOpLibButton.Name = "openOpLibButton";
     94      this.openOpLibButton.Size = new System.Drawing.Size(75, 23);
     95      this.openOpLibButton.TabIndex = 7;
     96      this.openOpLibButton.Text = "&Open";
     97      this.openOpLibButton.UseVisualStyleBackColor = true;
     98      this.openOpLibButton.Click += new System.EventHandler(this.opLibButton_Click);
    16799      //
    168100      // label1
    169101      //
    170102      this.label1.AutoSize = true;
    171       this.label1.Location = new System.Drawing.Point(3, 61);
     103      this.label1.Location = new System.Drawing.Point(3, 90);
    172104      this.label1.Name = "label1";
    173105      this.label1.Size = new System.Drawing.Size(85, 13);
     
    175107      this.label1.Text = "Operator Library:";
    176108      //
     109      // resultsLabel
     110      //
     111      this.resultsLabel.AutoSize = true;
     112      this.resultsLabel.Location = new System.Drawing.Point(43, 61);
     113      this.resultsLabel.Name = "resultsLabel";
     114      this.resultsLabel.Size = new System.Drawing.Size(45, 13);
     115      this.resultsLabel.TabIndex = 9;
     116      this.resultsLabel.Text = "Results:";
     117      //
     118      // openResultsButton
     119      //
     120      this.openResultsButton.Enabled = false;
     121      this.openResultsButton.Location = new System.Drawing.Point(94, 56);
     122      this.openResultsButton.Name = "openResultsButton";
     123      this.openResultsButton.Size = new System.Drawing.Size(75, 23);
     124      this.openResultsButton.TabIndex = 10;
     125      this.openResultsButton.Text = "&Open";
     126      this.openResultsButton.UseVisualStyleBackColor = true;
     127      this.openResultsButton.Click += new System.EventHandler(this.openChartButton_Click);
     128      //
     129      // openAgentsButton
     130      //
     131      this.openAgentsButton.Enabled = false;
     132      this.openAgentsButton.Location = new System.Drawing.Point(94, 27);
     133      this.openAgentsButton.Name = "openAgentsButton";
     134      this.openAgentsButton.Size = new System.Drawing.Size(75, 23);
     135      this.openAgentsButton.TabIndex = 12;
     136      this.openAgentsButton.Text = "&Open";
     137      this.openAgentsButton.UseVisualStyleBackColor = true;
     138      this.openAgentsButton.Click += new System.EventHandler(this.openAgentsButton_Click);
     139      //
     140      // agentsLabel
     141      //
     142      this.agentsLabel.AutoSize = true;
     143      this.agentsLabel.Location = new System.Drawing.Point(45, 32);
     144      this.agentsLabel.Name = "agentsLabel";
     145      this.agentsLabel.Size = new System.Drawing.Size(43, 13);
     146      this.agentsLabel.TabIndex = 11;
     147      this.agentsLabel.Text = "Agents:";
     148      //
    177149      // ConsoleEditor
    178150      //
    179151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     152      this.Controls.Add(this.openAgentsButton);
     153      this.Controls.Add(this.agentsLabel);
     154      this.Controls.Add(this.openResultsButton);
     155      this.Controls.Add(this.resultsLabel);
    180156      this.Controls.Add(this.label1);
    181       this.Controls.Add(this.opLibButton);
    182       this.Controls.Add(this.newButton);
    183       this.Controls.Add(this.projectLabel);
    184       this.Controls.Add(this.comboBox1);
     157      this.Controls.Add(this.openOpLibButton);
    185158      this.Controls.Add(this.connectButton);
    186       this.Controls.Add(this.tabControl);
    187159      this.Controls.Add(this.uriLabel);
    188160      this.Controls.Add(this.uriTextBox);
    189161      this.Name = "ConsoleEditor";
    190       this.Size = new System.Drawing.Size(515, 466);
    191       this.tabControl.ResumeLayout(false);
     162      this.Size = new System.Drawing.Size(445, 189);
    192163      this.ResumeLayout(false);
    193164      this.PerformLayout();
     
    199170        console.Connect(uriTextBox.Text);
    200171        connectButton.Enabled = false;
    201         tabControl.Enabled = true;
    202         agentsPage.Controls.Clear();
    203         agentsPage.Controls.Add((Control)console.AgentList.CreateView());
    204         agentsPage.Controls[0].Dock = DockStyle.Fill;
    205         resultsTabPage.Controls.Clear();
    206         resultsTabPage.Controls.Add((Control)console.ResultsList.CreateView());
    207         resultsTabPage.Controls[0].Dock = DockStyle.Fill;
    208         opLibButton.Enabled = true;
    209         opLibButton.Enabled = true;
     172        openOpLibButton.Enabled = true;
     173        openAgentsButton.Enabled = true;
     174        openResultsButton.Enabled = true;
    210175      } catch(CommunicationException ex) {
    211176        MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
     
    221186      }
    222187    }
     188
     189    private void openChartButton_Click(object sender, EventArgs e) {
     190      PluginManager.ControlManager.ShowControl(console.ResultsList.CreateView());
     191    }
     192
     193    private void openAgentsButton_Click(object sender, EventArgs e) {
     194      PluginManager.ControlManager.ShowControl(console.AgentList.CreateView());
     195    }
    223196  }
    224197}
  • trunk/sources/HeuristicLab.sln

    r558 r561  
    377377    {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
    378378    {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|x86.ActiveCfg = Debug|Any CPU
     379    {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|x86.Build.0 = Debug|Any CPU
    379380    {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
    380381    {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Release|Any CPU.Build.0 = Release|Any CPU
  • trunk/sources/HeuristicLab/HeuristicLab.csproj

    r39 r561  
    3636    <WarningLevel>4</WarningLevel>
    3737    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
     38  </PropertyGroup>
     39  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     40    <DebugSymbols>true</DebugSymbols>
     41    <OutputPath>bin\Debug\</OutputPath>
     42    <DefineConstants>DEBUG;TRACE</DefineConstants>
     43    <DebugType>full</DebugType>
     44    <PlatformTarget>x86</PlatformTarget>
     45    <ErrorReport>prompt</ErrorReport>
     46  </PropertyGroup>
     47  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     48    <OutputPath>bin\x86\Release\</OutputPath>
     49    <DefineConstants>TRACE</DefineConstants>
     50    <Optimize>true</Optimize>
     51    <DebugType>pdbonly</DebugType>
     52    <PlatformTarget>x86</PlatformTarget>
     53    <ErrorReport>prompt</ErrorReport>
     54  </PropertyGroup>
     55  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release x64|x86' ">
     56    <OutputPath>bin\x86\Release x64\</OutputPath>
     57    <PlatformTarget>x86</PlatformTarget>
    3858  </PropertyGroup>
    3959  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.