Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/14 17:15:32 (10 years ago)
Author:
bburlacu
Message:

#1772: Small improvements to FragmentGraphView, moved tracking classes to separate folder.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
Files:
1 added
1 edited
10 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10728 r10746  
    193193  <ItemGroup>
    194194    <Compile Include="Exporters\SymbolicSolutionExcelExporter.cs" />
    195     <Compile Include="FragmentGraphView.cs">
    196       <SubType>UserControl</SubType>
    197     </Compile>
    198     <Compile Include="FragmentGraphView.Designer.cs">
    199       <DependentUpon>FragmentGraphView.cs</DependentUpon>
    200     </Compile>
    201195    <Compile Include="InteractiveSymbolicExpressionTreeChart.cs">
    202196      <SubType>UserControl</SubType>
     
    225219      <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
    226220    </Compile>
    227     <Compile Include="SymboldDataAnalysisGenealogyView.cs">
    228       <SubType>UserControl</SubType>
    229     </Compile>
    230     <Compile Include="SymboldDataAnalysisGenealogyView.Designer.cs">
    231       <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    232     </Compile>
    233     <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" />
    234     <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
    235       <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
    236     </Compile>
    237     <Compile Include="SymbolicExpressionChartControl.cs">
    238       <SubType>UserControl</SubType>
    239     </Compile>
    240     <Compile Include="SymbolicExpressionChartControl.Designer.cs">
    241       <DependentUpon>SymbolicExpressionChartControl.cs</DependentUpon>
    242     </Compile>
    243     <Compile Include="SymbolicDataAnalysisExpressionLineageExplorerView.cs">
    244       <SubType>UserControl</SubType>
    245     </Compile>
    246     <Compile Include="SymbolicDataAnalysisExpressionLineageExplorerView.Designer.cs">
    247       <DependentUpon>SymbolicDataAnalysisExpressionLineageExplorerView.cs</DependentUpon>
    248     </Compile>
    249221    <Compile Include="TextualSymbolicDataAnalysisModelView.cs">
    250222      <SubType>UserControl</SubType>
     
    294266    <Compile Include="Symbols\VariableView.Designer.cs">
    295267      <DependentUpon>VariableView.cs</DependentUpon>
     268    </Compile>
     269    <Compile Include="Tracking\FragmentGraphView.cs">
     270      <SubType>UserControl</SubType>
     271    </Compile>
     272    <Compile Include="Tracking\FragmentGraphView.Designer.cs">
     273      <DependentUpon>FragmentGraphView.cs</DependentUpon>
     274    </Compile>
     275    <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.cs">
     276      <SubType>UserControl</SubType>
     277    </Compile>
     278    <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.Designer.cs">
     279      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
     280    </Compile>
     281    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
     282      <SubType>UserControl</SubType>
     283    </Compile>
     284    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
     285      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
     286    </Compile>
     287    <Compile Include="Tracking\SymbolicDataAnalysisExpressionLineageExplorerView.cs">
     288      <SubType>UserControl</SubType>
     289    </Compile>
     290    <Compile Include="Tracking\SymbolicDataAnalysisExpressionLineageExplorerView.Designer.cs">
     291      <DependentUpon>SymbolicDataAnalysisExpressionLineageExplorerView.cs</DependentUpon>
     292    </Compile>
     293    <Compile Include="Tracking\SymbolicExpressionChartControl.cs">
     294      <SubType>UserControl</SubType>
     295    </Compile>
     296    <Compile Include="Tracking\SymbolicExpressionChartControl.Designer.cs">
     297      <DependentUpon>SymbolicExpressionChartControl.cs</DependentUpon>
    296298    </Compile>
    297299    <Compile Include="TreeEditDialogs\SymbolicExpressionTreeConstantNodeEditDialog.cs">
     
    366368    </Content>
    367369  </ItemGroup>
     370  <ItemGroup />
    368371  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    369372  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/FragmentGraphView.cs

    r10732 r10746  
    1313  [Content(typeof(IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>), IsDefaultView = true)]
    1414  public sealed partial class FragmentGraphView : ItemView {
    15     private int PreferredSpacing = 50;
     15    private const int PreferredHorizontalSpacing = 10;
     16    private const int PreferredVerticalSpacing = 25;
    1617
    1718    private ReingoldTilfordLayoutEngine<TileLayoutNode> layoutEngine;
     
    3132
    3233      layoutEngine = new ReingoldTilfordLayoutEngine<TileLayoutNode>(n => n.Children) {
    33         HorizontalSpacing = 50,
    34         VerticalSpacing = 50,
     34        HorizontalSpacing = PreferredHorizontalSpacing,
     35        VerticalSpacing = PreferredVerticalSpacing,
    3536      };
    3637      symbolicExpressionEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(n => n.Subtrees) {
    37         HorizontalSpacing = 50,
    38         VerticalSpacing = 50,
     38        HorizontalSpacing = PreferredHorizontalSpacing,
     39        VerticalSpacing = PreferredVerticalSpacing,
    3940        NodeWidth = 80,
    4041        NodeHeight = 40
     
    7475      layoutEngine.NodeWidth = maxTileWidth;
    7576      layoutEngine.NodeHeight = maxTileHeight;
    76       layoutEngine.HorizontalSpacing = PreferredSpacing;
    77       layoutEngine.VerticalSpacing = PreferredSpacing;
     77      layoutEngine.HorizontalSpacing = PreferredHorizontalSpacing;
     78      layoutEngine.VerticalSpacing = PreferredVerticalSpacing;
    7879
    7980      var visualNodes = layoutEngine.CalculateLayout(fragmentRoot);
     
    9293        var aPos = aTile.Position;
    9394
    94         var lowerLeftMarker = new FixedSizeCircle(chart, aTile.Position, 5, new Pen(Color.Red), new SolidBrush(Color.Transparent));
    95         var upperRightMarker = new FixedSizeCircle(chart, new PointD(aPos.X + aSize.Width, aPos.Y + aSize.Height), 5,
    96           new Pen(Color.Blue), new SolidBrush(Color.Transparent));
    97         symbolicExpressionChartControl.Add(lowerLeftMarker); symbolicExpressionChartControl.Add(upperRightMarker);
     95        // mark swapped fragment
     96        if (node.Content.Index != 0) {
     97          var subtree = node.Content.Root.NodeAt(node.Content.Index);
     98          foreach (var s in subtree.IterateNodesPrefix()) {
     99            var primitive = aTile.GetPrimitive(s);
     100            if (primitive != null) {
     101              var rpb = primitive as RectangularPrimitiveBase;
     102              if (rpb != null) {
     103                rpb.Pen = new Pen(Color.RoyalBlue);
     104              }
     105            }
     106          }
     107        }
     108
     109        // mark the subtree that was replaced by the fragment
     110        if (node.Children.Any() && node.Content.Index != 0) {
     111          var child = node.Children.First();
     112          {
     113            var subtree = child.Content.Root.NodeAt(node.Content.Index);
     114            var tile = tileDictionary[child].Tile;
     115            foreach (var s in subtree.IterateNodesPrefix()) {
     116              var primitive = tile.GetPrimitive(s);
     117              if (primitive != null) {
     118                var rpb = primitive as RectangularPrimitiveBase;
     119                if (rpb != null) {
     120                  rpb.Pen = new Pen(Color.DarkOrange);
     121                }
     122              }
     123            }
     124          }
     125        }
    98126
    99127        foreach (var child in node.Children) {
     
    104132          var line = new Line(chart, new PointD(aPos.X + aSize.Width / 2.0, aPos.Y + aSize.Height), new PointD(bPos.X + bSize.Width / 2.0, bPos.Y));
    105133          symbolicExpressionChartControl.Add(line);
     134
     135
    106136        }
    107137      }
    108       //      symbolicExpressionChartControl.FlipVertical();
    109138      symbolicExpressionChartControl.UpdateEnabled = true;
    110139      symbolicExpressionChartControl.EnforceUpdate();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs

    r10732 r10746  
    182182        var fragmentLength = fragment.Root.GetLength();
    183183
    184         var fragmentNode = new FragmentNode { Content = new Fragment<ISymbolicExpressionTreeNode> { Root = subtree }, Rank = graphNode.Rank };
     184        var fragmentNode = new FragmentNode {
     185          Content = new Fragment<ISymbolicExpressionTreeNode> {
     186            Root = subtree,
     187          },
     188          Rank = graphNode.Rank
     189        };
     190
    185191        if (parentNode != null) {
    186           if (parentNode == fragmentNode)
     192          if (parentNode == fragmentNode) {
    187193            throw new Exception("Node cannot be a child of itself!");
     194          }
    188195          var arc = new GenealogyGraphArc { Source = parentNode, Target = fragmentNode };
    189196          parentNode.AddForwardArc(arc);
    190197        }
    191198        fragmentGraph.AddVertex(fragmentNode);
     199
    192200        parentNode = fragmentNode;
    193201
     
    213221        if (subtreeIndex < fragment.Index && fragment.Index < subtreeIndex + subtreeLength) {
    214222          if (fragmentLength >= subtreeLength) throw new Exception("Subtree contains fragment, so fragment length should be less than the subtree length.");
    215 
     223          fragmentNode.Content.Index = fragment.Index - subtreeIndex;
    216224          graphNode = parentVertices[0];
     225          // debug check
    217226          tree = graphNode.Content;
    218227          subtree = tree.NodeAt(subtreeIndex);
     228          if (subtree.GetLength() <= fragmentNode.Content.Index) {
     229            throw new Exception("Index exceeds subtree length.");
     230          }
    219231          // track subtree
    220232          Trace(graphNode, subtree, fragmentGraph, fragmentNode);
     
    222234          // track fragment
    223235          if (parentVertices.Count > 1) {
     236            // save the index of the current fragment in the tree where it was swapped
    224237            graphNode = parentVertices[1];
    225238            tree = graphNode.Content;
Note: See TracChangeset for help on using the changeset viewer.