Changeset 561
- Timestamp:
- 09/13/08 13:36:57 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj
r560 r561 50 50 </ItemGroup> 51 51 <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> 52 59 <Compile Include="HeuristicLabCedmaChartingPlugin.cs" /> 53 60 <Compile Include="Histogram.cs" /> … … 65 72 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> 66 73 <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>71 74 </ProjectReference> 72 75 <ProjectReference Include="..\HeuristicLab.Charting\HeuristicLab.Charting.csproj"> … … 88 91 </ItemGroup> 89 92 <ItemGroup> 93 <EmbeddedResource Include="BubbleChartControl.resx"> 94 <DependentUpon>BubbleChartControl.cs</DependentUpon> 95 <SubType>Designer</SubType> 96 </EmbeddedResource> 90 97 <EmbeddedResource Include="ResultListView.resx"> 91 98 <DependentUpon>ResultListView.cs</DependentUpon> -
trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLabCedmaChartingPlugin.cs
r560 r561 29 29 [PluginFile(Filename = "HeuristicLab.CEDMA.Charting.dll", Filetype = PluginFileType.Assembly)] 30 30 [Dependency(Dependency = "HeuristicLab.Charting")] 31 [Dependency(Dependency = "HeuristicLab.Charting.Data")]32 31 [Dependency(Dependency = "HeuristicLab.Core")] 33 32 [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")] -
trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs
r560 r561 61 61 set { 62 62 store = value; 63 ReloadList();64 FireChanged();63 Action reloadList = ReloadList; 64 reloadList.BeginInvoke(null, null); 65 65 } 66 66 } 67 67 68 private List<string> variableNames = new List<string>() { TARGET_VARIABLE, TREE_SIZE, TREE_HEIGHT, 68 69 MAPE_TRAINING, MAPE_VALIDATION, MAPE_TEST, … … 76 77 77 78 private void ReloadList() { 78 allVariables.Clear();79 79 List<double> trainingMAPE = new List<double>(); 80 80 List<double> validationMAPE = new List<double>(); … … 86 86 List<double> height = new List<double>(); 87 87 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 } 97 101 98 102 var results = store.Select(new Statement(anyEntity, new Entity(cedmaNS + "instanceOf"), new Literal("class:GpFunctionTree"))) … … 106 110 Random random = new Random(); // for adding random noise to int values 107 111 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 } 136 142 } 137 143 } 144 FireChanged(); 138 145 } 139 146 } … … 154 161 internal Histogram GetHistogram(string variableName) { 155 162 Histogram h = new Histogram(50); 156 h.AddValues(allVariables[variableName]); 163 lock(allVariables) { 164 h.AddValues(allVariables[variableName]); 165 } 157 166 return h; 158 167 } 159 168 160 169 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; 162 175 } 163 176 } -
trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.Designer.cs
r560 r561 24 24 /// </summary> 25 25 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(); 27 29 this.xAxisLabel = new System.Windows.Forms.Label(); 28 30 this.xAxisComboBox = new System.Windows.Forms.ComboBox(); … … 30 32 this.yAxisComboBox = new System.Windows.Forms.ComboBox(); 31 33 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(); 35 39 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit(); 36 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();37 40 this.SuspendLayout(); 38 41 // 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); 51 71 // 52 72 // xAxisLabel … … 54 74 this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 55 75 this.xAxisLabel.AutoSize = true; 56 this.xAxisLabel.Location = new System.Drawing.Point( 197, 429);76 this.xAxisLabel.Location = new System.Drawing.Point(305, 394); 57 77 this.xAxisLabel.Name = "xAxisLabel"; 58 78 this.xAxisLabel.Size = new System.Drawing.Size(15, 13); … … 64 84 this.xAxisComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 65 85 this.xAxisComboBox.FormattingEnabled = true; 66 this.xAxisComboBox.Location = new System.Drawing.Point( 218, 426);86 this.xAxisComboBox.Location = new System.Drawing.Point(326, 391); 67 87 this.xAxisComboBox.Name = "xAxisComboBox"; 68 88 this.xAxisComboBox.Size = new System.Drawing.Size(121, 21); … … 90 110 // yTrackBar 91 111 // 92 this.yTrackBar.Location = new System.Drawing.Point( 186, 3);112 this.yTrackBar.Location = new System.Drawing.Point(38, 30); 93 113 this.yTrackBar.Maximum = 100; 94 114 this.yTrackBar.Name = "yTrackBar"; 95 this.yTrackBar.Size = new System.Drawing.Size( 60, 45);115 this.yTrackBar.Size = new System.Drawing.Size(107, 45); 96 116 this.yTrackBar.TabIndex = 10; 97 117 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); 129 165 // 130 166 // ResultListView … … 132 168 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 133 169 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); 134 174 this.Controls.Add(this.yJitterLabel); 135 175 this.Controls.Add(this.xJitterlabel); 136 176 this.Controls.Add(this.xTrackBar); 137 this.Controls.Add(this.dataChart);138 177 this.Controls.Add(this.xAxisLabel); 139 178 this.Controls.Add(this.xAxisComboBox); … … 142 181 this.Controls.Add(this.yTrackBar); 143 182 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(); 145 185 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit(); 146 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();147 186 this.ResumeLayout(false); 148 187 this.PerformLayout(); … … 152 191 #endregion 153 192 154 private HeuristicLab.Charting.Data.DataChartControl dataChart;193 private BubbleChartControl dataChart; 155 194 private System.Windows.Forms.Label xAxisLabel; 156 195 private System.Windows.Forms.ComboBox xAxisComboBox; … … 161 200 private System.Windows.Forms.Label xJitterlabel; 162 201 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; 163 205 } 164 206 } -
trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs
r560 r561 14 14 private ResultList results; 15 15 private const string FREQUENCY = "<Frequency>"; 16 private const string CONSTANT_SIZE = "<constant>"; 16 17 private double xJitterFactor = 0.0; 17 18 private double yJitterFactor = 0.0; … … 21 22 public ResultListView(ResultList results) { 22 23 this.results = results; 24 results.Changed += new EventHandler(results_Changed); 23 25 InitializeComponent(); 24 dataChart.Chart = new HeuristicLab.Charting.Data.Datachart(0, 0, 100, 1);25 26 xAxisComboBox.Items.AddRange(results.VariableNames); 26 27 yAxisComboBox.Items.Add(FREQUENCY); 27 28 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 } 28 55 } 29 56 … … 45 72 CreateHistogramChart(); 46 73 } else { 47 CreateScatterplot();74 dataChart.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem); 48 75 } 49 76 } 50 77 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 84 80 } 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) { 119 83 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); 121 87 } 122 88 UpdateChart(); 123 89 } 124 90 125 private void xTrackBar_ValueChanged(object sender, EventArgs e) {91 private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) { 126 92 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(); 128 95 } 129 UpdateChart();130 96 } 131 97 } -
trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs
r510 r561 40 40 set { 41 41 database = value; 42 ReloadList(); 43 FireChanged(); 42 Action reload = ReloadList; 43 lock(agentList) { 44 agentList.Clear(); 45 } 46 reload.BeginInvoke(null, null); 44 47 } 45 48 } 46 49 47 50 private void ReloadList() { 48 agentList.Clear();49 51 foreach(AgentEntry a in database.GetAgents()) { 50 52 Agent newAgent = new Agent(Database, a.Id); 51 53 newAgent.Name = a.Name; 52 54 newAgent.Status = a.Status; 53 agentList.Add(newAgent); 55 lock(agentList) { 56 agentList.Add(newAgent); 57 } 58 FireChanged(); 54 59 } 55 60 } … … 67 72 long id = database.InsertAgent(null, agent.Name, PersistenceManager.SaveToGZip(agent.OperatorGraph)); 68 73 agent.Id = id; 69 agentList.Add(agent); 74 lock(agentList) { 75 agentList.Add(agent); 76 } 70 77 FireChanged(); 71 78 } 72 79 73 80 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(); 76 86 } 77 87 -
trunk/sources/HeuristicLab.CEDMA.Core/ConsoleEditor.cs
r560 r561 35 35 private System.Windows.Forms.TextBox uriTextBox; 36 36 private System.Windows.Forms.Label uriLabel; 37 private System.Windows.Forms.TabControl tabControl;38 private System.Windows.Forms.TabPage agentsPage;39 37 private Button connectButton; 40 private ComboBox comboBox1; 41 private Label projectLabel; 42 private Button newButton; 43 private Button opLibButton; 38 private Button openOpLibButton; 44 39 private Label label1; 45 private TabPage resultsTabPage; 40 private Label resultsLabel; 41 private Button openResultsButton; 42 private Button openAgentsButton; 43 private Label agentsLabel; 46 44 private Console console; 47 45 … … 54 52 this.uriTextBox = new System.Windows.Forms.TextBox(); 55 53 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();59 54 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(); 64 56 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(); 66 61 this.SuspendLayout(); 67 62 // … … 76 71 // 77 72 this.uriLabel.AutoSize = true; 78 this.uriLabel.Location = new System.Drawing.Point( 3, 6);73 this.uriLabel.Location = new System.Drawing.Point(6, 6); 79 74 this.uriLabel.Name = "uriLabel"; 80 75 this.uriLabel.Size = new System.Drawing.Size(82, 13); 81 76 this.uriLabel.TabIndex = 1; 82 77 this.uriLabel.Text = "CEDMA Server:"; 83 //84 // tabControl85 //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 // agentsPage99 //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 // resultsTabPage109 //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;117 78 // 118 79 // connectButton … … 126 87 this.connectButton.Click += new System.EventHandler(this.connectButton_Click); 127 88 // 128 // comboBox189 // openOpLibButton 129 90 // 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); 167 99 // 168 100 // label1 169 101 // 170 102 this.label1.AutoSize = true; 171 this.label1.Location = new System.Drawing.Point(3, 61);103 this.label1.Location = new System.Drawing.Point(3, 90); 172 104 this.label1.Name = "label1"; 173 105 this.label1.Size = new System.Drawing.Size(85, 13); … … 175 107 this.label1.Text = "Operator Library:"; 176 108 // 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 // 177 149 // ConsoleEditor 178 150 // 179 151 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); 180 156 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); 185 158 this.Controls.Add(this.connectButton); 186 this.Controls.Add(this.tabControl);187 159 this.Controls.Add(this.uriLabel); 188 160 this.Controls.Add(this.uriTextBox); 189 161 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); 192 163 this.ResumeLayout(false); 193 164 this.PerformLayout(); … … 199 170 console.Connect(uriTextBox.Text); 200 171 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; 210 175 } catch(CommunicationException ex) { 211 176 MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message); … … 221 186 } 222 187 } 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 } 223 196 } 224 197 } -
trunk/sources/HeuristicLab.sln
r558 r561 377 377 {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|Any CPU.Build.0 = Debug|Any CPU 378 378 {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|x86.ActiveCfg = Debug|Any CPU 379 {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Debug|x86.Build.0 = Debug|Any CPU 379 380 {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Release|Any CPU.ActiveCfg = Release|Any CPU 380 381 {1BF17271-5350-476A-8F6D-FC74FA3E82CA}.Release|Any CPU.Build.0 = Release|Any CPU -
trunk/sources/HeuristicLab/HeuristicLab.csproj
r39 r561 36 36 <WarningLevel>4</WarningLevel> 37 37 <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> 38 58 </PropertyGroup> 39 59 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.