Changeset 18086 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ShapeConstraintsAnalyzer.cs
- Timestamp:
- 11/19/21 16:07:45 (3 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ShapeConstraintsAnalyzer.cs
r17903 r18086 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 32 32 [StorableType("4318C6BD-E0A1-45FE-AC30-96E7F73B51FB")] 33 [Item("Shape -constraints analyser", "Analyzes the number of shape-constraint violations of symbolic regression models.")]33 [Item("ShapeConstraintsAnalyzer", "Analyzes the number of shape constraint violations of symbolic regression models.")] 34 34 public class ShapeConstraintsAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicExpressionTreeAnalyzer { 35 35 private const string ProblemDataParameterName = "ProblemData"; … … 97 97 98 98 public override IOperation Apply() { 99 var problemData = RegressionProblemData;99 var problemData = (IShapeConstrainedRegressionProblemData)RegressionProblemData; 100 100 var trees = SymbolicExpressionTree.ToArray(); 101 101 … … 106 106 var estimator = new IntervalArithBoundsEstimator(); 107 107 108 if ( constraintViolationsTable.Rows.Any())108 if (!constraintViolationsTable.Rows.Any()) 109 109 foreach (var constraint in constraints) 110 110 constraintViolationsTable.Rows.Add(new DataRow(constraint.ToString())); … … 115 115 } 116 116 117 var constraintUnsatisfiedSolutionsDataTable = InfeasibleSolutions;118 if ( constraintUnsatisfiedSolutionsDataTable.Rows.Count == 0)119 constraintUnsatisfiedSolutionsDataTable.Rows.Add(new DataRow(InfeasibleSolutionsParameterName));117 var infeasibleSolutionsDataTable = InfeasibleSolutions; 118 if (infeasibleSolutionsDataTable.Rows.Count == 0) 119 infeasibleSolutionsDataTable.Rows.Add(new DataRow(InfeasibleSolutionsParameterName)); 120 120 121 constraintUnsatisfiedSolutionsDataTable.Rows[InfeasibleSolutionsParameterName]121 infeasibleSolutionsDataTable.Rows[InfeasibleSolutionsParameterName] 122 122 .Values 123 123 .Add(trees.Count(t => IntervalUtil.GetConstraintViolations(constraints, estimator, variableRanges, t).Any(x => x > 0.0)));
Note: See TracChangeset
for help on using the changeset viewer.