Changeset 16629
- Timestamp:
- 02/28/19 14:02:15 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r16565 r16629 88 88 var outputInterval = Evaluate(instructions, ref instructionCount); 89 89 90 return outputInterval; 90 // because of numerical errors the bounds might be incorrect 91 if (outputInterval.LowerBound <= outputInterval.UpperBound) 92 return outputInterval; 93 else 94 return new Interval(outputInterval.UpperBound, outputInterval.LowerBound); 91 95 } 92 96 … … 102 106 var outputInterval = Evaluate(instructions, ref instructionCount, intervals); 103 107 104 nodeIntervals = intervals; 105 106 return outputInterval; 108 // fix incorrect intervals if necessary (could occur because of numerical errors) 109 nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>(); 110 foreach(var kvp in intervals) { 111 var interval = kvp.Value; 112 if (interval.IsInfiniteOrUndefined || interval.LowerBound <= interval.UpperBound) 113 nodeIntervals.Add(kvp.Key, interval); 114 else 115 nodeIntervals.Add(kvp.Key, new Interval(interval.UpperBound, interval.LowerBound)); 116 } 117 118 // because of numerical errors the bounds might be incorrect 119 if (outputInterval.IsInfiniteOrUndefined || outputInterval.LowerBound <= outputInterval.UpperBound) 120 return outputInterval; 121 else 122 return new Interval(outputInterval.UpperBound, outputInterval.LowerBound); 107 123 } 108 124
Note: See TracChangeset
for help on using the changeset viewer.