Changeset 11852
- Timestamp:
- 02/01/15 23:17:56 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Tests/GenealogyOperationsPerformanceTests.cs
r11694 r11852 48 48 // var trace = tc.Trace(bestIndividual, 2); 49 49 sw.Stop(); 50 Console.WriteLine("Avg trace size: {0}", s / graph.Ranks.Last().Value.Count );50 Console.WriteLine("Avg trace size: {0}", s / graph.Ranks.Last().Value.Count()); 51 51 // var ancestry = bestIndividual.Ancestors; 52 52 // Console.WriteLine("Ancestry size: {0}", ancestry.Count()); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r11817 r11852 40 40 private readonly Pen defaultPen; 41 41 42 private Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode> nodeMap; 43 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 44 42 45 public IGenealogyGraph GenealogyGraph { 43 46 get { return genealogyGraph; } … … 63 66 } 64 67 65 private Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode> nodeMap; 66 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 68 public bool UpdateEnabled { 69 get { return Chart.UpdateEnabled; } 70 set { Chart.UpdateEnabled = value; } 71 } 72 73 public void EnforceUpdate() { 74 Chart.EnforceUpdate(); 75 } 67 76 68 77 #region chart modes … … 225 234 226 235 // update 227 Chart.UpdateEnabled = true;228 Chart.EnforceUpdate();236 UpdateEnabled = true; 237 EnforceUpdate(); 229 238 230 239 if (SelectedVisualNode != null) 231 /* emit clicked event */ 232 OnGenealogyGraphNodeClicked(SelectedVisualNode, e); 240 OnGenealogyGraphNodeClicked(SelectedVisualNode, e); // emit clicked event 233 241 234 242 base.pictureBox_MouseUp(sender, e); … … 306 314 } 307 315 316 public void ClearArcs() { 317 foreach (var primitive in Chart.Group.Primitives.OfType<VisualGenealogyGraphArc>()) { 318 primitive.Pen = Pens.Transparent; 319 } 320 } 321 322 public void ClearNodes() { 323 foreach (var primitive in Chart.Group.Primitives.OfType<VisualGenealogyGraphNode>()) { 324 primitive.Brush = new SolidBrush(Color.Transparent); 325 primitive.Pen = new Pen(Color.LightGray); 326 } 327 } 328 308 329 public virtual void ClearPrimitives() { 309 330 foreach (var primitive in Chart.Group.Primitives) { … … 313 334 primitive.Brush = new SolidBrush(Color.Transparent); 314 335 primitive.Pen = new Pen(Color.DarkGray); 315 } 316 } 317 } 318 319 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) { 320 Chart.UpdateEnabled = false; 321 ClearPrimitives(); 336 // primitive.Pen = Pens.Transparent; // remove the node contour 337 } 338 } 339 } 340 341 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes, bool clearPrimitives = true) { 342 if (clearPrimitives) 343 ClearPrimitives(); 344 322 345 foreach (var node in nodes) { 323 346 var graphNode = GetMappedNode(node); 324 347 graphNode.Brush = new SolidBrush(node.GetColor()); 325 348 } 326 Chart.UpdateEnabled = true; 327 Chart.EnforceUpdate(); 349 } 350 351 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes, Color color, bool clearPrimitives = true) { 352 if (clearPrimitives) 353 ClearPrimitives(); 354 355 foreach (var node in nodes.Select(GetMappedNode)) { 356 node.Brush = new SolidBrush(color); 357 } 328 358 } 329 359 330 360 public void HighlightAll() { 331 Chart.UpdateEnabled = false;332 361 foreach (var visualNode in nodeMap.Values) { 333 362 visualNode.Brush = new SolidBrush(visualNode.Data.GetColor()); … … 340 369 arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor()); 341 370 } 342 Chart.UpdateEnabled = true;343 Chart.EnforceUpdate();344 371 } 345 372 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.Designer.cs
r11817 r11852 26 26 private void InitializeComponent() { 27 27 this.splitContainer = new System.Windows.Forms.SplitContainer(); 28 this.genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart(); 28 29 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 29 30 this.groupBox = new System.Windows.Forms.GroupBox(); … … 31 32 this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox(); 32 33 this.trace_checkBox = new System.Windows.Forms.CheckBox(); 33 this. genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart();34 this.openNew_CheckBox = new System.Windows.Forms.CheckBox(); 34 35 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 35 36 this.splitContainer.Panel1.SuspendLayout(); … … 58 59 this.splitContainer.TabIndex = 0; 59 60 // 61 // genealogyGraphChart 62 // 63 this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 64 | System.Windows.Forms.AnchorStyles.Left) 65 | System.Windows.Forms.AnchorStyles.Right))); 66 this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control; 67 this.genealogyGraphChart.GenealogyGraph = null; 68 this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0); 69 this.genealogyGraphChart.LockGenealogy = false; 70 this.genealogyGraphChart.Name = "genealogyGraphChart"; 71 this.genealogyGraphChart.ScaleOnResize = true; 72 this.genealogyGraphChart.SimpleLineages = false; 73 this.genealogyGraphChart.Size = new System.Drawing.Size(689, 738); 74 this.genealogyGraphChart.TabIndex = 0; 75 this.genealogyGraphChart.TraceFragments = false; 76 this.genealogyGraphChart.UpdateEnabled = true; 77 // 60 78 // viewHost 61 79 // … … 77 95 // groupBox 78 96 // 97 this.groupBox.Controls.Add(this.openNew_CheckBox); 79 98 this.groupBox.Controls.Add(this.lockGraph_checkBox); 80 99 this.groupBox.Controls.Add(this.simpleLineages_checkBox); … … 123 142 this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged); 124 143 // 125 // genealogyGraphChart144 // openNew_CheckBox 126 145 // 127 this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 128 | System.Windows.Forms.AnchorStyles.Left) 129 | System.Windows.Forms.AnchorStyles.Right))); 130 this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control; 131 this.genealogyGraphChart.GenealogyGraph = null; 132 this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0); 133 this.genealogyGraphChart.LockGenealogy = false; 134 this.genealogyGraphChart.Name = "genealogyGraphChart"; 135 this.genealogyGraphChart.ScaleOnResize = true; 136 this.genealogyGraphChart.SimpleLineages = false; 137 this.genealogyGraphChart.Size = new System.Drawing.Size(689, 738); 138 this.genealogyGraphChart.TabIndex = 0; 139 this.genealogyGraphChart.TraceFragments = false; 146 this.openNew_CheckBox.AutoSize = true; 147 this.openNew_CheckBox.Location = new System.Drawing.Point(237, 20); 148 this.openNew_CheckBox.Name = "openNew_CheckBox"; 149 this.openNew_CheckBox.Size = new System.Drawing.Size(111, 17); 150 this.openNew_CheckBox.TabIndex = 1; 151 this.openNew_CheckBox.Text = "Open in new view"; 152 this.openNew_CheckBox.UseVisualStyleBackColor = true; 140 153 // 141 154 // GenealogyGraphView … … 166 179 protected System.Windows.Forms.CheckBox simpleLineages_checkBox; 167 180 protected System.Windows.Forms.CheckBox lockGraph_checkBox; 181 protected System.Windows.Forms.CheckBox openNew_CheckBox; 168 182 169 183 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj
r11639 r11852 129 129 <None Include="HeuristicLab.snk" /> 130 130 </ItemGroup> 131 <ItemGroup> 132 <EmbeddedResource Include="GenealogyGraphView.resx"> 133 <DependentUpon>GenealogyGraphView.cs</DependentUpon> 134 </EmbeddedResource> 135 </ItemGroup> 131 136 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 132 137 <PropertyGroup> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs
r10830 r11852 19 19 set { root = value; } 20 20 } 21 22 21 [StorableConstructor] 23 22 protected Fragment(bool deserializable) : base(deserializable) { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
r11752 r11852 154 154 sb.AppendLine("graph fragmentgraph {"); 155 155 foreach (var v in Vertices) { 156 sb.AppendLine("\"" + v.Id + "\"[shape=circle, style = filled, width = " + v.Degree / 2.0 + ", label = " + v.Rank + ", fillcolor = \"" + ColorTranslator.ToHtml(GetColor(v)) + "\"]"); 156 double width = Math.Max(0.5, v.Degree); 157 sb.AppendLine("\"" + v.Id + "\"[shape=circle, style = filled, width = " + width + ", label = " + v.Rank + "\n" + String.Format("{0:00}", v.Quality) + ", fillcolor = \"" + ColorTranslator.ToHtml(GetColor(v)) + "\"]"); 157 158 } 158 159 foreach (var a in Arcs) { … … 167 168 if (colorIndex >= ColorGradient.Colors.Count) return ColorGradient.Colors.Last(); 168 169 return ColorGradient.Colors[colorIndex]; 170 } 171 172 public override void AddVertices(IEnumerable<IVertex> vertexList) { 173 base.AddVertices(vertexList); 174 RebuildDictionaries(); 169 175 } 170 176 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
r11750 r11852 62 62 get { return InArcs.Select(a => a.Source); } 63 63 } 64 64 65 public IEnumerable<IGenealogyGraphNode> Children { 65 66 get { return OutArcs.Select(a => a.Target); } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 11675
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 11679
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs
r11638 r11852 132 132 Content.Fixed = true; 133 133 DeregisterContentEvents(); 134 Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList(); 134 Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value); 135 Content.AllVariableNames = variableNamesView.Content.Select(x => x.Value); 135 136 RegisterContentEvents(); 136 137 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs
r11817 r11852 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; … … 72 73 var visualNode = (VisualGenealogyGraphNode)sender; 73 74 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data; 75 76 if (openNew_CheckBox.Checked) { 77 // get the ancestors into a new view 78 var cloner = new Cloner(); 79 80 var graph = new GenealogyGraph<ISymbolicExpressionTree>(); 81 var ancestors = new[] { graphNode }.Concat(graphNode.Ancestors); 82 var cloned = ancestors.ToDictionary(x => x, x => cloner.Clone(x)); 83 graph.AddVertices(cloned.Values); 84 foreach (var arc in cloned.Keys.SelectMany(x => x.InArcs)) { 85 graph.AddArc(cloner.Clone(arc)); 86 } 87 // graph.AddVertices(graphNode.Ancestors); 88 MainFormManager.MainForm.ShowContent(graph); 89 } 90 74 91 if (graphNode.InArcs.Any()) { 75 92 var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>; … … 92 109 var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; 93 110 var subtree = visualNode.Content; 94 95 111 // highlight the selected subtree inside the displayed tree on the right hand side 96 112 treeChart_ClearColors(); … … 103 119 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode; 104 120 var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree); 105 // var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex);106 121 var traceGraph = TraceCalculator.TraceSubtree(graphNode, subtreeIndex); 107 108 122 if (traceGraph.Vertices.Any()) { 123 genealogyGraphChart.UpdateEnabled = false; 124 genealogyGraphChart.ClearArcs(); 125 // genealogyGraphChart.ClearPrimitives(); 109 126 var genealogyNodes = traceGraph.Vertices.Select(v => Content.GetByContent(v.Data)); 110 genealogyGraphChart.HighlightNodes(genealogyNodes); 111 foreach (var a in traceGraph.Arcs) { 112 genealogyGraphChart.HighlightArc(Content.GetByContent(a.Target.Data), Content.GetByContent(a.Source.Data)); 113 } 127 // genealogyGraphChart.HighlightNodes(graphNode.Ancestors, Color.Gray, false); 128 genealogyGraphChart.HighlightNodes(genealogyNodes, Color.Black, false); 129 // foreach (var a in traceGraph.Arcs) { 130 // genealogyGraphChart.HighlightArc(Content.GetByContent(a.Target.Data), Content.GetByContent(a.Source.Data)); 131 // } 132 genealogyGraphChart.UpdateEnabled = true; 133 genealogyGraphChart.EnforceUpdate(); 114 134 MainFormManager.MainForm.ShowContent(traceGraph); // display the fragment graph on the screen 115 135 } … … 121 141 122 142 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)); 123 graphChart_ highlightMatchingVertices(matchingVertices);143 graphChart_HighlightMatchingVertices(matchingVertices); 124 144 } 125 145 } 126 146 127 private void graphChart_ highlightMatchingVertices(IEnumerable<IGenealogyGraphNode> vertices) {147 private void graphChart_HighlightMatchingVertices(IEnumerable<IGenealogyGraphNode> vertices) { 128 148 genealogyGraphChart.Chart.UpdateEnabled = false; 129 149 genealogyGraphChart.ClearPrimitives(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs
r11208 r11852 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Data; 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 36 37 [StorableClass] 37 38 public abstract class SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> : SymbolicDataAnalysisSingleObjectiveAnalyzer, 38 ISymbolicDataAnalysisValidationAnalyzer<T, U> 39 ISymbolicDataAnalysisValidationAnalyzer<T, U>, IStochasticOperator 39 40 where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U> 40 41 where U : class, IDataAnalysisProblemData { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs
r11694 r11852 45 45 var result = base.Apply(); // the base operator will add the child to the graph before the actual crossover operation takes place 46 46 var parents = ParentsParameter.ActualValue.ToList(); 47 var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(parents[0]); // use the parent since it is actually the child before crossover (and the ChildParameter doesn't have a value yet)47 var childVertex = GenealogyGraph.GetByContent(parents[0]); // use the parent since it is actually the child before crossover (and the ChildParameter doesn't have a value yet) 48 48 var arcs = childVertex.InArcs.ToList(); 49 49 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs
r11751 r11852 204 204 return; 205 205 var lastTraceData = traceMap[last]; 206 int lastSi = lastTraceData.Item1; // last subtree index 207 int lastFi = lastTraceData.Item2; // last fragment index 206 int lastSi = lastTraceData.Item1; // last subtree index (index of the traced subtree in the parent) 207 int lastFi = lastTraceData.Item2; // last fragment index (index of the fragment in the parent) 208 208 var td = new Tuple<int, int, int, int>(si, fi, lastSi, lastFi); // trace data 209 209 var arc = n.InArcs.SingleOrDefault(a => a.Source == last && a.Data.Equals(td)); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.TravelingSalesman
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.TravelingSalesman.Views
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Tracking.sln
r11694 r11852 184 184 HideSolutionNode = FALSE 185 185 EndGlobalSection 186 GlobalSection(Performance) = preSolution187 HasPerformanceSessions = true188 EndGlobalSection189 186 GlobalSection(TestCaseManagementSettings) = postSolution 190 187 CategoryFile = HeuristicLab.Tracking.vsmdi
Note: See TracChangeset
for help on using the changeset viewer.