Changeset 4106 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers
- Timestamp:
- 07/26/10 16:18:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs
r4068 r4106 90 90 private static bool IsMatchingPointType(SymbolicExpressionTreeNode parent, int replacedSubtreeIndex, SymbolicExpressionTreeNode branch) { 91 91 // check syntax constraints of direct parent - child relation 92 if (!parent.Grammar.IsAllowedChild(parent.Symbol, branch.Symbol, replacedSubtreeIndex)) return false; 92 if (!parent.Grammar.ContainsSymbol(branch.Symbol) || 93 !parent.Grammar.IsAllowedChild(parent.Symbol, branch.Symbol, replacedSubtreeIndex)) return false; 93 94 94 95 bool result = true; … … 97 98 result = 98 99 result && 100 parent.Grammar.ContainsSymbol(n.Symbol) && 99 101 n.SubTrees.Count >= parent.Grammar.GetMinSubtreeCount(n.Symbol) && 100 n.SubTrees.Count <= parent.Grammar.GetMaxSubtreeCount(n.Symbol) && 101 parent.Grammar.ContainsSymbol(n.Symbol); 102 n.SubTrees.Count <= parent.Grammar.GetMaxSubtreeCount(n.Symbol); 102 103 }); 103 104 return result;
Note: See TracChangeset
for help on using the changeset viewer.