Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/14 18:29:47 (11 years ago)
Author:
bburlacu
Message:

#1772: Fixed identification of mutation fragments.

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

Legend:

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

    r10833 r10837  
    4848        var a = nodesAfter[i];
    4949        var b = nodesBefore[i];
    50         if (ReferenceEquals(a, b) && comparer.Equals(a, b)) continue;
     50
     51        bool found = false;
     52        if (comparer.Equals(a, b)) {
     53          int m = 0;
     54          for (int j = 0; j < a.SubtreeCount; ++j) {
     55            if (!AreSimilar(a.GetSubtree(j), b.GetSubtree(j), comparer)) { ++m; }
     56            if (m > 1) {
     57              found = true;
     58              break;
     59            }
     60          }
     61          if (m == 0) {
     62            // everything is similar so we skip the whole subtree
     63            i += a.GetLength();
     64          }
     65          if (!found) continue;
     66        }
    5167        fragment = new Fragment<ISymbolicExpressionTreeNode> {
    5268          Root = a,
     
    6076      return base.Apply();
    6177    }
     78
     79    private bool AreSimilar(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, SymbolicExpressionTreeNodeSimilarityComparer comp) {
     80      int length = a.GetLength();
     81      return comparer.Equals(a, b) && length.Equals(b.GetLength()) && SymbolicExpressionTreeMatching.Match(a, b, comp) == length;
     82    }
    6283  }
    6384}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs

    r10833 r10837  
    3131
    3232      var vChild = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph[ChildParameter.ActualValue];
    33       vChild.InArcs.First().Data = vChild.Content.IterateNodesPrefix().ToList();
     33      var vClone = (IGenealogyGraphNode<ISymbolicExpressionTree>)vChild.InArcs.Last().Source;
     34      vChild.InArcs.First().Data = vClone.Content.IterateNodesPrefix().ToList();
    3435
    35       var vClone = (IGenealogyGraphNode<ISymbolicExpressionTree>)vChild.InArcs.Last().Source;
    3636      var fragment = (IFragment<ISymbolicExpressionTreeNode>)vClone.InArcs.Last().Data;
    3737      if (fragment != null) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionTracing.cs

    r10833 r10837  
    3636            var arc = new GenealogyGraphArc { Source = parent, Target = fragmentNode };
    3737            parent.AddForwardArc(arc);
    38             //            fragmentNode.Content.Index1 = parent.Content.Index1;
    3938          }
    4039          yield return fragmentNode; // no tracing if there are no parents
     
    6261          var fragmentNode = new FragmentNode {
    6362            Content = new Fragment<ISymbolicExpressionTreeNode> { Root = subtree },
    64             Rank = node.Rank
     63            Rank = node.Rank,
     64            Quality = node.Quality
    6565          };
    6666          if (parent != null) {
Note: See TracChangeset for help on using the changeset viewer.