Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/16/14 16:37:56 (11 years ago)
Author:
bburlacu
Message:

#1772: Small changes to the GenealogyGraph. Added generic Fragment class and interface. Added the SymbolicDataAnalysisPopulationDiversityAnalyzer. Added specialized tracking operators for symbolic data analysis. Merged trunk changes.

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

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeMatching.cs

    r10302 r10347  
    55using HeuristicLab.Core;
    66using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     7using HeuristicLab.EvolutionTracking;
    78using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    89using HeuristicLab.Problems.DataAnalysis.Symbolic;
     
    7980  }
    8081
    81   public class SymbolicExpressionTreeFragmentSimilarityComparer : IEqualityComparer<IFragment> {
     82  public class SymbolicExpressionTreeFragmentSimilarityComparer : IEqualityComparer<IFragment<ISymbolicExpressionTreeNode>> {
    8283    public SymbolicExpressionTreeNodeSimilarityComparer SimilarityComparer { get; set; }
    8384
    84     public bool Equals(IFragment x, IFragment y) {
     85    public bool Equals(IFragment<ISymbolicExpressionTreeNode> x, IFragment<ISymbolicExpressionTreeNode> y) {
    8586      if (SimilarityComparer == null)
    8687        throw new ArgumentNullException("SimilarityComparer needs to be initialized first.");
    87       return x.Length == y.Length && SymbolicExpressionTreeMatching.Match(x.Root, y.Root, SimilarityComparer) == x.Length;
    88     }
    89 
    90     public int GetHashCode(IFragment fragment) {
     88      return x.Root.GetLength() == y.Root.GetLength() && SymbolicExpressionTreeMatching.Match(x.Root, y.Root, SimilarityComparer) == x.Root.GetLength();
     89    }
     90
     91    public int GetHashCode(IFragment<ISymbolicExpressionTreeNode> fragment) {
    9192      return fragment.Root.Symbol.Name.ToLower().GetHashCode();
    9293    }
     
    162163
    163164public static class SymbolicExpressionTreeMatching {
    164   public static bool ContainsFragment(this ISymbolicExpressionTreeNode root, IFragment fragment, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
     165  public static bool ContainsFragment(this ISymbolicExpressionTreeNode root, IFragment<ISymbolicExpressionTreeNode> fragment, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
    165166    return FindMatches(root, fragment.Root, comparer).Any();
    166167  }
Note: See TracChangeset for help on using the changeset viewer.