Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/14 17:15:33 (11 years ago)
Author:
bburlacu
Message:

#1772: Simplified genealogy graph and fragment graph creation:

  • the genealogy graph now has a 1-1 mapping between content and vertices (as opposed to 1-n as it was previously, to account for elites); this required changes to the directed graph implementation
  • the fragment graph only contains bifurcation points (where the subtree contains the fragment so tracing must be done both ways (in the root parent AND in the other parent). in the other cases, tracing is restarted from the parent genealogy graph node.
Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
Files:
2 edited

Legend:

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

    r10752 r10755  
    22using System.Drawing;
    33using System.Linq;
     4using HeuristicLab.Common;
    45using HeuristicLab.Core.Views;
    56using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    9394        var aPos = aTile.Position;
    9495
    95         if (node.Content.Index > 0) {
    96           var subtree = node.Content.Root.NodeAt(node.Content.Index);
    97           foreach (var s in subtree.IterateNodesPrefix()) {
     96        if (node.Rank.IsAlmost(0)) {
     97          foreach (var s in node.Content.Root.IterateNodesPrefix()) {
    9898            var primitive = aTile.GetPrimitive(s);
    9999            if (primitive != null) {
    100100              var rpb = primitive as RectangularPrimitiveBase;
    101101              if (rpb != null) {
    102                 rpb.Pen = new Pen(Color.RoyalBlue);
     102                rpb.Pen = new Pen(Color.ForestGreen);
     103              }
     104            }
     105          }
     106        } else {
     107
     108          if (node.Content.Index1 > 0) {
     109            var subtree = node.Content.Root.NodeAt(node.Content.Index1);
     110            foreach (var s in subtree.IterateNodesPrefix()) {
     111              var primitive = aTile.GetPrimitive(s);
     112              if (primitive != null) {
     113                var rpb = primitive as RectangularPrimitiveBase;
     114                if (rpb != null) {
     115                  rpb.Pen = new Pen(Color.RoyalBlue);
     116                }
    103117              }
    104118            }
     
    115129
    116130          if (child == node.Children.First()) {
    117             if (node.Content.Index > 0) {
    118               var subtree = child.Content.Root.NodeAt(node.Content.Index);
     131            if (node.Content.Index1 > 0) {
     132              var subtree = child.Content.Root.NodeAt(node.Content.Index1);
    119133              foreach (var s in subtree.IterateNodesPrefix()) {
    120134                var primitive = bTile.GetPrimitive(s);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs

    r10752 r10755  
    8181        var fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data;
    8282        if (fragment != null) {
    83           treeChart_HighlightSubtree(fragment.Root);
     83          treeChart_HighlightSubtree(graphNode.Content.NodeAt(fragment.Index1));
    8484        }
    8585      }
     
    101101        var subtreeIndex = graphNode.Content.IterateNodesPrefix().ToList().IndexOf(subtree);
    102102        var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex);
    103         MainFormManager.MainForm.ShowContent(fragmentGraph); // display the fragment graph on the screen
     103        if (fragmentGraph.Nodes.Any()) {
     104          MainFormManager.MainForm.ShowContent(fragmentGraph); // display the fragment graph on the screen
     105        }
    104106      } else {
    105107        // perform matching like it was done before
     
    108110        var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer));
    109111
    110         var matchingVertices = matchingTrees.SelectMany(x => Content[x]).Cast<IGenealogyGraphNode<ISymbolicExpressionTree>>();
     112        var matchingVertices = matchingTrees.Select(x => Content[x]).Cast<IGenealogyGraphNode<ISymbolicExpressionTree>>();
    111113        graphChart_highlightMatchingVertices(matchingVertices);
    112114      }
Note: See TracChangeset for help on using the changeset viewer.