Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10650


Ignore:
Timestamp:
03/24/14 16:59:22 (11 years ago)
Author:
bburlacu
Message:

#1772: Added new SymbolicDataAnalysisGenealogyView and added support for the tracing of building blocks (finding the constituent ancestral elements of a selected subtree).

Location:
branches/HeuristicLab.EvolutionTracking
Files:
11 added
30 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs

    r10524 r10650  
    4141
    4242    public ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> LayoutEngine { get; set; }
    43     public SymbolicExpressionTreeTile(IChart chart) : base(chart) { }
     43    private Dictionary<IPrimitive, ISymbolicExpressionTreeNode> primitiveMap;
     44
     45    public SymbolicExpressionTreeTile(IChart chart)
     46      : base(chart) {
     47      primitiveMap = new Dictionary<IPrimitive, ISymbolicExpressionTreeNode>();
     48    }
    4449    public SymbolicExpressionTreeTile(IChart chart, ISymbolicExpressionTree tree)
    45       : base(chart) {
     50      : this(chart) {
    4651      SymbolicExpressionTree = tree;
    4752      PreferredNodeWidth = 80;
     
    5055    private void GeneratePrimitives(double preferredNodeWidth, double preferredNodeHeight) {
    5156      Clear();
    52       LayoutEngine.Initialize(SymbolicExpressionTree.Root, node => node.Subtrees);
    53       LayoutEngine.CalculateLayout();
     57      ISymbolicExpressionTreeNode root = SymbolicExpressionTree.Root;
     58      if (root.Symbol is ProgramRootSymbol && root.SubtreeCount == 1) { root = root.GetSubtree(0); }
     59      var visualNodes = LayoutEngine.CalculateLayout(root);
    5460
    55       var primitivesMap = new Dictionary<ISymbolicExpressionTreeNode, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase
    5661      var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel);
    5762
    58       var visualNodes = LayoutEngine.GetVisualNodes().ToList();
    5963      var visualNodeMap = visualNodes.ToDictionary(x => x.Content, x => x);
    6064
     
    7175
    7276        this.Add(rectangularPrimitive);
    73         primitivesMap.Add(node, rectangularPrimitive);
    7477      }
    7578
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNodeComparer.cs

    r10269 r10650  
    22
    33namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    4   public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> {
    5 
    6   }
     4  public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> { }
    75}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs

    r10302 r10650  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Drawing;
     
    2647    }
    2748
     49    public IGenealogyGraphNode SelectedGraphNode { get; private set; }
     50
    2851    private void Clear() {
    2952      if (nodeMap == null)
     
    4164    private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap;
    4265
     66    #region chart modes
    4367    public bool SimpleLineages { get; set; }
    4468    public bool LockGenealogy { get; set; }
     69    public bool TraceFragments { get; set; }
     70    #endregion
     71
    4572    private Visualization.Rectangle TargetRectangle { get; set; }
     73    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
     74    private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
    4675
    4776    private VisualGenealogyGraphNode GetMappedNode(IGenealogyGraphNode node) {
     
    6291      return arc;
    6392    }
    64     private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
    65     private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
    66 
    67     public event MouseEventHandler GenealogyGraphNodeClicked;
    68     private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
    69       var clicked = GenealogyGraphNodeClicked;
    70       if (clicked != null) clicked(sender, e);
    71     }
     93
    7294    public GenealogyGraphChart()
    7395      : base() {
    7496      InitializeComponent();
    7597    }
     98
    7699    protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) {
    77100      Chart.UpdateEnabled = false;
     
    127150      DrawInProgress = false;
    128151    }
     152
     153    public event MouseEventHandler GenealogyGraphNodeClicked;
     154    private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
     155      var clicked = GenealogyGraphNodeClicked;
     156      if (clicked != null) clicked(sender, e);
     157    }
     158
     159    #region event handlers
    129160    protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    130161      if (!DrawInProgress) {
     
    160191      SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode;
    161192      if (SelectedVisualNode == null) return;
     193      SelectedGraphNode = SelectedVisualNode.Data;
    162194
    163195      if (!LockGenealogy) {
     
    188220      base.pictureBox_MouseUp(sender, e);
    189221    }
     222    #endregion
     223
    190224    private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) {
    191225      if (node.Brush != null) return;
     
    205239      }
    206240    }
     241
    207242    void MarkSelectedNode() {
    208243      var center = SelectedVisualNode.Center;
     
    219254      }
    220255    }
     256
    221257    private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) {
    222258      var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush };
     
    227263      return arc;
    228264    }
     265
    229266    public virtual void ClearPrimitives() {
    230267      foreach (var primitive in Chart.Group.Primitives) {
     
    236273      }
    237274    }
     275
    238276    public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) {
    239277      Chart.UpdateEnabled = false;
    240278      ClearPrimitives();
    241279      foreach (var node in nodes) {
    242         GetMappedNode(node).Brush = new SolidBrush(node.GetColor());
     280        var graphNode = GetMappedNode(node);
     281        graphNode.Brush = new SolidBrush(node.GetColor());
    243282      }
    244283      Chart.UpdateEnabled = true;
    245284      Chart.EnforceUpdate();
    246285    }
     286
    247287    public void HighlightAll() {
    248288      Chart.UpdateEnabled = false;
     
    261301    }
    262302  }
     303
    263304  internal static class Util {
    264305    public static Color GetColor(this IGenealogyGraphNode node) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphTextLabel.cs

    r10271 r10650  
    55namespace HeuristicLab.EvolutionTracking.Views {
    66  public class VisualGenealogyGraphTextLabel : Rectangle {
    7     private string text;
    8     public string Text { get { return text; } set { text = value; } }
    9 
    10     private Font font;
    11     public Font Font { get { return font; } set { font = value; } }
     7    //    private string text;
     8    //    public string Text { get { return text; } set { text = value; } }
     9    //
     10    //    private Font font;
     11    //    public Font Font { get { return font; } set { font = value; } }
    1212
    1313    private Brush fontBrush;
     
    3232
    3333      float fontSize = s.Height;
    34       font = new Font(font.Name, fontSize, Font.Style, GraphicsUnit.Pixel);
    35       graphics.DrawString(text, font, fontBrush, p.X, p.Y);
     34      var font = new Font(Font.Name, fontSize, Font.Style, GraphicsUnit.Pixel);
     35      graphics.DrawString(Text, font, fontBrush, p.X, p.Y);
    3636    }
    3737
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs

    r10462 r10650  
    9393      get { return GenerationsParameter.ActualValue; }
    9494    }
    95     public IGenealogyGraph GenealogyGraph {
     95    public IGenealogyGraph<T> GenealogyGraph {
    9696      get {
    9797        IResult result;
    9898        if (!Results.ContainsKey(PopulationGraphParameterName)) {
    99           result = new Result(PopulationGraphParameterName, new GenealogyGraph());
     99          result = new Result(PopulationGraphParameterName, new GenealogyGraph<T>());
    100100          Results.Add(result);
    101101        } else {
    102102          result = Results[PopulationGraphParameterName];
    103103        }
    104         var graph = (IGenealogyGraph)result.Value;
     104        var graph = (IGenealogyGraph<T>)result.Value;
    105105        return graph;
    106106      }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs

    r10300 r10650  
    4545
    4646  public interface IVertex<T> : IVertex
    47   where T : class,IItem {
     47  where T : class {
    4848    new T Content { get; set; }
    4949  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs

    r10501 r10650  
    88  public class Fragment : Item, IFragment {
    99    [Storable]
    10     public int NewPos { get; set; }
     10    public int Index { get; set; }
    1111
    1212    [Storable]
    13     public int OldPos { get; set; }
     13    public int OldIndex { get; set; }
    1414
    1515    [Storable]
     
    2323      : base(original, cloner) {
    2424      Root = original.Root;
    25       NewPos = original.NewPos;
    26       OldPos = original.OldPos;
     25      Index = original.Index;
     26      OldIndex = original.OldIndex;
    2727    }
    2828    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs

    r10347 r10650  
    8080  public class GenealogyGraph<T> : DirectedGraph, IGenealogyGraph<T> where T : class, IItem {
    8181    [Storable]
    82     private Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> ranks;
    83     public Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> Ranks {
     82    private Dictionary<double, LinkedList<IGenealogyGraphNode>> ranks;
     83    public Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks {
    8484      get { return ranks; }
    8585      set { ranks = value; }
     
    9494    protected GenealogyGraph(bool deserializing) : base(deserializing) { }
    9595    public GenealogyGraph() {
    96       Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode<T>>>();
     96      Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode>>();
    9797    }
    9898    public override void AddVertex(IVertex vertex) {
    9999      var node = (IGenealogyGraphNode<T>)vertex;
    100100      if (!Ranks.ContainsKey(node.Rank))
    101         Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode<T>>();
     101        Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode>();
    102102      Ranks[node.Rank].AddLast(node);
    103103      base.AddVertex(vertex);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs

    r10300 r10650  
    2525namespace HeuristicLab.EvolutionTracking {
    2626  public interface IGenealogyGraph : IDirectedGraph {
    27     Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; set; }
     27    Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; }
    2828  }
    2929
    30   public interface IGenealogyGraph<T> : IDirectedGraph
    31     where T : class,IItem {
    32     Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> Ranks { get; set; }
    33   }
     30  public interface IGenealogyGraph<T> : IGenealogyGraph where T : class,IItem { }
    3431}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs

    r10300 r10650  
    3636  }
    3737
    38   public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class,IItem { }
     38  public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class { }
    3939}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Interfaces/IFragment.cs

    r10347 r10650  
    2525  public interface IFragment : IItem {
    2626    object Root { get; set; }
    27     int NewPos { get; set; }
    28     int OldPos { get; set; }
     27    int Index { get; set; }
     28    int OldIndex { get; set; }
    2929  }
    3030
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs

    r10462 r10650  
    2828  [StorableClass]
    2929  [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")]
    30   public class AfterCrossoverOperator<T> : EvolutionTrackingOperator, ICrossoverOperator<T> where T : class,IItem {
     30  public class AfterCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem {
    3131    private const string DefaultParentsParameterName = "Parents";
    3232    private const string DefaultChildParameterName = "Child";
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterManipulatorOperator.cs

    r10347 r10650  
    2828  [StorableClass]
    2929  [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")]
    30   public class AfterManipulatorOperator<T> : EvolutionTrackingOperator, IManipulatorOperator<T> where T : class,IItem {
     30  public class AfterManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem {
    3131
    3232    private const string ChildParameterName = "Child";
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs

    r10347 r10650  
    2727  [StorableClass]
    2828  [Item("AfterSolutionCreatorOperator", "An operator that runs after the solution creator and performs additional actions.")]
    29   public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator
     29  public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator<T>
    3030    where T : class,IItem {
    3131
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs

    r10347 r10650  
    3131  [StorableClass]
    3232  [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")]
    33   public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator, ICrossoverOperator<T> where T : class,IItem {
     33  public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem {
    3434    private const string defaultParentsParameterName = "Parents";
    3535    private const string defaultChildParameterName = "Child";
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs

    r10347 r10650  
    2929  [StorableClass]
    3030  [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")]
    31   public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator, IManipulatorOperator<T> where T : class,IItem {
     31  public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem {
    3232
    3333    private const string ChildParameterName = "Child";
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs

    r10300 r10650  
    2828
    2929namespace HeuristicLab.EvolutionTracking {
    30   public class EvolutionTrackingOperator : SingleSuccessorOperator {
     30  public class EvolutionTrackingOperator<T> : SingleSuccessorOperator where T : class,IItem {
    3131    // evolution tracking-related parameters
    3232    private const string resultsParameterName = "Results";
     
    4646      get { return GenerationsParameter.ActualValue; }
    4747    }
    48     public IGenealogyGraph GenealogyGraph {
     48    public IGenealogyGraph<T> GenealogyGraph {
    4949      get {
    5050        IResult result;
    5151        if (!Results.ContainsKey(populationGraphParameterName)) {
    52           result = new Result(populationGraphParameterName, new GenealogyGraph());
     52          result = new Result(populationGraphParameterName, new GenealogyGraph<T>());
    5353          Results.Add(result);
    5454        } else {
    5555          result = Results[populationGraphParameterName];
    5656        }
    57         var graph = (GenealogyGraph)result.Value;
     57        var graph = (GenealogyGraph<T>)result.Value;
    5858        return graph;
    5959      }
     
    6363      Parameters.Add(new LookupParameter<ResultCollection>(resultsParameterName));
    6464    }
    65     protected EvolutionTrackingOperator(EvolutionTrackingOperator original, Cloner cloner)
     65    protected EvolutionTrackingOperator(EvolutionTrackingOperator<T> original, Cloner cloner)
    6666      : base(original, cloner) {
    6767    }
    6868    public override IDeepCloneable Clone(Cloner cloner) {
    69       return new EvolutionTrackingOperator(this, cloner);
     69      return new EvolutionTrackingOperator<T>(this, cloner);
    7070    }
    7171  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

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

    r10514 r10650  
    219219      <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
    220220    </Compile>
     221    <Compile Include="SymboldDataAnalysisGenealogyView.cs">
     222      <SubType>UserControl</SubType>
     223    </Compile>
     224    <Compile Include="SymboldDataAnalysisGenealogyView.Designer.cs">
     225      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
     226    </Compile>
     227    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
     228      <SubType>UserControl</SubType>
     229    </Compile>
     230    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
     231      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
     232    </Compile>
    221233    <Compile Include="SymbolicDataAnalysisExpressionLineageExplorerChart.cs">
    222234      <SubType>UserControl</SubType>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r9462 r10650  
    1919 */
    2020#endregion
     21
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
     
    137138      //
    138139      // btnOptimizeConstants
    139       //
    140       this.btnOptimizeConstants.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     140      //      
     141      this.btnOptimizeConstants.AutoSize = true;
    141142      this.btnOptimizeConstants.Enabled = false;
    142       this.btnOptimizeConstants.Location = new System.Drawing.Point(104, 3);
     143      //      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
     144      this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
     145      this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3);
    143146      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
    144       this.btnOptimizeConstants.Size = new System.Drawing.Size(97, 23);
     147      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
    145148      this.btnOptimizeConstants.TabIndex = 2;
    146149      this.btnOptimizeConstants.Text = "Optimize";
     150      this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     151      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    147152      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
    148153      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
     
    150155      // btnSimplify
    151156      //
     157      this.btnSimplify.AutoSize = true;
     158      this.btnSimplify.Enabled = true;
     159      //      this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator;
     160      this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
    152161      this.btnSimplify.Location = new System.Drawing.Point(3, 3);
    153162      this.btnSimplify.Name = "btnSimplify";
    154       this.btnSimplify.Size = new System.Drawing.Size(95, 23);
     163      this.btnSimplify.Size = new System.Drawing.Size(80, 24);
    155164      this.btnSimplify.TabIndex = 1;
    156165      this.btnSimplify.Text = "Simplify";
     166      this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     167      this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    157168      this.btnSimplify.UseVisualStyleBackColor = true;
    158169      this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r10524 r10650  
    5252      Content.ModelChanged += Content_Changed;
    5353      Content.ProblemDataChanged += Content_Changed;
     54      treeChart.Repainted += treeChart_Repainted;
    5455    }
    5556    protected override void DeregisterContentEvents() {
     
    5758      Content.ModelChanged -= Content_Changed;
    5859      Content.ProblemDataChanged -= Content_Changed;
     60      treeChart.Repainted -= treeChart_Repainted;
    5961    }
    6062
     
    6870      UpdateView();
    6971      viewHost.Content = this.Content;
     72    }
     73
     74    private void treeChart_Repainted(object sender, EventArgs e) {
     75      if (nodeImpacts != null && nodeImpacts.Count > 0)
     76        PaintNodeImpacts();
    7077    }
    7178
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r10524 r10650  
    3232
    3333  internal sealed partial class InteractiveSymbolicExpressionTreeChart : SymbolicExpressionTreeChart {
    34     private ISymbolicExpressionTreeNode tempNode; // node in clipboard (to be cut/copy/pasted etc)
    35     private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; // currently selected node
     34    private ISymbolicExpressionTreeNode tempNode; //node in clipboard (to be cut/copy/pasted etc)
     35    private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; //currently selected node
    3636    private enum EditOp { NoOp, CopySubtree, CutSubtree }
    3737    private EditOp lastOp = EditOp.NoOp;
     
    218218            if (tempNode.IterateNodesBreadth().Contains(node))
    219219              throw new ArgumentException();// cannot cut/paste a node into itself
    220             ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent     
     220            ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent
    221221            ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent
    222222            break;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame

    r10037 r10650  
    3232  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3333  [PluginDependency("HeuristicLab.Common", "3.3")]
     34  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3435  [PluginDependency("HeuristicLab.Core", "3.3")]
    3536  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerChart.cs

    r10517 r10650  
    11using System.Collections.Generic;
    22using System.Drawing;
     3using System.Windows.Forms;
    34using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
    45using HeuristicLab.Visualization;
     
    5960      }
    6061    }
     62
     63    protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) {
     64      base.pictureBox_MouseUp(sender, e);
     65      // get the selected primitive and update it's graphics
     66      var point = new Point(e.X, e.Y);
     67
     68      var selectedPrimitives = Chart.GetAllPrimitives(point);
     69      // first primitive in the list should be the tile, the second one should be the actual primitive representing a tree node
     70      var tile = (SymbolicExpressionTreeTile)selectedPrimitives[0];
     71      var selectedPrimitive = (RectangularPrimitiveBase)selectedPrimitives[1];
     72      var tree = tile.SymbolicExpressionTree; // use the tree to get the genealogy graph node and the fragments used for tracing building blocks
     73
     74      var pen = new Pen(Color.Blue);
     75      using (var g = Graphics.FromImage(pictureBox.Image)) {
     76        g.DrawRectangle(pen, (float)selectedPrimitive.LowerLeft.X, (float)selectedPrimitive.LowerLeft.Y, (float)selectedPrimitive.Size.Width, (float)selectedPrimitive.Size.Height);
     77      }
     78    }
    6179  }
    6280}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs

    r10524 r10650  
    3030    public SymbolicDataAnalysisExpressionLineageExplorerView() {
    3131      InitializeComponent();
    32       symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> {
     32      symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(node => node.Subtrees) {
    3333        HorizontalSpacing = MinHorizontalSpacing,
    3434        VerticalSpacing = MinVerticalSpacing,
     
    3636        NodeHeight = PreferredNodeHeight
    3737      };
     38
    3839      treeMap = new Dictionary<TreeNode, ISymbolicExpressionTree>();
    3940      double width = lineageExplorerChart.PreferredSize.Width;
     
    4344      }
    4445    }
    45 
    4646
    4747    #region events
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r10464 r10650  
    189189      <SubType>Code</SubType>
    190190    </Compile>
     191    <Compile Include="Matching\SymbolicExpressionTreeCanonicalSorter.cs" />
     192    <Compile Include="Matching\SymbolicExpressionTreeEqualityComparer.cs" />
     193    <Compile Include="Matching\SymbolicExpressionTreeMatching.cs" />
     194    <Compile Include="Matching\SymbolicExpressionTreeMaxCommonSequenceCalculator.cs" />
     195    <Compile Include="Matching\SymbolicExpressionTreeNodeComparer.cs" />
     196    <Compile Include="Matching\SymbolicExpressionTreeNodeSimilarityComparer.cs" />
    191197    <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
    192198    <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
     
    198204    <Compile Include="SymbolGraph\SymbolGraph.cs" />
    199205    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
    200     <Compile Include="SymbolicDataAnalysisExpressionTreeMatching.cs" />
    201206    <Compile Include="SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs" />
    202207    <Compile Include="SymbolicDataAnalysisSolutionPruningOptimizer.cs" />
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs

    r10464 r10650  
    8484      Parameters.Add(new ValueParameter<ISymbolicExpressionTree>(CurrentSymbolicExpressionTreeParameterName, ""));
    8585      Parameters.Add(new LookupParameter<BoolValue>(MatchVariablesParameterName, "Specify if the symbolic expression tree comparer should match variable names."));
    86       Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weights."));
     86      Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weghts."));
    8787      Parameters.Add(new LookupParameter<BoolValue>(MatchConstantValuesParameterName, "Specify if the symbolic expression tree comparer should match constant values."));
    8888      Parameters.Add(new LookupParameter<DoubleValue>(SimilarityValuesParmeterName, ""));
     
    113113    }
    114114
    115     public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b,
    116       SymbolicExpressionTreeNodeSimilarityComparer comp) {
    117       return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comp) / (a.GetLength() + b.GetLength());
     115    public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
     116      return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comparer) / (a.GetLength() + b.GetLength());
    118117    }
    119118
    120     public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b,
    121       SymbolicExpressionTreeNodeSimilarityComparer comparer) {
    122       double max = 0;
     119    /// <summary>
     120    /// Try to match each pair of nodes from trees a and b and return a similarity value based on the maximum number of matched node pairs.
     121    /// </summary>
     122    /// <param name="a"></param>
     123    /// <param name="b"></param>
     124    /// <param name="comparer"></param>
     125    /// <returns>A similarity value computed as 2.0 * MaxNumberOfMatchedPairs / (Sum of both tree sizes)</returns>
     126    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
     127      int max = 0;
    123128      var rootA = a.Root.GetSubtree(0).GetSubtree(0);
    124129      var rootB = b.Root.GetSubtree(0).GetSubtree(0);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r10459 r10650  
    2121        fragment = new Fragment<ISymbolicExpressionTreeNode> {
    2222          Root = childNodes[i],
    23           NewPos = i
     23          Index = i
    2424        };
    2525      }
     
    2828      for (int i = 0; i < nodes1.Count; ++i) {
    2929        if (nodes1[i] != fragment.Root) continue;
    30         fragment.OldPos = i;
     30        fragment.OldIndex = i;
    3131      }
    3232
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs

    r10347 r10650  
    2828        fragment = new Fragment<ISymbolicExpressionTreeNode> {
    2929          Root = nodesAfter[i],
    30           NewPos = i
     30          Index = i
    3131        };
    3232      }
Note: See TracChangeset for help on using the changeset viewer.