Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14494 for trunk


Ignore:
Timestamp:
12/16/16 14:38:47 (8 years ago)
Author:
bburlacu
Message:

#2710: Extend tree validity test in the InteractiveSymbolicDataAnalysisSolutionSimplifierView to test if all the variable names in the tree are contained in the solution problem data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r14400 r14494  
    112112      treeChart.Tree = tree;
    113113      treeChart.Repaint();
    114       bool valid = !tree.IterateNodesPostfix().Any(node => node.SubtreeCount < GetMinArity(node.Symbol) || node.SubtreeCount > node.Symbol.MaximumArity);
     114      // check if all nodes have a legal arity
     115      var nodes = tree.IterateNodesPostfix().ToList();
     116      bool valid = !nodes.Any(node => node.SubtreeCount < GetMinArity(node.Symbol) || node.SubtreeCount > node.Symbol.MaximumArity);
     117
     118      if (valid) {
     119        // check if all variables are contained in the dataset
     120        var variables = new HashSet<string>(Content.ProblemData.Dataset.DoubleVariables);
     121        valid = nodes.OfType<VariableTreeNode>().All(x => variables.Contains(x.VariableName));
     122      }
     123
    115124      if (valid) {
    116125        btnOptimizeConstants.Enabled = true;
Note: See TracChangeset for help on using the changeset viewer.