Free cookie consent management tool by TermsFeed Policy Generator

Changeset 451


Ignore:
Timestamp:
08/05/08 16:38:38 (16 years ago)
Author:
gkronber
Message:

added checking of sub-operator type constraints to IsValidTree (ticket #225)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/TreeGardener.cs

    r450 r451  
    282282
    283283    internal bool IsValidTree(IFunctionTree tree) {
     284      SubOperatorsConstraintAnalyser analyzer = new SubOperatorsConstraintAnalyser();
     285      analyzer.AllPossibleOperators = AllFunctions.Cast<IOperator>().ToArray<IOperator>();
     286      for(int i = 0; i < tree.SubTrees.Count; i++) {
     287        if(!analyzer.GetAllowedOperators(tree.Function, i).Contains(tree.SubTrees[i].Function)) return false;
     288      }
     289
    284290      foreach(IConstraint constraint in tree.Function.Constraints) {
    285291        if(constraint is NumberOfSubOperatorsConstraint) {
Note: See TracChangeset for help on using the changeset viewer.