Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/26/14 01:56:35 (11 years ago)
Author:
bburlacu
Message:

#1772: Introduced separate class for FragmentNodes and adjusted tracing code. Fixed small bug creating the genealogy graph.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/FragmentGraphView.cs

    r10884 r10888  
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3434  [View("FragmentGraphView")]
    35   [Content(typeof(IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>), IsDefaultView = true)]
     35  [Content(typeof(FragmentGraph), IsDefaultView = true)]
    3636  public sealed partial class FragmentGraphView : ItemView {
    3737    private const int PreferredHorizontalSpacing = 10;
     
    4141    private ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> symbolicExpressionEngine;
    4242
    43     private Dictionary<IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>, TileLayoutNode> tileDictionary;
     43    private Dictionary<FragmentNode, TileLayoutNode> tileDictionary;
    4444
    4545    private SymbolicExpressionTreeTile Root { get; set; }
    4646
    47     public new IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>> Content {
    48       get { return (IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>)base.Content; }
     47    public new FragmentGraph Content {
     48      get { return (FragmentGraph)base.Content; }
    4949      set { base.Content = value; }
    5050    }
     
    6363        NodeHeight = 40
    6464      };
    65       tileDictionary = new Dictionary<IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>, TileLayoutNode>();
     65      tileDictionary = new Dictionary<FragmentNode, TileLayoutNode>();
    6666    }
    6767
     
    7070      tileDictionary.Clear();
    7171      foreach (var node in Content.Nodes) {
     72        var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)node.Content;
    7273        var tile = new SymbolicExpressionTreeTile(chart);
    7374        tile.LayoutEngine = symbolicExpressionEngine;
    74         tile.Label = "Generation " + node.Rank + Environment.NewLine +
    75                      "Quality " + String.Format("{0:0.000}", node.Quality);
    76         tile.Root = node.Content.Root;
     75        tile.Label = "Generation " + node.Content.Rank + Environment.NewLine +
     76                     "Quality " + String.Format("{0:0.000}", node.Content.Quality);
     77        tile.Root = graphNode.Content.Root;
    7778        var tileNode = new TileLayoutNode { Tile = tile };
    7879        tileDictionary.Add(node, tileNode);
    7980      }
    80       foreach (var node in Content.Nodes.Where(n => n.Children.Any())) {
     81      foreach (var node in Content.Nodes.Where(n => n.OutArcs.Any())) {
    8182        var layoutNode = tileDictionary[node];
    82         layoutNode.Children = new List<TileLayoutNode>(node.Children.Select(x => tileDictionary[x]));
     83        layoutNode.Children = new List<TileLayoutNode>(node.OutArcs.Select(a => tileDictionary[(FragmentNode)a.Target]));
    8384      }
    8485    }
     
    116117        var aSize = aTile.Size;
    117118        var aPos = aTile.Position;
    118 
    119         var fragment = node.Content;
    120         if (fragment.Index1 > 0) {
    121           var subtree = fragment.Root.NodeAt(fragment.Index1);
     119        var graphNode = node.Content;
     120
     121        if (node.SubtreeIndex > 0) {
     122          var subtree = graphNode.Content.Root.NodeAt(node.SubtreeIndex);
    122123          foreach (var s in subtree.IterateNodesPrefix()) {
    123124            var primitive = aTile.GetPrimitive(s);
     
    130131          }
    131132        }
    132         if (fragment.Index2 > 0) {
    133           var subtree = fragment.Root.NodeAt(fragment.Index2);
     133        if (node.FragmentIndex > 0) {
     134          var subtree = graphNode.Content.Root.NodeAt(node.FragmentIndex);
    134135          foreach (var s in subtree.IterateNodesPrefix()) {
    135136            var primitive = aTile.GetPrimitive(s);
     
    143144        }
    144145
    145         if (node.Parents.Any() && node == node.Parents.First().Children.First()) {
    146           var parent = node.Parents.First();
    147           var index = fragment.Index1 + (parent.Content.Index2 - parent.Content.Index1);
    148           // some mutations create discontinuities which invalidate the index
    149           if (index >= 0 && index < fragment.Root.GetLength()) {
    150             var subtree = fragment.Root.NodeAt(index);
    151             var primitive = aTile.GetPrimitive(subtree);
    152             primitive.Brush = new SolidBrush(Color.LightCoral);
     146        if (node.InArcs.Any()) {
     147          var parent = (FragmentNode)node.InArcs.First().Source;
     148          if (parent.OutArcs.First().Target == node) {
     149            var index = node.SubtreeIndex + (parent.FragmentIndex - parent.SubtreeIndex);
     150            // some mutations create discontinuities which invalidate the index
     151            if (index >= 0 && index < graphNode.Content.Length) {
     152              var subtree = graphNode.Content.NodeAt(index);
     153              var primitive = aTile.GetPrimitive(subtree);
     154              primitive.Brush = new SolidBrush(Color.LightCoral);
     155            }
    153156          }
    154157        }
    155158
    156         foreach (var child in node.Children) {
     159        foreach (var child in node.OutArcs.Select(x => (FragmentNode)x.Target)) {
    157160          var bTile = tileDictionary[child].Tile;
    158161          var bSize = bTile.Size;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.Designer.cs

    r10833 r10888  
    5151      this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();
    5252      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
     53      this.groupBox1 = new System.Windows.Forms.GroupBox();
     54      this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
     55      this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
    5356      this.trace_checkBox = new System.Windows.Forms.CheckBox();
    54       this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
    55       this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
     57      this.hotPaths_button = new System.Windows.Forms.Button();
    5658      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    5759      this.splitContainer1.Panel1.SuspendLayout();
    5860      this.splitContainer1.Panel2.SuspendLayout();
    5961      this.splitContainer1.SuspendLayout();
     62      this.groupBox1.SuspendLayout();
    6063      this.SuspendLayout();
    6164      //
    6265      // splitContainer1
    6366      //
    64       this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Bottom;
    65       this.splitContainer1.Location = new System.Drawing.Point(0, 33);
     67      this.splitContainer1.Location = new System.Drawing.Point(0, 57);
    6668      this.splitContainer1.Name = "splitContainer1";
    6769      //
     
    7375      //
    7476      this.splitContainer1.Panel2.Controls.Add(this.symbolicExpressionTreeChart);
    75       this.splitContainer1.Size = new System.Drawing.Size(1247, 722);
     77      this.splitContainer1.Size = new System.Drawing.Size(1247, 698);
    7678      this.splitContainer1.SplitterDistance = 607;
    7779      this.splitContainer1.TabIndex = 0;
     
    8789      this.genealogyGraphChart.ScaleOnResize = true;
    8890      this.genealogyGraphChart.SimpleLineages = false;
    89       this.genealogyGraphChart.Size = new System.Drawing.Size(607, 722);
     91      this.genealogyGraphChart.Size = new System.Drawing.Size(607, 698);
    9092      this.genealogyGraphChart.TabIndex = 0;
    9193      this.genealogyGraphChart.TraceFragments = false;
     
    98100      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
    99101      this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
    100       this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(636, 722);
     102      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(636, 698);
    101103      this.symbolicExpressionTreeChart.Spacing = 5;
    102104      this.symbolicExpressionTreeChart.SuspendRepaint = false;
    103105      this.symbolicExpressionTreeChart.TabIndex = 0;
    104       this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font(FontFamily.GenericSansSerif, 10);
     106      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
    105107      this.symbolicExpressionTreeChart.Tree = null;
     108      //
     109      // groupBox1
     110      //
     111      this.groupBox1.Controls.Add(this.hotPaths_button);
     112      this.groupBox1.Controls.Add(this.simpleLineages_checkBox);
     113      this.groupBox1.Controls.Add(this.lockGraph_checkBox);
     114      this.groupBox1.Controls.Add(this.trace_checkBox);
     115      this.groupBox1.Location = new System.Drawing.Point(3, 3);
     116      this.groupBox1.Name = "groupBox1";
     117      this.groupBox1.Size = new System.Drawing.Size(1195, 48);
     118      this.groupBox1.TabIndex = 4;
     119      this.groupBox1.TabStop = false;
     120      this.groupBox1.Text = "Controls";
     121      //
     122      // simpleLineages_checkBox
     123      //
     124      this.simpleLineages_checkBox.AutoSize = true;
     125      this.simpleLineages_checkBox.Location = new System.Drawing.Point(94, 19);
     126      this.simpleLineages_checkBox.Name = "simpleLineages_checkBox";
     127      this.simpleLineages_checkBox.Size = new System.Drawing.Size(103, 17);
     128      this.simpleLineages_checkBox.TabIndex = 6;
     129      this.simpleLineages_checkBox.Text = "Simple Lineages";
     130      this.simpleLineages_checkBox.UseVisualStyleBackColor = true;
     131      this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged);
     132      //
     133      // lockGraph_checkBox
     134      //
     135      this.lockGraph_checkBox.AutoSize = true;
     136      this.lockGraph_checkBox.Location = new System.Drawing.Point(6, 19);
     137      this.lockGraph_checkBox.Name = "lockGraph_checkBox";
     138      this.lockGraph_checkBox.Size = new System.Drawing.Size(82, 17);
     139      this.lockGraph_checkBox.TabIndex = 5;
     140      this.lockGraph_checkBox.Text = "Lock Graph";
     141      this.lockGraph_checkBox.UseVisualStyleBackColor = true;
     142      this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged);
    106143      //
    107144      // trace_checkBox
    108145      //
    109146      this.trace_checkBox.AutoSize = true;
    110       this.trace_checkBox.Location = new System.Drawing.Point(611, 10);
     147      this.trace_checkBox.Location = new System.Drawing.Point(203, 19);
    111148      this.trace_checkBox.Name = "trace_checkBox";
    112149      this.trace_checkBox.Size = new System.Drawing.Size(54, 17);
    113       this.trace_checkBox.TabIndex = 1;
     150      this.trace_checkBox.TabIndex = 4;
    114151      this.trace_checkBox.Text = "Trace";
    115152      this.trace_checkBox.UseVisualStyleBackColor = true;
    116153      this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged);
    117154      //
    118       // lockGraph_checkBox
     155      // hotPaths_button
    119156      //
    120       this.lockGraph_checkBox.AutoSize = true;
    121       this.lockGraph_checkBox.Location = new System.Drawing.Point(4, 10);
    122       this.lockGraph_checkBox.Name = "lockGraph_checkBox";
    123       this.lockGraph_checkBox.Size = new System.Drawing.Size(82, 17);
    124       this.lockGraph_checkBox.TabIndex = 2;
    125       this.lockGraph_checkBox.Text = "Lock Graph";
    126       this.lockGraph_checkBox.UseVisualStyleBackColor = true;
    127       this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged);
    128       //
    129       // simpleLineages_checkBox
    130       //
    131       this.simpleLineages_checkBox.AutoSize = true;
    132       this.simpleLineages_checkBox.Location = new System.Drawing.Point(91, 10);
    133       this.simpleLineages_checkBox.Name = "simpleLineages_checkBox";
    134       this.simpleLineages_checkBox.Size = new System.Drawing.Size(103, 17);
    135       this.simpleLineages_checkBox.TabIndex = 3;
    136       this.simpleLineages_checkBox.Text = "Simple Lineages";
    137       this.simpleLineages_checkBox.UseVisualStyleBackColor = true;
    138       this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged);
     157      this.hotPaths_button.Location = new System.Drawing.Point(263, 15);
     158      this.hotPaths_button.Name = "hotPaths_button";
     159      this.hotPaths_button.Size = new System.Drawing.Size(75, 23);
     160      this.hotPaths_button.TabIndex = 7;
     161      this.hotPaths_button.Text = "Hot paths";
     162      this.hotPaths_button.UseVisualStyleBackColor = true;
     163      this.hotPaths_button.Click += new System.EventHandler(this.hotPaths_button_Click);
    139164      //
    140165      // SymboldDataAnalysisGenealogyView
     
    142167      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    143168      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    144       this.Controls.Add(this.simpleLineages_checkBox);
    145       this.Controls.Add(this.lockGraph_checkBox);
    146       this.Controls.Add(this.trace_checkBox);
     169      this.Controls.Add(this.groupBox1);
    147170      this.Controls.Add(this.splitContainer1);
    148171      this.Name = "SymboldDataAnalysisGenealogyView";
     
    152175      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    153176      this.splitContainer1.ResumeLayout(false);
     177      this.groupBox1.ResumeLayout(false);
     178      this.groupBox1.PerformLayout();
    154179      this.ResumeLayout(false);
    155       this.PerformLayout();
    156180
    157181    }
     
    162186    private SymbolicDataAnalysisExpressionGenealogyGraphChart genealogyGraphChart;
    163187    private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;
     188    private System.Windows.Forms.GroupBox groupBox1;
     189    private System.Windows.Forms.CheckBox simpleLineages_checkBox;
     190    private System.Windows.Forms.CheckBox lockGraph_checkBox;
    164191    private System.Windows.Forms.CheckBox trace_checkBox;
    165     private System.Windows.Forms.CheckBox lockGraph_checkBox;
    166     private System.Windows.Forms.CheckBox simpleLineages_checkBox;
     192    private System.Windows.Forms.Button hotPaths_button;
    167193
    168194  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs

    r10755 r10888  
    3030using HeuristicLab.EvolutionTracking.Views;
    3131using HeuristicLab.MainForm;
    32 
    3332
    3433namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
     
    161160    }
    162161    #endregion
     162
     163    private void hotPaths_button_Click(object sender, System.EventArgs e) {
     164      genealogyGraphChart.HighlightHotPaths();
     165    }
    163166  }
    164167}
Note: See TracChangeset for help on using the changeset viewer.