Free cookie consent management tool by TermsFeed Policy Generator

Changeset 148 for branches


Ignore:
Timestamp:
04/22/08 11:17:08 (16 years ago)
Author:
gkronber
Message:

fixed bugs in struct-id operators (ticket #112)

Location:
branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs

    r143 r148  
    120120
    121121      // match the sub-trees of the child with the allowed sub-trees of the parent
    122       IFunction[] possibleChilds = gardener.GetAllowedSubFunctions(parent.Function, childIndex).SelectMany(allowedFun => child.SubTrees
    123         .Where(subTree => allowedFun == subTree.Function)).Select(t=>t.Function).ToArray(); // Actually we should probably use OperatorEqualityComparer here (gkronber 21.04.08)
     122      IFunctionTree[] possibleChilds = gardener.GetAllowedSubFunctions(parent.Function, childIndex).SelectMany(allowedFun => child.SubTrees
     123        .Where(subTree => allowedFun == subTree.Function)).ToArray(); // Actually we should probably use OperatorEqualityComparer here (gkronber 21.04.08)
    124124
    125125      if (possibleChilds.Length > 0) {
    126126        // replace child with a random child of the child
    127127        // make a clone to simplify removing obsolete branches from the function-tree
    128         IFunction selectedChild = possibleChilds[random.Next(possibleChilds.Length)];       
     128        IFunctionTree selectedChild = possibleChilds[random.Next(possibleChilds.Length)];       
    129129        parent.RemoveSubTree(childIndex);
    130         parent.InsertSubTree(childIndex, new FunctionTree(selectedChild));
     130        parent.InsertSubTree(childIndex, selectedChild);
    131131
    132132        if (!gardener.IsValidTree(root)) {
  • branches/FunctionsAndStructIdRefactoring/HeuristicLab.StructureIdentification/TreeGardener.cs

    r145 r148  
    329329          int max = ((NumberOfSubOperatorsConstraint)constraint).MaxOperators.Data;
    330330          int min = ((NumberOfSubOperatorsConstraint)constraint).MinOperators.Data;
    331           if(tree.SubTrees.Count < min || tree.SubTrees.Count > max) return false;
     331          if(tree.SubTrees.Count < min || tree.SubTrees.Count > max)
     332            return false;
    332333        }
    333334      }
Note: See TracChangeset for help on using the changeset viewer.