Changeset 7817 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Timestamp:
- 05/15/12 00:21:10 (13 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs
r7792 r7817 127 127 // compare the two nodes lists and check the difference (comparing node references so we avoid false functional identity). 128 128 // if no difference is found, then it is assumed that the whole tree was swapped with itself (it can happen), so the index is 0 129 int i , min = Math.Max(nodes0.Count, nodes1.Count);130 for ( i = 0; i != min; ++i)129 int i = 0, min = Math.Min(nodes0.Count, nodes1.Count); 130 for (; i != min; ++i) 131 131 if (nodes0[i] != nodes1[i]) break; 132 132 if (i == min) i = 0; -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs
r7800 r7817 26 26 27 27 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 28 [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7 799")]28 [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7800")] 29 29 [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeMatching.cs
r7792 r7817 70 70 71 71 public static bool ContainsFragment(this ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode fragment, int mode) { 72 var nodes = tree.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;73 var fragments = fragment.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;72 var nodes = tree.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 73 var fragments = fragment.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 74 74 return FindMatch(nodes, fragments, mode) != -1; 75 75 } … … 77 77 // convenience methods for less typing :) 78 78 private static IEnumerator<ISymbolicExpressionTreeNode> Enumerator(this ISymbolicExpressionTree tree) { 79 return tree.IterateNodes Breadth().GetEnumerator();79 return tree.IterateNodesPostfix().GetEnumerator(); 80 80 } 81 81 private static IEnumerator<ISymbolicExpressionTreeNode> Enumerator(this ISymbolicExpressionTreeNode tree) { 82 return tree.IterateNodes Breadth().GetEnumerator();82 return tree.IterateNodesPostfix().GetEnumerator(); 83 83 } 84 84 public static int FindMatch(ISymbolicExpressionTree a, ISymbolicExpressionTree b, int mode) { 85 var nodesA = a.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;86 var nodesB = b.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;85 var nodesA = a.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 86 var nodesB = b.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 87 87 return FindMatch(nodesA, nodesB, mode); 88 88 } 89 89 public static int FindMatch(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, int mode) { 90 var nodesA = a.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;91 var nodesB = b.IterateNodes Breadth() as List<ISymbolicExpressionTreeNode>;90 var nodesA = a.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 91 var nodesB = b.IterateNodesPostfix() as List<ISymbolicExpressionTreeNode>; 92 92 return FindMatch(nodesA, nodesB, mode); 93 93 }
Note: See TracChangeset
for help on using the changeset viewer.