Changeset 6803 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers
- Timestamp:
- 09/20/11 11:12:10 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:ignore
-
old new 13 13 *.vsp 14 14 *.docstates 15 bin 16 HeuristicLab 3.3.6.0.ReSharper.user
-
- Property svn:mergeinfo changed
/branches/GP.Grammar.Editor (added) merged: 6284-6285,6296,6299,6335,6337,6377,6379,6387,6403,6409,6415,6493-6494,6497,6618,6620,6622,6626,6647,6675,6782,6784,6786,6795
- Property svn:ignore
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
-
Property
svn:ignore
set to
bin
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r5916 r6803 96 96 int maxInsertedBranchDepth = maxTreeDepth - GetBranchLevel(parent0.Root, crossoverPoint0.Parent); 97 97 98 99 98 List<ISymbolicExpressionTreeNode> allowedBranches = new List<ISymbolicExpressionTreeNode>(); 100 99 parent1.Root.ForEachNodePostfix((n) => { 101 100 if (n.GetLength() <= maxInsertedBranchLength && 102 n.GetDepth() <= maxInsertedBranchDepth &&103 IsMatchingPointType(crossoverPoint0, n))101 n.GetDepth() <= maxInsertedBranchDepth && 102 IsMatchingPointType(crossoverPoint0, n)) 104 103 allowedBranches.Add(n); 105 104 }); … … 133 132 if (newChild == null) { 134 133 // make sure that one subtree can be removed and that only the last subtree is removed 135 return parent.Grammar.GetMinimumSubtreeCount(parent.Symbol) < parent.Subtree sCount &&136 cutPoint.ChildIndex == parent.Subtree sCount - 1;134 return parent.Grammar.GetMinimumSubtreeCount(parent.Symbol) < parent.SubtreeCount && 135 cutPoint.ChildIndex == parent.SubtreeCount - 1; 137 136 } else { 138 137 // check syntax constraints of direct parent - child relation … … 146 145 result && 147 146 parent.Grammar.ContainsSymbol(n.Symbol) && 148 n.Subtree sCount >= parent.Grammar.GetMinimumSubtreeCount(n.Symbol) &&149 n.Subtree sCount <= parent.Grammar.GetMaximumSubtreeCount(n.Symbol);147 n.SubtreeCount >= parent.Grammar.GetMinimumSubtreeCount(n.Symbol) && 148 n.SubtreeCount <= parent.Grammar.GetMaximumSubtreeCount(n.Symbol); 150 149 }); 151 150 return result; … … 169 168 } 170 169 // add one additional extension point if the number of sub trees for the symbol is not full 171 if (n.Subtree sCount < n.Grammar.GetMaximumSubtreeCount(n.Symbol)) {170 if (n.SubtreeCount < n.Grammar.GetMaximumSubtreeCount(n.Symbol)) { 172 171 // empty extension point 173 internalCrossoverPoints.Add(new CutPoint(n, n.Subtree sCount));172 internalCrossoverPoints.Add(new CutPoint(n, n.SubtreeCount)); 174 173 } 175 174 }
Note: See TracChangeset
for help on using the changeset viewer.