Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/14 18:28:25 (10 years ago)
Author:
bburlacu
Message:

#1772: Fixed bug and improved handling of elite individuals in the genealogy analyzer. Fixed minor bug in the tracing code. Other minor cosmetic improvements to the GenealogyGraph and FragmentGraphView.

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

Legend:

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

    r11253 r11318  
    4646      }
    4747
     48      if (fragment == null)
     49        throw new InvalidOperationException("Could not identify crossover fragment.");
     50
    4851      arcs[0].Data = null;
    4952      arcs[1].Data = fragment;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionTracing.cs

    r11253 r11318  
    3232    public static FragmentGraph TraceSubtree(IGenealogyGraphNode<ISymbolicExpressionTree> graphNode, int subtreeIndex) {
    3333      var graph = new FragmentGraph();
    34       var nodes = Trace(graphNode, subtreeIndex);
    35       foreach (var n in nodes) {
    36         graph.AddVertex(n);
    37       }
     34      var vertices = Trace(graphNode, subtreeIndex).ToList();
     35      graph.AddVertices(vertices);
    3836      return graph;
    3937    }
     
    5250      while (true) {
    5351        if (!node.Parents.Any()) {
    54           var fragmentNode = new FragmentNode(node) {
    55             SubtreeIndex = index,
    56           };
     52          // no tracing if there are no parents, return a fragment node representing the current trace
     53          var fragmentNode = new FragmentNode(node) { SubtreeIndex = index };
    5754          if (parent != null) {
    5855            var arc = new Arc(parent, fragmentNode);
    5956            parent.AddArc(arc);
    6057            fragmentNode.AddArc(arc);
    61 
    62             //            parent.AddForwardArc(arc);
    63             //            fragmentNode.AddReverseArc(arc);
    6458          }
    65           yield return fragmentNode; // no tracing if there are no parents
     59          yield return fragmentNode;
    6660          break;
    6761        }
    6862        var parents = node.Parents.ToList();
    69         var fragment = (IFragment<ISymbolicExpressionTreeNode>)node.InArcs.Last().Data;
    70 
    71         if (node.IsElite || fragment == null) {
     63        if (node.IsElite) {
    7264          // skip elite, go up the graph to original individual
    7365          node = parents[0];
    7466          continue;
    7567        }
     68        var fragment = (IFragment<ISymbolicExpressionTreeNode>)node.InArcs.Last().Data;
     69
     70        if (node.Rank > 1 && fragment == null)
     71          throw new ArgumentNullException("Fragment cannot be null");
     72
    7673        var fragmentLength = fragment.Root.GetLength();
    7774        var tree = node.Data;
     
    139136          if (fragment.Index1 > index) {
    140137            if (fragment.Index1 < index + subtreeLength) {
    141               // subtree contains fragment => bifurcation point in the fragment graph
     138              // subtree contains fragment => branching point in the fragment graph
    142139              var fragmentNode = new FragmentNode(node) {
    143140                SubtreeIndex = index,
Note: See TracChangeset for help on using the changeset viewer.