Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/02/09 12:45:08 (15 years ago)
Author:
gkronber
Message:

fixed #479 (Crossover operators create trees that are larger than the allowed max size)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP/Recombination/SizeFairCrossOver.cs

    r835 r1196  
    3939  /// </summary>
    4040  public class SizeFairCrossOver : SizeConstrictedGPCrossoverBase {
    41     private const int MAX_RECOMBINATION_TRIES = 20;
     41    private int MaxRecombinationTries { get { return 20; } }
    4242    // private data structure for crossover points
    4343    protected class CrossoverPoint {
     
    5757        removedBranchIndex = random.Next(parent.SubTrees.Count);
    5858        insertedBranch = GetReplacementBranch(random, gardener, tree0, parent, removedBranchIndex, tree1, maxTreeSize, maxTreeHeight);
    59       } while (insertedBranch == null && tries++ < MAX_RECOMBINATION_TRIES);
     59      } while (insertedBranch == null && tries++ < MaxRecombinationTries);
    6060
    6161      if (insertedBranch != null) {
     
    139139      for (int i = 0; i < root.SubTrees.Count; i++) {
    140140        GetTrail(root.SubTrees[i], branch, trail);
    141         if (trail.Count>0) {
     141        if (trail.Count > 0) {
    142142          trail.Add(i);
    143143          return;
Note: See TracChangeset for help on using the changeset viewer.