Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/08 15:01:08 (16 years ago)
Author:
gkronber
Message:

used Debug.Assert to enable tree-validity checks only in debug builds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Recombination/SizeFairCrossOver.cs

    r189 r238  
    3030using HeuristicLab.Constraints;
    3131using HeuristicLab.Functions;
     32using System.Diagnostics;
    3233
    3334namespace HeuristicLab.StructureIdentification {
     
    9596
    9697      // check if the new tree is valid and if the size of is still in the allowed bounds
    97       if(!gardener.IsValidTree(newTree) ||
    98         newTreeHeight > maxTreeHeight ||
    99         newTreeSize > maxTreeSize) {
    100         throw new InvalidProgramException();
    101       }
     98      Debug.Assert(gardener.IsValidTree(newTree) &&
     99        newTreeHeight <= maxTreeHeight && newTreeSize <= maxTreeSize);
    102100      return gardener.CreateInitializationOperation(newBranches, child);
    103101    }
     
    165163          //  - go down in tree1 => the tree that is inserted becomes smaller
    166164          //  - however we have to get lucky to solve the 'allowed sub-trees' problem
    167           if(tree1Height == 1 || (tree0Level>0 && random.Next(2) == 0)) {
     165          if(tree1Height == 1 || (tree0Level > 0 && random.Next(2) == 0)) {
    168166            // go up in tree0
    169167            tree0Level--;
Note: See TracChangeset for help on using the changeset viewer.