Changeset 11927 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Timestamp:
- 02/06/15 00:45:30 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 1 deleted
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs
r11482 r11927 45 45 set { 46 46 MatchConstantValuesParameter.Value.Value = value; 47 (( BottomUpSimilarityCalculator)SimilarityCalculator).MatchConstantValues = value;47 ((SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculator).MatchConstantValues = value; 48 48 } 49 49 } … … 53 53 set { 54 54 MatchVariableWeightsParameter.Value.Value = value; 55 (( BottomUpSimilarityCalculator)SimilarityCalculator).MatchVariableWeights = value;55 ((SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculator).MatchVariableWeights = value; 56 56 } 57 57 } … … 69 69 70 70 public SymbolicDataAnalysisBottomUpDiversityAnalyzer() { 71 SimilarityCalculator = new BottomUpSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" };71 SimilarityCalculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" }; 72 72 Parameters.Add(new ValueParameter<BoolValue>(MatchConstantValuesParameterName, "Specifies if the similarity calculator should match constant values.", new BoolValue(true))); 73 73 Parameters.Add(new ValueParameter<BoolValue>(MatchVariableWeightsParameterName, "Specifies if the similarity calculator should match variable weights", new BoolValue(true))); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMaxCommonSubtreeDiversityAnalyzer.cs
r11482 r11927 32 32 33 33 public SymbolicDataAnalysisMaxCommonSubtreeDiversityAnalyzer() { 34 SimilarityCalculator = new MaxCommonSubtreeSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" };34 SimilarityCalculator = new SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" }; 35 35 } 36 36 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs
r11458 r11927 54 54 public SymbolicDataAnalysisExpressionDiversityPreservingCrossover() { 55 55 Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9))); 56 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisExpressionSimilarityCalculator>(SimilarityCalculatorParameterName, "The similarity calculator", new BottomUpSimilarityCalculator()));56 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisExpressionSimilarityCalculator>(SimilarityCalculatorParameterName, "The similarity calculator", new SymbolicExpressionTreeBottomUpSimilarityCalculator())); 57 57 } 58 58 … … 78 78 var left = actualRoot.GetSubtree(0); 79 79 var right = actualRoot.GetSubtree(1); 80 var bus = ( BottomUpSimilarityCalculator)similarityCalculator;80 var bus = (SymbolicExpressionTreeBottomUpSimilarityCalculator)similarityCalculator; 81 81 var map = bus.ComputeBottomUpMapping(left, right); 82 82 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r11926 r11927 204 204 <Compile Include="Importer\Token.cs" /> 205 205 <Compile Include="Interfaces\IModelBacktransformator.cs" /> 206 <Compile Include="SimilarityCalculators\BottomUpSimilarityCalculator.cs" /> 207 <Compile Include="SimilarityCalculators\MaxCommonSubtreeSimilarityCalculator.cs" /> 208 <Compile Include="SimilarityCalculators\PhenotypicSimilarityCalculator.cs" /> 206 <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionSimilarityCalculator.cs" /> 207 <Compile Include="TreeMatching\SymbolicExpressionTreePhenotypicSimilarityCalculator.cs" /> 209 208 <Compile Include="SymbolicExpressionTreeBacktransformator.cs" /> 210 209 <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" /> … … 312 311 <Compile Include="Symbols\VariableConditionTreeNode.cs" /> 313 312 <Compile Include="Symbols\VariableTreeNode.cs" /> 313 <Compile Include="Tracking\SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs" /> 314 <Compile Include="Tracking\SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs" /> 315 <Compile Include="Tracking\SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs" /> 316 <Compile Include="Tracking\SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs" /> 314 317 <Compile Include="Tracking\TraceCalculator.cs" /> 315 318 <Compile Include="TransformationToSymbolicTreeMapper.cs" /> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r11921 r11927 34 34 [StorableClass] 35 35 [Item("SymbolicExpressionTreeBottomUpSimilarityCalculator", "A similarity calculator which uses the tree bottom-up distance as a similarity metric.")] 36 public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {36 public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator, ISymbolicDataAnalysisExpressionSimilarityCalculator { 37 37 private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" }; 38 38 public bool MatchVariableWeights { get; set; } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMatching.cs
r11910 r11927 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 31 31 public static class SymbolicExpressionTreeMatching { 32 public static bool ContainsSubtree(this ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comparer) {32 public static bool ContainsSubtree(this ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeEqualityComparer comparer) { 33 33 return FindMatches(root, subtree, comparer).Any(); 34 34 } 35 public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comparer) {35 public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeEqualityComparer comparer) { 36 36 return FindMatches(tree.Root, subtree, comparer); 37 37 } 38 38 39 public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comp) {39 public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeEqualityComparer comp) { 40 40 var fragmentLength = subtree.GetLength(); 41 41 // below, we use ">=" for Match(n, subtree, comp) >= fragmentLength because in case of relaxed conditions, … … 52 52 /// </summary> 53 53 /// <returns>Number of pairs that were matched</returns> 54 public static int Match(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, ISymbolicExpressionTreeNode SimilarityComparer comp) {54 public static int Match(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, ISymbolicExpressionTreeNodeEqualityComparer comp) { 55 55 if (!comp.Equals(a, b)) return 0; 56 56 int m = a.SubtreeCount; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs
r11910 r11927 30 30 [StorableClass] 31 31 [Item("SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator", "A similarity calculator based on the size of the maximum common subtree between two trees")] 32 public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {32 public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator, ISymbolicDataAnalysisExpressionSimilarityCalculator { 33 33 [Storable] 34 34 private readonly SymbolicExpressionTreeNodeEqualityComparer comparer; … … 85 85 } 86 86 87 public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, ISymbolicExpressionTreeNode SimilarityComparer comparer) {87 public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, ISymbolicExpressionTreeNodeEqualityComparer comparer) { 88 88 int max = 0; 89 89 var rootA = a.Root.GetSubtree(0).GetSubtree(0); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs
r11910 r11927 28 28 [Item("SymbolicExpressionTreeNodeEqualityComparer", "An operator that checks node equality based on different similarity measures.")] 29 29 [StorableClass] 30 public class SymbolicExpressionTreeNodeEqualityComparer : Item, ISymbolicExpressionTreeNode SimilarityComparer {30 public class SymbolicExpressionTreeNodeEqualityComparer : Item, ISymbolicExpressionTreeNodeEqualityComparer { 31 31 [StorableConstructor] 32 32 protected SymbolicExpressionTreeNodeEqualityComparer(bool deserializing) : base(deserializing) { }
Note: See TracChangeset
for help on using the changeset viewer.