Changeset 11965 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
- Timestamp:
- 02/06/15 19:01:26 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 11950
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r11927 r11965 36 36 public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator, ISymbolicDataAnalysisExpressionSimilarityCalculator { 37 37 private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" }; 38 public bool MatchVariableWeights { get; set; }39 public bool MatchConstantValues { get; set; }40 41 38 public SymbolicExpressionTreeBottomUpSimilarityCalculator() { } 42 39 … … 48 45 protected SymbolicExpressionTreeBottomUpSimilarityCalculator(SymbolicExpressionTreeBottomUpSimilarityCalculator original, Cloner cloner) 49 46 : base(original, cloner) { 50 MatchVariableWeights = original.MatchVariableWeights;51 MatchConstantValues = original.MatchConstantValues;52 47 } 53 48 … … 214 209 } 215 210 216 private st ring Label(ISymbolicExpressionTreeNode node) {211 private static string Label(ISymbolicExpressionTreeNode node) { 217 212 if (node.SubtreeCount > 0) 218 213 return node.Symbol.Name; … … 220 215 var constant = node as ConstantTreeNode; 221 216 if (constant != null) 222 return MatchConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : constant.Symbol.Name; 217 return constant.Value.ToString(CultureInfo.InvariantCulture); 218 223 219 var variable = node as VariableTreeNode; 224 if (variable != null) { 225 return MatchVariableWeights ? variable.Weight + variable.VariableName : variable.VariableName; 226 } 220 if (variable != null) 221 return variable.Weight + variable.VariableName; 227 222 228 223 return node.ToString();
Note: See TracChangeset
for help on using the changeset viewer.