Changeset 17821 for branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiHardConstraintEvaluator.cs
- Timestamp:
- 01/19/21 10:22:50 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiHardConstraintEvaluator.cs
r17733 r17821 11 11 [StorableType("9397A63D-0C6B-4733-BD1A-59AAE9A9F006")] 12 12 public class SymbolicRegressionMultiObjectiveMultiHardConstraintEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 13 private const string BoundsEstimatorParameterName = "Bounds estimator"; 14 public IValueParameter<IBoundsEstimator> BoundsEstimatorParameter => 15 (IValueParameter<IBoundsEstimator>)Parameters[BoundsEstimatorParameterName]; 16 17 public IBoundsEstimator BoundsEstimator { 18 get => BoundsEstimatorParameter.Value; 19 set => BoundsEstimatorParameter.Value = value; 20 } 21 13 22 #region Constructors 14 23 … … 47 56 48 57 var qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, 49 rows, applyLinearScaling, DecimalPlaces );58 rows, applyLinearScaling, DecimalPlaces, BoundsEstimator); 50 59 QualitiesParameter.ActualValue = new DoubleArray(qualities); 51 60 return base.InstrumentedApply(); … … 62 71 EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, 63 72 problemData, rows, 64 ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces );73 ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces, BoundsEstimator); 65 74 66 75 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; … … 75 84 double upperEstimationLimit, 76 85 IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, 77 int decimalPlaces ) {86 int decimalPlaces, IBoundsEstimator estimator) { 78 87 OnlineCalculatorError errorState; 79 88 var estimatedValues = … … 91 100 92 101 var constraints = problemData.IntervalConstraints.Constraints.Where(c => c.Enabled); 93 var variableRanges = problemData.VariableRanges.GetReadonlyDictionary();102 var intervalCollection = problemData.VariableRanges; 94 103 95 104 var objectives = new List<double> {nmse}; //Add r² to resultlist 96 105 var constraintObjectives = constraints.Select(constraint => 97 ConstraintExceeded(constraint, new IntervalInterpreter(),98 variableRanges, solution)); 106 IntervalUtil.IntervalConstraintViolation(constraint, estimator, intervalCollection, solution) > 0 ? 0.0 : 1.0); 107 99 108 objectives.AddRange(constraintObjectives); //Add hardconstraints for each constraint 100 109 … … 102 111 } 103 112 104 private static double ConstraintExceeded(IntervalConstraint constraint, IntervalInterpreter intervalInterpreter,105 IReadOnlyDictionary<string, Interval> variableRanges,106 ISymbolicExpressionTree solution) {107 return SymbolicRegressionConstraintAnalyzer.ConstraintSatisfied(constraint, new IntervalInterpreter(),108 variableRanges, solution, out double error) ? 0 : 1;109 }110 113 111 114 /*
Note: See TracChangeset
for help on using the changeset viewer.