Changeset 13789
- Timestamp:
- 04/24/16 20:37:12 (9 years ago)
- Location:
- branches/HeuristicLab.VariableInteractionNetworks
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.Designer.cs
r13727 r13789 32 32 // pictureBox 33 33 // 34 this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image")));34 //this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image"))); 35 35 // 36 36 // toolTip -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
r13727 r13789 83 83 this.AddChartModes(directedGraphChartMode, new PanChartMode(this), new ZoomInChartMode(this), new ZoomOutChartMode(this)); 84 84 shapes = new Dictionary<Type, LabeledPrimitive>(); 85 SmoothingMode = SmoothingMode.HighQuality; // set antialiasing for nicer rendering 85 86 } 86 87 … … 110 111 foreach (var v in graph.Vertices) { 111 112 var shape = CreateShape(v); 113 shape.ToolTipText = v.Label; 112 114 vertexMap[shape] = v; 113 115 vertexShapes[v] = shape; … … 152 154 var len = points.Length; // len = 2 when no edge routingMode is performed 153 155 Pen pen; 156 var penWidth = weight / max * 2; 154 157 if (len == 2) { 155 pen = new Pen(Color.Black, (float)(weight / max * 3f)) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 158 if (double.IsInfinity(penWidth) || double.IsNaN(penWidth)) penWidth = 1; 159 pen = new Pen(Color.Black, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 156 160 var start = points[0]; 157 161 var end = points[1]; … … 168 172 if (intersectionPoint == default(PointD)) 169 173 intersectionPoint = end; 170 line = new Line(Chart, new PointD(start.X, start.Y), intersectionPoint, pen) ;174 line = new Line(Chart, new PointD(start.X, start.Y), intersectionPoint, pen) { ToolTipText = arc.Label }; 171 175 Chart.Group.Add(line); 172 176 arcShapes[arc] = line; … … 193 197 if (intersectionPoints.Any()) { 194 198 endPoint = intersectionPoints.First(); 195 pen = new Pen(Color.Black, (float) (weight / max * 3f)) { CustomEndCap = new AdjustableArrowCap(5, 3) };199 pen = new Pen(Color.Black, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 196 200 } else { 197 201 endPoint = end; 198 pen = new Pen(Color.Black, (float) (weight / max * 3f));202 pen = new Pen(Color.Black, (float)penWidth); 199 203 } 200 line = new Line(Chart, new PointD(start.X, start.Y), endPoint, pen) ;204 line = new Line(Chart, new PointD(start.X, start.Y), endPoint, pen) { ToolTipText = arc.Label }; 201 205 Chart.Group.Add(line); 202 206 if (intersectionPoints.Any()) { -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChartMode.cs
r13727 r13789 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.MainForm; 27 using HeuristicLab.Problems.DataAnalysis;28 27 using HeuristicLab.Visualization; 29 28 … … 56 55 } 57 56 } 58 } finally { chartControl.ResumeRendering(); } 57 } 58 finally { chartControl.ResumeRendering(); } 59 59 break; 60 60 } 61 } finally { 61 } 62 finally { 62 63 base.HandleOnMouseDown(sender, e); 63 64 } … … 67 68 try { 68 69 switch (e.Button) { 69 case MouseButtons.None:70 try {71 chartControl.SuspendRendering();72 var sp = chartControl.Chart.GetPrimitive(e.Location);73 if (sp is RectangularPrimitiveBase) {74 var vertex = Control.GetVertex(sp) as IVertex<IDeepCloneable>;75 var junctionNode = vertex as JunctionNetworkNode;76 if (junctionNode != null) {77 var solution = vertex.Data as IRegressionSolution;78 if (solution != null) {79 var toolTip = string.Format("Target: {0}\nQuality: {1}", solution.ProblemData.TargetVariable, solution.TrainingRSquared);80 Control.ToolTip.SetToolTip(Control, toolTip);81 }82 }83 }84 } finally { chartControl.ResumeRendering(); }85 break;86 70 case MouseButtons.Left: 87 71 var previousWorldLocation = chartControl.Chart.TransformPixelToWorld(previousLocation); … … 119 103 } 120 104 } 121 } finally { chartControl.ResumeRendering(); } 105 } 106 finally { chartControl.ResumeRendering(); } 122 107 break; 123 108 } 124 } finally {125 chartControl.UpdatePicture();109 } 110 finally { 126 111 base.HandleOnMouseMove(sender, e); 127 112 } -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.Designer.cs
r13773 r13789 50 50 // settingsGroupBox 51 51 // 52 this.settingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 52 this.settingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 53 53 | System.Windows.Forms.AnchorStyles.Left))); 54 54 this.settingsGroupBox.Controls.Add(this.onlineImpactCalculationButton); … … 169 169 // layoutOptionsGroupBox 170 170 // 171 this.layoutOptionsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 171 this.layoutOptionsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 172 172 | System.Windows.Forms.AnchorStyles.Left))); 173 173 this.layoutOptionsGroupBox.Controls.Add(this.idealEdgeLengthTextBox); … … 230 230 // graphChart 231 231 // 232 this.graphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 233 | System.Windows.Forms.AnchorStyles.Left) 232 this.graphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 233 | System.Windows.Forms.AnchorStyles.Left) 234 234 | System.Windows.Forms.AnchorStyles.Right))); 235 235 this.graphChart.BackColor = System.Drawing.SystemColors.Control; -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
r13773 r13789 233 233 IVertex junctionNode; 234 234 if (!nodes.TryGetValue(junctionLabel, out junctionNode)) { 235 junctionNode = new JunctionNetworkNode { Label = string.Empty, Data = CreateEnsembleSolution(targetRuns) }; 235 var solutionsEnsemble = CreateEnsembleSolution(targetRuns); 236 junctionNode = new JunctionNetworkNode { Label = string.Empty, Data = solutionsEnsemble }; 236 237 vn.AddVertex(junctionNode); 237 238 nodes[junctionLabel] = junctionNode; 239 junctionNode.Label = string.Format("Target quality: {0:0.000}", solutionsEnsemble.TrainingRSquared); 238 240 } 239 241 IArc arc; … … 245 247 nodes[v] = variableNode; 246 248 } 247 arc = new Arc(variableNode, junctionNode) { Weight = impact };249 arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) }; 248 250 vn.AddArc(arc); 249 251 } 250 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight) }; 252 var trainingR2 = ((IRegressionSolution)((JunctionNetworkNode)junctionNode).Data).TrainingRSquared; 253 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = string.Format("Quality: {0:0.000}", trainingR2) }; 251 254 vn.AddArc(arc); 252 255 } else { … … 258 261 nodes[v] = variableNode; 259 262 } 260 var arc = new Arc(variableNode, targetNode) { Weight = impact };263 var arc = new Arc(variableNode, targetNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) }; 261 264 vn.AddArc(arc); 262 265 } … … 380 383 var filteredNetwork = new VariableInteractionNetwork(); 381 384 var cloner = new Cloner(); 382 var vertices = arcs.SelectMany(x => new[] { x.Source, x.Target }).Select(cloner.Clone) ; // arcs are not cloned385 var vertices = arcs.SelectMany(x => new[] { x.Source, x.Target }).Select(cloner.Clone).Distinct(); // arcs are not cloned 383 386 filteredNetwork.AddVertices(vertices); 384 foreach (var arc in arcs) { 385 var source = cloner.Clone(arc.Source); 386 var target = cloner.Clone(arc.Target); 387 filteredNetwork.AddArc(source, target); 388 } 387 filteredNetwork.AddArcs(arcs.Select(x => (IArc)x.Clone(cloner))); 388 389 389 var unusedJunctions = filteredNetwork.Vertices.Where(x => x.InDegree == 0 && x is JunctionNetworkNode).ToList(); 390 390 filteredNetwork.RemoveVertices(unusedJunctions); … … 443 443 button.Enabled = false; 444 444 var impacts = CalculateVariableImpactsOnline(Content, false); 445 var network = CreateNetwork(impacts);445 variableInteractionNetwork = CreateNetwork(impacts); 446 446 var threshold = double.Parse(impactThresholdTextBox.Text); 447 graphChart.Graph = ApplyThreshold( network, threshold);447 graphChart.Graph = ApplyThreshold(variableInteractionNetwork, threshold); 448 448 }; 449 449 worker.RunWorkerCompleted += (o, e) => button.Enabled = true; -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/HeuristicLab.VariableInteractionNetworks-3.3.csproj
r13728 r13789 166 166 <Compile Include="Properties\AssemblyInfo.cs" /> 167 167 <Compile Include="SymbolicDataAnalysisVariableImpactsAnalyzer.cs" /> 168 <Compile Include="TinySet.cs" /> 168 169 <Compile Include="VariableInteractionNetwork.cs" /> 169 170 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.