Changeset 16591
 Timestamp:
 02/06/19 14:41:06 (2 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs
r16589 r16591 51 51 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 52 52 QualityParameter.ActualValue = new DoubleValue(quality); 53 54 53 return base.InstrumentedApply(); 55 54 } … … 67 66 68 67 foreach (var constraint in constraints) { 69 if ( !variableRanges.ContainsKey(constraint.Variable))68 if (constraint.Variable != null && !variableRanges.ContainsKey(constraint.Variable)) 70 69 throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser)); 71 70 if (!constraint.IsDerivation) { … … 118 117 119 118 private static bool IntervalInBoundaries(Interval i1, Interval i2, bool inclusiveLower, bool inclusiveUpper) { 120 if (inclusiveLower) { 121 if (i2.LowerBound < i1.LowerBound) 122 return false; 123 } else { 124 if (i2.LowerBound <= i1.LowerBound) 125 return false; 119 if (double.IsNegativeInfinity(i1.LowerBound) && double.IsPositiveInfinity(i1.UpperBound)) 120 return true; 121 //Leftunbounded and rightbounded: 122 if (double.IsNegativeInfinity(i1.LowerBound)) { 123 if (inclusiveUpper) 124 return i2.LowerBound <= i1.UpperBound && i2.UpperBound <= i1.UpperBound; 125 return i2.LowerBound < i1.UpperBound && i2.UpperBound < i1.UpperBound; 126 126 } 127 127 128 if (inclusiveUpper) { 129 if (i2.UpperBound > i1.UpperBound) 130 return false; 131 } else { 132 if (i2.UpperBound >= i1.UpperBound) 133 return false; 128 //Leftbounded and rightunbounded: 129 if (double.IsPositiveInfinity(i1.UpperBound)) { 130 if (inclusiveLower) 131 return i2.LowerBound >= i1.LowerBound && i2.UpperBound >= i1.LowerBound; 132 return i2.LowerBound > i1.LowerBound && i2.UpperBound > i1.LowerBound; 134 133 } 135 134 136 return true; 135 //Proper and bounded: 136 //Closed: 137 if (inclusiveLower && inclusiveUpper) { 138 return i1.LowerBound <= i2.LowerBound && i2.UpperBound <= i1.UpperBound; 139 } 140 //Open: 141 if (!inclusiveLower && !inclusiveUpper) { 142 return i1.LowerBound < i2.LowerBound && i2.UpperBound < i1.UpperBound; 143 } 144 //Leftclosed, rightopen: 145 if (inclusiveLower) { 146 return i1.LowerBound <= i2.LowerBound && i2.UpperBound < i1.UpperBound; 147 } 148 //Leftopen, rightclosed: 149 return i1.LowerBound < i2.LowerBound && i2.UpperBound <= i1.UpperBound; 137 150 } 138 151 }
Note: See TracChangeset
for help on using the changeset viewer.