Changeset 13727 for branches/HeuristicLab.VariableInteractionNetworks
- Timestamp:
- 03/24/16 14:03:06 (9 years ago)
- Location:
- branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3
- Files:
-
- 5 added
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/HeuristicLab.VariableInteractionNetworks.Views-3.3.csproj
r12460 r13727 37 37 </PropertyGroup> 38 38 <ItemGroup> 39 <Reference Include="Cola, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 40 <SpecificVersion>False</SpecificVersion> 41 <HintPath>..\..\..\..\trunk\sources\bin\Cola.dll</HintPath> 42 </Reference> 43 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 44 <SpecificVersion>False</SpecificVersion> 45 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath> 46 </Reference> 39 47 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 40 48 <SpecificVersion>False</SpecificVersion> … … 110 118 <Private>False</Private> 111 119 </Reference> 120 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 121 <SpecificVersion>False</SpecificVersion> 122 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> 123 </Reference> 124 <Reference Include="HeuristicLab.Visualization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 125 <SpecificVersion>False</SpecificVersion> 126 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization-3.3.dll</HintPath> 127 </Reference> 112 128 <Reference Include="PresentationCore" /> 113 129 <Reference Include="PresentationFramework" /> … … 127 143 </ItemGroup> 128 144 <ItemGroup> 145 <Compile Include="DirectedGraphChart.cs"> 146 <SubType>UserControl</SubType> 147 </Compile> 148 <Compile Include="DirectedGraphChart.Designer.cs"> 149 <DependentUpon>DirectedGraphChart.cs</DependentUpon> 150 </Compile> 151 <Compile Include="DirectedGraphChartMode.cs" /> 152 <Compile Include="Layout\ConstrainedForceDirectedLayout.cs" /> 129 153 <Compile Include="Plugin.cs" /> 130 154 <Compile Include="Properties\AssemblyInfo.cs" /> 131 <Compile Include=" VariableInteractionNetworkView.cs">155 <Compile Include="RunCollectionVariableInteractionNetworkView.cs"> 132 156 <SubType>UserControl</SubType> 133 157 </Compile> 134 <Compile Include=" VariableInteractionNetworkView.Designer.cs">135 <DependentUpon> VariableInteractionNetworkView.cs</DependentUpon>158 <Compile Include="RunCollectionVariableInteractionNetworkView.Designer.cs"> 159 <DependentUpon>RunCollectionVariableInteractionNetworkView.cs</DependentUpon> 136 160 </Compile> 137 161 </ItemGroup> … … 146 170 <None Include="HeuristicLab.snk" /> 147 171 <None Include="Plugin.cs.frame" /> 148 </ItemGroup>149 <ItemGroup>150 <EmbeddedResource Include="VariableInteractionNetworkView.resx">151 <DependentUpon>VariableInteractionNetworkView.cs</DependentUpon>152 </EmbeddedResource>153 172 </ItemGroup> 154 173 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.Designer.cs
r13726 r13727 1 using System.Linq; 2 3 namespace HeuristicLab.VariableInteractionNetworks.Views 4 { 5 partial class VariableInteractionNetworkView 6 { 7 /// <summary> 8 /// Required designer variable. 9 /// </summary> 10 private System.ComponentModel.IContainer components = null; 11 12 /// <summary> 13 /// Clean up any resources being used. 14 /// </summary> 15 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 16 protected override void Dispose(bool disposing) 17 { 18 if (disposing && (components != null)) 19 { 20 components.Dispose(); 21 } 22 base.Dispose(disposing); 23 } 24 25 26 #region Component Designer generated code 27 28 /// <summary> 29 /// Required method for Designer support - do not modify 30 /// the contents of this method with the code editor. 31 /// </summary> 32 private void InitializeComponent() 33 { 34 this.components = new System.ComponentModel.Container(); 35 this.groupBox1 = new System.Windows.Forms.GroupBox(); 36 this.viewHost1 = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 37 this.viewHost2 = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 38 this.groupBox2 = new System.Windows.Forms.GroupBox(); 39 this.viewHost3 = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 40 this.groupBox4 = new System.Windows.Forms.GroupBox(); 41 this.textBox4 = new System.Windows.Forms.TextBox(); 42 this.textBox3 = new System.Windows.Forms.TextBox(); 43 this.selectTargetVariable = new System.Windows.Forms.Label(); 44 this.targetVariablesCombo = new System.Windows.Forms.ComboBox(); 45 this.selectedThreshold2 = new System.Windows.Forms.Label(); 46 this.targetThreshold = new System.Windows.Forms.TextBox(); 47 this.trackBar2 = new System.Windows.Forms.TrackBar(); 48 this.groupBox3 = new System.Windows.Forms.GroupBox(); 49 this.textBox2 = new System.Windows.Forms.TextBox(); 50 this.textBox1 = new System.Windows.Forms.TextBox(); 51 this.selectedThreshold1 = new System.Windows.Forms.Label(); 52 this.genThreshold = new System.Windows.Forms.TextBox(); 53 this.trackBar1 = new System.Windows.Forms.TrackBar(); 54 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 55 this.errorProvider2 = new System.Windows.Forms.ErrorProvider(this.components); 56 this.groupBox1.SuspendLayout(); 57 this.groupBox2.SuspendLayout(); 58 this.groupBox4.SuspendLayout(); 59 ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit(); 60 this.groupBox3.SuspendLayout(); 61 ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); 62 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 63 ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).BeginInit(); 64 this.SuspendLayout(); 65 // 66 // groupBox1 67 // 68 this.groupBox1.Controls.Add(this.viewHost1); 69 this.groupBox1.Controls.Add(this.viewHost2); 70 this.groupBox1.Location = new System.Drawing.Point(6, 3); 71 this.groupBox1.Name = "groupBox1"; 72 this.groupBox1.Size = new System.Drawing.Size(641, 276); 73 this.groupBox1.TabIndex = 0; 74 this.groupBox1.TabStop = false; 75 this.groupBox1.Text = "Adjacency Matrix. Node Impacts"; 76 // 77 // viewHost1 78 // 79 this.viewHost1.Caption = "View"; 80 this.viewHost1.Content = null; 81 this.viewHost1.Enabled = false; 82 this.viewHost1.Location = new System.Drawing.Point(6, 19); 83 this.viewHost1.Name = "viewHost1"; 84 this.viewHost1.ReadOnly = false; 85 this.viewHost1.Size = new System.Drawing.Size(354, 247); 86 this.viewHost1.TabIndex = 0; 87 this.viewHost1.ViewsLabelVisible = true; 88 this.viewHost1.ViewType = null; 89 // 90 // viewHost2 91 // 92 this.viewHost2.Caption = "View"; 93 this.viewHost2.Content = null; 94 this.viewHost2.Enabled = false; 95 this.viewHost2.Location = new System.Drawing.Point(365, 19); 96 this.viewHost2.Name = "viewHost2"; 97 this.viewHost2.ReadOnly = false; 98 this.viewHost2.Size = new System.Drawing.Size(218, 247); 99 this.viewHost2.TabIndex = 0; 100 this.viewHost2.ViewsLabelVisible = true; 101 this.viewHost2.ViewType = null; 102 // 103 // groupBox2 104 // 105 this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 1 namespace HeuristicLab.VariableInteractionNetworks.Views { 2 partial class RunCollectionVariableInteractionNetworkView { 3 /// <summary> 4 /// Required designer variable. 5 /// </summary> 6 private System.ComponentModel.IContainer components = null; 7 8 /// <summary> 9 /// Clean up any resources being used. 10 /// </summary> 11 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 12 protected override void Dispose(bool disposing) { 13 if (disposing && (components != null)) { 14 components.Dispose(); 15 } 16 base.Dispose(disposing); 17 } 18 19 20 #region Component Designer generated code 21 /// <summary> 22 /// Required method for Designer support - do not modify 23 /// the contents of this method with the code editor. 24 /// </summary> 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 27 this.settingsGroupBox = new System.Windows.Forms.GroupBox(); 28 this.impactThresholdTextBox = new System.Windows.Forms.TextBox(); 29 this.impactAggregationComboBox = new System.Windows.Forms.ComboBox(); 30 this.impactResultNameComboBox = new System.Windows.Forms.ComboBox(); 31 this.weightAggregationLabel = new System.Windows.Forms.Label(); 32 this.label2 = new System.Windows.Forms.Label(); 33 this.label1 = new System.Windows.Forms.Label(); 34 this.layoutOptionsGroupBox = new System.Windows.Forms.GroupBox(); 35 this.idealEdgeLengthTextBox = new System.Windows.Forms.TextBox(); 36 this.edgeRoutingComboBox = new System.Windows.Forms.ComboBox(); 37 this.label4 = new System.Windows.Forms.Label(); 38 this.label3 = new System.Windows.Forms.Label(); 39 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 40 this.qualityResultNameLabel = new System.Windows.Forms.Label(); 41 this.qualityResultNameComboBox = new System.Windows.Forms.ComboBox(); 42 this.maximizationCheckBox = new System.Windows.Forms.CheckBox(); 43 this.graphChart = new HeuristicLab.VariableInteractionNetworks.Views.DirectedGraphChart(); 44 this.settingsGroupBox.SuspendLayout(); 45 this.layoutOptionsGroupBox.SuspendLayout(); 46 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 47 this.SuspendLayout(); 48 // 49 // settingsGroupBox 50 // 51 this.settingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 106 52 | System.Windows.Forms.AnchorStyles.Left))); 107 this.groupBox2.Controls.Add(this.viewHost3); 108 this.groupBox2.Controls.Add(this.groupBox4); 109 this.groupBox2.Controls.Add(this.groupBox3); 110 this.groupBox2.Location = new System.Drawing.Point(6, 285); 111 this.groupBox2.Name = "groupBox2"; 112 this.groupBox2.Size = new System.Drawing.Size(641, 283); 113 this.groupBox2.TabIndex = 1; 114 this.groupBox2.TabStop = false; 115 this.groupBox2.Text = "Updated Adjacency Matrix"; 116 // 117 // viewHost3 118 // 119 this.viewHost3.Caption = "View"; 120 this.viewHost3.Content = null; 121 this.viewHost3.Enabled = false; 122 this.viewHost3.Location = new System.Drawing.Point(6, 19); 123 this.viewHost3.Name = "viewHost3"; 124 this.viewHost3.ReadOnly = false; 125 this.viewHost3.Size = new System.Drawing.Size(354, 239); 126 this.viewHost3.TabIndex = 0; 127 this.viewHost3.ViewsLabelVisible = true; 128 this.viewHost3.ViewType = null; 129 // 130 // groupBox4 131 // 132 this.groupBox4.Controls.Add(this.textBox4); 133 this.groupBox4.Controls.Add(this.textBox3); 134 this.groupBox4.Controls.Add(this.selectTargetVariable); 135 this.groupBox4.Controls.Add(this.targetVariablesCombo); 136 this.groupBox4.Controls.Add(this.selectedThreshold2); 137 this.groupBox4.Controls.Add(this.targetThreshold); 138 this.groupBox4.Controls.Add(this.trackBar2); 139 this.groupBox4.Location = new System.Drawing.Point(365, 148); 140 this.groupBox4.Name = "groupBox4"; 141 this.groupBox4.Size = new System.Drawing.Size(255, 123); 142 this.groupBox4.TabIndex = 13; 143 this.groupBox4.TabStop = false; 144 this.groupBox4.Text = "Apply Edge Weights Threshold for a Chosen Target Variable"; 145 // 146 // textBox4 147 // 148 this.textBox4.BackColor = System.Drawing.SystemColors.Control; 149 this.textBox4.Location = new System.Drawing.Point(217, 60); 150 this.textBox4.Name = "textBox4"; 151 this.textBox4.ReadOnly = true; 152 this.textBox4.Size = new System.Drawing.Size(32, 20); 153 this.textBox4.TabIndex = 14; 154 // 155 // textBox3 156 // 157 this.textBox3.BackColor = System.Drawing.SystemColors.Control; 158 this.textBox3.Location = new System.Drawing.Point(6, 60); 159 this.textBox3.Name = "textBox3"; 160 this.textBox3.ReadOnly = true; 161 this.textBox3.Size = new System.Drawing.Size(33, 20); 162 this.textBox3.TabIndex = 14; 163 // 164 // selectTargetVariable 165 // 166 this.selectTargetVariable.AutoSize = true; 167 this.selectTargetVariable.Location = new System.Drawing.Point(31, 36); 168 this.selectTargetVariable.Name = "selectTargetVariable"; 169 this.selectTargetVariable.Size = new System.Drawing.Size(112, 13); 170 this.selectTargetVariable.TabIndex = 8; 171 this.selectTargetVariable.Text = "Select Target Variable"; 172 // 173 // targetVariablesCombo 174 // 175 this.targetVariablesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 176 this.targetVariablesCombo.FormattingEnabled = true; 177 this.targetVariablesCombo.Location = new System.Drawing.Point(159, 33); 178 this.targetVariablesCombo.Name = "targetVariablesCombo"; 179 this.targetVariablesCombo.Size = new System.Drawing.Size(61, 21); 180 this.targetVariablesCombo.TabIndex = 1; 181 this.targetVariablesCombo.DropDown += new System.EventHandler(this.targetVariablesCombo_Dropdown); 182 this.targetVariablesCombo.SelectedIndexChanged += new System.EventHandler(this.targetVariablesCombo_SelectedIndexChanged); 183 // 184 // selectedThreshold2 185 // 186 this.selectedThreshold2.AutoSize = true; 187 this.selectedThreshold2.Location = new System.Drawing.Point(31, 93); 188 this.selectedThreshold2.Name = "selectedThreshold2"; 189 this.selectedThreshold2.Size = new System.Drawing.Size(93, 13); 190 this.selectedThreshold2.TabIndex = 7; 191 this.selectedThreshold2.Text = "Select Threshold: "; 192 // 193 // targetThreshold 194 // 195 this.targetThreshold.Location = new System.Drawing.Point(132, 90); 196 this.targetThreshold.Name = "targetThreshold"; 197 this.targetThreshold.Size = new System.Drawing.Size(48, 20); 198 this.targetThreshold.TabIndex = 6; 199 this.targetThreshold.Text = "0"; 200 this.targetThreshold.TextChanged += new System.EventHandler(this.targetThreshold_TextChanged); 201 this.targetThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.targetThreshold_KeyDown); 202 // 203 // trackBar2 204 // 205 this.trackBar2.BackColor = System.Drawing.SystemColors.Control; 206 this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand; 207 this.trackBar2.LargeChange = 4; 208 this.trackBar2.Location = new System.Drawing.Point(34, 60); 209 this.trackBar2.Name = "trackBar2"; 210 this.trackBar2.Size = new System.Drawing.Size(186, 45); 211 this.trackBar2.TabIndex = 3; 212 this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None; 213 this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged); 214 this.trackBar2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar2_MouseDown); 215 // 216 // groupBox3 217 // 218 this.groupBox3.Controls.Add(this.textBox2); 219 this.groupBox3.Controls.Add(this.textBox1); 220 this.groupBox3.Controls.Add(this.selectedThreshold1); 221 this.groupBox3.Controls.Add(this.genThreshold); 222 this.groupBox3.Controls.Add(this.trackBar1); 223 this.groupBox3.Location = new System.Drawing.Point(365, 19); 224 this.groupBox3.Name = "groupBox3"; 225 this.groupBox3.Size = new System.Drawing.Size(255, 95); 226 this.groupBox3.TabIndex = 12; 227 this.groupBox3.TabStop = false; 228 this.groupBox3.Text = "Apply General Threshold for Edge Weights"; 229 // 230 // textBox2 231 // 232 this.textBox2.BackColor = System.Drawing.SystemColors.Control; 233 this.textBox2.Location = new System.Drawing.Point(217, 24); 234 this.textBox2.Name = "textBox2"; 235 this.textBox2.ReadOnly = true; 236 this.textBox2.Size = new System.Drawing.Size(32, 20); 237 this.textBox2.TabIndex = 13; 238 // 239 // textBox1 240 // 241 this.textBox1.BackColor = System.Drawing.SystemColors.Control; 242 this.textBox1.Location = new System.Drawing.Point(6, 24); 243 this.textBox1.Name = "textBox1"; 244 this.textBox1.ReadOnly = true; 245 this.textBox1.Size = new System.Drawing.Size(33, 20); 246 this.textBox1.TabIndex = 12; 247 // 248 // selectedThreshold1 249 // 250 this.selectedThreshold1.AutoSize = true; 251 this.selectedThreshold1.Location = new System.Drawing.Point(31, 62); 252 this.selectedThreshold1.Name = "selectedThreshold1"; 253 this.selectedThreshold1.Size = new System.Drawing.Size(93, 13); 254 this.selectedThreshold1.TabIndex = 10; 255 this.selectedThreshold1.Text = "Select Threshold: "; 256 // 257 // genThreshold 258 // 259 this.genThreshold.Location = new System.Drawing.Point(132, 59); 260 this.genThreshold.Name = "genThreshold"; 261 this.genThreshold.Size = new System.Drawing.Size(48, 20); 262 this.genThreshold.TabIndex = 9; 263 this.genThreshold.Text = "0"; 264 this.genThreshold.TextChanged += new System.EventHandler(this.genThreshold_TextChanged); 265 this.genThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.genThreshold_KeyDown); 266 // 267 // trackBar1 268 // 269 this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand; 270 this.trackBar1.LargeChange = 4; 271 this.trackBar1.Location = new System.Drawing.Point(34, 24); 272 this.trackBar1.Name = "trackBar1"; 273 this.trackBar1.RightToLeft = System.Windows.Forms.RightToLeft.No; 274 this.trackBar1.Size = new System.Drawing.Size(186, 45); 275 this.trackBar1.TabIndex = 2; 276 this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None; 277 this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged); 278 this.trackBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseDown); 279 // 280 // errorProvider 281 // 282 this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; 283 this.errorProvider.ContainerControl = this; 284 // 285 // errorProvider2 286 // 287 this.errorProvider2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; 288 this.errorProvider2.ContainerControl = this; 289 // 290 // VariableInteractionNetworkView 291 // 292 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 293 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 294 this.Controls.Add(this.groupBox2); 295 this.Controls.Add(this.groupBox1); 296 this.Name = "VariableInteractionNetworkView"; 297 this.Size = new System.Drawing.Size(810, 599); 298 this.groupBox1.ResumeLayout(false); 299 this.groupBox2.ResumeLayout(false); 300 this.groupBox4.ResumeLayout(false); 301 this.groupBox4.PerformLayout(); 302 ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit(); 303 this.groupBox3.ResumeLayout(false); 304 this.groupBox3.PerformLayout(); 305 ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); 306 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 307 ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).EndInit(); 308 this.ResumeLayout(false); 309 310 } 311 312 #endregion 313 314 private System.Windows.Forms.GroupBox groupBox1; 315 private System.Windows.Forms.GroupBox groupBox2; 316 private System.Windows.Forms.GroupBox groupBox3; 317 private System.Windows.Forms.GroupBox groupBox4; 318 private MainForm.WindowsForms.ViewHost viewHost1; 319 private MainForm.WindowsForms.ViewHost viewHost2; 320 private MainForm.WindowsForms.ViewHost viewHost3; 321 private System.Windows.Forms.TrackBar trackBar1; 322 private System.Windows.Forms.TrackBar trackBar2; 323 private System.Windows.Forms.ComboBox targetVariablesCombo; 324 private System.Windows.Forms.TextBox genThreshold; 325 private System.Windows.Forms.TextBox targetThreshold; 326 private System.Windows.Forms.Label selectedThreshold2; 327 private System.Windows.Forms.Label selectedThreshold1; 328 private System.Windows.Forms.Label selectTargetVariable; 329 private System.Windows.Forms.TextBox textBox2; 330 private System.Windows.Forms.TextBox textBox1; 331 private System.Windows.Forms.ErrorProvider errorProvider; 332 private System.Windows.Forms.TextBox textBox4; 333 private System.Windows.Forms.TextBox textBox3; 334 private System.Windows.Forms.ErrorProvider errorProvider2; 53 this.settingsGroupBox.Controls.Add(this.maximizationCheckBox); 54 this.settingsGroupBox.Controls.Add(this.qualityResultNameComboBox); 55 this.settingsGroupBox.Controls.Add(this.qualityResultNameLabel); 56 this.settingsGroupBox.Controls.Add(this.impactThresholdTextBox); 57 this.settingsGroupBox.Controls.Add(this.impactAggregationComboBox); 58 this.settingsGroupBox.Controls.Add(this.impactResultNameComboBox); 59 this.settingsGroupBox.Controls.Add(this.weightAggregationLabel); 60 this.settingsGroupBox.Controls.Add(this.label2); 61 this.settingsGroupBox.Controls.Add(this.label1); 62 this.settingsGroupBox.Location = new System.Drawing.Point(4, 4); 63 this.settingsGroupBox.Name = "settingsGroupBox"; 64 this.settingsGroupBox.Size = new System.Drawing.Size(331, 230); 65 this.settingsGroupBox.TabIndex = 1; 66 this.settingsGroupBox.TabStop = false; 67 this.settingsGroupBox.Text = "Network Configuration"; 68 // 69 // impactThresholdTextBox 70 // 71 this.impactThresholdTextBox.Location = new System.Drawing.Point(121, 94); 72 this.impactThresholdTextBox.Name = "impactThresholdTextBox"; 73 this.impactThresholdTextBox.Size = new System.Drawing.Size(201, 20); 74 this.impactThresholdTextBox.TabIndex = 2; 75 this.impactThresholdTextBox.Text = "0.2"; 76 this.impactThresholdTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.TextBoxValidating); 77 this.impactThresholdTextBox.Validated += new System.EventHandler(this.NetworkConfigurationBoxValidated); 78 // 79 // impactAggregationComboBox 80 // 81 this.impactAggregationComboBox.FormattingEnabled = true; 82 this.impactAggregationComboBox.Items.AddRange(new object[] { 83 "Best run", 84 "Runs average"}); 85 this.impactAggregationComboBox.Location = new System.Drawing.Point(121, 120); 86 this.impactAggregationComboBox.Name = "impactAggregationComboBox"; 87 this.impactAggregationComboBox.Size = new System.Drawing.Size(201, 21); 88 this.impactAggregationComboBox.TabIndex = 1; 89 this.impactAggregationComboBox.Text = "Best run"; 90 this.impactAggregationComboBox.SelectedIndexChanged += new System.EventHandler(this.NetworkConfigurationChanged); 91 // 92 // impactResultNameComboBox 93 // 94 this.impactResultNameComboBox.FormattingEnabled = true; 95 this.impactResultNameComboBox.Location = new System.Drawing.Point(121, 67); 96 this.impactResultNameComboBox.Name = "impactResultNameComboBox"; 97 this.impactResultNameComboBox.Size = new System.Drawing.Size(201, 21); 98 this.impactResultNameComboBox.TabIndex = 1; 99 this.impactResultNameComboBox.SelectedIndexChanged += new System.EventHandler(this.NetworkConfigurationChanged); 100 // 101 // weightAggregationLabel 102 // 103 this.weightAggregationLabel.AutoSize = true; 104 this.weightAggregationLabel.Location = new System.Drawing.Point(7, 123); 105 this.weightAggregationLabel.Name = "weightAggregationLabel"; 106 this.weightAggregationLabel.Size = new System.Drawing.Size(98, 13); 107 this.weightAggregationLabel.TabIndex = 0; 108 this.weightAggregationLabel.Text = "Impact aggregation"; 109 // 110 // label2 111 // 112 this.label2.AutoSize = true; 113 this.label2.Location = new System.Drawing.Point(7, 97); 114 this.label2.Name = "label2"; 115 this.label2.Size = new System.Drawing.Size(85, 13); 116 this.label2.TabIndex = 0; 117 this.label2.Text = "Impact threshold"; 118 // 119 // label1 120 // 121 this.label1.AutoSize = true; 122 this.label1.Location = new System.Drawing.Point(7, 70); 123 this.label1.Name = "label1"; 124 this.label1.Size = new System.Drawing.Size(96, 13); 125 this.label1.TabIndex = 0; 126 this.label1.Text = "Impact result name"; 127 // 128 // layoutOptionsGroupBox 129 // 130 this.layoutOptionsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 131 | System.Windows.Forms.AnchorStyles.Left))); 132 this.layoutOptionsGroupBox.Controls.Add(this.idealEdgeLengthTextBox); 133 this.layoutOptionsGroupBox.Controls.Add(this.edgeRoutingComboBox); 134 this.layoutOptionsGroupBox.Controls.Add(this.label4); 135 this.layoutOptionsGroupBox.Controls.Add(this.label3); 136 this.layoutOptionsGroupBox.Location = new System.Drawing.Point(4, 240); 137 this.layoutOptionsGroupBox.Name = "layoutOptionsGroupBox"; 138 this.layoutOptionsGroupBox.Size = new System.Drawing.Size(331, 222); 139 this.layoutOptionsGroupBox.TabIndex = 2; 140 this.layoutOptionsGroupBox.TabStop = false; 141 this.layoutOptionsGroupBox.Text = "Layout Options"; 142 // 143 // idealEdgeLengthTextBox 144 // 145 this.idealEdgeLengthTextBox.Location = new System.Drawing.Point(121, 43); 146 this.idealEdgeLengthTextBox.Name = "idealEdgeLengthTextBox"; 147 this.idealEdgeLengthTextBox.Size = new System.Drawing.Size(201, 20); 148 this.idealEdgeLengthTextBox.TabIndex = 2; 149 this.idealEdgeLengthTextBox.Text = "50"; 150 this.idealEdgeLengthTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.TextBoxValidating); 151 this.idealEdgeLengthTextBox.Validated += new System.EventHandler(this.LayoutConfigurationBoxValidated); 152 // 153 // edgeRoutingComboBox 154 // 155 this.edgeRoutingComboBox.FormattingEnabled = true; 156 this.edgeRoutingComboBox.Items.AddRange(new object[] { 157 "None", 158 "Polyline", 159 "Orthogonal"}); 160 this.edgeRoutingComboBox.Location = new System.Drawing.Point(121, 17); 161 this.edgeRoutingComboBox.Name = "edgeRoutingComboBox"; 162 this.edgeRoutingComboBox.Size = new System.Drawing.Size(201, 21); 163 this.edgeRoutingComboBox.TabIndex = 3; 164 this.edgeRoutingComboBox.Text = "None"; 165 this.edgeRoutingComboBox.SelectedIndexChanged += new System.EventHandler(this.LayoutConfigurationChanged); 166 // 167 // label4 168 // 169 this.label4.AutoSize = true; 170 this.label4.Location = new System.Drawing.Point(6, 46); 171 this.label4.Name = "label4"; 172 this.label4.Size = new System.Drawing.Size(89, 13); 173 this.label4.TabIndex = 0; 174 this.label4.Text = "Ideal edge length"; 175 // 176 // label3 177 // 178 this.label3.AutoSize = true; 179 this.label3.Location = new System.Drawing.Point(7, 20); 180 this.label3.Name = "label3"; 181 this.label3.Size = new System.Drawing.Size(67, 13); 182 this.label3.TabIndex = 0; 183 this.label3.Text = "Edge routing"; 184 // 185 // errorProvider 186 // 187 this.errorProvider.ContainerControl = this; 188 // 189 // qualityResultNameLabel 190 // 191 this.qualityResultNameLabel.AutoSize = true; 192 this.qualityResultNameLabel.Location = new System.Drawing.Point(7, 20); 193 this.qualityResultNameLabel.Name = "qualityResultNameLabel"; 194 this.qualityResultNameLabel.Size = new System.Drawing.Size(96, 13); 195 this.qualityResultNameLabel.TabIndex = 3; 196 this.qualityResultNameLabel.Text = "Quality result name"; 197 // 198 // qualityResultNameComboBox 199 // 200 this.qualityResultNameComboBox.FormattingEnabled = true; 201 this.qualityResultNameComboBox.Location = new System.Drawing.Point(121, 17); 202 this.qualityResultNameComboBox.Name = "qualityResultNameComboBox"; 203 this.qualityResultNameComboBox.Size = new System.Drawing.Size(201, 21); 204 this.qualityResultNameComboBox.TabIndex = 4; 205 this.qualityResultNameComboBox.SelectedIndexChanged += new System.EventHandler(this.NetworkConfigurationChanged); 206 // 207 // maximizationCheckBox 208 // 209 this.maximizationCheckBox.AutoSize = true; 210 this.maximizationCheckBox.Location = new System.Drawing.Point(236, 44); 211 this.maximizationCheckBox.Name = "maximizationCheckBox"; 212 this.maximizationCheckBox.Size = new System.Drawing.Size(86, 17); 213 this.maximizationCheckBox.TabIndex = 5; 214 this.maximizationCheckBox.Text = "Maximization"; 215 this.maximizationCheckBox.UseVisualStyleBackColor = true; 216 this.maximizationCheckBox.CheckedChanged += new System.EventHandler(this.NetworkConfigurationChanged); 217 // 218 // graphChart 219 // 220 this.graphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 221 | System.Windows.Forms.AnchorStyles.Left) 222 | System.Windows.Forms.AnchorStyles.Right))); 223 this.graphChart.BackColor = System.Drawing.SystemColors.Control; 224 this.graphChart.Graph = null; 225 this.graphChart.IdealEdgeLength = 50D; 226 this.graphChart.Location = new System.Drawing.Point(341, 4); 227 this.graphChart.Mode = null; 228 this.graphChart.Name = "graphChart"; 229 this.graphChart.PerformEdgeRouting = false; 230 this.graphChart.RoutingMode = HeuristicLab.VariableInteractionNetworks.Views.ConstrainedForceDirectedLayout.EdgeRouting.None; 231 this.graphChart.ScaleOnResize = true; 232 this.graphChart.ShowToolBar = true; 233 this.graphChart.Size = new System.Drawing.Size(411, 458); 234 this.graphChart.TabIndex = 0; 235 // 236 // RunCollectionVariableInteractionNetworkView 237 // 238 this.Controls.Add(this.layoutOptionsGroupBox); 239 this.Controls.Add(this.settingsGroupBox); 240 this.Controls.Add(this.graphChart); 241 this.Name = "RunCollectionVariableInteractionNetworkView"; 242 this.Size = new System.Drawing.Size(755, 465); 243 this.settingsGroupBox.ResumeLayout(false); 244 this.settingsGroupBox.PerformLayout(); 245 this.layoutOptionsGroupBox.ResumeLayout(false); 246 this.layoutOptionsGroupBox.PerformLayout(); 247 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 248 this.ResumeLayout(false); 249 335 250 } 251 252 #endregion 253 254 private DirectedGraphChart graphChart; 255 private System.Windows.Forms.GroupBox settingsGroupBox; 256 private System.Windows.Forms.Label label1; 257 private System.Windows.Forms.Label label2; 258 private System.Windows.Forms.ComboBox impactResultNameComboBox; 259 private System.Windows.Forms.TextBox impactThresholdTextBox; 260 private System.Windows.Forms.GroupBox layoutOptionsGroupBox; 261 private System.Windows.Forms.Label label3; 262 private System.Windows.Forms.ComboBox edgeRoutingComboBox; 263 private System.Windows.Forms.TextBox idealEdgeLengthTextBox; 264 private System.Windows.Forms.Label label4; 265 private System.Windows.Forms.ErrorProvider errorProvider; 266 private System.Windows.Forms.ComboBox impactAggregationComboBox; 267 private System.Windows.Forms.Label weightAggregationLabel; 268 private System.Windows.Forms.Label qualityResultNameLabel; 269 private System.Windows.Forms.ComboBox qualityResultNameComboBox; 270 private System.Windows.Forms.CheckBox maximizationCheckBox; 271 } 336 272 } -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
r13726 r13727 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 using System.Drawing; 26 26 using System.Linq; 27 using System.Text; 27 28 using System.Windows.Forms; 28 29 using HeuristicLab.Common; 30 using HeuristicLab.Core; 31 using HeuristicLab.Core.Views; 29 32 using HeuristicLab.Data; 30 33 using HeuristicLab.MainForm; 31 using HeuristicLab.MainForm.WindowsForms;32 34 using HeuristicLab.Optimization; 33 35 using HeuristicLab.Problems.DataAnalysis; 34 using HeuristicLab.Problems.DataAnalysis.Symbolic; 35 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression; 36 using System.Collections; 37 38 namespace HeuristicLab.VariableInteractionNetworks.Views 39 { 40 [View("Variable Interaction Network")] 41 [Content(typeof(RunCollection), IsDefaultView = false)] 42 43 public sealed partial class VariableInteractionNetworkView : AsynchronousContentView 44 { 45 private const string variableImpactResultName = "Variable impacts"; 46 private const string TrainingBestSolutionParameterName = "Best training solution"; 47 48 public new RunCollection Content 49 { 50 get { return (RunCollection)base.Content; } 51 set { base.Content = value; } 52 } 53 54 public VariableInteractionNetworkView() 55 { 56 InitializeComponent(); 57 } 58 59 internal class NoFocusTrackBar : System.Windows.Forms.TrackBar 60 { 61 [System.Runtime.InteropServices.DllImport("user32.dll")] 62 public extern static int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam); 63 64 private static int MakeParam(int loWord, int hiWord) 65 { 66 return (hiWord << 16) | (loWord & 0xffff); 36 using HeuristicLab.Visualization; 37 using Rectangle = HeuristicLab.Visualization.Rectangle; 38 39 namespace HeuristicLab.VariableInteractionNetworks.Views { 40 [View("Variable Interaction Network")] 41 [Content(typeof(RunCollection), IsDefaultView = false)] 42 43 public sealed partial class RunCollectionVariableInteractionNetworkView : ItemView { 44 public RunCollectionVariableInteractionNetworkView() { 45 InitializeComponent(); 46 ConfigureNodeShapes(); 47 } 48 49 public new RunCollection Content { 50 get { return (RunCollection)base.Content; } 51 set { 52 if (value != null && value != Content) { 53 base.Content = value; 54 } 55 } 56 } 57 58 private static VariableInteractionNetwork BuildNetworkFromSolutionQualities(RunCollection runs, double threshold, bool useBestRunsPerTarget = false) { 59 var nodes = new Dictionary<string, IVertex>(); 60 var vn = new VariableInteractionNetwork(); 61 var targets = runs.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 62 var targetQualities = new Dictionary<string, double>(); 63 var targetInputs = new Dictionary<string, List<string>>(); 64 65 if (useBestRunsPerTarget) { 66 foreach (var target in targets) { 67 var bestRun = target.OrderBy(x => ((DoubleValue)x.Results["Best training solution quality"]).Value).First(); 68 var bestQuality = ((DoubleValue)bestRun.Results["Best training solution quality"]).Value; 69 var pd = (IRegressionProblemData)bestRun.Parameters["ProblemData"]; 70 if (threshold > bestQuality) continue; // skip if quality is below the treshold 71 targetQualities[target.Key] = bestQuality; 72 targetInputs[target.Key] = pd.AllowedInputVariables.ToList(); 73 } 74 } else { 75 foreach (var target in targets) { 76 var avgQuality = CalculateAverageQuality(new RunCollection(target)); 77 if (threshold > avgQuality) continue; 78 targetQualities[target.Key] = avgQuality; 79 var pd = (IRegressionProblemData)target.First().Parameters["ProblemData"]; 80 targetInputs[target.Key] = pd.AllowedInputVariables.ToList(); 81 } 82 } 83 84 foreach (var ti in targetQualities) { 85 var target = ti.Key; 86 var variables = targetInputs[ti.Key]; 87 var quality = ti.Value; 88 IVertex targetNode; 89 90 if (!nodes.TryGetValue(target, out targetNode)) { 91 targetNode = new VariableNetworkNode { Label = target }; 92 vn.AddVertex(targetNode); 93 nodes[target] = targetNode; 94 } 95 96 IVertex variableNode; 97 if (variables.Count > 0) { 98 var variableList = new List<string>(variables); 99 variableList.Add(target); 100 var junctionLabel = Concatenate(variableList); 101 IVertex junctionNode; 102 if (!nodes.TryGetValue(junctionLabel, out junctionNode)) { 103 junctionNode = new JunctionNetworkNode { Label = string.Empty }; 104 vn.AddVertex(junctionNode); 105 nodes[junctionLabel] = junctionNode; 106 } 107 IArc arc; 108 foreach (var v in variables) { 109 var impact = quality; 110 if (!nodes.TryGetValue(v, out variableNode)) { 111 variableNode = new VariableNetworkNode { Label = v }; 112 vn.AddVertex(variableNode); 113 nodes[v] = variableNode; 67 114 } 68 69 protected override void OnGotFocus(EventArgs e) 70 { 71 base.OnGotFocus(e); 72 SendMessage(this.Handle, 0x0128, MakeParam(1, 0x1), 0); 115 arc = new Arc(variableNode, junctionNode) { Weight = impact }; 116 vn.AddArc(arc); 117 } 118 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight) }; 119 vn.AddArc(arc); 120 } else { 121 foreach (var v in variables) { 122 var impact = quality; 123 if (!nodes.TryGetValue(v, out variableNode)) { 124 variableNode = new VariableNetworkNode { Label = v }; 125 vn.AddVertex(variableNode); 126 nodes[v] = variableNode; 73 127 } 74 } 75 76 #region events 77 78 // #region Event Handlers (Content) 79 protected override void OnContentChanged() 80 { 81 base.OnContentChanged(); 82 if (Content == null) 83 { 84 // TODO: Add code when content has been changed and is null 128 var arc = new Arc(variableNode, targetNode) { Weight = impact }; 129 vn.AddArc(arc); 130 } 131 } 132 } 133 134 return vn; 135 } 136 137 private static VariableInteractionNetwork BuildNetworkFromVariableImpacts(RunCollection runs, string qualityResultName, bool maximization, string impactsResultName, double threshold, bool useBestRunsPerTarget = false) { 138 var nodes = new Dictionary<string, IVertex>(); 139 var vn = new VariableInteractionNetwork(); 140 var targets = runs.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 141 142 var targetImpacts = new Dictionary<string, Dictionary<string, double>>(); 143 144 if (useBestRunsPerTarget) { 145 var bestRunsPerTarget = maximization ? 146 targets.Select(x => x.OrderBy(y => ((DoubleValue)y.Results[qualityResultName]).Value).Last()) : 147 targets.Select(x => x.OrderBy(y => ((DoubleValue)y.Results[qualityResultName]).Value).First()); 148 149 foreach (var run in bestRunsPerTarget) { 150 var pd = (IRegressionProblemData)run.Parameters["ProblemData"]; 151 var target = pd.TargetVariable; 152 var impacts = (DoubleMatrix)run.Results[impactsResultName]; 153 targetImpacts[target] = impacts.RowNames.Select((x, i) => new { Name = x, Index = i }).ToDictionary(x => x.Name, x => impacts[x.Index, 0]); 154 } 155 } else { 156 foreach (var target in targets) { 157 var averageImpacts = CalculateAverageImpacts(new RunCollection(target), impactsResultName); 158 targetImpacts[target.Key] = averageImpacts; 159 } 160 } 161 162 foreach (var ti in targetImpacts) { 163 var target = ti.Key; 164 var variableImpacts = ti.Value; 165 IVertex targetNode; 166 167 var variables = variableImpacts.Keys.Where(x => variableImpacts[x] >= threshold).ToList(); 168 if (variables.Count == 0) continue; 169 170 if (!nodes.TryGetValue(target, out targetNode)) { 171 targetNode = new VariableNetworkNode { Label = target }; 172 vn.AddVertex(targetNode); 173 nodes[target] = targetNode; 174 } 175 176 IVertex variableNode; 177 if (variables.Count > 1) { 178 var variableList = new List<string>(variables) { target }; 179 var junctionLabel = Concatenate(variableList); 180 IVertex junctionNode; 181 if (!nodes.TryGetValue(junctionLabel, out junctionNode)) { 182 junctionNode = new JunctionNetworkNode { Label = string.Empty }; 183 vn.AddVertex(junctionNode); 184 nodes[junctionLabel] = junctionNode; 185 } 186 IArc arc; 187 foreach (var v in variables) { 188 var impact = variableImpacts[v]; 189 if (!nodes.TryGetValue(v, out variableNode)) { 190 variableNode = new VariableNetworkNode { Label = v }; 191 vn.AddVertex(variableNode); 192 nodes[v] = variableNode; 85 193 } 86 else 87 { 88 // TODO: Add code when content has been changed and is not null 89 viewHost2.Content = CalculateNodeImportance(CalculateAdjacencyMatrix()); 90 var adjMatrix = CalculateAdjacencyMatrix(); 91 viewHost1.Content = adjMatrix; 92 viewHost3.Content = (DoubleMatrix)adjMatrix.Clone(); 93 trackBar1.Minimum = (int)(1000 * GetMinNonNullElement(adjMatrix)); 94 trackBar1.Maximum = (int)(1000 * (adjMatrix.Max())); 194 arc = new Arc(variableNode, junctionNode) { Weight = impact }; 195 vn.AddArc(arc); 196 } 197 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight) }; 198 vn.AddArc(arc); 199 } else { 200 foreach (var v in variables) { 201 var impact = variableImpacts[v]; 202 if (!nodes.TryGetValue(v, out variableNode)) { 203 variableNode = new VariableNetworkNode { Label = v }; 204 vn.AddVertex(variableNode); 205 nodes[v] = variableNode; 95 206 } 96 } 97 #endregion 98 99 protected override void SetEnabledStateOfControls() 100 { 101 base.SetEnabledStateOfControls(); 102 // TODO: Enable or disable controls based on whether the content is null or the view is set readonly 103 } 104 105 #region Event Handlers (child controls) 106 // TODO: Put event handlers of child controls here. 107 #endregion 108 109 private DoubleMatrix CalculateAdjacencyMatrix() 110 { 111 var runCollection = Content; 112 var inputVariables = ((IRegressionProblemData)runCollection.First().Parameters["ProblemData"]).InputVariables.Select(x => x.Value).ToList(); 113 var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).OrderBy(x => inputVariables.IndexOf(x.Key)).ToList(); 114 115 var allVariableImpacts = runCollection.Select(run => (DoubleMatrix)run.Results[variableImpactResultName]); 116 var variableNames = (from variableImpact in allVariableImpacts 117 from variableName in variableImpact.RowNames 118 select variableName).Distinct().ToArray(); 119 120 var vars = new List<Tuple<int, string>>(); 121 122 var allowedInputs = ((IRegressionProblemData)groupRunCollection[0].First().Parameters["ProblemData"]).AllowedInputVariables.ToList(); 123 124 var adjMatrix = new DoubleMatrix(variableNames.Length, variableNames.Length); 125 126 for (int i = 0; i < adjMatrix.Rows; ++i) 127 { 128 int inputIndex = allowedInputs.FindIndex(x => x == variableNames[i]); 129 vars.Add(new Tuple<int, string>(inputIndex, variableNames[i])); 130 } 131 132 vars.Sort((a, b) => a.Item1.CompareTo(b.Item1)); 133 134 for (int i = 0; i < adjMatrix.Rows; ++i) 135 { 136 variableNames[i] = vars[i].Item2; 137 } 138 adjMatrix.RowNames = variableNames; 139 adjMatrix.ColumnNames = adjMatrix.RowNames; 140 141 for (int j = 0; j < groupRunCollection.Count; ++j) 142 { 143 var g = groupRunCollection[j]; 144 145 var matrix = CalculateAdjacencyRows(g); 146 var variables = new List<double>(); 147 148 for (int i = 0; i < matrix.Columns; ++i) 149 { 150 variables.Add(matrix[0, i]); 151 } 152 153 for (int i = 0; i < variables.Count; ++i) 154 { 155 if (i == j) 156 { 157 adjMatrix[i, i] = 0; 158 variables.Insert(i, 0); 159 } 160 else 161 adjMatrix[j, i] = variables[i]; 162 } 163 } 164 return adjMatrix; 165 } 166 167 private DoubleMatrix CalculateAdjacencyRows(IEnumerable<IRun> runs) 168 { 169 var runNames = runs.Select(x => x.Name).ToArray(); 170 var runsArray = runs.ToArray(); 171 DoubleMatrix varImpactMatrix = CalculateVariableImpactMatrix(runsArray, runNames); 172 173 var targetMatrix = new DoubleMatrix(1, varImpactMatrix.Rows); 174 175 for (int i = 0; i < varImpactMatrix.Rows; ++i) 176 { 177 targetMatrix[0, i] = varImpactMatrix[i, runNames.Length]; 178 } 179 180 targetMatrix.RowNames = new[] { "Impacts" }; 181 targetMatrix.ColumnNames = varImpactMatrix.RowNames; 182 return targetMatrix; 183 } 184 185 private DoubleMatrix UpdateAdjacencyMatrixByThresholdAndTargetVariable(double threshold, string targetVariable, DoubleMatrix adjMatrix) 186 { 187 var originalMatrix = (DoubleMatrix)viewHost1.Content; 188 var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 189 string[] targets = adjMatrix.RowNames.ToArray(); 190 var targetIndex = Array.IndexOf(targets, targetVariable); 191 192 for (int j = 0; j < groupRunCollection.Count; ++j) 193 { 194 double originalValue = originalMatrix[targetIndex, j]; 195 adjMatrix[targetIndex, j] = (originalValue <= Math.Max(threshold, Double.Parse(genThreshold.Text))) ? 0 : originalValue; 196 } 197 return adjMatrix; 198 } 199 200 private DoubleMatrix UpdateAdjacencyMatrixByThreshold(double threshold, DoubleMatrix adjMatrix) 201 { 202 var originalMatrix = (DoubleMatrix)viewHost1.Content; 203 var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 204 205 for (int i = 0; i < adjMatrix.Rows; ++i) 206 { 207 for (int j = 0; j < adjMatrix.Columns; ++j) 208 { 209 double originalValue = originalMatrix[i, j]; 210 adjMatrix[i, j] = originalValue <= threshold ? 0 : originalValue; 211 } 212 } 213 return adjMatrix; 214 } 215 216 private double GetMinNonNullElement(DoubleMatrix adjMatrix) 217 { 218 double min = adjMatrix.Max(); 219 for (int i = 0; i < adjMatrix.Rows; i++) 220 { 221 for (int j = 0; j < adjMatrix.Columns; j++) 222 { 223 min = (min > adjMatrix[i, j] && adjMatrix[i, j] != 0) ? adjMatrix[i, j] : min; 224 } 225 } 226 return min; 227 } 228 229 private double GetMaxFromRow(int rowIndex, DoubleMatrix adjMatrix) 230 { 231 double max = adjMatrix.Min(); 232 for (int j = 0; j < adjMatrix.Columns; ++j) 233 { 234 max = (max < adjMatrix[rowIndex, j] && adjMatrix[rowIndex, j] != 0) ? adjMatrix[rowIndex, j] : max; 235 } 236 return max; 237 } 238 239 private DoubleMatrix CalculateNodeImportance(DoubleMatrix adjMatrix) 240 { 241 DoubleMatrix nodeImportance = new DoubleMatrix(adjMatrix.Rows, 1); 242 var variables = new List<Tuple<string, double>>(); 243 var rowNames = adjMatrix.RowNames.ToList(); 244 var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 245 double[] meanQuality = new double[groupRunCollection.Count]; 246 247 for (int j = 0; j < groupRunCollection.Count; ++j) 248 { 249 var g = groupRunCollection[j]; 250 meanQuality[j] = g.Average(x => ((IRegressionSolution)x.Results[TrainingBestSolutionParameterName]).TrainingRSquared); 251 } 252 253 for (int i = 0; i < adjMatrix.Columns; ++i) 254 { 255 for (int j = 0; j < adjMatrix.Rows; ++j) 256 { 257 nodeImportance[i, 0] += adjMatrix[j, i] * meanQuality[j]; 258 } 259 nodeImportance[i, 0] /= (adjMatrix.Rows - 1); 260 variables.Add(new Tuple<string, double>(rowNames[i], nodeImportance[i, 0])); 261 } 262 263 variables.Sort((b, a) => a.Item2.CompareTo(b.Item2)); 264 265 for (int i = 0; i < nodeImportance.Rows; ++i) 266 { 267 nodeImportance[i, 0] = variables[i].Item2; 268 rowNames[i] = variables[i].Item1; 269 } 270 271 nodeImportance.RowNames = rowNames; 272 nodeImportance.ColumnNames = new[] { "Node Importance" }; 273 return nodeImportance; 274 } 275 276 //modified from RunCollectionVariableImpactView 277 private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames) 278 { 279 IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs 280 select run.Results[variableImpactResultName]).Cast<DoubleMatrix>(); 281 IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts 282 from variableName in variableImpact.RowNames 283 select variableName).Distinct(); 284 285 // filter variableNames: only include names that have at least one non-zero value in a run 286 List<string> variableNamesList = (from variableName in variableNames 287 where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0)) 288 select variableName).ToList(); 289 290 List<string> columnNames = new List<string>(runNames); 291 columnNames.Add("Mean"); 292 293 int numberOfRuns = runs.Length; 294 295 DoubleMatrix matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + 1); 296 matrix.SortableView = true; 297 matrix.ColumnNames = columnNames; 298 299 List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList 300 select GetVariableImpacts(variableName, allVariableImpacts).ToList()).ToList(); 301 302 for (int row = 0; row < variableImpactsOverRuns.Count; row++) 303 { 304 matrix[row, numberOfRuns] = Math.Round(variableImpactsOverRuns[row].Average(), 3); 305 } 306 307 // fill matrix with impacts from runs 308 for (int i = 0; i < runs.Length; i++) 309 { 310 IRun run = runs[i]; 311 DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName]; 312 for (int j = 0; j < runVariableImpacts.Rows; j++) 313 { 314 int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j)); 315 if (rowIndex > -1) 316 { 317 matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3); 318 } 319 } 320 } 321 322 // sort by median 323 var sortedMatrix = (DoubleMatrix)matrix.Clone(); 324 var sortedIndexes = from i in Enumerable.Range(0, sortedMatrix.Rows) 325 orderby matrix[i, numberOfRuns] 326 select i; 327 328 int targetIndex = 0; 329 foreach (var sourceIndex in sortedIndexes) 330 { 331 for (int c = 0; c < matrix.Columns; c++) 332 sortedMatrix[targetIndex, c] = matrix[sourceIndex, c]; 333 targetIndex++; 334 } 335 sortedMatrix.RowNames = sortedIndexes.Select(i => variableNamesList[i]); 336 337 var vars = new List<Tuple<int, string, double>>(); 338 var rowNames = sortedMatrix.RowNames.ToList(); 339 340 var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 341 var inputs = ((IRegressionProblemData)groupRunCollection[0].First().Parameters["ProblemData"]).InputVariables.ToList(); 342 List<string> inp = (from input in inputs 343 select (input.ToString())).ToList(); 344 345 for (int i = 0; i < sortedMatrix.Rows; ++i) 346 { 347 int inputIndex = inp.FindIndex(x => x == rowNames[i]); 348 vars.Add(new Tuple<int, string, double>(inputIndex, rowNames[i], sortedMatrix[i, runNames.Length])); 349 } 350 351 vars.Sort((a, b) => a.Item1.CompareTo(b.Item1)); 352 353 for (int i = 0; i < sortedMatrix.Rows; ++i) 354 { 355 sortedMatrix[i, runNames.Length] = vars[i].Item3; 356 rowNames[i] = vars[i].Item2; 357 } 358 sortedMatrix.RowNames = rowNames; 359 360 return sortedMatrix; 361 } 362 363 //taken from RunCollectionVariableImpactView 364 private IEnumerable<double> GetVariableImpacts(string variableName, IEnumerable<DoubleMatrix> allVariableImpacts) 365 { 366 foreach (DoubleMatrix runVariableImpacts in allVariableImpacts) 367 { 368 int row = 0; 369 foreach (string rowName in runVariableImpacts.RowNames) 370 { 371 if (rowName == variableName) 372 yield return runVariableImpacts[row, 0]; 373 row++; 374 } 375 } 376 } 377 378 private void trackBar1_ValueChanged(object sender, EventArgs e) 379 { 380 genThreshold.Text = (0.001 * trackBar1.Value).ToString(); 381 textBox1.Text = (0.001 * trackBar1.Minimum).ToString(); 382 textBox2.Text = (0.001 * trackBar1.Maximum).ToString(); 383 viewHost3.Content = UpdateAdjacencyMatrixByThreshold(0.001 * trackBar1.Value, (DoubleMatrix)viewHost3.Content); 384 } 385 386 private void mouseDownEvent(TrackBar tb, MouseEventArgs e) 387 { 388 double percentage = (double)e.X / (double)(tb.Width - 6); 389 double clickPos = percentage * (tb.Maximum - tb.Minimum); 390 try 391 { 392 tb.Value = (int)clickPos + tb.Minimum; 393 } 394 catch 395 { 396 MessageBox.Show("Value outside range!"); 397 return; 398 } 399 } 400 401 private void trackBar1_MouseDown(object sender, MouseEventArgs e) 402 { 403 mouseDownEvent(trackBar1, e); 404 } 405 406 private void trackBar2_MouseDown(object sender, MouseEventArgs e) 407 { 408 if (targetVariablesCombo.SelectedIndex < 0) 409 { 410 return; 411 } 412 else 413 { 414 mouseDownEvent(trackBar2, e); 415 } 416 } 417 418 private void trackBar2_ValueChanged(object sender, EventArgs e) 419 { 420 targetThreshold.Text = (0.001 * trackBar2.Value).ToString(); 421 422 if (targetVariablesCombo.SelectedIndex < 0) 423 { 424 MessageBox.Show("Please select target variable!"); 425 return; 426 } 427 else 428 { 429 string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex]; 430 viewHost3.Content = UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content); 431 } 432 } 433 434 private void genThresholdEvent() 435 { 436 this.errorProvider.SetError(genThreshold, ""); 437 438 if (genThreshold.Text != "") 439 { 440 if (Double.Parse(genThreshold.Text) >= GetMinNonNullElement((DoubleMatrix)viewHost1.Content) && Double.Parse(genThreshold.Text) <= ((DoubleMatrix)viewHost1.Content).Max()) 441 { 442 genThreshold.Select(genThreshold.Text.Length, 0); 443 trackBar1.Value = (int)(1000 * Double.Parse(genThreshold.Text)); 444 viewHost3.Content = UpdateAdjacencyMatrixByThreshold(Double.Parse(genThreshold.Text), (DoubleMatrix)viewHost3.Content); 445 } 446 else 447 { 448 this.errorProvider.SetError(genThreshold, "Value out of range!"); 449 } 450 } 451 else 452 { 453 MessageBox.Show("Please select a threshold!"); 454 this.errorProvider.SetError(genThreshold, ""); 455 return; 456 } 457 } 458 459 private void genThreshold_TextChanged(object sender, EventArgs e) 460 { 461 genThresholdEvent(); 462 } 463 464 private void genThreshold_KeyDown(object sender, KeyEventArgs e) 465 { 466 if (e.KeyCode == Keys.Enter) 467 genThresholdEvent(); 468 } 469 470 private void targetThresholdEvent() 471 { 472 this.errorProvider2.SetError(targetThreshold, ""); 473 474 if (targetVariablesCombo.SelectedIndex < 0) 475 { 476 return; 477 } 478 else 479 { 480 string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex]; 481 if (Double.Parse(targetThreshold.Text) >= Double.Parse(textBox3.Text) && Double.Parse(targetThreshold.Text) <= Double.Parse(textBox4.Text)) 482 { 483 trackBar2.Value = (int)(1000 * Double.Parse(targetThreshold.Text)); 484 } 485 else 486 { 487 this.errorProvider2.SetError(targetThreshold, "Value out of range!"); 488 return; 489 } 490 } 491 } 492 493 private void targetThreshold_TextChanged(object sender, EventArgs e) 494 { 495 targetThresholdEvent(); 496 } 497 498 private void targetThreshold_KeyDown(object sender, KeyEventArgs e) 499 { 500 if (e.KeyCode == Keys.Enter) 501 { 502 targetThresholdEvent(); 503 } 504 } 505 506 private void targetVariablesCombo_Dropdown(object sender, System.EventArgs e) 507 { 508 targetVariablesCombo.Items.Clear(); 509 string[] targetVariables = ((DoubleMatrix)viewHost3.Content).RowNames.ToArray(); 510 targetVariablesCombo.Items.AddRange(targetVariables); 511 } 512 513 private void targetVariablesCombo_SelectedIndexChanged(object sender, System.EventArgs e) 514 { 515 var targetIndex = targetVariablesCombo.SelectedIndex; 516 string selectedItem = (string)targetVariablesCombo.Items[targetIndex]; 517 trackBar2.Minimum = 0; 518 trackBar2.Maximum = (int)(1000 * GetMaxFromRow(targetIndex, (DoubleMatrix)viewHost1.Content)); 519 textBox3.Text = trackBar2.Minimum.ToString(); 520 textBox4.Text = (0.001 * trackBar2.Maximum).ToString(); 521 UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content); 522 } 523 } 207 var arc = new Arc(variableNode, targetNode) { Weight = impact }; 208 vn.AddArc(arc); 209 } 210 } 211 } 212 return vn; 213 } 214 215 private static double CalculateAverageQuality(RunCollection runs) { 216 var pd = (IRegressionProblemData)runs.First().Parameters["ProblemData"]; 217 var target = pd.TargetVariable; 218 var inputs = pd.AllowedInputVariables; 219 220 if (!runs.All(x => { 221 var problemData = (IRegressionProblemData)x.Parameters["ProblemData"]; 222 return target == problemData.TargetVariable && inputs.SequenceEqual(problemData.AllowedInputVariables); 223 })) { 224 throw new ArgumentException("All runs must have the same target and inputs."); 225 } 226 return runs.Average(x => ((DoubleValue)x.Results["Best training solution quality"]).Value); 227 } 228 229 private static Dictionary<string, double> CalculateAverageImpacts(RunCollection runs, string resultName) { 230 var pd = (IRegressionProblemData)runs.First().Parameters["ProblemData"]; 231 var target = pd.TargetVariable; 232 var inputs = pd.AllowedInputVariables.ToList(); 233 234 var impacts = inputs.ToDictionary(x => x, x => 0d); 235 236 // check if all the runs have the same target and same inputs 237 if (!runs.All(x => { 238 var problemData = (IRegressionProblemData)x.Parameters["ProblemData"]; 239 return target == problemData.TargetVariable && inputs.SequenceEqual(problemData.AllowedInputVariables); 240 })) { 241 throw new ArgumentException("All runs must have the same target and inputs."); 242 } 243 244 foreach (var run in runs) { 245 var impactsMatrix = (DoubleMatrix)run.Results[resultName]; 246 247 int i = 0; 248 foreach (var v in impactsMatrix.RowNames) { 249 impacts[v] += impactsMatrix[i, 0]; 250 ++i; 251 } 252 } 253 254 foreach (var v in inputs) { 255 impacts[v] /= runs.Count; 256 } 257 258 return impacts; 259 } 260 261 private static string Concatenate(IEnumerable<string> strings) { 262 var sb = new StringBuilder(); 263 foreach (var s in strings) { 264 sb.Append(s); 265 } 266 return sb.ToString(); 267 } 268 269 private void ConfigureNodeShapes() { 270 graphChart.ClearShapes(); 271 var font = new Font(FontFamily.GenericSansSerif, 12); 272 graphChart.AddShape(typeof(VariableNetworkNode), new LabeledPrimitive(new Ellipse(graphChart.Chart, new PointD(0, 0), new PointD(30, 30), Pens.Black, Brushes.White), "", font)); 273 graphChart.AddShape(typeof(JunctionNetworkNode), new LabeledPrimitive(new Rectangle(graphChart.Chart, new PointD(0, 0), new PointD(15, 15), Pens.Black, Brushes.DarkGray), "", font)); 274 } 275 276 #region events 277 protected override void OnContentChanged() { 278 base.OnContentChanged(); 279 var run = Content.First(); 280 var pd = (IRegressionProblemData)run.Parameters["ProblemData"]; 281 var variables = new HashSet<string>(new List<string>(pd.Dataset.DoubleVariables)); 282 impactResultNameComboBox.Items.Clear(); 283 foreach (var result in run.Results.Where(x => x.Value is DoubleMatrix)) { 284 var m = (DoubleMatrix)result.Value; 285 if (m.RowNames.All(x => variables.Contains(x))) 286 impactResultNameComboBox.Items.Add(result.Key); 287 } 288 qualityResultNameComboBox.Items.Clear(); 289 foreach (var result in run.Results.Where(x => x.Value is DoubleValue)) { 290 qualityResultNameComboBox.Items.Add(result.Key); 291 } 292 if (impactResultNameComboBox.Items.Count > 0) { 293 impactResultNameComboBox.Text = (string)impactResultNameComboBox.Items[0]; 294 } 295 if (qualityResultNameComboBox.Items.Count > 0) { 296 qualityResultNameComboBox.Text = (string)qualityResultNameComboBox.Items[0]; 297 } 298 if (impactResultNameComboBox.Items.Count > 0 && qualityResultNameComboBox.Items.Count > 0) 299 NetworkConfigurationChanged(this, EventArgs.Empty); 300 } 301 302 private void TextBoxValidating(object sender, CancelEventArgs e) { 303 double v; 304 string errorMsg = "Could not parse the entered value. Please input a real number."; 305 var tb = (TextBox)sender; 306 if (!double.TryParse(tb.Text, out v)) { 307 e.Cancel = true; 308 tb.Select(0, tb.Text.Length); 309 310 // Set the ErrorProvider error with the text to display. 311 this.errorProvider.SetError(tb, errorMsg); 312 errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; 313 errorProvider.SetIconPadding(tb, -20); 314 } 315 } 316 317 private void NetworkConfigurationBoxValidated(object sender, EventArgs e) { 318 var tb = (TextBox)sender; 319 errorProvider.SetError(tb, string.Empty); 320 NetworkConfigurationChanged(sender, e); 321 } 322 323 private void LayoutConfigurationBoxValidated(object sender, EventArgs e) { 324 var tb = (TextBox)sender; 325 errorProvider.SetError(tb, string.Empty); 326 LayoutConfigurationChanged(sender, e); 327 } 328 329 private void NetworkConfigurationChanged(object sender, EventArgs e) { 330 var useBest = impactAggregationComboBox.SelectedIndex <= 0; 331 var threshold = double.Parse(impactThresholdTextBox.Text); 332 var qualityResultName = qualityResultNameComboBox.Text; 333 var impactsResultName = impactResultNameComboBox.Text; 334 if (string.IsNullOrEmpty(qualityResultName) || string.IsNullOrEmpty(impactsResultName)) 335 return; 336 var maximization = maximizationCheckBox.Checked; 337 var network = BuildNetworkFromVariableImpacts(Content, qualityResultName, maximization, impactsResultName, threshold, useBest); 338 if (network.Vertices.Any()) 339 graphChart.Graph = network; 340 } 341 342 private void LayoutConfigurationChanged(object sender, EventArgs e) { 343 ConstrainedForceDirectedLayout.EdgeRouting routingMode; 344 switch (edgeRoutingComboBox.SelectedIndex) { 345 case 0: 346 routingMode = ConstrainedForceDirectedLayout.EdgeRouting.None; 347 break; 348 case 1: 349 routingMode = ConstrainedForceDirectedLayout.EdgeRouting.Polyline; 350 break; 351 case 2: 352 routingMode = ConstrainedForceDirectedLayout.EdgeRouting.Orthogonal; 353 break; 354 default: 355 throw new ArgumentException("Invalid edge routing mode."); 356 } 357 var idealEdgeLength = double.Parse(idealEdgeLengthTextBox.Text); 358 if (routingMode == graphChart.RoutingMode && idealEdgeLength.IsAlmost(graphChart.IdealEdgeLength)) return; 359 graphChart.RoutingMode = routingMode; 360 graphChart.PerformEdgeRouting = routingMode != ConstrainedForceDirectedLayout.EdgeRouting.None; 361 graphChart.IdealEdgeLength = idealEdgeLength; 362 graphChart.Draw(); 363 } 364 #endregion 365 } 524 366 }
Note: See TracChangeset
for help on using the changeset viewer.