Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/11 19:04:27 (14 years ago)
Author:
gkronber
Message:

#1136 Fixed test cases for symbolic expression tree encoding operators (+ minor bug fixes in symbolic expression tree operators).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs

    r5014 r5367  
    7474      List<SymbolicExpressionTreeNode> allowedBranches = new List<SymbolicExpressionTreeNode>();
    7575      parent1.Root.ForEachNodePostfix((n) => {
    76         if (n.GetSize() < maxInsertedBranchSize &&
    77           n.GetHeight() < maxInsertedBranchHeight &&
     76        if (n.GetSize() <= maxInsertedBranchSize &&
     77          n.GetHeight() <= maxInsertedBranchHeight &&
    7878          IsMatchingPointType(crossoverPoint0, replacedSubtreeIndex, n))
    7979          allowedBranches.Add(n);
     
    117117      List<CrossoverPoint> leafCrossoverPoints = new List<CrossoverPoint>();
    118118      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) {
    124120          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            }
    129128          }
    130129        }
    131130      });
     131
    132132      if (random.NextDouble() < internalNodeProbability) {
    133133        // select from internal node if possible
Note: See TracChangeset for help on using the changeset viewer.