Changeset 5367 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers
- Timestamp:
- 01/24/11 19:04:27 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs
r5014 r5367 74 74 List<SymbolicExpressionTreeNode> allowedBranches = new List<SymbolicExpressionTreeNode>(); 75 75 parent1.Root.ForEachNodePostfix((n) => { 76 if (n.GetSize() < maxInsertedBranchSize &&77 n.GetHeight() < maxInsertedBranchHeight &&76 if (n.GetSize() <= maxInsertedBranchSize && 77 n.GetHeight() <= maxInsertedBranchHeight && 78 78 IsMatchingPointType(crossoverPoint0, replacedSubtreeIndex, n)) 79 79 allowedBranches.Add(n); … … 117 117 List<CrossoverPoint> leafCrossoverPoints = new List<CrossoverPoint>(); 118 118 parent0.Root.ForEachNodePostfix((n) => { 119 if (n.SubTrees.Count > 0 && 120 n.GetSize() < maxBranchSize && 121 n.GetHeight() < maxBranchHeight && 122 n != parent0.Root 123 ) { 119 if (n.SubTrees.Count > 0 && n != parent0.Root) { 124 120 foreach (var child in n.SubTrees) { 125 if (child.SubTrees.Count > 0) 126 internalCrossoverPoints.Add(new CrossoverPoint(n, child)); 127 else 128 leafCrossoverPoints.Add(new CrossoverPoint(n, child)); 121 if (child.GetSize() <= maxBranchSize && 122 child.GetHeight() <= maxBranchHeight) { 123 if (child.SubTrees.Count > 0) 124 internalCrossoverPoints.Add(new CrossoverPoint(n, child)); 125 else 126 leafCrossoverPoints.Add(new CrossoverPoint(n, child)); 127 } 129 128 } 130 129 } 131 130 }); 131 132 132 if (random.NextDouble() < internalNodeProbability) { 133 133 // select from internal node if possible
Note: See TracChangeset
for help on using the changeset viewer.