Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/12 16:12:15 (12 years ago)
Author:
bburlacu
Message:

#1772: Performance improvements for the GenealogyGraph. Minor refactoring to VisualGenealogyGraphArc and VisualGenealogyGraphNode classes. Added new functionality to the SymbolicExpressionTreeFragmentsAnalyzer, minor refactoring in the other two analyzers. Refactored View code. Updated project references and plugin dependencies and added HeuristicLab.Problems.DataAnalysis.Symbolic to the branch.

Location:
branches/HeuristicLab.EvolutionaryTracking
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking

    • Property svn:ignore
      •  

        old new  
         1*.suo
        12_ReSharper.HeuristicLab.Tracking
        23bin
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views

    • Property svn:ignore set to
      *.user
      bin
      obj
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.Designer.cs

    r7779 r8213  
    5959
    6060    #endregion
    61 
    62     //private System.Windows.Forms.ToolTip toolTip;
    6361  }
    6462}
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs

    r7817 r8213  
    2626using System.Linq;
    2727using System.Windows.Forms;
     28using HeuristicLab.Common;
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2930using HeuristicLab.Visualization;
     
    3334    private Dictionary<GenealogyGraphNode, List<VisualGenealogyGraphNode>> _visualNodeMap;
    3435    private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> _visualArcMap;
    35     private const int Diameter = 20;
    36     private int x, y;
    37     private const int Cx = 30, Cy = 30;
    38 
     36    private const int Diameter = 20; // node diameter
     37    private int x, y; // coordinates for positioning each node
     38    private const int Cx = 30, Cy = 30; // position increments
    3939    private VisualGenealogyGraphNode _selectedGenealogyGraphNode;
    4040    public VisualGenealogyGraphNode SelectedGenealogyGraphNode { get { return _selectedGenealogyGraphNode; } }
     
    7474      for (int i = 0; i != count; ++i) {
    7575        // propagate elites from successive layers
    76         if (currRank == (int)currRank) prevLayer = currLayer;
     76        bool f = currRank % 1 == 0;
     77        if (f) // if the rank is an integer, then we need to propagate elites
     78          prevLayer = currLayer;
    7779        currRank = layers.ElementAt(i).Key;
    7880        currLayer = layers.ElementAt(i).ToList();
    79         if (i > 0 && currRank == (int)currRank) {
    80           // this code injects elites that propagate from the previous generation into the current graph layer, so that they can be represented as visual nodes
    81           int prevCount = prevLayer.Count(node => node.IsElite);
    82           int currCount = currLayer.Count(node => node.IsElite);
    83           for (int j = currCount; j < prevCount; ++j) currLayer.Add(prevLayer.ElementAt(j));
     81        if (i > 0 && f) {
     82          // this following code injects elites that propagate from the previous generation into the current graph layer,
     83          // so that they can be represented as visual nodes
     84          int prevEliteCount = prevLayer.Count(node => node.IsElite);
     85          int currEliteCount = currLayer.Count(node => node.IsElite);
     86          for (int j = currEliteCount; j < prevEliteCount; ++j)
     87            currLayer.Add(prevLayer.ElementAt(j));
    8488        }
    8589        currLayer.Sort(); // uses the CompareTo() method inside the GenealogyGraphNode class
    86 
    8790        foreach (var node in currLayer) {
    8891          var pen = new Pen(Color.LightGray);
    8992          var nl = Environment.NewLine;
    9093          var visualNode = new VisualGenealogyGraphNode(Chart, x, y, x + Diameter, y + Diameter, pen, null) {
    91             Data = node, ToolTipText = "Id: " + node.Label + nl + "Rank: " + node.Rank + nl + "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl + "IsElite: " + node.IsElite
     94            Data = node,
     95            ToolTipText = "Id: " + node.Label + nl +
     96                          "Rank: " + node.Rank + nl +
     97                          "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl +
     98                          "IsElite: " + node.IsElite
    9299          };
    93100          Chart.Group.Add(visualNode);
    94           if (!_visualNodeMap.ContainsKey(node)) _visualNodeMap[node] = new List<VisualGenealogyGraphNode>();
     101          if (!_visualNodeMap.ContainsKey(node))
     102            _visualNodeMap[node] = new List<VisualGenealogyGraphNode>();
    95103          _visualNodeMap[node].Add(visualNode);
    96           // connect visual nodes that actually represent the same individual in the genealogy graph (this applies for elites) with a dashed line
     104          // connect visual nodes that actually represent the same individual
     105          // in the genealogy graph (this applies for elites) with a dashed line
    97106          if (_visualNodeMap[node].Count > 1) {
    98107            for (int c = _visualNodeMap[node].Count; c >= 2; --c) {
     
    104113          }
    105114          x += Cx; // increment horizontal coordinate
    106           if (node.InEdges == null) continue;
     115          if (node.InEdges == null && _visualNodeMap.ContainsKey(node)) continue;
    107116          // add visual edges
    108117          foreach (var arc in node.InEdges) {
    109118            var parent = arc.Target;
    110119            // find the visual parent node that is closest to the current node in terms of vertical distance
    111             var visualParent = _visualNodeMap[parent].Where(p => p.Center.Y > visualNode.Center.Y).OrderByDescending(p => p.Center.Y).Last();
     120            var visualParent = _visualNodeMap[parent].Where(p => p.Center.Y >= visualNode.Center.Y).OrderByDescending(p => p.Center.Y).Last();
    112121            DashStyle style;
    113             if (visualParent.Data == visualNode.Data) {
     122            if (visualParent.Data == visualNode.Data) { // if the graph nodes represent the same elite individual
    114123              style = DashStyle.Dash;
    115124            } else {
     
    143152        base.pictureBox_MouseUp(sender, e);
    144153      else { // select mode
    145         Chart.UpdateEnabled = false;
    146         // clear colors
    147         foreach (var primitive in Chart.Group.Primitives) {
    148           if (primitive is VisualGenealogyGraphNode) {
    149             var visualNode = primitive as VisualGenealogyGraphNode;
    150             visualNode.Brush = null;
    151           } else if (primitive is VisualGenealogyGraphArc) {
    152             var visualArc = primitive as VisualGenealogyGraphArc;
    153             if (visualArc.Source.Data != visualArc.Target.Data) visualArc.Pen.Brush = new SolidBrush(Color.Transparent);
    154           }
    155         }
    156154        // get selected node
    157155        var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList();
    158156        if (visualNodes.Count > 0) {
     157          if (_selectedGenealogyGraphNode == visualNodes[0]) return;
    159158          _selectedGenealogyGraphNode = visualNodes[0] as VisualGenealogyGraphNode;
    160           // color selected node and its genealogy
    161159          if (_selectedGenealogyGraphNode == null) return;
    162           // use special highlighting for the currently selected genealogy graph node
     160          // new node has been selected, clean up
     161          Chart.UpdateEnabled = false;
     162          // clear colors
     163          ClearAllNodes();
     164          // use a rectangle to highlight the currently selected genealogy graph node
    163165          var center = _selectedGenealogyGraphNode.Center;
    164166          var size = _selectedGenealogyGraphNode.Size;
    165           double x1 = center.X - size.Width / 2, x2 = x1 + size.Width;
    166           double y1 = center.Y - size.Height / 2, y2 = y1 + size.Height;
    167           if (_targetRectangle != null) _targetRectangle.SetPosition(x1, y1, x2, y2);
    168           else {
     167          double x1 = center.X - size.Width / 2;
     168          double x2 = x1 + size.Width;
     169          double y1 = center.Y - size.Height / 2;
     170          double y2 = y1 + size.Height;
     171          if (_targetRectangle == null) {
    169172            _targetRectangle = new Visualization.Rectangle(Chart, x1, y1, x2, y2, new Pen(Color.Black), null);
    170173            Chart.Group.Add(_targetRectangle);
     174          } else {
     175            _targetRectangle.SetPosition(x1, y1, x2, y2);
    171176          }
    172177          var gNode = _selectedGenealogyGraphNode.Data; // genealogy graph node (representing an individual in the population)
    173178          double rank = gNode.Rank;
     179          // ancestors
    174180          var ancestors = gNode.Ancestors().Where(a => a.Rank < rank).ToList();
    175181          ancestors.Add(gNode);
    176           // highlight selected node and its ancestry
    177           foreach (var node in ancestors.SelectMany(n => _visualNodeMap[n])) {
    178             node.Brush = new SolidBrush(node.ToColor());
    179             if (node.IncomingArcs != null && node == _visualNodeMap[node.Data].First()) {
    180               foreach (var arc in node.IncomingArcs) {
    181                 if (arc.Source.Data == node.Data) continue;
    182                 var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
    183                 var end = new Point((int)arc.End.X, (int)arc.End.Y);
    184                 arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
    185               }
    186             }
    187           }
    188           // highlight the descendants
     182          // descendants
    189183          var descendants = gNode.Descendants().Where(a => a.Rank > rank).ToList();
    190184          descendants.Add(gNode);
    191           foreach (var node in descendants.SelectMany(n => _visualNodeMap[n])) {
     185          // highlight ancestors
     186          foreach (var node in ancestors.Select(n => _visualNodeMap[n][0])) {
    192187            node.Brush = new SolidBrush(node.ToColor());
    193             foreach (var arc in node.IncomingArcs.Where(a => descendants.Contains(a.Source.Data))) {
    194               if (arc.Source.Data == node.Data) continue;
    195               var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
    196               var end = new Point((int)arc.End.X, (int)arc.End.Y);
    197               arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
    198             }
     188            if (node.IncomingArcs != null)
     189              foreach (var arc in node.IncomingArcs)
     190                if (arc.Source.Data != arc.Target.Data && arc.Source == _visualNodeMap[arc.Source.Data][0]) {
     191                  var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
     192                  var end = new Point((int)arc.End.X, (int)arc.End.Y);
     193                  arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
     194                }
     195          }
     196          // highlight descendants
     197          foreach (var node in descendants.Select(n => _visualNodeMap[n][0])) {
     198            node.Brush = new SolidBrush(node.ToColor());
     199            if (node.OutgoingArcs != null)
     200              foreach (var arc in node.OutgoingArcs)
     201                if (arc.Source.Data != arc.Target.Data && arc.Target == _visualNodeMap[arc.Target.Data][0]) {
     202                  var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
     203                  var end = new Point((int)arc.End.X, (int)arc.End.Y);
     204                  arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
     205                }
    199206          }
    200207        } else {
     
    206213        if (_selectedGenealogyGraphNode != null)
    207214          /* emit clicked event */
    208           GenealogyGraphNodeClicked(_selectedGenealogyGraphNode, e);
     215          OnGenealogyGraphNodeClicked(_selectedGenealogyGraphNode, e);
    209216      }
    210217    }
    211218
    212219    public void ClearAllNodes() {
     220      foreach (var primitive in Chart.Group.Primitives) {
     221        if (primitive.Brush != null)
     222          primitive.Brush = null;
     223        if (primitive is VisualGenealogyGraphArc) {
     224          var arc = primitive as VisualGenealogyGraphArc;
     225          if (arc.Source.Data != arc.Target.Data && primitive.Pen.Brush != null)
     226            primitive.Pen.Brush = new SolidBrush(Color.Transparent);
     227        }
     228      }
     229    }
     230
     231    public void HighlightLineage(IEnumerable<GenealogyGraphNode> nodes) {
     232      foreach (var node in nodes.SelectMany(n => _visualNodeMap[n])) {
     233        node.Brush = new SolidBrush(node.ToColor());
     234        if (node.IncomingArcs != null && node == _visualNodeMap[node.Data][0]) {
     235          foreach (var arc in node.IncomingArcs) {
     236            if (arc.Source.Data == node.Data) continue;
     237            var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
     238            var end = new Point((int)arc.End.X, (int)arc.End.Y);
     239            arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
     240          }
     241        }
     242      }
     243    }
     244
     245    public void HighlightNodes(IEnumerable<ISymbolicExpressionTree> trees, Color color) {
     246      foreach (var visualNode in trees.Select(tree => _visualNodeMap[Graph.GetNode(tree)]).SelectMany(vList => vList))
     247        visualNode.Brush = new SolidBrush(color);
     248    }
     249
     250    public void HighlightInDegree() {
    213251      Chart.UpdateEnabled = false;
    214       foreach (var node in Chart.Group.Primitives.Where(p => p is VisualGenealogyGraphNode).Cast<VisualGenealogyGraphNode>()) {
    215         node.Brush = null;
    216         if (node.IncomingArcs != null)
    217           foreach (var arc in node.IncomingArcs)
    218             if (arc.Source.Data != node.Data) arc.Pen = new Pen(Color.Transparent);
     252      ClearAllNodes();
     253      var graphNodes = Graph.Values.ToList();
     254      double min = graphNodes.Min(x => x.InEdges == null ? 0 : x.InEdges.Count);
     255      double max = graphNodes.Max(x => x.InEdges == null ? 0 : x.InEdges.Count);
     256      foreach (var graphNode in graphNodes) {
     257        var visualNode = _visualNodeMap[graphNode][0];
     258        double deg = graphNode.InEdges == null ? 0 : graphNode.InEdges.Count;
     259        var color = Color.FromArgb((int)(1 - deg / max) * 255, (int)(deg / max * 255), 100);
     260        visualNode.Brush = new SolidBrush(color);
    219261      }
    220262      Chart.UpdateEnabled = true;
     
    222264    }
    223265
    224     public void HighlightNodes(IEnumerable<ISymbolicExpressionTree> trees, Color color) {
     266    public void HighlightOutDegree() {
    225267      Chart.UpdateEnabled = false;
    226       foreach (var visualNode in trees.Select(tree => _visualNodeMap[Graph.GetNode(tree)]).SelectMany(vList => vList))
    227         visualNode.Brush = new SolidBrush(color);
    228 
     268      ClearAllNodes();
     269      var graphNodes = Graph.Values.ToList();
     270      double min = graphNodes.Min(x => x.OutEdges == null ? 0 : x.OutEdges.Count);
     271      double max = graphNodes.Max(x => x.OutEdges == null ? 0 : x.OutEdges.Count);
     272      foreach (var graphNode in graphNodes) {
     273        var visualNode = _visualNodeMap[graphNode][0];
     274        double deg = graphNode.OutEdges == null ? 0 : graphNode.OutEdges.Count;
     275        int index = (int)(deg / max * ColorGradient.Colors.Count) - 1;
     276        if (index < 0) index = 0;
     277        visualNode.Brush = new SolidBrush(ColorGradient.Colors[index]);
     278      }
    229279      Chart.UpdateEnabled = true;
    230280      Chart.EnforceUpdate();
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.Designer.cs

    r7779 r8213  
    2727      this.mainTableLayout = new System.Windows.Forms.TableLayoutPanel();
    2828      this.splitContainer = new System.Windows.Forms.SplitContainer();
    29       this.topControlBox = new System.Windows.Forms.GroupBox();
    30       this.similarityModeLabel = new System.Windows.Forms.Label();
    31       this.similarityModeSelector = new System.Windows.Forms.ComboBox();
    32       this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
    3329      this.genealogyTableLayout = new System.Windows.Forms.TableLayoutPanel();
    3430      this.graphControlsPanel = new System.Windows.Forms.Panel();
     
    3632      this.moveModeButton = new System.Windows.Forms.RadioButton();
    3733      this.zoomModeButton = new System.Windows.Forms.RadioButton();
     34      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
     35      this.topControlBox = new System.Windows.Forms.GroupBox();
     36      this.similarityModeLabel = new System.Windows.Forms.Label();
     37      this.similarityModeSelector = new System.Windows.Forms.ComboBox();
    3838      this.genealogyGraphChart = new HeuristicLab.EvolutionaryTracking.Views.GenealogyGraphChart();
     39      this.inDegreeButton = new System.Windows.Forms.Button();
     40      this.outDegreeButton = new System.Windows.Forms.Button();
    3941      this.mainTableLayout.SuspendLayout();
    4042      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
     
    4244      this.splitContainer.Panel2.SuspendLayout();
    4345      this.splitContainer.SuspendLayout();
    44       this.topControlBox.SuspendLayout();
    4546      this.genealogyTableLayout.SuspendLayout();
    4647      this.graphControlsPanel.SuspendLayout();
     48      this.topControlBox.SuspendLayout();
    4749      this.SuspendLayout();
    4850      //
     
    8385      this.splitContainer.TabIndex = 7;
    8486      //
    85       // topControlBox
    86       //
    87       this.topControlBox.Controls.Add(this.similarityModeLabel);
    88       this.topControlBox.Controls.Add(this.similarityModeSelector);
    89       this.topControlBox.Dock = System.Windows.Forms.DockStyle.Fill;
    90       this.topControlBox.Location = new System.Drawing.Point(3, 3);
    91       this.topControlBox.Name = "topControlBox";
    92       this.topControlBox.Size = new System.Drawing.Size(522, 44);
    93       this.topControlBox.TabIndex = 6;
    94       this.topControlBox.TabStop = false;
    95       this.topControlBox.Text = "Controls";
    96       //
    97       // similarityModeLabel
    98       //
    99       this.similarityModeLabel.AutoSize = true;
    100       this.similarityModeLabel.Location = new System.Drawing.Point(6, 20);
    101       this.similarityModeLabel.Name = "similarityModeLabel";
    102       this.similarityModeLabel.Size = new System.Drawing.Size(80, 13);
    103       this.similarityModeLabel.TabIndex = 1;
    104       this.similarityModeLabel.Text = "Similarity Mode:";
    105       //
    106       // similarityModeSelector
    107       //
    108       this.similarityModeSelector.FormattingEnabled = true;
    109       this.similarityModeSelector.Items.AddRange(new object[] {
    110             "Exact",
    111             "High",
    112             "Relaxed"});
    113       this.similarityModeSelector.Location = new System.Drawing.Point(92, 17);
    114       this.similarityModeSelector.Name = "similarityModeSelector";
    115       this.similarityModeSelector.Size = new System.Drawing.Size(148, 21);
    116       this.similarityModeSelector.TabIndex = 0;
    117       this.similarityModeSelector.SelectedIndexChanged += new System.EventHandler(this.similarityModeSelector_SelectedIndexChanged);
    118       //
    119       // symbolicExpressionTreeChart
    120       //
    121       this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
    122       this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
    123       this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
    124       this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
    125       this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
    126       this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(275, 385);
    127       this.symbolicExpressionTreeChart.Spacing = 5;
    128       this.symbolicExpressionTreeChart.SuspendRepaint = false;
    129       this.symbolicExpressionTreeChart.TabIndex = 2;
    130       this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
    131       this.symbolicExpressionTreeChart.Tree = null;
    132       //
    13387      // genealogyTableLayout
    13488      //
     
    148102      // graphControlsPanel
    149103      //
     104      this.graphControlsPanel.Controls.Add(this.outDegreeButton);
     105      this.graphControlsPanel.Controls.Add(this.inDegreeButton);
    150106      this.graphControlsPanel.Controls.Add(this.selectModeButton);
    151107      this.graphControlsPanel.Controls.Add(this.moveModeButton);
     
    160116      this.selectModeButton.Appearance = System.Windows.Forms.Appearance.Button;
    161117      this.selectModeButton.AutoSize = true;
    162       this.selectModeButton.Location = new System.Drawing.Point(103, 3);
     118      this.selectModeButton.Location = new System.Drawing.Point(65, 3);
    163119      this.selectModeButton.Name = "selectModeButton";
    164       this.selectModeButton.Size = new System.Drawing.Size(47, 23);
     120      this.selectModeButton.Size = new System.Drawing.Size(24, 23);
    165121      this.selectModeButton.TabIndex = 5;
    166122      this.selectModeButton.TabStop = true;
    167       this.selectModeButton.Text = "Select";
     123      this.selectModeButton.Text = "S";
    168124      this.selectModeButton.UseVisualStyleBackColor = true;
    169125      this.selectModeButton.CheckedChanged += new System.EventHandler(this.selectModeButton_CheckedChanged);
     
    175131      this.moveModeButton.Location = new System.Drawing.Point(3, 3);
    176132      this.moveModeButton.Name = "moveModeButton";
    177       this.moveModeButton.Size = new System.Drawing.Size(44, 23);
     133      this.moveModeButton.Size = new System.Drawing.Size(26, 23);
    178134      this.moveModeButton.TabIndex = 3;
    179135      this.moveModeButton.TabStop = true;
    180       this.moveModeButton.Text = "Move";
     136      this.moveModeButton.Text = "M";
    181137      this.moveModeButton.UseVisualStyleBackColor = true;
    182138      this.moveModeButton.CheckedChanged += new System.EventHandler(this.moveModeButton_CheckedChanged);
     
    186142      this.zoomModeButton.Appearance = System.Windows.Forms.Appearance.Button;
    187143      this.zoomModeButton.AutoSize = true;
    188       this.zoomModeButton.Location = new System.Drawing.Point(53, 3);
     144      this.zoomModeButton.Location = new System.Drawing.Point(35, 3);
    189145      this.zoomModeButton.Name = "zoomModeButton";
    190       this.zoomModeButton.Size = new System.Drawing.Size(44, 23);
     146      this.zoomModeButton.Size = new System.Drawing.Size(24, 23);
    191147      this.zoomModeButton.TabIndex = 4;
    192148      this.zoomModeButton.TabStop = true;
    193       this.zoomModeButton.Text = "Zoom";
     149      this.zoomModeButton.Text = "Z";
    194150      this.zoomModeButton.UseVisualStyleBackColor = true;
    195151      this.zoomModeButton.CheckedChanged += new System.EventHandler(this.zoomModeButton_CheckedChanged);
     152      //
     153      // symbolicExpressionTreeChart
     154      //
     155      this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
     156      this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
     157      this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
     158      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
     159      this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
     160      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(275, 385);
     161      this.symbolicExpressionTreeChart.Spacing = 5;
     162      this.symbolicExpressionTreeChart.SuspendRepaint = false;
     163      this.symbolicExpressionTreeChart.TabIndex = 2;
     164      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
     165      this.symbolicExpressionTreeChart.Tree = null;
     166      //
     167      // topControlBox
     168      //
     169      this.topControlBox.Controls.Add(this.similarityModeLabel);
     170      this.topControlBox.Controls.Add(this.similarityModeSelector);
     171      this.topControlBox.Dock = System.Windows.Forms.DockStyle.Fill;
     172      this.topControlBox.Location = new System.Drawing.Point(3, 3);
     173      this.topControlBox.Name = "topControlBox";
     174      this.topControlBox.Size = new System.Drawing.Size(522, 44);
     175      this.topControlBox.TabIndex = 6;
     176      this.topControlBox.TabStop = false;
     177      this.topControlBox.Text = "Controls";
     178      //
     179      // similarityModeLabel
     180      //
     181      this.similarityModeLabel.AutoSize = true;
     182      this.similarityModeLabel.Location = new System.Drawing.Point(6, 20);
     183      this.similarityModeLabel.Name = "similarityModeLabel";
     184      this.similarityModeLabel.Size = new System.Drawing.Size(80, 13);
     185      this.similarityModeLabel.TabIndex = 1;
     186      this.similarityModeLabel.Text = "Similarity Mode:";
     187      //
     188      // similarityModeSelector
     189      //
     190      this.similarityModeSelector.FormattingEnabled = true;
     191      this.similarityModeSelector.Items.AddRange(new object[] {
     192            "Exact",
     193            "High",
     194            "Relaxed"});
     195      this.similarityModeSelector.Location = new System.Drawing.Point(92, 17);
     196      this.similarityModeSelector.Name = "similarityModeSelector";
     197      this.similarityModeSelector.Size = new System.Drawing.Size(148, 21);
     198      this.similarityModeSelector.TabIndex = 0;
     199      this.similarityModeSelector.SelectedIndexChanged += new System.EventHandler(this.similarityModeSelector_SelectedIndexChanged);
    196200      //
    197201      // genealogyGraphChart
     
    204208      this.genealogyGraphChart.Size = new System.Drawing.Size(233, 343);
    205209      this.genealogyGraphChart.TabIndex = 2;
     210      //
     211      // inDegreeButton
     212      //
     213      this.inDegreeButton.AutoSize = true;
     214      this.inDegreeButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     215      this.inDegreeButton.Location = new System.Drawing.Point(95, 3);
     216      this.inDegreeButton.Name = "inDegreeButton";
     217      this.inDegreeButton.Size = new System.Drawing.Size(28, 23);
     218      this.inDegreeButton.TabIndex = 6;
     219      this.inDegreeButton.Text = "IN";
     220      this.inDegreeButton.UseVisualStyleBackColor = true;
     221      this.inDegreeButton.Click += new System.EventHandler(this.inDegreeButton_Click);
     222      //
     223      // outDegreeButton
     224      //
     225      this.outDegreeButton.AutoSize = true;
     226      this.outDegreeButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     227      this.outDegreeButton.Location = new System.Drawing.Point(129, 3);
     228      this.outDegreeButton.Name = "outDegreeButton";
     229      this.outDegreeButton.Size = new System.Drawing.Size(40, 23);
     230      this.outDegreeButton.TabIndex = 7;
     231      this.outDegreeButton.Text = "OUT";
     232      this.outDegreeButton.UseVisualStyleBackColor = true;
     233      this.outDegreeButton.Click += new System.EventHandler(this.outDegreeButton_Click);
    206234      //
    207235      // GenealogyGraphView
     
    217245      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    218246      this.splitContainer.ResumeLayout(false);
    219       this.topControlBox.ResumeLayout(false);
    220       this.topControlBox.PerformLayout();
    221247      this.genealogyTableLayout.ResumeLayout(false);
    222248      this.graphControlsPanel.ResumeLayout(false);
    223249      this.graphControlsPanel.PerformLayout();
     250      this.topControlBox.ResumeLayout(false);
     251      this.topControlBox.PerformLayout();
    224252      this.ResumeLayout(false);
    225253
     
    240268    private System.Windows.Forms.RadioButton moveModeButton;
    241269    private System.Windows.Forms.RadioButton zoomModeButton;
     270    private System.Windows.Forms.Button inDegreeButton;
     271    private System.Windows.Forms.Button outDegreeButton;
    242272
    243273  }
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs

    r7997 r8213  
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
    3030using HeuristicLab.MainForm;
     31using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3132using HeuristicLab.Visualization;
    3233
     
    9293      var genealogyGraphNode = (GenealogyGraphNode)visualGenealogyGraphNode.Data;
    9394      symbolicExpressionTreeChart.Tree = (ISymbolicExpressionTree)genealogyGraphNode.Data;
     95      // highlight the relevant fragment in the symbolic expression tree
    9496      if (_selectedVisualSymbolicExpressionTreeNode != null) {
    9597        var nodes = symbolicExpressionTreeChart.Tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
     
    140142      var treeNode = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode;
    141143      Color[] colors = { Color.LightSkyBlue, Color.PaleGreen, Color.Tan };
    142 
     144      // update visual graph nodes
     145      genealogyGraphChart.Chart.UpdateEnabled = false;
    143146      genealogyGraphChart.ClearAllNodes(); // clear node colors
    144147      // color each graph node according to the degree to which it matches the selected tree fragment
     
    147150        if (owners.Any()) genealogyGraphChart.HighlightNodes(owners, colors[i]); // highlight matching individuals from the genealogy
    148151      }
     152      genealogyGraphChart.Chart.UpdateEnabled = true;
     153      genealogyGraphChart.Chart.EnforceUpdate();
    149154
    150155      // highlight subtree nodes in the tree chart
     
    164169      var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, similarityModeSelector.SelectedIndex).ToList();
    165170      if (owners.Any()) {
     171        genealogyGraphChart.Chart.UpdateEnabled = false;
    166172        genealogyGraphChart.ClearAllNodes(); // clear the fill color of all nodes
    167173        genealogyGraphChart.HighlightNodes(owners, Color.LightSkyBlue); // highlight matching individuals from the genealogy
     174        genealogyGraphChart.Chart.UpdateEnabled = true;
    168175      }
     176      genealogyGraphChart.Chart.EnforceUpdate();
    169177      // highlight subtree nodes in the tree chart
    170178      foreach (var visualNode in symbolicExpressionTreeChart.Tree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))
     
    174182    }
    175183    #endregion
     184
     185    private void inDegreeButton_Click(object sender, EventArgs e) {
     186      genealogyGraphChart.HighlightInDegree();
     187    }
     188
     189    private void outDegreeButton_Click(object sender, EventArgs e) {
     190      genealogyGraphChart.HighlightOutDegree();
     191    }
    176192  }
    177193}
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/HeuristicLab.EvolutionaryTracking.Views-3.4.csproj

    r7779 r8213  
    1818    <DebugType>full</DebugType>
    1919    <Optimize>false</Optimize>
    20     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     20    <OutputPath>..\..\..\..\Trunk\sources\bin\</OutputPath>
    2121    <DefineConstants>DEBUG;TRACE</DefineConstants>
    2222    <ErrorReport>prompt</ErrorReport>
     
    2626    <DebugType>pdbonly</DebugType>
    2727    <Optimize>true</Optimize>
    28     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     28    <OutputPath>..\..\..\..\Trunk\sources\bin\</OutputPath>
    2929    <DefineConstants>TRACE</DefineConstants>
    3030    <ErrorReport>prompt</ErrorReport>
     
    6767      <SpecificVersion>False</SpecificVersion>
    6868      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
    69     </Reference>
    70     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    71       <SpecificVersion>False</SpecificVersion>
    72       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
    7369    </Reference>
    7470    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    118114      <Name>HeuristicLab.EvolutionaryTracking-3.4</Name>
    119115    </ProjectReference>
     116    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
     117      <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
     118      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
     119    </ProjectReference>
    120120  </ItemGroup>
    121121  <ItemGroup>
     
    123123  </ItemGroup>
    124124  <ItemGroup>
     125    <EmbeddedResource Include="GenealogyGraphView.resx">
     126      <DependentUpon>GenealogyGraphView.cs</DependentUpon>
     127    </EmbeddedResource>
    125128    <EmbeddedResource Include="Properties\Resources.resx">
    126129      <Generator>ResXFileCodeGenerator</Generator>
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs

    r7779 r8213  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2522using HeuristicLab.PluginInfrastructure;
    2623
     
    2825  [Plugin("HeuristicLab.EvolutionaryTracking.Views", "Provides controls and views for the evolution graph and related structures.", "3.4.2.7439")]
    2926  [PluginFile("HeuristicLab.EvolutionaryTracking.Views-3.4.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.Collections", "3.3")]
    31   [PluginDependency("HeuristicLab.Common", "3.3")]
    3227  [PluginDependency("HeuristicLab.Core", "3.3")]
    33   [PluginDependency("HeuristicLab.Data", "3.3")]
     28  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
    3429  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
    35   [PluginDependency("HeuristicLab.Operators", "3.3")]
    36   [PluginDependency("HeuristicLab.Optimization", "3.3")]
    37   [PluginDependency("HeuristicLab.Parameters", "3.3")]
    38   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     30  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.4")]
     31  [PluginDependency("HeuristicLab.MainForm", "3.3")]
     32  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
     33  [PluginDependency("HeuristicLab.Visualization", "3.3")]
     34  [PluginDependency("HeuristicLab.EvolutionaryTracking", "3.4")]
     35  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
     36
    3937  public class HeuristicLabEvolutionaryTrackingPlugin : PluginBase {
    4038  }
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties

    • Property svn:ignore set to
      AssemblyInfo.cs
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphArc.cs

    r7779 r8213  
    2525
    2626namespace HeuristicLab.EvolutionaryTracking.Views {
    27   class VisualGenealogyGraphArc : Line {
     27  public class VisualGenealogyGraphArc : Line {
    2828    public VisualGenealogyGraphNode Source;
    2929    public VisualGenealogyGraphNode Target;
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphNode.cs

    r7779 r8213  
    2828  public class VisualGenealogyGraphNode : Ellipse {
    2929    public GenealogyGraphNode Data { get; internal set; }
    30     internal List<VisualGenealogyGraphArc> IncomingArcs = new List<VisualGenealogyGraphArc>();
    31     internal List<VisualGenealogyGraphArc> OutgoingArcs = new List<VisualGenealogyGraphArc>();
     30    private List<VisualGenealogyGraphArc> _incomingArcs = new List<VisualGenealogyGraphArc>();
     31    private List<VisualGenealogyGraphArc> _outgoingArgs = new List<VisualGenealogyGraphArc>();
     32
     33    public List<VisualGenealogyGraphArc> IncomingArcs {
     34      get { return _incomingArcs; }
     35      set { _incomingArcs = value; }
     36    }
     37    public List<VisualGenealogyGraphArc> OutgoingArcs {
     38      get { return _outgoingArgs; }
     39      set { _outgoingArgs = value; }
     40    }
    3241
    3342    public VisualGenealogyGraphNode(IChart chart, PointD lowerLeft, PointD upperRight)
Note: See TracChangeset for help on using the changeset viewer.