Changeset 18132 for trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/3140_NumberSymbol (added) merged: 18091,18093,18100,18112-18121,18123-18131
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic (added) merged: 18093,18100,18112-18116,18118,18121,18123-18124,18129-18130
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r17180 r18132 41 41 protected override bool IsCommutative { get { return true; } } 42 42 43 public bool Match ConstantValues { get; set; }43 public bool MatchParameterValues { get; set; } 44 44 public bool MatchVariableWeights { get; set; } 45 45 … … 66 66 67 67 public static double CalculateSimilarity(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) { 68 var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchConstantValues = strict, MatchVariableWeights = strict };69 68 return CalculateSimilarity(n1, n2, strict); 70 69 } 71 70 72 public static Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, bool strict = false) {71 public static NodeMap ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, bool strict = false) { 73 72 return ComputeBottomUpMapping(ActualRoot(t1), ActualRoot(t2), strict); 74 73 } 75 74 76 public static Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) {77 var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { Match ConstantValues = strict, MatchVariableWeights = strict };75 public static NodeMap ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) { 76 var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchParameterValues = strict, MatchVariableWeights = strict }; 78 77 return calculator.ComputeBottomUpMapping(n1, n2); 79 78 } … … 81 80 82 81 public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) { 83 return CalculateSimilarity(t1, t2, out Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> map);82 return CalculateSimilarity(t1, t2, out _); 84 83 } 85 84 … … 110 109 } 111 110 112 public Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {111 public NodeMap ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) { 113 112 return ComputeBottomUpMapping(ActualRoot(t1), ActualRoot(t2)); 114 113 } 115 114 116 public Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2) {115 public NodeMap ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2) { 117 116 var compactedGraph = Compact(n1, n2); 118 117 … … 211 210 return node.Symbol.Name; 212 211 213 if (node is ConstantTreeNode constant)214 return Match ConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : constant.Symbol.Name;212 if (node is INumericTreeNode numNode) 213 return MatchParameterValues ? numNode.Value.ToString(CultureInfo.InvariantCulture) : "Numeric"; 215 214 216 215 if (node is VariableTreeNode variable)
Note: See TracChangeset
for help on using the changeset viewer.