Changeset 17892 for branches/3076_IA_evaluators_analyzers_reintegration/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs
- Timestamp:
- 03/12/21 16:42:21 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3076_IA_evaluators_analyzers_reintegration/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs
r17821 r17892 1 using System; 2 using System.Collections.Generic; 3 using System.Collections.ObjectModel; 4 using System.Linq; 5 using System.Threading; 1 using System.Linq; 6 2 using HEAL.Attic; 7 3 using HeuristicLab.Analysis; 8 4 using HeuristicLab.Common; 9 5 using HeuristicLab.Core; 10 using HeuristicLab.Data;11 6 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 12 7 using HeuristicLab.Optimization; 13 using HeuristicLab.Optimization.Operators;14 8 using HeuristicLab.Parameters; 15 9 … … 37 31 public static int Iterations { get; set; } = 0; 38 32 39 public IBoundsEstimator BoundsEstimator { get; set; } = new I ABoundsEstimator();33 public IBoundsEstimator BoundsEstimator { get; set; } = new IntervalArithBoundsEstimator(); 40 34 41 35 [StorableConstructor] … … 105 99 106 100 var results = ResultCollectionParameter.ActualValue; 107 var constraints = problemData. IntervalConstraints.EnabledConstraints;101 var constraints = problemData.ShapeConstraints.EnabledConstraints; 108 102 var variableRanges = problemData.VariableRanges.GetReadonlyDictionary(); 109 103 var intervalCollection = problemData.VariableRanges; 110 104 var newDataTable = ConstraintViolationParameter.ActualValue; 111 var solutions = this.SymbolicExpressionTree.ToArray();105 var solutions = SymbolicExpressionTree.ToArray(); 112 106 113 107 if (newDataTable.Rows.Count == 0) 114 108 foreach (var constraint in constraints) 115 newDataTable.Rows.Add(new DataRow(constraint. Expression));109 newDataTable.Rows.Add(new DataRow(constraint.ToString())); 116 110 117 111 foreach (var constraint in constraints) { 118 var violations = trees.Count(tree => IntervalUtil. IntervalConstraintViolation(constraint, BoundsEstimator, intervalCollection, tree) > 0.0);112 var violations = trees.Count(tree => IntervalUtil.GetConstraintViolation(constraint, BoundsEstimator, intervalCollection, tree) > 0.0); 119 113 120 newDataTable.Rows[constraint. Expression].Values.Add(violations);114 newDataTable.Rows[constraint.ToString()].Values.Add(violations); 121 115 } 122 116 … … 127 121 constraintUnsatisfiedSolutionsDataTable.Rows[ConstraintUnsatisfiedSolutionsParameterName] 128 122 .Values 129 .Add(solutions.Count(s => IntervalUtil. IntervalConstraintsViolation(constraints, BoundsEstimator, intervalCollection, s).Any(x => x != 0.0)));123 .Add(solutions.Count(s => IntervalUtil.GetConstraintViolations(constraints, BoundsEstimator, intervalCollection, s).Any(x => x != 0.0))); 130 124 131 125 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.