Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/21/14 01:31:20 (10 years ago)
Author:
bburlacu
Message:

#1772: Added the ability to ignore variable weights or constant values to the BottomUpSimilarityCalculator and added parameters to the SymbolicDataAnalysisBottomUpDiversityAnalyzer. Added separate methods in the MaxCommonSubtreeSimilarityCalculator for performing matching with full subtrees (including all leaves) or without (like the old - and better - behavior).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SimilarityCalculators/MaxCommonSubtreeSimilarityCalculator.cs

    r11458 r11482  
    3131  [Item("MaxCommonSubtreeSimilarityCalculator", "A similarity calculator based on the size of the maximum common subtree between two trees")]
    3232  public class MaxCommonSubtreeSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator, ISymbolicDataAnalysisExpressionSimilarityCalculator {
     33    [Storable]
    3334    private readonly SymbolicExpressionTreeNodeSimilarityComparer comparer;
    3435    public bool MatchVariableNames {
     
    8889    }
    8990
    90     public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
     91    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, ISymbolicExpressionTreeNodeSimilarityComparer comparer) {
     92      int m = SymbolicExpressionTreeMatching.Match(a.Root, b.Root, comparer);
     93      return 2.0 * m / (a.Length + b.Length);
     94    }
     95
     96    public static double MaxCommonSubtreeSimilarityRestricted(ISymbolicExpressionTree a, ISymbolicExpressionTree b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
    9197      int max = 0;
    9298      var rootA = a.Root.GetSubtree(0).GetSubtree(0);
     
    99105          if (lenB <= max) continue;
    100106          int matches = SymbolicExpressionTreeMatching.Match(aa, bb, comparer);
     107          //          if (max < matches)
    101108          if (matches == lenB && max < matches)
    102109            max = matches;
Note: See TracChangeset for help on using the changeset viewer.