Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17914


Ignore:
Timestamp:
03/24/21 10:13:04 (4 years ago)
Author:
chaider
Message:

#3073 Fixed check for scaling nodes in ConstraintsEvaluators

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/NMSEConstraintsEvaluator.cs

    r17906 r17914  
    109109      } else {
    110110        if (applyLinearScaling) {
    111           //Check for interval arithmetic grammar
    112           if (!(tree.Root.Grammar is IntervalArithmeticGrammar))
    113             throw new ArgumentException($"{ItemName} can only be used with IntervalArithmeticGrammar.");
    114 
    115111          var rootNode = new ProgramRootSymbol().CreateTreeNode();
    116112          var startNode = new StartSymbol().CreateTreeNode();
     
    118114                                .GetSubtree(0); //Offset
    119115          var scaling = offset.GetSubtree(0);
     116
     117          //Check if tree contains offset and scaling nodes
     118          if (!(offset.Symbol is Addition) || !(scaling.Symbol is Multiplication))
     119            throw new ArgumentException($"{ItemName} can only be used with IntervalArithmeticGrammar.");
     120
     121
    120122          var t = (ISymbolicExpressionTreeNode)scaling.GetSubtree(0).Clone();
    121123          rootNode.AddSubtree(startNode);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/NMSEConstraintsEvaluator.cs

    r17906 r17914  
    132132      } else {
    133133        if (applyLinearScaling) {
    134           //Check for interval arithmetic grammar
    135           if (!(tree.Root.Grammar is IntervalArithmeticGrammar))
    136             throw new ArgumentException($"{ItemName} can only be used with IntervalArithmeticGrammar.");
    137 
    138134          var rootNode = new ProgramRootSymbol().CreateTreeNode();
    139135          var startNode = new StartSymbol().CreateTreeNode();
     
    141137                                .GetSubtree(0); //Offset
    142138          var scaling = offset.GetSubtree(0);
     139
     140          //Check if tree contains offset and scaling nodes
     141          if (!(offset.Symbol is Addition) || !(scaling.Symbol is Multiplication))
     142            throw new ArgumentException($"{ItemName} can only be used with IntervalArithmeticGrammar.");
     143
    143144          var t = (ISymbolicExpressionTreeNode)scaling.GetSubtree(0).Clone();
    144145          rootNode.AddSubtree(startNode);
Note: See TracChangeset for help on using the changeset viewer.